/* ==========================================================================
   Community Rehab Physical Therapy Centers
   Design system — coastal Gulf Coast identity
   Palette: deep marine teal + mid tide aqua + warm coral action accent
   Signature: layered water/wave motif (grounded in aquatic therapy)
   Type: Bricolage Grotesque (display) + Figtree (body/UI)
   ========================================================================== */

:root {
  /* Color — Community Rehab brand: blue #0058C5 + green #00D294 */
  --ink:        #0F2544;   /* deep navy text */
  --ink-soft:   #4B5E79;   /* secondary text */
  --marine:     #0058C5;   /* brand blue (primary) */
  --marine-dk:  #013E8C;   /* deep blue — footer / deep surfaces */
  --tide:       #1A6BD6;   /* link blue / secondary accent */
  --foam:       #E6EEFB;   /* pale blue tint */
  --foam-2:     #D3E2F7;
  --paper:      #F4F8FD;   /* page background (cool blue-white) */
  --card:       #FFFFFF;
  /* NOTE: the --coral* tokens now hold the brand GREEN (kept the names so all
     existing button/accent usages pick it up). Primary buttons use navy text
     on green for AA contrast. */
  --coral:      #00D294;   /* brand green — accent */
  --coral-btn:  #00D294;   /* brand green — primary button background */
  --coral-dk:   #00B080;   /* darker green — hover/active */
  --green-deep: #009E74;   /* green dark enough for text on white if needed */
  --error:      #C8402F;   /* form error red (not green!) */
  --line:       #D7E2F1;   /* hairlines / borders */
  --gold:       #E4A93C;   /* star ratings */

  /* Type scale — fluid, generous for older readers */
  --f-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --f-body:    "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: clamp(0.86rem, 0.82rem + 0.20vw, 0.95rem);
  --step-0:  clamp(1.02rem, 0.97rem + 0.28vw, 1.15rem);   /* base body */
  --step-1:  clamp(1.22rem, 1.13rem + 0.45vw, 1.44rem);
  --step-2:  clamp(1.46rem, 1.31rem + 0.75vw, 1.90rem);
  --step-3:  clamp(1.75rem, 1.50rem + 1.25vw, 2.55rem);
  --step-4:  clamp(2.10rem, 1.68rem + 2.10vw, 3.40rem);
  --step-5:  clamp(2.52rem, 1.85rem + 3.35vw, 4.40rem);

  /* Space & shape */
  --sp-1: 0.5rem;  --sp-2: 0.85rem; --sp-3: 1.25rem; --sp-4: 2rem;
  --sp-5: 3rem;    --sp-6: 4.5rem;  --sp-7: 6.5rem;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(18,51,59,.05), 0 10px 30px -18px rgba(18,51,59,.28);
  --shadow-lg: 0 30px 60px -30px rgba(14,90,107,.40);
  --wrap: 1180px;
  --measure: 66ch;
}

/* ---------- 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; } }

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.62;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 .5em;
  font-weight: 700;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p  { margin: 0 0 1rem; max-width: var(--measure); }
a  { color: var(--tide); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--marine); }
img { max-width: 100%; display: block; }
strong { font-weight: 700; }

/* Focus visibility — accessibility floor */
:focus-visible {
  outline: 3px solid var(--tide);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: 8px; top: -60px;
  background: var(--marine); color: #fff; padding: .6rem 1rem;
  border-radius: 8px; z-index: 200; transition: top .2s;
}
.skip-link:focus { top: 8px; color:#fff; }

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2.4rem, var(--wrap)); margin-inline: auto; }
.section { padding-block: var(--sp-7); }
.section--tight { padding-block: var(--sp-5); }
.section--foam { background: var(--foam); }
.eyebrow {
  font-size: var(--step--1);
  font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--tide); margin: 0 0 .7rem;
}
.lede { font-size: var(--step-1); color: var(--ink-soft); max-width: 60ch; }
.center { text-align: center; margin-inline: auto; }
.center p { margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--f-body); font-weight: 600; font-size: var(--step-0);
  padding: .82rem 1.4rem; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--coral-btn); color: var(--marine-dk); box-shadow: 0 10px 22px -12px rgba(0,210,148,.6); }
