/* Public-site surface system, matched to the approved Open Forum folio.
   Loaded last by Layout only: the operational admin theme is independent. */
:root,
html[data-theme] {
  --color-bg: #101b15;
  --color-bg-alt: #18271d;
  --color-surface: #1b2c21;
  --color-surface-elevated: #24382a;
  --color-primary: #9bb787;
  --color-primary-light: #b8cba5;
  --color-primary-dark: #435e3b;
  --color-accent: #8ca482;
  --color-accent-light: #b8cba5;
  --color-text: #edf3e8;
  --color-text-muted: #c2cebf;
  --color-text-subtle: #a3b29e;
  --color-border: rgba(183, 202, 167, .19);
  --color-border-glow: rgba(183, 202, 167, .32);
  /* Keep legacy token names for existing consumers, without colored gradients. */
  --gradient-primary: var(--color-primary);
  --gradient-hero: none;
  --gradient-section: var(--color-bg);
  --gradient-glow: none;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .17);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .2);
  --shadow-xl: 0 24px 60px rgba(0, 0, 0, .24);
  --shadow-glow: none;
  --shadow-glow-accent: none;
  --paper-texture: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23889980' opacity='.025' filter='url(%23paper)' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}

html[data-theme="light"] {
  --color-bg: #f7f9f1;
  --color-bg-alt: #eef1e7;
  --color-surface: #ffffff;
  --color-surface-elevated: #f2f4ec;
  --color-primary: #52694b;
  --color-primary-light: #52694b;
  --color-primary-dark: #304d35;
  --color-accent: #52694b;
  --color-accent-light: #52694b;
  --color-text: #102f23;
  --color-text-muted: #375044;
  --color-text-subtle: #586751;
  --color-border: rgba(55, 80, 51, .18);
  --color-border-glow: rgba(82, 105, 75, .32);
  --shadow-sm: 0 1px 3px rgba(35, 48, 27, .05);
  --shadow-md: 0 8px 24px rgba(35, 48, 27, .06);
  --shadow-lg: 0 16px 40px rgba(35, 48, 27, .08);
  --shadow-xl: 0 24px 60px rgba(35, 48, 27, .1);
}

body.public-site {
  background: var(--paper-texture) repeat, var(--color-bg);
}

/* A single paper canvas across the homepage, content routes, directory,
   application, account screens, policies and newsroom. */
html[data-theme] body.public-site :is(
  .dhero, .home-film, .home-objectives, .home-resources, .home-mission,
  .home-story, .home-forum, .home-pathways, .home-final, .overview,
  .partners, .objectives, .impact, .membership, .contact, .page-main,
  .page-hero, .page-hero__bg, .page-section, .members, .apply-page,
  .apply-intro, .application-shell, .portal-auth, .portal-page,
  .policy-page, .news-page, .home-news, .footer
) {
  background: var(--paper-texture) repeat, var(--color-bg);
}

/* Preserve the selected botanical design and its own fine paper texture. */
html[data-theme] .public-site .open-forum {
  --forum-paper: var(--color-bg);
  --forum-ink: var(--color-text);
  --forum-sage: var(--color-primary-light);
  --forum-muted: var(--color-text-muted);
}

/* Remove ambient washes and decorative spotlight layers, not actual artwork. */
html[data-theme] .public-site :is(
  .hero__gradient, .home-objectives__glow, .join-preview__glow,
  .bio-viz__glow, .home-film__atmosphere
),
html[data-theme] .public-site :is(
  .dhero, .dhero__bg-img-container, .home-film, .join-preview,
  .join-preview__visual, .home-objectives, .home-objectives__rail,
  .home-mission, .home-pathways, .home-final, .partners, .membership,
  .page-section--bio, .application-shell
)::before,
html[data-theme] .public-site .dhero::after {
  display: none;
}

html[data-theme] .public-site :is(.portal-auth__atmosphere, .apply-hero__atmosphere) {
  background: none;
}

/* White/forest surfaces establish hierarchy through borders, not color haze. */
html[data-theme] body.public-site :is(
  .home-objectives .home-objective-card, .home-signal-panel,
  .home-signal-card, .home-pathway-card, .home-final__panel,
  .home-story__media, .home-resources__grid, .home-resource-links a,
  .home-story__list span, .partner-card, .impact-card,
  .membership__invite, .page-card, .page-feature, .page-step,
  .page-hero__brief, .page-editorial-panel, .legal-panel,
  .page-faq__item, .forum-card, .forum-locked, .event-card,
  .members__toolbar, .mcard, .member-modal__head,
  .portal-auth__card, .portal-panel, .application-folio,
  .application-submit-modal__card, .news-feature__art, .news-poster > a
) {
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: var(--shadow-md);
}

