/* ==========================================================================
   Soundside Ledger Co. — shared site styles (v1)
   Think of this file like a Figma library: tokens at the top (variables),
   then shared components (nav, buttons, cards, footer) used on every page.
   ========================================================================== */

/* EB Garamond (self-hosted, SIL Open Font License) — matches the logo */
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  --color-primary: #0A4C75;        /* brand blue */
  --color-primary-hover: #0A66AA;  /* brighter blue for hover on links and buttons */
  --color-on-primary: #FFFFFF;
  --color-surface: #FDFCFA;        /* lightest warm off-white (was #FBF9F5, #F7F3EC) */
  --color-surface-raised: #FFFFFF; /* cards */
  --color-on-surface: #1B2A31;
  --color-on-surface-variant: #3F4E55;
  --color-outline: rgba(10, 76, 117, 0.14);
  --color-accent: #E9DCC4;         /* sand */
  --color-water: #D5DFDF;          /* flat Sound water */
  --color-trees: #BFCCC7;          /* tree lines: Kings Point, Plum Point */
  --color-far-shore: #CED8D7;      /* the Bronx, far off */
  --color-sand-scene: #EDE2CF;     /* sand as drawn in the bay scene (sand at 80% over the page) */
  --color-focus: #C2620A;          /* high-visibility focus ring */

  --font-display: "EB Garamond", Garamond, "Times New Roman", serif;
  --font-body: "Roboto Flex", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 72px;
  --radius-button: 8px;
  --radius-card: 16px;
  --container: 1200px;

  --motion-standard: cubic-bezier(0.2, 0, 0, 1); /* Material 3 standard easing */
  --duration-short: 200ms;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
html { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-on-surface);
  background: var(--color-surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; }

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

/* Skip link — lets keyboard users jump straight to content (WCAG 2.4.1) */
.skip-link {
  position: absolute; left: var(--space-3); top: -100px; z-index: 30;
  background: var(--color-primary); color: var(--color-on-primary);
  padding: var(--space-2) var(--space-3); border-radius: 8px;
}
.skip-link:focus { top: var(--space-3); }

/* Links: brand blue and underlined at rest; brighter blue, underline removed on hover */
a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 0.2em; }
a:hover { color: var(--color-primary-hover); text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; color: var(--color-primary); letter-spacing: -0.005em; }
h1 { font-size: clamp(2.4rem, 1.6rem + 3vw, 3.8rem); line-height: 1.06; margin: 0 0 var(--space-3); text-wrap: balance; }
h2 { font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.4rem); line-height: 1.15; margin: 0 0 var(--space-3); text-wrap: balance; }
h3 { font-size: 1.45rem; line-height: 1.2; margin: 0 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }
.lede { font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem); color: var(--color-on-surface-variant); max-width: 60ch; }
.muted { color: var(--color-on-surface-variant); }

/* Double rule under page titles — borrowed from the logo's "final total" line */
.ledger-rule { width: 96px; height: 7px; border-top: 2px solid var(--color-primary); border-bottom: 2px solid var(--color-primary); margin: var(--space-4) 0; }