.btn--primary:hover { background: var(--coral-dk); color: var(--marine-dk); }
.btn--marine { background: var(--marine); color: #fff; }
.btn--marine:hover { background: var(--marine-dk); color:#fff; }
.btn--ghost { background: transparent; color: var(--marine); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--marine); color: var(--marine); background: #fff; }
.btn--lg { padding: 1rem 1.7rem; font-size: var(--step-1); }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245,248,248,.86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 74px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; margin-right: auto; }
.brand__mark { width: 38px; height: 38px; flex: none; }
.brand__name { font-family: var(--f-display); font-weight: 700; color: var(--marine); font-size: 1.12rem; line-height: 1.05; letter-spacing: -.01em; }
.brand__name span { display:block; font-family: var(--f-body); font-weight: 600; font-size: .68rem; letter-spacing: .13em; text-transform: uppercase; color: var(--tide); }

.nav { display: flex; align-items: center; gap: .3rem; }
.nav > a, .nav-top {
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .98rem;
  padding: .5rem .72rem; border-radius: 8px; display: inline-flex; align-items: center; gap: .2rem;
}
.nav > a:hover, .nav > a[aria-current="page"],
.nav-top:hover, .nav-top[aria-current="page"] { background: var(--foam); color: var(--marine); }

/* Dropdowns */
.nav-item { position: relative; display: flex; align-items: center; }
.sub-toggle { display: none; background: none; border: 0; cursor: pointer; color: var(--ink-soft); padding: .35rem; border-radius: 6px; }
.sub-toggle svg { width: 16px; height: 16px; transition: transform .2s; display: block; }
.subnav {
  position: absolute; top: 100%; left: 0; min-width: 232px; margin: 0; padding: .4rem;
  list-style: none; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 120;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.nav-item--has-sub:hover .subnav,
.nav-item--has-sub:focus-within .subnav { opacity: 1; visibility: visible; transform: none; }
.subnav a { display: block; padding: .55rem .7rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: .95rem; white-space: nowrap; }
.subnav a:hover { background: var(--foam); color: var(--marine); }
@media (prefers-reduced-motion: reduce) { .subnav { transition: none; } }
.header-cta { display: flex; align-items: center; gap: .7rem; }
.header-phone { display:none; align-items:center; gap:.4rem; font-weight:700; color: var(--marine); text-decoration:none; white-space:nowrap; font-size:.95rem; }
.header-phone svg { width:17px; height:17px; flex:none; }
.header-phone:hover { color: var(--coral-dk); }

.nav-toggle {
  display: none; background: none; border: 2px solid var(--line);
  border-radius: 10px; width: 46px; height: 44px; cursor: pointer; color: var(--marine);
}
.nav-toggle svg { width: 22px; height: 22px; margin: auto; }

@media (max-width: 900px) {
  .nav {
    position: fixed; inset: 74px 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--paper); border-bottom: 1px solid var(--line); padding: .6rem 1.2rem 1.2rem;
    gap: .1rem; transform: translateY(-120%); transition: transform .25s ease; box-shadow: var(--shadow);
    max-height: calc(100vh - 74px); overflow-y: auto;
  }
  .nav[data-open="true"] { transform: translateY(0); }
  .nav > a { padding: .85rem .6rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav-item { flex-wrap: wrap; border-bottom: 1px solid var(--line); }
  .nav-top { flex: 1; padding: .85rem .6rem; }
  .sub-toggle { display: inline-flex; margin-left: auto; }
  .subnav {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; border-radius: 0; padding: 0 0 .5rem .8rem;
    min-width: 0; flex-basis: 100%; display: none; background: transparent;
  }
  .nav-item[data-sub-open="true"] .subnav { display: block; }
  .nav-item[data-sub-open="true"] .sub-toggle svg { transform: rotate(180deg); }
  .subnav a { padding: .6rem .6rem; }
  .nav-toggle { display: flex; }
}
@media (min-width: 1040px) { .header-phone { display: inline-flex; } }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: clip; background: linear-gradient(175deg, var(--foam) 0%, var(--paper) 62%); }
.hero__inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--sp-5); align-items: center; padding-block: var(--sp-6) 0; }
.hero h1 { margin-bottom: .35em; }
.hero .lede { margin-bottom: 1.6rem; }
.hero__aside {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.6rem; box-shadow: var(--shadow); align-self: center;
}
.hero__aside h2 { font-size: var(--step-1); }
.badge-row { display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom: 1.2rem; }
.badge {
  display:inline-flex; align-items:center; gap:.4rem; background: var(--foam);
  color: var(--marine); font-weight:600; font-size:.82rem; padding:.35rem .7rem; border-radius:999px;
}
.badge svg { width: 15px; height: 15px; }

/* Wave divider (signature) */
.wave { display:block; width:100%; height: 60px; margin-top: -1px; color: var(--paper); }
.wave--foam { color: var(--foam); }
.wave--marine { color: var(--marine-dk); }
.wave--flip { transform: rotate(180deg); }

