/* Shared header + cross-device fixes for all public pages.
   Loaded after each page's inline styles. Header classes are namespaced (cfc-*)
   so legacy page rules (.nav-ctas, .nav-cta, .btn) cannot collide. */

:root {
  color-scheme: dark;
  --cfc-bg: #0E0E0E;
  --cfc-gold: #C9A84C;
  --cfc-gold-hi: #DBB85A;
  --cfc-text: #F4F1EB;
  --cfc-muted: #A69C88;
  --cfc-border: #2A2822;
  --cfc-h: 64px;
  --cfc-safe-t: env(safe-area-inset-top, 0px);
  --cfc-safe-l: env(safe-area-inset-left, 0px);
  --cfc-safe-r: env(safe-area-inset-right, 0px);
  --cfc-safe-b: env(safe-area-inset-bottom, 0px);
  /* Contrast: legacy muted (#6B6456 / #888) failed WCAG AA on near-black. */
  --muted: #A69C88;
}
body.svc-page { --muted: #A69C88; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: #0E0E0E; }
html, body { color-scheme: dark; }
body { padding-left: var(--cfc-safe-l); padding-right: var(--cfc-safe-r); padding-bottom: var(--cfc-safe-b); }
body:has(.cfc-header[data-cfc-header="fixed"]) { padding-top:var(--cfc-safe-t); }
img { max-width: 100%; }

/* ── HEADER ─────────────────────────────────────────────────────────── */
.cfc-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  padding-top: var(--cfc-safe-t);
  background: rgba(14,14,14,.94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cfc-border);
  font-family: 'DM Sans', sans-serif;
}
.cfc-header[data-cfc-header="flow"] { position: sticky; }
.cfc-header nav.cfc-nav {
  position: static; inset: auto; background: none; border: 0; padding: 0 max(16px, var(--cfc-safe-r)) 0 max(16px, var(--cfc-safe-l));
  -webkit-backdrop-filter: none; backdrop-filter: none;
  max-width: 1440px; margin: 0 auto; height: var(--cfc-h);
  display: flex; align-items: center; gap: 16px; z-index: auto;
}
.cfc-brand {
  display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto;
  text-decoration: none !important; min-height: 44px; color: var(--cfc-gold);
}
.cfc-brand img { height: 42px; width: 42px; display: block; flex-shrink: 0; border-radius: 4px; }
.cfc-brand-name {
  font-family: 'DM Serif Display', serif; font-size: 1.1rem; color: var(--cfc-gold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
}
.cfc-links { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; margin-left: auto; }
.cfc-links li { margin: 0; padding: 0; }
.cfc-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: #CFC7B6; font-size: .86rem; font-weight: 500; letter-spacing: .02em;
  text-decoration: none !important; border-radius: 6px; white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.cfc-links a:hover { color: var(--cfc-text); background: rgba(201,168,76,.07); }
.cfc-links a[aria-current="page"] { color: var(--cfc-gold); box-shadow: inset 0 -2px 0 var(--cfc-gold); border-radius: 0; }
.cfc-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cfc-cta {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  background: var(--cfc-gold); color: #0E0E0E !important; border-radius: 6px;
  font-size: .86rem; font-weight: 600; letter-spacing: .03em; white-space: nowrap;
  text-decoration: none !important; transition: background-color .15s;
}
.cfc-cta:hover { background: var(--cfc-gold-hi); }
.cfc-toggle {
  display: none; width: 44px; height: 44px; padding: 0; flex-shrink: 0; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: transparent; border: 1px solid var(--cfc-border); border-radius: 6px;
}
.cfc-toggle span { display: block; width: 18px; height: 1.5px; background: var(--cfc-gold); transition: transform .2s, opacity .2s; }
.cfc-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.cfc-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.cfc-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
.cfc-header a:focus-visible, .cfc-toggle:focus-visible { outline: 2px solid var(--cfc-gold); outline-offset: 2px; }

/* Collapsed menu: below 1200px six links + brand + CTA do not fit. */
@media (max-width: 1199.98px) {
  .cfc-toggle { display: flex; }
  .cfc-actions { margin-left: auto; }
  .cfc-links {
    position: fixed; left: 0; right: 0; top: calc(var(--cfc-h) + var(--cfc-safe-t));
    margin: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(14,14,14,.98); border-bottom: 1px solid var(--cfc-border);
    padding: 4px max(8px, var(--cfc-safe-r)) calc(8px + var(--cfc-safe-b)) max(8px, var(--cfc-safe-l));
    max-height: calc(100dvh - var(--cfc-h) - var(--cfc-safe-t)); overflow-y: auto; overscroll-behavior: contain;
    visibility: hidden; opacity: 0; transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  }
  .cfc-header.is-open .cfc-links { visibility: visible; opacity: 1; transform: none; transition: opacity .18s ease, transform .18s ease; }
  .cfc-links li + li { border-top: 1px solid var(--cfc-border); }
  .cfc-links a { display: flex; min-height: 52px; padding: 0 16px; font-size: 1rem; border-radius: 0; }
  .cfc-links a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--cfc-gold); }
}
@media (max-width: 639.98px) {
  .cfc-brand { gap:6px; }
  .cfc-brand-name { white-space:normal; font-size:12px; line-height:1.2; max-width:110px; }
  .cfc-brand img { width:32px; height:32px; }
  .cfc-cta { padding: 0 14px; font-size: .82rem; }
}
@media (max-width: 359.98px) {
  .cfc-header nav.cfc-nav { gap: 8px; padding-left: max(12px, var(--cfc-safe-l)); padding-right: max(12px, var(--cfc-safe-r)); }
  .cfc-brand-name { max-width:88px; flex:0 0 88px; overflow:visible; text-overflow:clip; }
  .cfc-cta { padding: 0 8px; font-size:.72rem; }
  .cards-grid { grid-template-columns:minmax(0,1fr); gap:16px; }
}

/* Fixed header offset for in-page anchors. */
[id] { scroll-margin-top: calc(var(--cfc-h) + var(--cfc-safe-t) + 16px); }

/* ── FORMS: 16px prevents iOS zoom ─────────────────────────────────── */
html body input:not([type="hidden"]),
html body select,
html body textarea { font-size: 16px !important; max-width: 100%; }
html body select option { background: #1A1A1A; color: #F4F1EB; }
html body input::placeholder, html body textarea::placeholder { color: #7D7566; opacity: 1; }
html body button, html body input[type="submit"] { min-height: 44px; }
html body .btn { min-height: 44px; }
.check-label, .radio-label, .intake-decl { min-height: 44px; }

/* ── OVERFLOW: long words, emails, tables ──────────────────────────── */
p, li, td, th, dd, label, h1, h2, h3, h4 { overflow-wrap: break-word; }
a[href^="mailto:"], a[href^="tel:"], a[href^="http"] { overflow-wrap: anywhere; }
.fee-table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  .fee-table th, .fee-table td,
  .fee-schedule th, .fee-schedule td { padding: 12px 10px; }
  .fee-schedule td.amt { white-space: normal; font-size: 1.05rem; }
  .fee-schedule, .fee-table { font-size: .9rem; }
  .btn { white-space: normal; text-align: center; }
  .review-row { flex-wrap: wrap; }
  .review-row .rv { text-align: left; }
}

/* ── TAP TARGETS (touch only, keeps desktop typography intact) ─────── */
@media (pointer: coarse) {
  footer a, .footer-link { display: inline-block; padding-top: 10px; padding-bottom: 10px; }
  .ladder-link { padding: 10px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cfc-links, .cfc-toggle span { transition: none !important; }
}
