/* ==========================================================================
   CalculateMyCase — main.css
   Design system + global layout + shared components
   Mobile-first. BEM-ish naming. CSS custom properties for theming.
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------- */
:root {
  /* Brand palette (from spec) */
  --c-primary:        #1a4b8c;   /* primary blue  — trust, authority */
  --c-primary-2:      #2d6eb0;   /* secondary blue */
  --c-primary-dk:     #143a6b;   /* darker hover  */
  --c-accent:         #2e7d32;   /* accent green  — success/go */
  --c-accent-2:       #43a047;
  --c-cta:            #f57c00;   /* warning orange — secondary CTA */
  --c-cta-dk:         #e06f00;

  --c-ink:            #1f2733;   /* primary text */
  --c-ink-soft:       #5a6573;   /* subtext */
  --c-line:           #e2e8f0;   /* hairlines */
  --c-bg:             #ffffff;
  --c-bg-warm:        #f4f6fa;   /* warm grey sections */
  --c-bg-tint:        #eef3fa;   /* faint blue tint */

  --c-error:          #d32f2f;
  --c-success:        #2e7d32;

  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
               Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;

  /* Spacing scale */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;   --sp-7: 3rem;    --sp-8: 4rem;
  --sp-9: 6rem;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(20,40,80,.06), 0 1px 3px rgba(20,40,80,.05);
  --shadow:    0 4px 14px rgba(20,40,80,.08), 0 2px 6px rgba(20,40,80,.05);
  --shadow-lg: 0 18px 50px rgba(20,40,80,.14);

  --maxw: 1180px;
  --maxw-narrow: 760px;
  --nav-h: 76px;
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-primary-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--c-primary-dk); }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; color: var(--c-ink); margin: 0 0 var(--sp-4); letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.4vw, 3.25rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }
h4 { font-size: 1.2rem; }
p  { margin: 0 0 var(--sp-4); }

/* ---- Accessibility helpers ---------------------------------------------- */
.skip-link {
  position: absolute; left: var(--sp-3); top: -60px; z-index: 1000;
  background: var(--c-primary); color: #fff; padding: var(--sp-3) var(--sp-5);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); font-weight: 600;
  transition: top .2s ease;
}
.skip-link:focus { top: 0; color: #fff; outline: 3px solid var(--c-cta); }
:focus-visible { outline: 3px solid var(--c-cta); outline-offset: 2px; border-radius: 4px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Layout utilities ---------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-5); }
.wrap--narrow { max-width: var(--maxw-narrow); }
.section { padding-block: var(--sp-8); }
.section--warm { background: var(--c-bg-warm); }
.section--tint { background: var(--c-bg-tint); }
.eyebrow {
  font-family: var(--font-body); font-weight: 700; font-size: .8rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--c-primary-2);
  margin: 0 0 var(--sp-3); display: inline-flex; align-items: center; gap: .5rem;
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--c-cta); display: inline-block; }
.lede { font-size: 1.2rem; color: var(--c-ink-soft); }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  font: 600 1rem/1 var(--font-body); padding: .9rem 1.5rem; border-radius: 999px;
  border: 2px solid transparent; cursor: pointer; text-decoration: none;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--c-primary-2); color: #fff; }