/* ---------- Buttons (Material 3 filled button) ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-4);
  border-radius: var(--radius-button);
  background: var(--color-primary); color: var(--color-on-primary);
  font-weight: 600; font-size: 1rem; text-decoration: none;
  transition: box-shadow var(--duration-short) var(--motion-standard), background-color var(--duration-short) var(--motion-standard);
}
.button:hover { background: var(--color-primary-hover); color: var(--color-on-primary); text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.12); }

/* ---------- Top navigation bar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  /* Diamond texture (same pattern as chrisgammon.com), tinted to Soundside sand */
  background: var(--color-surface) url("/assets/textures/nav-texture.webp") repeat;
  box-shadow: 0 1px 2px rgba(10, 76, 117, 0.06), 0 4px 12px rgba(10, 76, 117, 0.06);
}
.site-header .bar {
  max-width: var(--container); margin: 0 auto; padding: 0 var(--space-4);
  min-height: 76px; display: flex; align-items: center; gap: var(--space-4);
}
.wordmark { display: inline-flex; align-items: center; gap: 12px; line-height: 0; text-decoration: none; margin-right: auto; color: var(--color-primary); }
.logo-mark { width: 24px; height: 34px; flex: none; }   /* calculator mark (3C), left of the logotype */
.site-header--blue .wordmark { color: #F4EFE6; }   /* matches the reversed logotype */
.wordmark img { height: auto; }
.logo-md { width: 260px; }       /* smallest size for the tagline version */
.logo-sm { width: 180px; display: none; }

.menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: var(--space-2); }
.menu-link {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 12px;
  font: inherit; font-size: 1rem; font-weight: 600;
  color: var(--color-primary); background: none; border: 0; border-radius: var(--radius-button);
  cursor: pointer; text-decoration: none; position: relative;   /* nav labels are not underlined */
}
.menu-link:hover { color: var(--color-primary-hover); text-decoration: none; background: rgba(10, 76, 117, 0.06); }
.menu-link[aria-current="page"]::after, .menu-link.is-current::after {   /* current page: short rule under the label */
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 6px; height: 2px; background: currentColor; border-radius: 2px;
}
.sub-toggle.is-current::after { right: 32px; }
.chev { transition: transform var(--duration-short) var(--motion-standard); }
.sub-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Services dropdown (opens on click or keyboard, not hover only) */
.has-sub { position: relative; }
.sub {
  list-style: none; margin: 0; padding: 8px;
  position: absolute; top: calc(100% + 10px); left: 0; width: 340px;
  background: var(--color-surface-raised); border: 1px solid rgba(10, 76, 117, 0.12); border-radius: 12px;
  box-shadow: 0 2px 4px rgba(10, 76, 117, 0.06), 0 12px 32px rgba(10, 76, 117, 0.12);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity var(--duration-short) var(--motion-standard), transform var(--duration-short) var(--motion-standard), visibility var(--duration-short);
}
.sub-toggle[aria-expanded="true"] + .sub { opacity: 1; visibility: visible; transform: none; }
.sub a { display: block; padding: 12px 14px; border-radius: 8px; text-decoration: none; color: var(--color-on-surface); }
.sub a strong { display: block; font-weight: 600; color: var(--color-primary); }
.sub a span { display: block; font-size: 0.875rem; color: var(--color-on-surface-variant); }
.sub a:hover, .sub a[aria-current="page"] { background: rgba(10, 76, 117, 0.06); text-decoration: none; }
.sub a:hover strong { color: var(--color-primary-hover); }
.sub-all { border-top: 1px solid rgba(10, 76, 117, 0.1); margin-top: 4px; padding-top: 4px; }
.sub > li + li:not(.sub-all) { border-top: 1px solid rgba(10, 76, 117, 0.1); margin-top: 4px; padding-top: 4px; }   /* keyline between Bookkeeping and Tax */
.sub-all a { font-weight: 600; color: var(--color-primary); }

