/* ==========================================================================
   Foundation Repair Network - design system
   ========================================================================== */

:root {
  /* Color: warm neutrals + a grounded rust/brick accent (construction,
     trustworthy) paired with a deep slate for structure/authority. */
  --color-bg: #faf8f5;
  --color-surface: #ffffff;
  --color-surface-alt: #f2ede6;
  --color-text: #241f1b;
  --color-text-muted: #5c5349;
  --color-border: #e4dcd1;

  --color-brand: #b6502f;       /* rust/brick - primary accent */
  --color-brand-dark: #8f3d22;
  --color-brand-light: #f4e3da;

  --color-slate: #172f53;       /* deep navy - headers, footer, authority */
  --color-slate-light: #2c4d82;

  --color-success: #3f7a4f;
  --color-focus: #1d6fb8;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-brand: "Archivo", "Inter", sans-serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(36, 31, 27, 0.06), 0 1px 1px rgba(36, 31, 27, 0.04);
  --shadow-md: 0 8px 24px rgba(36, 31, 27, 0.08), 0 2px 6px rgba(36, 31, 27, 0.06);
  --shadow-lg: 0 24px 48px rgba(36, 31, 27, 0.14), 0 8px 16px rgba(36, 31, 27, 0.08);

  --container-max: 1180px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #17140f;
    --color-surface: #201c16;
    --color-surface-alt: #2a251d;
    --color-text: #f3ede4;
    --color-text-muted: #bfb3a3;
    --color-border: #3a332a;

    --color-brand: #e07a52;
    --color-brand-dark: #f0946e;
    --color-brand-light: #3a271f;

    --color-slate: #0d1b33;
    --color-slate-light: #1b3358;
  }
}

:root[data-theme="dark"] {
  --color-bg: #17140f;
  --color-surface: #201c16;
  --color-surface-alt: #2a251d;
  --color-text: #f3ede4;
  --color-text-muted: #bfb3a3;
  --color-border: #3a332a;

  --color-brand: #e07a52;
  --color-brand-dark: #f0946e;
  --color-brand-light: #3a271f;

  --color-slate: #0d1b33;
  --color-slate-light: #1b3358;
}

/* --- Reset ---------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--color-bg);
  color-scheme: light dark;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Pushes the footer to the bottom of the viewport on short pages instead of
   leaving a gap of body background below it. */
main { flex: 1 0 auto; }

/* The live-chat widget's frames are light-only. Without this, visitors in dark mode
   get an opaque white box behind the chat bubble (a frame whose color scheme differs
   from the page's gets a solid backdrop). */
iframe[id^="apexchat"] { color-scheme: light; }

img, svg, video { max-width: 100%; display: block; }
a { color: var(--color-brand); text-decoration-color: transparent; transition: text-decoration-color .15s ease, color .15s ease; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.15; font-weight: 600; margin: 0 0 .6em; color: var(--color-text); }
h1 { font-size: clamp(2.25rem, 4vw + 1rem, 3.4rem); }
h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2.25rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.skip-link {
  position: absolute; left: var(--space-2); top: -60px;
  background: var(--color-slate); color: #fff; padding: .7em 1.2em;
  border-radius: var(--radius-sm); z-index: 1000; transition: top .15s ease;
}
.skip-link:focus { top: var(--space-2); }

/* --- Buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
  padding: .85em 1.6em; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline-offset: 3px; }

.btn-primary { background: var(--color-brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--color-brand-dark); box-shadow: var(--shadow-md); }

.btn-ghost { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover { background: var(--color-surface-alt); }

.btn-on-dark { background: #fff; color: var(--color-slate); }
.btn-on-dark:hover { background: var(--color-brand-light); }

.btn-outline-on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-outline-on-dark:hover { background: rgba(255,255,255,.1); border-color: #fff; }

/* --- Site header -------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--color-border);
}
/* Blur lives on a pseudo-element, not the header itself: backdrop-filter on a real
   element creates a containing block for its position:fixed descendants (the mobile
   nav panel and its backdrop), which would otherwise get clipped to the header's own
   height instead of the full viewport. */
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px) saturate(1.4);
}

.site-header__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); padding-block: .9rem;
}