.btn--primary:hover { background: var(--c-primary-dk); color: #fff; box-shadow: var(--shadow); }
.btn--cta { background: var(--c-cta); color: #fff; }
.btn--cta:hover { background: var(--c-cta-dk); color: #fff; box-shadow: var(--shadow); }
.btn--ghost { background: transparent; color: var(--c-primary); border-color: var(--c-primary); }
.btn--ghost:hover { background: var(--c-primary); color: #fff; }
.btn--lg { padding: 1.05rem 1.9rem; font-size: 1.0625rem; }
.btn--block { width: 100%; }

/* ---- Header / nav -------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.92); backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--c-line); }
.nav { display: flex; align-items: center; gap: var(--sp-5); min-height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: .65rem; font-family: var(--font-head); font-weight: 600; font-size: 1.3rem; color: var(--c-primary); text-decoration: none; flex-shrink: 0; }
.brand__mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--c-primary), var(--c-primary-2)); color: #fff; display: grid; place-items: center; font-weight: 700; font-family: var(--font-body); }
.brand b { color: var(--c-cta); }

.nav__list { list-style: none; display: flex; gap: var(--sp-2); margin: 0; padding: 0; align-items: center; }
.nav__item { position: relative; }
.nav__link { display: inline-flex; align-items: center; gap: .35rem; padding: .55rem .7rem; border-radius: 8px; color: var(--c-ink); font-weight: 500; font-size: .98rem; text-decoration: none; }
.nav__link:hover, .nav__item:hover > .nav__link { background: var(--c-bg-tint); color: var(--c-primary); }
.nav__link[aria-current="page"] { color: var(--c-primary); box-shadow: inset 0 -2px 0 var(--c-cta); border-radius: 8px 8px 0 0; }
.nav__caret { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }

/* dropdowns */
.nav__menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 260px;
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: var(--sp-2); list-style: none; margin: 0;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s; z-index: 50;
  max-height: 70vh; overflow-y: auto;
}
.nav__menu--wide { min-width: 460px; columns: 2; column-gap: var(--sp-2); }
.nav__item:hover > .nav__menu, .nav__item:focus-within > .nav__menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav__menu a { display: block; padding: .5rem .7rem; border-radius: 8px; color: var(--c-ink); text-decoration: none; font-size: .94rem; break-inside: avoid; }
.nav__menu a:hover { background: var(--c-bg-tint); color: var(--c-primary); }

.nav__actions { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }
.nav__phone { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--c-primary); text-decoration: none; white-space: nowrap; }
.nav__phone svg { width: 18px; height: 18px; fill: var(--c-accent); }
.nav__toggle { display: none; }

/* mobile menu button */
.hamburger {
  display: none; width: 46px; height: 46px; border: 1px solid var(--c-line);
  background: #fff; border-radius: 10px; cursor: pointer; padding: 0; position: relative;
}
.hamburger span { position: absolute; left: 11px; right: 11px; height: 2px; background: var(--c-ink); transition: transform .2s ease, opacity .2s ease; }
.hamburger span:nth-child(1) { top: 15px; }
.hamburger span:nth-child(2) { top: 22px; }
.hamburger span:nth-child(3) { top: 29px; }
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Hero ---------------------------------------------------------------- */
.hero { position: relative; background: var(--c-primary); color: #fff; overflow: hidden; }
.hero__bg { position: absolute; inset: 0; z-index: 0; }
.hero__bg img { width: 100%; height: 100%; object-fit: cover; opacity: .26; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(115deg, rgba(20,40,80,.94) 0%, rgba(26,75,140,.82) 45%, rgba(45,110,176,.55) 100%); }
.hero__inner { position: relative; z-index: 2; display: grid; gap: var(--sp-7); padding-block: var(--sp-9); }
.hero h1 { color: #fff; }
.hero .lede { color: rgba(255,255,255,.9); }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-5); }
.hero__phone { margin-top: var(--sp-5); display: inline-flex; align-items: center; gap: .6rem; font-size: 1.15rem; font-weight: 700; color: #fff; text-decoration: none; }
.hero__phone .dot { width: 9px; height: 9px; border-radius: 50%; background: #6ee7a8; box-shadow: 0 0 0 0 rgba(110,231,168,.7); animation: pulse 2.2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(110,231,168,.6);} 70%{box-shadow:0 0 0 12px rgba(110,231,168,0);} 100%{box-shadow:0 0 0 0 rgba(110,231,168,0);} }
.hero__badges { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-6); }
.hero__badge { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; color: rgba(255,255,255,.95); }
.hero__badge svg { width: 18px; height: 18px; fill: #6ee7a8; flex-shrink: 0; }

/* hero with side panel (calculator/quote pages) */
.hero--split .hero__inner { grid-template-columns: 1fr; }
@media (min-width: 940px) {
  .hero--split .hero__inner { grid-template-columns: 1.05fr .95fr; align-items: center; }
}
.hero__panel { background: #fff; color: var(--c-ink); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--sp-6); }

/* ---- Trust strip --------------------------------------------------------- */
.trust { background: #fff; border-bottom: 1px solid var(--c-line); }
.trust__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); padding-block: var(--sp-5); }
.trust__item { display: flex; align-items: center; gap: .7rem; font-weight: 600; font-size: .95rem; }
.trust__item svg { width: 26px; height: 26px; flex-shrink: 0; }
.trust__item .ic { color: var(--c-accent); }
@media (min-width: 720px) { .trust__grid { grid-template-columns: repeat(4, 1fr); } }

/* ---- Cards / grids ------------------------------------------------------- */
.grid { display: grid; gap: var(--sp-5); }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } .grid--4 { grid-template-columns: repeat(4, 1fr); } }

.card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); padding: var(--sp-5); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease; }
.card--link { text-decoration: none; color: inherit; display: block; }
.card--link:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cdd9ea; color: inherit; }
.card__icon { width: 52px; height: 52px; border-radius: 12px; background: var(--c-bg-tint); color: var(--c-primary); display: grid; place-items: center; margin-bottom: var(--sp-4); }
.card__icon svg { width: 26px; height: 26px; fill: currentColor; }
.card h3 { margin-bottom: var(--sp-2); }
.card p { color: var(--c-ink-soft); margin-bottom: 0; font-size: .98rem; }
.card__more { display: inline-flex; align-items: center; gap: .35rem; margin-top: var(--sp-4); font-weight: 600; color: var(--c-primary-2); font-size: .95rem; }
.card__more::after { content: "→"; transition: transform .18s ease; }
.card--link:hover .card__more::after { transform: translateX(4px); }