/* Mobile menu button (hidden on desktop) */
.menu-toggle {
  display: none; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px; border: 1px solid rgba(10, 76, 117, 0.2); border-radius: var(--radius-button);
  background: none; color: var(--color-primary); font: inherit; font-weight: 600; cursor: pointer;
}
.menu-toggle:hover { color: var(--color-primary-hover); background: rgba(10, 76, 117, 0.06); }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 900px) {
  .site-header .bar { min-height: 64px; }
  .menu-toggle { display: inline-flex; }
  .main-nav { position: absolute; left: 0; right: 0; top: 100%; }
  .menu {
    display: none; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--color-surface); padding: 8px var(--space-4) var(--space-4);
    box-shadow: 0 8px 16px rgba(10, 76, 117, 0.08); border-top: 1px solid rgba(10, 76, 117, 0.08);
    max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .menu.open { display: flex; }
  .menu > li { border-bottom: 1px solid rgba(10, 76, 117, 0.08); }
  .menu-link { width: 100%; justify-content: space-between; min-height: 52px; padding: 0 4px; font-size: 1.0625rem; }
  .menu-link:hover { background: none; }
  .menu-link[aria-current="page"]::after, .menu-link.is-current::after { left: 4px; right: auto; width: 24px; bottom: 8px; }
  .sub { position: static; width: auto; box-shadow: none; border: 0; background: none; padding: 0 0 8px; display: none; opacity: 1; visibility: visible; transform: none; }
  .sub-toggle[aria-expanded="true"] + .sub { display: block; }
}
@media (max-width: 480px) {
  .logo-md { display: none; }
  .logo-sm { display: block; }
  .logo-mark { width: 18px; height: 26px; }
  .toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---------- Bay scene (Manhasset Bay: Kings Point, the Bronx, Plum Point) ---------- */
.shore {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: -1;
  height: var(--shore-h, clamp(150px, 20vw, 300px));
  --scene-opacity: 0.8;            /* lower = lighter (water, land and sand); 0.8 keeps all text ≥ 5.8:1 contrast */
  background: #DDE5E5;
  background: color-mix(in srgb, var(--color-water) calc(var(--scene-opacity) * 100%), var(--color-surface));
}
.bayline { position: absolute; left: 0; bottom: 100%; display: block; width: 100%; height: auto; opacity: var(--scene-opacity); }
.gulls { position: absolute; left: 0; bottom: 100%; display: block; width: 100%; height: auto; pointer-events: none;
  color: #9DAEB2; opacity: var(--scene-opacity); }   /* a few gulls in the sky: one set on the home hero, one on inner pages */
.gulls-home, .hero .gulls-inner { display: none; }
.hero .gulls-home { display: inline; }
.gulls path { stroke-width: 1.75px; vector-effect: non-scaling-stroke; }
.wave {
  position: absolute; left: 0; bottom: -1px; display: block; width: 100%;
  height: clamp(32px, 6vw, 80px);
  color: #EDE2CF;
  color: color-mix(in srgb, var(--color-accent) calc(var(--scene-opacity) * 100%), var(--color-surface));
}

/* ---------- Interior pages ---------- */
main { flex: 1; }
.page-head { padding-block: var(--space-6) var(--space-4); }
.breadcrumb { font-size: 0.875rem; color: var(--color-on-surface-variant); margin-bottom: var(--space-4); }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; opacity: 0.6; }

.section { padding-block: var(--space-5) var(--space-6); }
.section-head { max-width: 60ch; margin-bottom: var(--space-5); }
.section + .section { padding-top: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--space-4); }
.cards--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.card {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-card);
  padding: clamp(24px, 3vw, 32px);
  scroll-margin-top: 100px;          /* anchors land below the sticky nav */
}
.card > :last-child { margin-bottom: 0; }
.card p { color: var(--color-on-surface-variant); }
.card--feature h2 { margin-bottom: var(--space-2); }

.check-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: 10px; }
.check-list li { position: relative; padding-left: 28px; }
.check-list li::before {
  content: ""; position: absolute; left: 2px; top: 0.55em; width: 14px; height: 7px;
  border-left: 2px solid var(--color-primary); border-bottom: 2px solid var(--color-primary); transform: rotate(-45deg) translateY(-50%);
}
.check-list a { text-decoration: none; }
.check-list a:hover { text-decoration: underline; }

.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.jump a {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--color-outline); border-radius: 999px;
  background: var(--color-surface-raised); font-size: 0.875rem; text-decoration: none;
}
.jump a:hover { border-color: var(--color-primary-hover); }

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.pill-list li { padding: 6px 14px; border-radius: 999px; background: rgba(10, 76, 117, 0.07); color: var(--color-primary); font-weight: 600; font-size: 0.9375rem; }

.note { border-left: 3px solid var(--color-primary); padding: 12px 16px; background: rgba(10, 76, 117, 0.05); border-radius: 0 8px 8px 0; color: var(--color-on-surface-variant); }

/* Two-column layout with a sticky contact card */
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: clamp(32px, 5vw, 64px); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* Contact card (same as the home page) */
.panel {
  /* white card with the same diamond pattern as the nav (gold diamonds on white) */
  background: var(--color-surface-raised) url("/assets/textures/card-texture.webp") repeat;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-card);
  padding: clamp(24px, 3vw, 36px);
}
.panel p { margin: 0 0 20px; color: var(--color-on-surface-variant); }
.panel .button { width: 100%; }
.panel dl { margin: 20px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-3); font-size: 0.9375rem; color: var(--color-on-surface-variant); }
.panel dt { font-weight: 600; }
.panel dd { margin: 0; }

