/* Light surfaces are the default, including before scripts are available. */
:root { color-scheme: light; }

/* Interior pages share the same light masthead as the editorial sections. */
:root:not([data-theme="dark"]) :is(.guide-hero, .gallery-lead, .call-hero, .field-hero, .challenge-head) {
  color: var(--ink);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
:root:not([data-theme="dark"]) :is(.gallery-lead, .call-hero, .challenge-head, .guide-hero, .field-hero) h1 em {
  color: var(--red);
}
:root:not([data-theme="dark"]) :is(.guide-hero-copy p, .guide-crumbs ol, .guide-figure figcaption, .reportage-medias figcaption, .gallery-lead p, .gallery-lead figcaption, .call-intro, .field-hero-copy .intro, .challenge-head .intro, .challenge-head .breadcrumbs) {
  color: var(--muted);
}
:root:not([data-theme="dark"]) :is(.guide-crumbs ol, .guide-figure figcaption) { border-color: var(--line); }
:root:not([data-theme="dark"]) .guide-crumbs li + li::before { color: var(--muted); }
:root:not([data-theme="dark"]) .guide-figure figcaption a { color: var(--ink); }

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #080808;
  --graphite: #171718;
  --surface: #111112;
  --line: #333335;
  --silver: #29292c;
  --paper: #f5f5f5;
  --muted: #bebec2;
  --on-dark: #d3d3d5;
  --panel: #1b1b1d;
  --control-line: #717175;
  --accent-text: #ff7774;
  color: var(--paper);
  background: #050505;
}

html[data-theme="dark"] body {
  color: var(--paper);
  background: #050505;
}

html[data-theme="dark"] :is(header, #nav) {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .topline {
  background: #000;
  color: var(--muted);
  box-shadow: inset 0 -1px #232324;
}

html[data-theme="dark"] #nav a { color: #ebebec; }
html[data-theme="dark"] #nav :is(a:hover, a[aria-current="page"]) { color: var(--accent-text); }

html[data-theme="dark"] :is(.menu, .skip-link, .btn.light) {
  background: var(--panel);
  border-color: var(--control-line);
  color: var(--paper);
}

html[data-theme="dark"] :is(.menu:hover, .btn.light:hover) { background: #303033; }
html[data-theme="dark"] :is(.hero, .call-hero, .challenge-head, .gallery-lead, .guide-hero, .field-hero) {
  color: var(--paper);
  background: var(--ink);
}
html[data-theme="dark"] .intervention-hero { --hero-ink: #080808; }
html[data-theme="dark"] .carousel-figure::after {
  background:
    linear-gradient(90deg, var(--hero-ink) 18%, rgb(8 8 8 / 97%) 24%, rgb(8 8 8 / 88%) 33%, rgb(8 8 8 / 65%) 41%, rgb(8 8 8 / 10%) 56%, transparent 64%),
    linear-gradient(0deg, rgb(0 0 0 / 87%), transparent 25%);
}
@media (max-width: 760px) {
  html[data-theme="dark"] .carousel-figure::after {
    background: linear-gradient(0deg, rgb(8 8 8 / 96%), rgb(8 8 8 / 55%) 13%, transparent 34%);
  }
}
html[data-theme="dark"] :is(.home-services, .home-area) {
  background: #050505;
  color: var(--paper);
}
html[data-theme="dark"] :is(.home-field, .home-call, .page-cta, .service-evidence) {
  background: var(--surface);
  color: var(--paper);
  box-shadow: inset 0 1px var(--line);
}
html[data-theme="dark"] :is(.home-report, .service, .guide-checklist) { background: var(--panel); }
html[data-theme="dark"] .service { border-top-color: #676769; }
html[data-theme="dark"] .service:is(:hover, :focus-within) { border-top-color: var(--signal); }

html[data-theme="dark"] :is(.home-service p, .home-area p, .home-call p, .guide-section p, .evidence-visuals figcaption) {
  color: var(--muted);
}
html[data-theme="dark"] :is(.home-guides, .home-guides li, .guide-related-links a, .gallery-group h2, .service-evidence) {
  border-color: var(--line);
}
html[data-theme="dark"] :is(.guide-related-links a:hover, .guide-directory-column a:hover, .quote span, .step > span, .icon, .field-card i, summary::after) {
  color: var(--accent-text);
}
html[data-theme="dark"] .topic-links a {
  border-color: var(--control-line);
  color: var(--paper);
}
html[data-theme="dark"] .topic-links a:hover { background: #252528; }
html[data-theme="dark"] :is(.evidence-visuals img, .evidence-visuals video) { background: #090909; }
html[data-theme="dark"] .gallery-viewer { background: #080808; }
html[data-theme="dark"] .gallery-viewer::backdrop { background: rgb(0 0 0 / 93%); }
html[data-theme="dark"] footer { background: #000; box-shadow: inset 0 1px var(--line); }

html[data-theme="dark"] :is(.cookie-banner, .cookie-dialog) {
  color: var(--paper);
  background: var(--panel);
  border-color: #646467;
  border-top-color: var(--signal);
  box-shadow: 0 .65rem 2rem rgb(0 0 0 / 55%);
}
html[data-theme="dark"] .cookie-dialog::backdrop { background: rgb(0 0 0 / 75%); }
html[data-theme="dark"] .cookie-actions button {
  background: #333335;
  border-color: #828284;
  color: #fff;
}
html[data-theme="dark"] .cookie-actions .cookie-detail { background: transparent; }
html[data-theme="dark"] .cookie-actions button:hover { background: #48484b; }
html[data-theme="dark"] .cookie-option input { accent-color: var(--signal); }

html[data-theme="dark"] :is(a, button, summary, input, video):focus-visible {
  outline-color: #fff;
}
html[data-theme="dark"] ::selection { background: var(--red); color: #fff; }
