:root {
  --journal-paper: #f3f3f0;
  --journal-surface: #ffffff;
  --journal-ink: #0a0a0b;
  --journal-muted: #66676c;
  --journal-accent: #3b247a;
  --journal-accent-bright: #6248b4;
  --journal-impact: #ed006f;
  --journal-line-color: rgba(10, 10, 11, 0.24);
  --journal-soft: #e9e9e5;
  --journal-header-bg: rgba(243, 243, 240, 0.96);
  --journal-dark-section: #0a0a0b;
  --journal-on-dark: #f3f3f0;
  --journal-accent-deep: #2c1b5a;
  --journal-line: 2px;
  --journal-gutter: clamp(1.15rem, 4vw, 4.75rem);
  --journal-display: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --journal-ui: Arial, Helvetica, sans-serif;

  /* Bridge the experimental pages onto one editorial colour system. */
  --paper: var(--journal-paper);
  --ink: var(--journal-ink);
  --impact: var(--journal-accent);
  --signal: var(--journal-accent);
  --violet: var(--journal-accent);
  --muted: var(--journal-muted);
  --line: var(--journal-line-color);
  --soft: var(--journal-soft);
  color-scheme: light;
}

html[data-theme="dark"] {
  --journal-paper: #0d0d0f;
  --journal-surface: #171719;
  --journal-ink: #efefea;
  --journal-muted: #a3a3a8;
  --journal-accent: #8975e8;
  --journal-accent-bright: #a795ff;
  --journal-impact: #ff4b9a;
  --journal-line-color: rgba(239, 239, 234, 0.24);
  --journal-soft: #202024;
  --journal-header-bg: rgba(13, 13, 15, 0.96);
  --journal-dark-section: #08080a;
  --journal-on-dark: #efefea;
  --journal-accent-deep: #2d2353;
  color-scheme: dark;
}

html {
  scroll-padding-top: 7rem;
  scroll-behavior: smooth;
}

body {
  background: var(--journal-paper);
  color: var(--journal-ink);
  font-family: var(--journal-ui);
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

.journal-shell-header {
  position: sticky;
  z-index: 200;
  top: 0;
  min-height: 5.25rem;
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) auto minmax(10rem, 1fr);
  align-items: center;
  gap: 2rem;
  padding: 0.8rem var(--journal-gutter);
  border-bottom: var(--journal-line) solid var(--journal-ink);
  background: var(--journal-header-bg);
  color: var(--journal-ink);
  font-family: var(--journal-ui);
}

.journal-shell-brand {
  justify-self: start;
  display: grid;
  justify-items: center;
  color: inherit;
  font-style: italic;
  line-height: 0.75;
  text-decoration: none;
  transform: skewX(-5deg);
}

.journal-shell-brand span {
  font-family: var(--journal-display);
  font-size: clamp(1.05rem, 1.8vw, 1.5rem);
  font-weight: 950;
  letter-spacing: -0.075em;
}

.journal-shell-brand small {
  margin-top: 0.42rem;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.3em;
}

.journal-shell-title {
  justify-self: center;
  color: inherit;
  font-family: var(--journal-display);
  font-size: clamp(0.95rem, 1.25vw, 1.15rem);
  font-weight: 950;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.journal-shell-nav {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.2vw, 2.4rem);
  font-size: 0.96rem;
  font-weight: 800;
}

.journal-shell-nav > a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
}

.journal-shell-header a:focus-visible,
.journal-shell-header button:focus-visible {
  outline: 3px solid var(--journal-accent);
  outline-offset: 4px;
}