/* FAQ accordion (native details/summary: keyboard and screen-reader friendly) */
.faq { display: grid; gap: 12px; max-width: 820px; }
.faq details { background: var(--color-surface-raised); border: 1px solid var(--color-outline); border-radius: 12px; }
.faq summary {
  list-style: none; cursor: pointer; padding: 18px 56px 18px 20px; position: relative;
  font-weight: 600; font-size: 1.0625rem; color: var(--color-primary); border-radius: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 22px; top: 50%; width: 10px; height: 10px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg); transition: transform var(--duration-short) var(--motion-standard);
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq summary:hover { color: var(--color-primary-hover); }
.faq .answer { padding: 0 20px 18px; color: var(--color-on-surface-variant); }
.faq .answer > :last-child { margin-bottom: 0; }
.faq-group { margin-bottom: var(--space-6); }
.faq-group h2 { font-size: 1.6rem; }

/* Call-to-action band with the bay scene behind it */
.cta-band {
  position: relative; isolation: isolate; text-align: center;
  --shore-h: clamp(120px, 14vw, 200px);
  padding: var(--space-6) var(--space-4) calc(var(--shore-h) * 0.85);
  margin-top: var(--space-5);
}
.cta-band h2 { margin-bottom: var(--space-2); }
.cta-band p { color: var(--color-on-surface-variant); margin: 0 auto var(--space-4); max-width: 52ch; }
.cta-band .contact-line { margin: var(--space-3) auto 0; font-size: 0.9375rem; }
.cta-band--title-only h2 { margin-bottom: var(--space-4); }
.cta-band .contact-line .sep { margin: 0 0.6em; opacity: 0.6; }

/* Long-form (legal) pages */
.prose { max-width: 70ch; }
.prose h2 { font-size: 1.5rem; margin-top: var(--space-5); margin-bottom: var(--space-2); }
.prose ul { padding-left: 1.25em; }
.updated { color: var(--color-on-surface-variant); font-size: 0.9375rem; }