/* ---- Steps (how it works) ----------------------------------------------- */
.steps { counter-reset: step; display: grid; gap: var(--sp-5); }
@media (min-width: 820px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { position: relative; padding-top: var(--sp-6); }
.step__num { counter-increment: step; position: absolute; top: 0; left: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--c-primary); color: #fff; font-family: var(--font-head); font-weight: 600; display: grid; place-items: center; }
.step__num::before { content: counter(step); }
.step h3 { font-size: 1.2rem; margin-top: var(--sp-3); }
.step p { color: var(--c-ink-soft); font-size: .96rem; margin: 0; }

/* ---- Accordion ----------------------------------------------------------- */
.accordion { border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.accordion__item + .accordion__item { border-top: 1px solid var(--c-line); }
.accordion__btn { width: 100%; text-align: left; background: #fff; border: 0; padding: 1.15rem 1.3rem; font: 600 1.08rem var(--font-body); color: var(--c-ink); cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); }
.accordion__btn:hover { background: var(--c-bg-warm); }
.accordion__icon { flex-shrink: 0; width: 22px; height: 22px; position: relative; }
.accordion__icon::before, .accordion__icon::after { content: ""; position: absolute; background: var(--c-primary-2); border-radius: 2px; transition: transform .2s ease; }
.accordion__icon::before { top: 10px; left: 2px; right: 2px; height: 2px; }
.accordion__icon::after { left: 10px; top: 2px; bottom: 2px; width: 2px; }
.accordion__btn[aria-expanded="true"] .accordion__icon::after { transform: scaleY(0); }
.accordion__panel { padding: 0 1.3rem; max-height: 0; overflow: hidden; transition: max-height .25s ease, padding .25s ease; }
.accordion__panel p { color: var(--c-ink-soft); }
.accordion__panel--open { padding: 0 1.3rem 1.2rem; }

/* ---- Breadcrumbs --------------------------------------------------------- */
.crumbs { padding-block: var(--sp-4); font-size: .9rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; align-items: center; color: var(--c-ink-soft); }
.crumbs li::after { content: "/"; margin-left: .4rem; color: #b6c2d4; }
.crumbs li:last-child::after { content: ""; }
.crumbs a { color: var(--c-primary-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* ---- Article content ----------------------------------------------------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: var(--sp-7); }
.prose h3 { margin-top: var(--sp-6); }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 var(--sp-4); }
.prose li { margin-bottom: .4rem; }
.prose table { width: 100%; border-collapse: collapse; margin: var(--sp-5) 0; font-size: .96rem; }
.prose th, .prose td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--c-line); }
.prose thead th { background: var(--c-bg-tint); color: var(--c-primary); font-family: var(--font-body); }
.prose tbody tr:nth-child(even) { background: var(--c-bg-warm); }

.callout { background: var(--c-bg-tint); border-left: 4px solid var(--c-primary-2); border-radius: var(--radius-sm); padding: var(--sp-4) var(--sp-5); margin: var(--sp-5) 0; }
.callout--warn { background: #fff6ec; border-left-color: var(--c-cta); }
.callout p:last-child { margin-bottom: 0; }

/* layout with sidebar */
.layout { display: grid; gap: var(--sp-7); }
@media (min-width: 980px) { .layout { grid-template-columns: 1fr 320px; align-items: start; } }
.sidebar { position: sticky; top: calc(var(--nav-h) + 16px); display: grid; gap: var(--sp-5); }
.sidebar__card { background: var(--c-primary); color: #fff; border-radius: var(--radius); padding: var(--sp-5); }
.sidebar__card h3 { color: #fff; font-size: 1.25rem; }
.sidebar__card p { color: rgba(255,255,255,.88); font-size: .95rem; }
.sidebar__phone { font-size: 1.4rem; font-weight: 700; color: #fff; text-decoration: none; display: block; margin: var(--sp-3) 0; }
.related { background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); padding: var(--sp-5); }
.related h3 { font-size: 1.15rem; }
.related ul { list-style: none; margin: 0; padding: 0; }
.related li + li { border-top: 1px solid var(--c-line); }
.related a { display: block; padding: .55rem 0; text-decoration: none; color: var(--c-ink); font-size: .95rem; }
.related a:hover { color: var(--c-primary); padding-left: 4px; transition: padding .15s ease; }

/* ---- Sticky mobile CTA --------------------------------------------------- */
.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: none; gap: 1px; background: var(--c-line); box-shadow: 0 -4px 18px rgba(20,40,80,.12); }
.sticky-cta a { flex: 1; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .95rem; font-weight: 700; text-decoration: none; font-size: .98rem; }
.sticky-cta__call { background: var(--c-accent); color: #fff; }
.sticky-cta__form { background: var(--c-cta); color: #fff; }

/* ---- Footer -------------------------------------------------------------- */
.footer { background: #11243f; color: #c3d0e2; padding-block: var(--sp-8) var(--sp-6); margin-top: var(--sp-8); }
.footer a { color: #c3d0e2; text-decoration: none; }
.footer a:hover { color: #fff; text-decoration: underline; }
.footer__top { display: grid; gap: var(--sp-6); margin-bottom: var(--sp-7); }
@media (min-width: 760px) { .footer__top { grid-template-columns: 1.6fr 1fr 1fr; } }
.footer__brand { font-family: var(--font-head); font-size: 1.4rem; color: #fff; margin-bottom: var(--sp-3); display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.footer h4 { color: #fff; font-family: var(--font-body); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: var(--sp-4); }
.footer__links { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; font-size: .95rem; }
.footer__phone { font-size: 1.4rem; font-weight: 700; color: #fff; text-decoration: none; }
.footer__legal { border-top: 1px solid rgba(255,255,255,.12); padding-top: var(--sp-5); font-size: .82rem; line-height: 1.6; color: #92a3bd; }
.footer__legal p { margin-bottom: var(--sp-3); }
.footer__bottom { display: flex; flex-wrap: wrap; gap: var(--sp-4); justify-content: space-between; align-items: center; margin-top: var(--sp-5); font-size: .85rem; }
.footer__social { display: flex; gap: var(--sp-3); }
.footer__social a { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; display: grid; place-items: center; }
.footer__social svg { width: 18px; height: 18px; fill: #c3d0e2; }

/* ---- Responsive nav (mobile) -------------------------------------------- */
@media (max-width: 1024px) {
  .hamburger { display: block; margin-left: auto; }
  .nav__actions { margin-left: 0; }
  .nav__phone span { display: none; }
  .nav__menu-wrap {
    position: fixed; inset: var(--nav-h) 0 0 0; background: #fff; z-index: 99;
    transform: translateX(100%); transition: transform .25s ease; overflow-y: auto;
    padding: var(--sp-5); border-top: 1px solid var(--c-line);
  }
  .nav__menu-wrap[data-open="true"] { transform: translateX(0); }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__item { border-bottom: 1px solid var(--c-line); }
  .nav__link { padding: .9rem .3rem; justify-content: space-between; font-size: 1.05rem; }
  .nav__menu {
    position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none;
    border: 0; border-radius: 0; padding: 0 0 var(--sp-3) var(--sp-4); columns: 1; min-width: 0;
    max-height: 0; overflow: hidden; transition: max-height .2s ease;
  }
  .nav__menu--wide { min-width: 0; }
  .nav__item[data-open="true"] > .nav__menu { max-height: 1200px; }
  .nav__caret { transition: transform .2s ease; }
  .nav__item[data-open="true"] > .nav__link .nav__caret { transform: rotate(-135deg) translateY(2px); }
  .sticky-cta { display: flex; }
  body { padding-bottom: 56px; }
}
@media (min-width: 1025px) {
  .nav__menu-wrap { display: flex !important; align-items: center; gap: var(--sp-2); transform: none !important; }
}

/* ---- Misc ---------------------------------------------------------------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.section-head { max-width: 680px; margin-bottom: var(--sp-6); }
.section-head--center { margin-inline: auto; text-align: center; }
.cta-band { background: linear-gradient(120deg, var(--c-primary), var(--c-primary-2)); color: #fff; border-radius: var(--radius-lg); padding: var(--sp-7); text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.9); max-width: 560px; margin-inline: auto; }
.cta-band .hero__cta { justify-content: center; }