.brand { display: inline-flex; flex-direction: column; text-decoration: none; }
.brand__word { font-family: var(--font-brand); font-weight: 800; font-size: 1.5rem; line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
.brand__word .w1 { color: var(--color-text); }
.brand__word .w2 { color: var(--color-brand); }
.brand__sub { font-family: var(--font-brand); font-weight: 700; font-size: 1rem; line-height: 1; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-muted); margin-top: .15em; align-self: flex-end; }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: .5em .6em; cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; display: block; }

.main-nav { display: flex; align-items: center; gap: var(--space-3); }
.main-nav__links { display: flex; align-items: center; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.main-nav__links a { color: var(--color-text); font-weight: 500; font-size: .95rem; }
.main-nav__links a[aria-current="page"] { color: var(--color-brand); }
.main-nav__phone { display: flex; align-items: center; gap: .4em; font-weight: 600; color: var(--color-text); font-size: .95rem; white-space: nowrap; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .main-nav { position: fixed; inset: 0 0 0 auto; width: min(320px, 85vw); height: 100vh;
    background: var(--color-surface); flex-direction: column; align-items: stretch;
    padding: var(--space-4) var(--space-3); box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; }
  .main-nav[data-open="true"] { transform: translateX(0); }
  .main-nav__links { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .main-nav__links a { font-size: 1.1rem; }
  .main-nav__phone { margin-top: var(--space-3); }
}

.mobile-cta { display: none; }

@media (max-width: 860px) {
  .mobile-cta {
    display: flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: 0 var(--space-3) .9rem; flex-wrap: wrap;
  }
  .mobile-cta__phone {
    display: flex; align-items: center; gap: .4em; font-weight: 700;
    color: var(--color-text); font-size: 1rem; white-space: nowrap;
  }
  .mobile-cta__btn { flex-shrink: 0; }
}

@media (max-width: 380px) {
  .mobile-cta { flex-direction: column; }
  .mobile-cta__btn { width: 100%; justify-content: center; }
}

.nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(20,16,12,.4); z-index: 90; }
.nav-backdrop[data-open="true"] { display: block; }

/* --- Hero ---------------------------------------------------------- */

.hero {
  background: linear-gradient(160deg, var(--color-slate) 0%, var(--color-slate-light) 100%);
  color: #fff; overflow: hidden; position: relative;
}
.hero__eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 600; color: #f0c4ab; margin-bottom: var(--space-2); }
.hero h1 { color: #fff; }
.hero__lede { font-size: 1.15rem; color: rgba(255,255,255,.88); max-width: 46ch; text-shadow: 0 1px 12px rgba(0,0,0,.25); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

/* Full-bleed image slider hero */
.hero--slider { min-height: 640px; display: flex; align-items: center; }
.hero__slides { position: absolute; inset: 0; }
.hero__slide {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.4s ease;
}
.hero__slide.is-active { opacity: 1; }
.hero__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(13,27,51,.93) 0%, rgba(13,27,51,.8) 32%, rgba(13,27,51,.4) 62%, rgba(13,27,51,.18) 100%);
}
.hero__content { position: relative; z-index: 2; padding-block: var(--space-6); }
.hero__text { max-width: 640px; }
.hero__dots { position: absolute; z-index: 2; left: 0; right: 0; bottom: var(--space-3); display: flex; justify-content: center; gap: .6em; }
.hero__dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,.7); background: rgba(255,255,255,.25); cursor: pointer; transition: background .2s ease, transform .2s ease; }
.hero__dot.is-active { background: #fff; transform: scale(1.15); }

@media (max-width: 860px) {
  .hero--slider { min-height: 520px; }
}

/* --- Sections / cards ---------------------------------------------------------- */

.section { padding-block: var(--space-5); }
.section--alt { background: var(--color-surface-alt); }
.section__head { margin-bottom: var(--space-4); }
.section__head p { color: var(--color-text-muted); font-size: 1.05rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--color-brand); margin-bottom: .5em; display: block; }

.grid { display: grid; gap: var(--space-3); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) { .grid--3, .grid--2 { grid-template-columns: 1fr; } }