/* ---------- Footer ---------- */
.site-footer {
  width: 100%; max-width: var(--container); margin: 0 auto;
  /* Sand continues from the bay scene to the bottom of the page (full-bleed behind the footer) */
  background: var(--color-sand-scene);
  box-shadow: 0 0 0 100vmax var(--color-sand-scene);
  clip-path: inset(0 -100vmax -100vmax);
  padding: var(--space-4) var(--space-4) var(--space-5);
  font-size: 0.875rem; color: var(--color-on-surface-variant);
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); justify-content: space-between;
}
.site-footer p { margin: 0; }
.site-footer .sep { margin: 0 0.4em; opacity: 0.6; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ==========================================================================
   Contact form — Material 3 filled text fields (same pattern as
   ryanpaintingny.com / chrisgammon.com), themed to Soundside
   ========================================================================== */
.form-card h2 { margin-bottom: var(--space-4); }
.stack { display: grid; gap: var(--space-4); align-content: start; }
.panel-title { font-size: 1.45rem; margin: 0 0 var(--space-2); }
.h3-size { font-size: 1.45rem; }

.contact-form { display: grid; gap: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 599px) { .form-row { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.md-field {
  position: relative;
  border-radius: 6px 6px 0 0;
  background: rgba(10, 76, 117, 0.05);           /* filled container */
  color: var(--color-on-surface);
}
.md-field::before {                                /* hover state layer */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--color-primary); opacity: 0; pointer-events: none;
  transition: opacity 150ms var(--motion-standard);
}
.md-field:hover::before { opacity: 0.04; }
.md-field::after {                                 /* active indicator grows from the center on focus */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--color-primary); transform: scaleX(0); pointer-events: none;
  transition: transform 300ms cubic-bezier(0.05, 0.7, 0.1, 1);
}
.md-field:focus-within::after { transform: scaleX(1); }
.md-field input, .md-field textarea, .md-field select {
  position: relative; display: block; width: 100%; min-height: 56px;
  padding: 1.5rem 1rem 0.5rem;
  border: 0; border-bottom: 1px solid rgba(63, 78, 85, 0.6); border-radius: inherit;
  background: transparent; color: var(--color-on-surface);
  font: inherit; font-size: 1rem; line-height: 1.5rem; outline: none;
}
.md-field textarea { resize: vertical; min-height: 140px; }
.md-field select { appearance: none; -webkit-appearance: none; padding-right: 3rem; cursor: pointer; }
.md-field label {
  position: absolute; left: 1rem; top: 1rem; font-size: 1rem; line-height: 1.5rem;
  color: var(--color-on-surface-variant); pointer-events: none;
  transform-origin: left top; transition: transform 150ms var(--motion-standard), color 150ms;
  white-space: nowrap;
}
.md-field input:focus + label, .md-field input:not(:placeholder-shown) + label,
.md-field textarea:focus + label, .md-field textarea:not(:placeholder-shown) + label,
.md-field--select label { transform: translateY(-0.55rem) scale(0.75); }
.md-field :focus + label { color: var(--color-primary); }
.md-field input:-webkit-autofill { -webkit-text-fill-color: var(--color-on-surface); box-shadow: 0 0 0 100px #EEF0EE inset; }
.md-trailing-icon { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--color-on-surface-variant); pointer-events: none; }
.md-required { color: #B3261E; margin-left: 0.125em; }
.md-supporting, .card .md-supporting { font-size: 0.8125rem; color: var(--color-on-surface-variant); margin: -12px 1rem 0; }

/* Errors (WCAG 3.3.1 / 3.3.3): red indicator, red label, message under the field */
.md-field.has-error::after { background: #B3261E; transform: scaleX(1); }
.md-field.has-error label { color: #B3261E; }
.md-error-text, .card .md-error-text { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: #B3261E; margin: 6px 1rem 0; }
.md-error-text[hidden] { display: none; }
.md-error-text svg { flex-shrink: 0; }

/* Submit button: label → spinner while sending → check on success */
.form-submit { position: relative; justify-self: start; min-width: 180px; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.form-submit:disabled { cursor: default; }
.form-submit .btn-label { transition: opacity 150ms; }
.form-submit .btn-spinner, .form-submit .btn-check {
  position: absolute; inset: 0; display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.6); transition: opacity 200ms, transform 200ms; pointer-events: none;
}
.form-submit .btn-spinner svg, .form-submit .btn-check svg { width: 20px; height: 20px; }
.form-submit .btn-spinner svg { animation: btn-spin 0.85s linear infinite; }
.form-submit .btn-spinner circle { stroke-dasharray: 34 100; }
.form-submit.is-loading .btn-label, .form-submit.is-success .btn-label { opacity: 0; }
.form-submit.is-loading .btn-spinner, .form-submit.is-success .btn-check { opacity: 1; transform: scale(1); }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (max-width: 599px) { .form-submit { justify-self: stretch; } }
.form-note { font-size: 0.8125rem; margin: 0; }
/* Contact form header: title left, "* Required fields" top right (Nov 17) */
.form-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); flex-wrap: nowrap; margin-bottom: var(--space-4); }
.form-head .form-note { white-space: nowrap; }
.form-card .form-head h2 { margin-bottom: 0; }

/* Alerts above the first row: confirmation / success (and send failures).
   Field errors stay inline under each field. */
.md-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: 8px;
  font-size: 0.9375rem; line-height: 1.45;
  animation: md-alert-in 250ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.md-alert[hidden] { display: none; }
.md-alert svg { flex-shrink: 0; margin-top: 1px; }
.md-alert:focus { outline: none; }
.md-alert:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.md-alert--success { background: rgba(27, 110, 74, 0.08); border: 1px solid rgba(27, 110, 74, 0.32); color: #1B5E3F; }
.md-alert--error { background: rgba(179, 38, 30, 0.07); border: 1px solid rgba(179, 38, 30, 0.3); color: #8C1D18; }
.md-alert a { color: inherit; }
@keyframes md-alert-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .md-alert { animation: none; } }
@media (prefers-reduced-motion: reduce) { .form-submit .btn-spinner svg { animation: none; } }

/* ---------- Top nav: blue variant (add class "site-header--blue") ---------- */
.site-header--blue {
  background: var(--color-primary) url("/assets/textures/nav-texture-blue.webp") repeat;
  box-shadow: 0 1px 2px rgba(6, 40, 62, 0.25), 0 4px 12px rgba(6, 40, 62, 0.18);
}
.site-header--blue .menu-link { color: #FFFFFF; }
.site-header--blue .menu-link:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.12); }
.site-header--blue .menu-link:focus-visible,
.site-header--blue .wordmark:focus-visible,
.site-header--blue .menu-toggle:focus-visible { outline-color: #FFFFFF; }
.site-header--blue .menu-toggle { color: #FFFFFF; border-color: rgba(255, 255, 255, 0.45); }
.site-header--blue .menu-toggle:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.12); }
@media (max-width: 900px) {
  /* the open phone menu stays light for easy reading */
  .site-header--blue .menu .menu-link { color: var(--color-primary); }
  .site-header--blue .menu .menu-link:hover { color: var(--color-primary-hover); background: none; }
}

/* ---------- Inner pages: right rail (contact card + secondary content), Nov 16 ---------- */
.with-rail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  grid-template-areas: "crumbs crumbs" "head rail" "main rail";
  grid-template-rows: auto auto 1fr;
  column-gap: clamp(32px, 5vw, 64px);
  padding-top: var(--space-6);
}
.with-rail > .breadcrumb { grid-area: crumbs; }
.with-rail > .rail-head { grid-area: head; padding-bottom: var(--space-4); }
.with-rail > .rail-head > :first-child { margin-top: 0; }
.with-rail > .rail { grid-area: rail; align-self: start; display: grid; gap: var(--space-4); }
.with-rail > .rail-main { grid-area: main; min-width: 0; }
.rail-main .section:first-child { padding-top: var(--space-3); }
.rail-main .cards--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.rail-main .cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.rail-block { padding: 4px clamp(24px, 3vw, 36px) 0; }
.rail-title { font: 600 0.8125rem/1.4 var(--font-body, inherit); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-on-surface-variant); margin: 0 0 var(--space-2); }
.rail-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; border-left: 2px solid rgba(10, 76, 117, 0.12); }
.rail-links a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--color-primary); }
.rail-links a:hover { color: var(--color-primary-hover); border-left-color: var(--color-primary-hover); }
@media (max-width: 900px) {
  .with-rail { grid-template-columns: minmax(0, 1fr); grid-template-areas: "crumbs" "head" "rail" "main"; grid-template-rows: auto; }
  .with-rail > .rail { margin-bottom: var(--space-3); }
  .with-rail--rail-last { grid-template-areas: "crumbs" "head" "main" "rail"; }   /* Contact: form first on phones */
  .with-rail--rail-last > .rail { margin: var(--space-4) 0 0; }
  .rail-block { padding-inline: 0; }
  /* phones: "On this page" / "Topics" collapse into the chip style so content isn't pushed down */
  .rail-links { display: flex; flex-wrap: wrap; gap: 8px; border-left: 0; }
  .rail-links a { margin: 0; padding: 6px 12px; border: 1px solid var(--color-outline); border-radius: 999px; font-size: 0.875rem; background: var(--color-surface-raised); }
  .rail-links a:hover { border-color: var(--color-primary-hover); }
}

