/* Shared brand palette. Financial, warning and error colors remain semantic. */
:root {
  --theme-green: #294d3c;
  --theme-green-hover: #183d2a;
  --theme-page: #f5f3ed;
  --theme-paper: #ffffff;
  --theme-soft: #edf2eb;
  --theme-selected: #e3ece2;
  --theme-ink: #222b25;
  --theme-muted: #58665d;
  --theme-line: #d8ddd3;
  --theme-focus: #396b4e;
  --theme-focus-ring: rgb(57 107 78 / 18%);
  --theme-forest: #183d2a;
  --theme-forest-panel: #234a35;
  --theme-forest-line: #60816b;
  --theme-on-forest: #ffffff;
  --theme-on-forest-muted: #dce8dc;
  --theme-shadow: 0 18px 44px rgb(34 43 37 / 8%);
  color-scheme: light;
}

/* Existing pages keep their layout, routes and content. */
html { background-color: var(--theme-page); }
body { accent-color: var(--theme-green); }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--theme-focus);
  outline-offset: 4px;
}

/* Shared fixed header: include open/scrolled/mobile and service-link states. */
html body #siteHeader.site-header,
html body #siteHeader.site-header.is-scrolled {
  background: rgb(255 255 255 / 97%);
  color: var(--theme-ink);
  border-bottom-color: var(--theme-line);
}
html body #siteHeader .wordmark { color: var(--theme-green); }
html body #siteHeader .primary-nav a { color: var(--theme-muted); }
html body #siteHeader .primary-nav a:hover,
html body #siteHeader .primary-nav a:focus-visible,
html body #siteHeader .primary-nav a[aria-current=page] {
  color: var(--theme-green);
}
html body #siteHeader .primary-nav a[aria-current=page]::after {
  background: var(--theme-green);
}
html body #siteHeader .menu-button { color: var(--theme-green); }
html body #siteHeader .primary-nav a.site-service-link {
  color: var(--theme-green);
  border-color: var(--theme-line);
  background: var(--theme-soft);
}
html body #siteHeader :is(a, button):focus-visible {
  outline-color: var(--theme-focus);
}
@media (max-width: 900px) {
  html body #siteHeader .primary-nav {
    background: var(--theme-paper);
    border-bottom-color: var(--theme-line);
  }
  html body #siteHeader .primary-nav a { border-bottom-color: var(--theme-line); }
}

/* The older header has its own markup; preserve its menus and wrapping. */
html body .site-header.bank-style-header {
  background: var(--theme-paper);
  color: var(--theme-ink);
  border-color: var(--theme-line);
}
html body .site-header.bank-style-header .brand { color: var(--theme-green); }
html body .site-header.bank-style-header .brand span {
  background: var(--theme-green);
  color: white;
}

/* Bright brand introductions; existing photography and copy stay intact. */
html .about-page .about-hero-backdrop {
  background: linear-gradient(130deg, var(--theme-page), var(--theme-selected));
}
html .about-page .about-hero { color: var(--theme-ink); }
html .about-page .about-hero .eyebrow { color: var(--theme-green); }
html .about-page .about-hero-lead,
html .about-page .about-origin-card p { color: var(--theme-muted); }
html .about-page .about-origin-card {
  background: var(--theme-soft);
  color: var(--theme-ink);
  border-color: var(--theme-line);
}

/* Lower sections and expanded content need the same light/dark contrast. */
html .about-page .about-section-heading .section-kicker { color: var(--theme-green); }
html .about-page .about-closing { background: var(--theme-forest); color: var(--theme-on-forest); }
html .about-page .about-closing > p:not(.eyebrow),
html .about-page .about-closing .eyebrow,
html .about-page .about-closing .button-quiet { color: var(--theme-on-forest-muted); }
html .about-page .about-closing .button-primary {
  background: var(--theme-paper);
  color: var(--theme-green);
}
html .about-page .about-closing .button-primary:hover { background: var(--theme-selected); }
html .about-page .footer-main strong,
html .about-page .site-footer nav a:hover { color: var(--theme-green); }
html .book-legacy .eyebrow { color: var(--theme-green); }

/* Engineering notes share the same paper and green selection treatment. */
html .devlog-page .devlog-hero {
  background: var(--theme-soft);
  color: var(--theme-ink);
}
html .devlog-page .devlog-hero::after { border-color: var(--theme-line); box-shadow: none; }
html .devlog-page .devlog-kicker { color: var(--theme-green); }
html .devlog-page .devlog-lead,
html .devlog-page .devlog-stats span { color: var(--theme-muted); }
html .devlog-page .devlog-stats { border-color: var(--theme-line); }
html .devlog-page .devlog-day-meta span {
  color: var(--theme-green);
  background: var(--theme-paper);
  border-color: var(--theme-line);
}
html .devlog-page .devlog-filter { background: rgb(245 243 237 / 97%); }
html .devlog-page .devlog-filter a[aria-current=page],
html .devlog-page .state-card.after {
  color: white;
  background: var(--theme-green);
  border-color: var(--theme-green);
}
html .devlog-page .state-card.after p { color: var(--theme-on-forest-muted); }
html .devlog-page .devlog-footer {
  background: var(--theme-paper);
  color: var(--theme-muted);
  border-top: 1px solid var(--theme-line);
}