.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-3);
  box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, transform .2s ease;
  display: flex; flex-direction: column; gap: .6em;
}
a.card { text-decoration: none; color: inherit; }
a.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card__icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--color-brand-light); color: var(--color-brand-dark);
  display: grid; place-items: center; flex-shrink: 0;
}
.card__icon svg { width: 24px; height: 24px; }
.card h3 { margin-bottom: 0; font-size: 1.1rem; }
.card p { color: var(--color-text-muted); font-size: .95rem; margin-bottom: 0; }

/* --- Sign warning list ---------------------------------------------------------- */

.sign-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2) var(--space-3); list-style: none; padding: 0; margin: 0; }
@media (max-width: 640px) { .sign-list { grid-template-columns: 1fr; } }
.sign-list li { display: flex; align-items: flex-start; gap: .7em; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 1em 1.1em; font-weight: 500; }
.sign-list li::before {
  content: ""; flex-shrink: 0; width: 20px; height: 20px; margin-top: .15em; border-radius: 50%;
  background: var(--color-brand); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M12 5v9M12 20h.01'/%3E%3C/svg%3E") center/60% no-repeat;
}

/* --- CTA band ---------------------------------------------------------- */

.cta-band {
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 600px 240px at 88% -20%, rgba(182,80,47,.35), transparent 70%),
    linear-gradient(155deg, var(--color-slate) 0%, var(--color-slate-light) 100%);
  color: #fff; border-radius: var(--radius-lg); border-top: 3px solid var(--color-brand);
  padding: var(--space-5) var(--space-4);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
.cta-band::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(160deg, #000 10%, transparent 75%);
}
.cta-band__icon {
  position: absolute; right: -18px; bottom: -28px; width: 168px; height: 168px;
  opacity: .12; pointer-events: none;
}
.cta-band__copy { position: relative; max-width: 40ch; }
.cta-band__eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; font-weight: 700; color: #f0c4ab; display: block; margin-bottom: .5em; }
.cta-band h2 { font-family: var(--font-brand); font-weight: 800; letter-spacing: -.01em; color: #fff; margin-bottom: .4em; font-size: 1.9rem; }
.cta-band p { color: rgba(255,255,255,.78); margin-bottom: 0; font-size: 1.05rem; }
.cta-band__actions { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .9em; flex-shrink: 0; }
.cta-band__phone { display: flex; align-items: center; gap: .55em; color: #fff; text-decoration: none; font-family: var(--font-brand); font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.cta-band__phone svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--color-brand-dark); }
.cta-band__phone:hover { color: rgba(255,255,255,.85); }

@media (max-width: 640px) {
  .cta-band__actions { width: 100%; align-items: stretch; }
  .cta-band__actions .btn { white-space: normal; text-align: center; }
}

/* --- Breadcrumbs & article/topic layout ---------------------------------------------------------- */

.breadcrumbs { font-size: .85rem; color: var(--color-text-muted); margin-bottom: var(--space-2); }
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-brand); }

.topic-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--space-4); align-items: start; }
@media (max-width: 900px) { .topic-layout { grid-template-columns: 1fr; } }

.topic-nav { position: sticky; top: 90px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-2); }
.topic-nav__title { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-muted); padding: .4em .6em; }
.topic-nav__toggle { display: none; }
.topic-nav ul, .topic-nav__list { list-style: none; margin: 0; padding: 0; }
.topic-nav li + li { margin-top: .15em; }
.topic-nav a { display: block; padding: .55em .6em; border-radius: var(--radius-sm); color: var(--color-text); font-size: .93rem; }
.topic-nav a:hover { background: var(--color-surface-alt); }
.topic-nav a[aria-current="page"] { background: var(--color-brand-light); color: var(--color-brand-dark); font-weight: 600; }

@media (max-width: 900px) {
  /* On mobile the sidebar shouldn't float/stick over content — it sits in normal
     flow and collapses into a dropdown instead of showing the full topic list. */
  .topic-nav { position: static; top: auto; }
  .topic-nav__title { display: none; }
  .topic-nav__toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    background: none; border: none; padding: .4em .5em;
    font-family: var(--font-sans); font-weight: 700; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-muted);
    cursor: pointer;
  }
  .topic-nav__chevron { width: 18px; height: 18px; flex-shrink: 0; transition: transform .2s ease; }
  .topic-nav__toggle[aria-expanded="true"] .topic-nav__chevron { transform: rotate(180deg); }
  .topic-nav__list { display: none; padding-top: var(--space-1); }
  .topic-nav__list[data-open="true"] { display: block; }
}