/* ---------- Back to top (floating, bottom right), Nov 16 ---------- */
.to-top {
  --lift: 0px;
  position: fixed; z-index: 30;
  right: max(24px, env(safe-area-inset-right));
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + var(--lift));
  width: 48px; height: 48px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: var(--color-primary); color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(10, 76, 117, 0.25);
  opacity: 0; visibility: hidden; transform: translateY(12px) scale(0.9);
  transition: opacity var(--duration-short) var(--motion-standard), transform var(--duration-short) var(--motion-standard), visibility var(--duration-short), background-color var(--duration-short) var(--motion-standard);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--color-primary-hover); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 6px 14px rgba(10, 76, 117, 0.3); }
.to-top:focus-visible { outline: 3px solid var(--color-primary-hover); outline-offset: 3px; }
main:focus { outline: none; }
@media (max-width: 600px) { .to-top { right: max(16px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--lift)); } }
@media (prefers-reduced-motion: reduce) { .to-top { transition: opacity var(--duration-short), visibility var(--duration-short); transform: none; } }
@media print { .to-top { display: none; } }

/* ---------- Motion (Nov 16): same animations as chrisgammon.com ----------
   1. Headline: each line slides up from behind a mask (1s, second line 0.12s later).
   2. Intro: breadcrumb, then lede (0.6s), then ledger rule + contact card (1s) fade up 14px.
   3. Scroll reveal: sections fade and rise 28px the first time they scroll into view (1.3s).
   Everything is off for people who prefer reduced motion; scroll reveal only runs when JS is on. */