.journal-theme-toggle {
  min-width: 3.8rem;
  min-height: 2.6rem;
  padding: 0.35rem 0.65rem;
  border: 0;
  border-left: 1px solid var(--journal-line-color);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.journal-theme-toggle:hover {
  color: var(--journal-accent);
}

/* Standard reading surfaces. Combat features override only the accent. */
.arena-article {
  --impact: var(--journal-impact);
  --signal: var(--journal-impact);
  --article-accent: var(--journal-impact);
}

.human-page {
  --human-magenta: var(--journal-accent);
}

.journal-header,
.research-header,
.path-header,
.path-status,
.site-header {
  background: var(--journal-header-bg);
}

.journal-masthead,
.journal-purpose,
.article-heading,
.article-cover,
.research-hero,
.research-field,
.research-stage,
.path-pin,
.path-panel {
  background-color: var(--journal-paper);
  color: var(--journal-ink);
}

.journal-masthead__visual,
.journal-masthead__visual figcaption,
.story-card,
.story-card__image,
.article-boundary,
.research-hero__sheet,
.research-pane,
.research-pane h2,
.research-pane figure,
.research-pane p,
.path-hero-visual,
.path-hero-visual figcaption,
.path-choice,
.path-horizon-choice {
  background: var(--journal-surface);
  color: var(--journal-ink);
}

.journal-masthead__visual figcaption,
.path-hero-visual figcaption {
  background: color-mix(in srgb, var(--journal-surface) 93%, transparent);
}

.lead-story,
.journal-footer,
.article-next,
.arena-article .article-heading,
.definition-banner,
.research-more,
.path-panel--watch,
.human-machine-profile,
.human-machine-duo {
  background: var(--journal-dark-section);
  color: var(--journal-on-dark);
}

.lead-story,
.journal-footer,
.article-next,
.arena-article .article-heading,
.definition-banner,
.research-more,
.path-panel--watch {
  --ink: var(--journal-on-dark);
}

.path-panel--horizon {
  background: var(--journal-soft);
}

.path-choice.is-selected,
.path-choice:hover,
.path-choice:focus-visible,
.path-horizon-choice:hover,
.path-horizon-choice:focus-visible,
.path-horizon-choice.is-selected,
.research-pane:hover,
.research-pane:focus-visible,
.research-pane:hover h2,
.research-pane:focus-visible h2,
.research-pane:hover p,
.research-pane:focus-visible p {
  background: var(--journal-accent-deep);
  color: var(--journal-on-dark);
}

.path-choice.is-selected span,
.path-choice:hover span,
.path-choice:focus-visible span,
.path-horizon-choice:hover span,
.path-horizon-choice:focus-visible span,
.path-horizon-choice.is-selected span {
  color: color-mix(in srgb, var(--journal-on-dark) 78%, transparent);
}

.path-choice i,
.path-horizon-choice i {
  border-color: var(--journal-ink);
  background: var(--journal-ink);
  color: var(--journal-paper);
}

.path-choice.is-selected i,
.path-choice:hover i,
.path-choice:focus-visible i,
.path-horizon-choice:hover i,
.path-horizon-choice:focus-visible i,
.path-horizon-choice.is-selected i {
  border-color: var(--journal-on-dark);
  background: var(--journal-on-dark);
  color: var(--journal-accent-deep);
}

.path-route__branches circle {
  fill: var(--journal-surface);
  stroke: var(--journal-ink);
}

.path-route__branches circle.is-selected,
.path-route__origin {
  fill: var(--journal-accent);
}

.research-hero__sheet::after {
  background: linear-gradient(
    90deg,
    transparent 52%,
    color-mix(in srgb, var(--journal-accent) 16%, transparent) 52%,
    color-mix(in srgb, var(--journal-accent) 16%, transparent) 53%,
    transparent 53%
  );
}

.human-page .human-principle,
.human-sources {
  background: var(--journal-paper);
  color: var(--journal-ink);
}

.human-sources,
.human-sources > div {
  border-color: var(--journal-ink);
}

html[data-theme="dark"] .journal-masthead__visual img,
html[data-theme="dark"] .path-hero-visual img,
html[data-theme="dark"] .research-hero__sheet img,
html[data-theme="dark"] .research-pane img {
  filter: grayscale(0.35) brightness(0.76) contrast(1.12);
}

html[data-theme="dark"] .story-card,
html[data-theme="dark"] .lead-story {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .story-card:hover,
html[data-theme="dark"] .story-card:focus-visible,
html[data-theme="dark"] .lead-story:hover,
html[data-theme="dark"] .lead-story:focus-visible {
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.55);
}

.path-entry .journal-shell-header,
.research-entry .journal-shell-header,
.human-page .journal-shell-header {
  position: fixed;
  right: 0;
  left: 0;
  height: var(--header-h);
}

.path-entry,
.research-entry,
.human-page {
  --header-h: 5.25rem;
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 8.5rem;
  }
  .path-entry,
  .research-entry,
  .human-page {
    --header-h: 7rem;
  }

  .journal-shell-header {
    position: relative;
    grid-template-columns: auto 1fr;
    gap: 0.9rem 1rem;
    padding: 0.85rem 1rem 0;
  }

  .journal-shell-brand span {
    font-size: 1.05rem;
  }

  .journal-shell-title {
    justify-self: end;
    font-size: 0.94rem;
    text-align: right;
  }

  .journal-shell-nav {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
    flex-wrap: wrap;
    border-top: 1px solid var(--journal-line-color);
    font-size: 0.88rem;
  }

  .journal-shell-nav .language-switch {
    margin-left: auto;
  }

  .journal-theme-toggle {
    min-width: 3.5rem;
    min-height: 2.5rem;
    margin-left: auto;
  }
}

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

@media (max-width: 420px) {
  .journal-shell-nav {
    gap: 0.65rem;
    font-size: 0.82rem;
  }
}