/* Search remains a tool; only its brand surfaces and controls change. */
html .kospi-search-page .search-hero {
  background: var(--theme-soft);
  color: var(--theme-ink);
  border-color: var(--theme-line);
  box-shadow: var(--theme-shadow);
}
html .kospi-search-page .search-hero :is(h1, .eyebrow) { color: var(--theme-green); }
html .kospi-search-page .search-hero .lead,
html .kospi-search-page .search-hero-copy > p:last-child { color: var(--theme-muted); }
html .kospi-search-page .search-control > button {
  background: var(--theme-green);
  color: white;
}
html .kospi-search-page .search-control > button:hover { background: var(--theme-green-hover); }
html .kospi-search-page .search-control > button:disabled { opacity: .55; cursor: not-allowed; }
html .kospi-search-page .initial-notes span { color: var(--theme-muted); }

/* The migrated member screen uses these aliases after its Trade stylesheet. */
html .strategy-app-page {
  --blue: var(--theme-green);
  --ink: var(--theme-ink);
  --muted: var(--theme-muted);
  --line: var(--theme-line);
  --surface: var(--theme-page);
}

/* Inactive routes retain their inactive state. */
html body.inactive-page {
  background: var(--theme-page);
  color: var(--theme-ink);
}
html body.inactive-page main { background: transparent; }
html body.inactive-page :is(.muted, .status, p) { color: var(--theme-muted); }
html body.inactive-page .brand { color: var(--theme-green); }
html body.inactive-page :is(a.button, a.home) { background: var(--theme-green); color: white; }
html body.inactive-page :is(a.button, a.home):hover { background: var(--theme-green-hover); }
html body.inactive-page a:focus-visible { outline-color: var(--theme-focus); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Existing Live home: keep its content and layout, color its original surfaces. */
html body.green-theme-home .hero-backdrop { background: var(--theme-forest); }
html body.green-theme-home .hero h1,
html body.green-theme-home .closing { color: var(--theme-on-forest); }
html body.green-theme-home .hero .eyebrow,
html body.green-theme-home .hero-lead,
html body.green-theme-home .hero .button-quiet,
html body.green-theme-home .closing .eyebrow,
html body.green-theme-home .closing .button-quiet { color: var(--theme-on-forest-muted); }
html body.green-theme-home .hero-media { opacity: .22; }
html body.green-theme-home .hero-media::after { background: linear-gradient(180deg, transparent, var(--theme-forest)); }
html body.green-theme-home .hero .button-primary,
html body.green-theme-home .closing .button-primary { background: var(--theme-paper); color: var(--theme-green); }
html body.green-theme-home .hero .button-primary:hover,
html body.green-theme-home .closing .button-primary:hover { background: var(--theme-selected); }
html body.green-theme-home .statement > p:last-child { color: var(--theme-muted); }
html body.green-theme-home .story-card { background: var(--theme-forest); color: var(--theme-on-forest); }
html body.green-theme-home .story-card::before { background: linear-gradient(145deg, var(--theme-forest-panel), var(--theme-forest)); }
html body.green-theme-home .story-card-copy span,
html body.green-theme-home .story-card p,
html body.green-theme-home .story-card time { color: var(--theme-on-forest-muted); }
html body.green-theme-home .research-simulation { background: linear-gradient(145deg, var(--theme-soft), var(--theme-selected)); }
html body.green-theme-home .research-actual p { color: var(--theme-on-forest-muted); }
html body.green-theme-home .research-search-link { color: var(--theme-green); background: var(--theme-soft); border-color: var(--theme-line); }
html body.green-theme-home .closing { background: var(--theme-forest); }
html body.green-theme-home .footer-main strong,
html body.green-theme-home .site-footer nav a:hover { color: var(--theme-green); }

html body.green-theme-home .board-stories .section-kicker,
html body.green-theme-home .board-stories .text-link,
html body.green-theme-home .scroll-cue { color: var(--theme-on-forest-muted); }
html body.green-theme-home .board-story,
html body.green-theme-home .board-story-outline p { border-color: var(--theme-forest-line); }
html body.green-theme-home .board-stories a:focus-visible,
html body.green-theme-home .hero a:focus-visible,
html body.green-theme-home .closing a:focus-visible { outline-color: var(--theme-on-forest-muted); }