.line { display: block; overflow: hidden; padding: 0.04em 0 0.14em; margin: -0.04em 0 -0.14em; }
.line-in { display: block; }
@media (max-width: 719px) {          /* home headline wraps naturally on phones (no forced break) */
  .h1-split .line, .h1-split .line-in { display: inline; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .line-in { animation: sl-slide-up 1s cubic-bezier(0.2, 0.8, 0.1, 1) 0.15s both; }
  .line + .line .line-in { animation-delay: 0.27s; }
  .h1-split .line-in { animation-name: sl-slide-up; }
  .anim-fade { animation: sl-fade-up 0.7s cubic-bezier(0.2, 0.7, 0.1, 1) both; }
  .anim-fade.anim-d1 { animation-duration: 0.8s; animation-delay: 0.6s; }
  .anim-fade.anim-d2 { animation-duration: 0.6s; animation-delay: 1s; }
  .js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1.3s cubic-bezier(0.16, 1, 0.3, 1), transform 1.3s cubic-bezier(0.16, 1, 0.3, 1); }
  .js .reveal.reveal-visible { opacity: 1; transform: none; }
  @keyframes sl-fade-up { 0% { opacity: 0; transform: translateY(14px); } }
  @keyframes sl-slide-up { 0% { transform: translateY(105%); } }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 719px) {
  .h1-split .line-in { animation-name: sl-fade-up; }   /* inline lines can't slide; fade instead */
}
html { scroll-padding-top: 96px; }   /* anchor links land below the sticky nav */

/* Home page: the bay scene slowly fades in on load (water, shoreline and landmarks; the sand
   stays put so it meets the footer). Off with reduced motion. Nov 16 */
@media (prefers-reduced-motion: no-preference) {
  .hero .shore { animation: sl-scene-water 2.8s cubic-bezier(0.33, 0, 0.2, 1) 0.2s both; }
  .hero .bayline, .hero .gulls { animation: sl-scene-fade 2.8s cubic-bezier(0.33, 0, 0.2, 1) 0.2s both; }
  @keyframes sl-scene-water { from { background-color: var(--color-surface); } }
  @keyframes sl-scene-fade { from { opacity: 0; } }
}

/* ---------- Services ticker under the nav (Nov 16) ----------
   Same loop technique as the client ticker on chrisgammon.com (track = list x2, slides -50%).
   Pauses on hover, on keyboard focus, and with the pause button (WCAG 2.2.2). */