@media (max-width: 820px) {
  .hero__inner { grid-template-columns: 1fr; padding-block: var(--sp-5) 0; gap: var(--sp-4); }
}

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 1.2rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: flex; flex-direction: column; gap: .35rem;
}
.card--link:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--foam-2); }
.card h3 { font-size: var(--step-1); margin-bottom: .15em; }
.card p { color: var(--ink-soft); margin-bottom: .4rem; }
.card__icon {
  width: 46px; height: 46px; border-radius: 12px; background: var(--foam);
  display: grid; place-items: center; color: var(--marine); margin-bottom: .6rem;
}
.card__icon svg { width: 24px; height: 24px; }
.card a.card__more { margin-top: auto; font-weight: 600; text-decoration: none; }
.card a.card__more::after { content: " →"; }
a.card { text-decoration: none; color: inherit; }

/* Answer block — the AI-Overview extractable pattern */
.answer {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--coral);
  border-radius: var(--radius); padding: 1.3rem 1.5rem; box-shadow: var(--shadow);
  font-size: var(--step-1); color: var(--ink); max-width: 68ch;
}
.answer p { max-width: none; margin-bottom: 0; }

/* Stat / counter */
.stat { text-align: center; }
.stat__num { font-family: var(--f-display); font-weight: 700; font-size: var(--step-4); color: var(--marine); line-height: 1; }
.stat__label { color: var(--ink-soft); font-size: var(--step--1); font-weight: 600; letter-spacing:.04em; }

/* ---------- Location detail ---------- */
.loc-hero { display:grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); align-items:start; }
@media (max-width: 820px){ .loc-hero{ grid-template-columns:1fr; } }
.nap { display: grid; gap: .6rem; margin: 1.2rem 0; }
.nap__row { display:flex; gap:.7rem; align-items:flex-start; }
.nap__row svg { width: 20px; height: 20px; flex: none; color: var(--tide); margin-top: 3px; }
.nap a { font-weight: 600; }
.map-embed { width:100%; aspect-ratio: 4/3; border:0; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--foam); }
.hours-table { width:100%; border-collapse: collapse; background:var(--card); border:1px solid var(--line); border-radius: var(--radius); overflow:hidden; }
.hours-table th, .hours-table td { text-align:left; padding:.6rem .9rem; border-bottom:1px solid var(--line); font-size:.98rem; }
.hours-table tr:last-child td, .hours-table tr:last-child th { border-bottom:0; }
.hours-table th { font-weight:600; color: var(--ink-soft); width: 46%; }