.prose { max-width: 72ch; }
.prose--wide { max-width: none; }
.prose h2 { margin-top: 1.6em; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { color: var(--color-text); }

.content-photo { clear: both; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); margin: var(--space-3) 0 var(--space-4); }
.content-photo img { width: 100%; height: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }

/* Original line-art diagrams: float beside the text they illustrate (as on the
   original site), stack full-width on small screens. */
.prose h2, .prose h3 { clear: both; }
.diagram {
  float: right; width: 260px; margin: .25rem 0 var(--space-2) var(--space-3);
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: .5rem .5rem .6rem; text-align: center;
}
.diagram img { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }
.diagram figcaption { margin-top: .4rem; font-size: .82rem; font-weight: 600; color: #3a332a; line-height: 1.3; }
.diagram--wide { width: 340px; }
@media (max-width: 640px) {
  .diagram, .diagram--wide { float: none; width: min(100%, 340px); margin: var(--space-2) auto; }
}
.lede { font-size: 1.2rem; color: var(--color-text-muted); margin-bottom: var(--space-3); }

.callout {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-brand); border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3); margin: var(--space-3) 0;
}
.callout > :first-child { margin-top: 0; font-weight: 700; }
.callout > :last-child { margin-bottom: 0; }
.callout ul { margin: .5em 0 0; }

.warning-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: var(--space-4); align-items: center; }
.warning-grid .content-photo { margin: 0; }
.warning-grid .content-photo img { aspect-ratio: auto; }
@media (max-width: 900px) { .warning-grid { grid-template-columns: 1fr; } }
.sign-list--single { grid-template-columns: 1fr; }

.hub-photo { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); margin-bottom: var(--space-4); }
.hub-photo img { width: 100%; height: 100%; aspect-ratio: 21/9; object-fit: cover; display: block; }
@media (max-width: 640px) { .hub-photo img { aspect-ratio: 4/3; } }

/* --- Contact ---------------------------------------------------------- */

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: center; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* --- Footer ---------------------------------------------------------- */

.site-footer { background: var(--color-slate); color: rgba(255,255,255,.78); padding-block: var(--space-6) var(--space-3); border-top: 4px solid var(--color-brand); }
.site-footer a { color: #fff; }
.site-footer h4 { color: rgba(255,255,255,.9); font-family: var(--font-sans); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 1.1em; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: var(--space-4); padding-bottom: var(--space-4); }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li + li { margin-top: .7em; }
.footer-grid a { font-size: .93rem; color: rgba(255,255,255,.72); }
.footer-grid a:hover { color: #fff; }

.footer-brand { display: flex; flex-direction: column; gap: 1em; align-items: flex-start; }
.footer-brand__logo .w1 { color: #fff; }
.footer-brand__logo .brand__sub { color: rgba(255,255,255,.55); }
.footer-brand p { font-size: .92rem; color: rgba(255,255,255,.65); max-width: 34ch; }
.footer-brand__phone { margin-top: .2em; }
.footer-brand__phone a { font-family: var(--font-brand); font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; color: #fff; }
.footer-brand__phone a:hover { color: var(--color-brand-dark); }

.footer-bottom {
  padding-top: var(--space-3); border-top: 1px solid rgba(255,255,255,.14);
  display: flex; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap;
  font-size: .82rem; color: rgba(255,255,255,.5);
}

/* --- Glossary ---------------------------------------------------------- */

.glossary { display: flex; flex-direction: column; gap: 1.4em; }
.glossary__term { font-weight: 700; font-size: 1.05rem; margin-bottom: .25em; color: var(--color-text); }
.glossary__def { color: var(--color-text-muted); margin: 0; }
.glossary-search {
  width: 100%; font: inherit; padding: .8em 1em; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text);
  margin-bottom: var(--space-3);
}

/* --- Utility ---------------------------------------------------------- */

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