/* Keep existing interactive layouts; neutralize their gradient/glow overlays. */
html[data-theme] .public-site :is(
  .home-objective-card, .home-signal-card, .home-pathway-card,
  .home-resource-links a, .overview__pillar, .partner-card,
  .objective-card, .impact-card, .membership__invite,
  .membership-benefit, .page-card, .page-feature, .page-step,
  .home-signal-panel, .page-hero__media, .mcard, .home-film__frame
)::after,
html[data-theme] .public-site :is(
  .home-objective-card, .home-signal-card, .home-pathway-card,
  .home-signal-panel, .partner-card, .impact-card, .forum-card,
  .event-card, .page-card, .page-feature, .page-step, .mcard,
  .home-film__frame, .application-folio
)::before {
  background: none;
}

html[data-theme] .public-site :is(
  .home-objective-card__number, .home-resource-card__kicker,
  .page-card__mark, .forum-card__avatar--initials, .dhero__badge,
  .dhero__stat, .application-draft-status
) {
  background: var(--color-bg-alt);
}

html[data-theme] .public-site .mcard__halo { background: none; }
html[data-theme] .public-site :is(.section-divider, .footer__glow) { background: var(--color-border); }
html[data-theme] .public-site .dhero__bg-img-container { filter: drop-shadow(0 1rem 2rem rgba(35, 48, 27, .1)); }

/* Retain the hero image's readability fade, using paper only—not a color wash. */
html[data-theme] .public-site :is(.dhero__scrim, .dhero__bg-scrim) {
  background: linear-gradient(90deg, var(--color-bg) 0% 38%, color-mix(in srgb, var(--color-bg) 82%, transparent) 46%, transparent 60%);
}

html[data-theme] .public-site :is(.nav__inner, .nav__mobile) {
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  box-shadow: var(--shadow-md);
}

html[data-theme] .public-site .theme-toggle {
  background: var(--color-surface-elevated);
  box-shadow: none;
}

html[data-theme] .public-site .join-capsule button {
  color: var(--color-bg);
  background: var(--color-primary);
  box-shadow: none;
}

html[data-theme] .public-site .join-capsule button:hover { background: var(--color-primary-dark); color: #fff; }
html[data-theme] .public-site .home-film__frame { background: var(--color-surface); box-shadow: var(--shadow-lg); }
html[data-theme] .public-site .home-film__screen { background: var(--color-border); }
html[data-theme] .public-site .home-film__bezel-track { stroke: var(--color-primary-light); }

/* Scientific diagrams remain illustrations, with quiet single-color fills. */
html[data-theme] .public-site :is(
  .bio-viz__plant span,
  .bio-viz__impact i, .bio-viz__impact-core, .bio-viz__membership-center
),
html[data-theme] .public-site :is(.bio-viz__plant, .bio-viz__path)::before,
html[data-theme] .public-site :is(.bio-viz__forum, .bio-viz__library) span::after {
  background: var(--color-primary);
  box-shadow: none;
}

html[data-theme] .public-site .bio-viz__impact::before {
  background: conic-gradient(from 200deg, color-mix(in srgb, var(--color-primary) 38%, transparent) 0% 76%, transparent 76%);
}

html[data-theme] .public-site .bio-viz__impact::after { box-shadow: none; }
html[data-theme] .public-site .bio-viz__impact-mark::before { background: var(--color-primary); box-shadow: 0 0 0 6px var(--color-bg-alt); }

/* Page-local legacy variables resolve to the same shared surface system. */
html[data-theme] body.public-site {
  --impact-card-bg: var(--color-surface);
  --impact-feature-bg: var(--color-surface);
  --impact-grid-bg: none;
  --impact-shadow: var(--shadow-md);
  --impact-shadow-hover: var(--shadow-lg);
}

html[data-theme] .public-site .apply-page {
  --folio-paper: var(--color-surface);
  --folio-paper-deep: var(--color-bg-alt);
  --folio-green: var(--color-primary);
  --folio-green-bright: var(--color-primary-light);
}

html[data-theme] .public-site .application-folio__masthead { background: #203c2b; }
html[data-theme] .public-site .application-progress__track span { background: var(--folio-green); }
html[data-theme] .public-site .application-submit-modal::backdrop { background: rgba(3, 13, 10, .78); }
html[data-theme] .public-site :is(.news-page, .home-news) { --news-accent: var(--color-primary-light); }

@media (max-width: 900px) {
  /* The existing small-screen image sits beneath copy; preserve its neutral veil. */
  html[data-theme] .public-site .dhero__bg-scrim {
    background: radial-gradient(circle at center, transparent 15%, var(--color-bg) 88%);
  }
}