/* Photo placeholder */
.photo-ph {
  aspect-ratio: 4/3; border-radius: var(--radius); border: 2px dashed var(--foam-2);
  background: repeating-linear-gradient(135deg, var(--foam) 0 14px, #eef5f4 14px 28px);
  display:grid; place-items:center; text-align:center; color: var(--ink-soft); font-size:.86rem; font-weight:600; padding:1rem;
}

/* ---------- Accordion (FAQ) ---------- */
.faq { max-width: 800px; }
.faq details {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  margin-bottom: .7rem; padding: 0 1.2rem; box-shadow: var(--shadow);
}
.faq summary {
  list-style: none; cursor: pointer; padding: 1.05rem 0; font-weight: 600; font-size: var(--step-1);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; color: var(--tide); transition: transform .2s; line-height: 1; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > p { padding-bottom: 1.15rem; margin: 0; color: var(--ink-soft); }

/* ---------- Forms ---------- */
.form-card { background: var(--card); border:1px solid var(--line); border-radius: var(--radius-lg); padding: 1.7rem; box-shadow: var(--shadow); }
.field { margin-bottom: 1rem; }
.field label { display:block; font-weight:600; margin-bottom:.35rem; font-size:.96rem; }
.field input, .field select, .field textarea {
  width:100%; padding:.75rem .85rem; border:1.5px solid var(--line); border-radius:10px;
  font: inherit; color: var(--ink); background: var(--paper);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--tide); outline: none; box-shadow: 0 0 0 3px rgba(44,143,166,.18); }
.field textarea { min-height: 130px; resize: vertical; }
.form-note { font-size: .82rem; color: var(--ink-soft); }
.form-status { margin-top: .8rem; font-weight: 600; }
.form-status[data-state="ok"] { color: var(--marine); }
.form-status[data-state="err"] { color: var(--error); }

/* ---------- Callout / notice ---------- */
.notice {
  background: #FFF7E9; border:1px solid #F1DCA9; border-radius: var(--radius);
  padding: 1rem 1.2rem; color: #6b4e12; font-size: .96rem;
}
.notice strong { color: #5a3f08; }
.build-flag { background:#fdecea; border:1px dashed var(--coral); color: var(--coral-dk); font-size:.82rem; }

/* Breadcrumbs */
.crumbs { font-size: .85rem; color: var(--ink-soft); padding-top: 1.4rem; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--marine); }
.crumbs span { margin: 0 .35rem; opacity: .5; }

/* Prose helper for long-form pages */
.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.6rem; font-size: var(--step-1); }
.prose ul { max-width: var(--measure); padding-left: 1.2rem; }
.prose li { margin-bottom: .4rem; }

/* Chips */
.chips { display:flex; flex-wrap:wrap; gap:.5rem; margin: .8rem 0 0; }
.chip { background: var(--foam); color: var(--marine); font-weight:600; font-size:.86rem; padding:.4rem .8rem; border-radius:999px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--marine-dk); color: #cfe4e6; }
.footer-inner { display:grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; padding-block: var(--sp-6) var(--sp-4); }
.site-footer h4 { color:#fff; font-size: 1rem; letter-spacing:.02em; margin-bottom: .9rem; }
.site-footer a { color:#cfe4e6; text-decoration:none; }
.site-footer a:hover { color:#fff; }
.footer-col ul { list-style:none; margin:0; padding:0; display:grid; gap:.5rem; }
.footer-brand p { color:#a9cace; font-size:.94rem; max-width: 34ch; }
.footer-bottom { border-top:1px solid rgba(255,255,255,.12); padding-block:1.2rem; display:flex; flex-wrap:wrap; gap:.6rem 1.5rem; justify-content:space-between; font-size:.84rem; color:#9dc0c4; }
.footer-loc { font-size:.92rem; line-height:1.5; }
.footer-loc strong { color:#fff; display:block; }
@media (max-width: 820px){ .footer-inner{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px){ .footer-inner{ grid-template-columns: 1fr; } }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Utilities */
.mt-0{margin-top:0}.mb-0{margin-bottom:0}.mt-4{margin-top:var(--sp-4)}
.stack > * + * { margin-top: 1rem; }
.text-soft { color: var(--ink-soft); }
.hr { border:0; border-top:1px solid var(--line); margin: var(--sp-4) 0; }

/* Clickable chips (service-area links) */
a.chip { text-decoration: none; transition: background .15s ease; }
a.chip:hover { background: var(--foam-2); color: var(--marine-dk); }

/* ---------- Reviews / testimonials ---------- */
.stars { color: var(--gold); letter-spacing: 1px; font-size: 1.05rem; line-height: 1; }
.rating-hero { display:flex; flex-wrap:wrap; align-items:center; gap:1.4rem; }
.rating-big { font-family: var(--f-display); font-weight:700; font-size: var(--step-4); color: var(--marine); line-height:1; }
.review-card { background: var(--card); border:1px solid var(--line); border-radius: var(--radius); padding:1.3rem 1.4rem; box-shadow: var(--shadow); display:flex; flex-direction:column; gap:.6rem; }
.review-head { display:flex; align-items:center; gap:.7rem; }
.avatar { width:42px; height:42px; border-radius:50%; background:var(--foam); color:var(--marine); display:grid; place-items:center; font-weight:700; flex:none; font-size:1rem; }
.review-name { font-weight:600; line-height:1.15; }
.review-meta { font-size:.8rem; color:var(--ink-soft); }
.review-body { color:var(--ink); margin:0; }
.review-src { font-size:.78rem; color:var(--ink-soft); margin-top:auto; }
.g-mark { display:inline-flex; align-items:center; gap:.35rem; font-weight:600; color:var(--ink-soft); font-size:.82rem; }

/* ---------- Consent banner + gated maps (privacy) ---------- */
.consent {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 200;
  max-width: 760px; margin-inline: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 1.1rem 1.3rem;
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
}
.consent p { margin: 0; font-size: .92rem; color: var(--ink-soft); flex: 1 1 320px; max-width: none; }
.consent .btn-row { flex: 0 0 auto; }
.consent .btn { padding: .6rem 1.1rem; }
.map-ph {
  aspect-ratio: 4/3; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--foam); display: grid; place-items: center; text-align: center; padding: 1.2rem;
}
.map-ph p { color: var(--ink-soft); font-size: .9rem; max-width: 34ch; margin: 0 0 .8rem; }

/* Footer legal row */
.footer-legal { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.footer-legal a { font-size: .84rem; }

/* ---------- Brand logo images ---------- */
.brand { text-decoration: none; }
.brand__logo { height: 42px; width: auto; display: block; }
@media (max-width: 480px) { .brand__logo { height: 34px; } }
.footer-mark { width: 58px; height: 58px; border-radius: 14px; background: #fff; display: grid; place-items: center; margin-bottom: .85rem; box-shadow: var(--shadow); }
.footer-mark img { width: 44px; height: 44px; display: block; }