.ticker {
  position: relative; display: flex; align-items: center;
  background: #EEF3F6; border-bottom: 1px solid var(--color-outline);
  font-size: 0.875rem; font-weight: 500; line-height: 1;
}
.ticker-viewport {
  flex: 1; min-width: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
}
.ticker-track { display: flex; width: max-content; animation: sl-ticker 90s linear infinite; }
.ticker-list { display: flex; margin: 0; padding: 0; list-style: none; }
.ticker-list li { display: flex; align-items: center; white-space: nowrap; }
.ticker-list li::after { content: "•"; margin: 0 18px; color: var(--color-primary); opacity: 0.4; }   /* same dot as the logo tagline */
.ticker-list a { display: inline-block; padding: 12px 0; color: var(--color-primary); text-decoration: none; }
.ticker-list a:hover { color: var(--color-primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track, .ticker.is-paused .ticker-track { animation-play-state: paused; }
.ticker-toggle {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin-right: 4px;
  border: 0; border-radius: 50%; background: none; color: var(--color-primary); cursor: pointer;
}
.ticker-toggle:hover { background: rgba(10, 76, 117, 0.08); }
.ticker-toggle .i-play, .ticker.is-paused .ticker-toggle .i-pause { display: none; }
.ticker.is-paused .ticker-toggle .i-play { display: block; }
@keyframes sl-ticker { to { transform: translateX(-50%); } }
@media (max-width: 600px) { .ticker { font-size: 0.8125rem; } .ticker-list a { padding: 11px 0; } }
@media (prefers-reduced-motion: reduce) {   /* no motion: a still row you can swipe/scroll sideways */
  .ticker-track { animation: none; }
  .ticker-viewport { overflow-x: auto; -webkit-mask-image: none; mask-image: none; padding-left: var(--space-4); }
  .ticker-list[aria-hidden="true"], .ticker-toggle { display: none; }
}
@media print { .ticker { display: none; } }

/* ---------- Right rail: location card (Google map + Business Profile banner), Nov 16 ---------- */
.map-card {
  background: var(--color-surface-raised); border: 1px solid var(--color-outline); border-radius: var(--radius-card);
  padding: 20px 20px 0; overflow: hidden;
}
.map-frame { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--color-water); border: 1px solid var(--color-outline); }
.map-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-caption { margin: 14px 0 16px; font-size: 0.9375rem; color: var(--color-on-surface-variant); }
.gbp-banner {
  display: flex; align-items: center; gap: 12px; margin: 0 -20px; padding: 14px 20px;
  background: var(--color-surface-raised) url("/assets/textures/card-texture.webp") repeat;   /* same beige diamond pattern as the contact card */
  border-top: 1px solid var(--color-outline);
  color: var(--color-primary); text-decoration: none;
  transition: box-shadow var(--duration-short) var(--motion-standard), color var(--duration-short) var(--motion-standard);
}
.gbp-banner:hover { color: var(--color-primary-hover); box-shadow: inset 0 0 0 999px rgba(10, 76, 117, 0.05); }
.gbp-banner:focus-visible { outline: 3px solid var(--color-focus); outline-offset: -3px; }
.gbp-banner > span { display: grid; gap: 2px; flex: 1; line-height: 1.3; }
.gbp-banner strong { font-weight: 600; }
.gbp-sub { font-size: 0.875rem; text-decoration: underline; text-underline-offset: 3px; }
.gbp-banner:hover .gbp-sub { text-decoration: none; }
.gbp-arrow { opacity: 0.85; }
.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; }

/* ---------- About: team profiles (Nov 16) ---------- */
.team-grid { display: grid; gap: var(--space-4); margin-bottom: var(--space-4); }
.person-card {
  display: flex; gap: clamp(20px, 3vw, 28px); align-items: center;
  background: var(--color-surface-raised); border: 1px solid var(--color-outline); border-radius: var(--radius-card);
  padding: clamp(20px, 3vw, 28px);
}
.person-photo { flex: none; width: 144px; height: 144px; border-radius: 12px; object-fit: cover; background: var(--color-water); }
.person-name { font-size: 1.6rem; margin: 0 0 2px; }
.person-title { margin: 0 0 var(--space-2); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-on-surface-variant); }
.person-body > p:last-child { margin: 0; color: var(--color-on-surface-variant); }
@media (max-width: 520px) { .person-card { flex-direction: column; align-items: flex-start; } .person-photo { width: 120px; height: 120px; } }

/* ---------- Pre-launch responsive fixes (Nov 16) ---------- */
.panel dd, .cta-band .contact-line, .map-caption { overflow-wrap: anywhere; }   /* long email address can wrap on 320px screens */
@media (max-width: 600px) {
  .site-footer a, .breadcrumb a { display: inline-block; padding-block: 4px; }   /* bigger tap targets on phones */
}
@media (min-width: 601px) and (max-width: 900px) {   /* tablets: stacked rail cards sit side by side instead of one tall column */
  .with-rail > .rail { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .with-rail > .rail > .rail-block { grid-column: 1 / -1; }
}
@media (min-width: 601px) and (max-width: 900px) {
  .with-rail > .rail:not(:has(.map-card)) { grid-template-columns: minmax(0, 1fr); }   /* contact card alone: full width */
}

/* Services overview: Bookkeeping / Tax card buttons span the card and line up at the bottom (Nov 16) */
.card--feature { display: flex; flex-direction: column; }
.card--feature > .button { width: 100%; justify-content: center; margin-top: auto; }
.card--feature > .check-list { margin-bottom: var(--space-4); }

/* About: 1px keyline above "Our team" and "Where we work" (Nov 16) */
.section.section--rule { border-top: 1px solid var(--color-outline); padding-top: var(--space-5); }

/* Bookkeeping / Tax: "Why one firm for both" cards sit three across (Nov 17) */
.rail-main [aria-labelledby="why-title"] .cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
