/* Shared navigation and reading modules. Authored prose, figures and demos stay local. */
html[data-editorial-page], html[data-editorial-index] {
  --editorial-bg: #000;
  --editorial-fg: #fff;
  --editorial-muted: rgba(255,255,255,.67);
  --editorial-line: rgba(255,255,255,.2);
  --editorial-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --editorial-header-height: 104px;
  scroll-padding-top: calc(var(--editorial-header-height) + 24px);
}
html[data-editorial-page] .editorial-header {
  position: sticky;
  inset: 0 0 auto;
  z-index: 10001;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 24px;
  width: 100%;
  max-width: none;
  min-height: 104px;
  margin: 0;
  padding: 8px clamp(16px, 3vw, 40px) 0;
  border: 0;
  border-bottom: 1px solid var(--editorial-line);
  border-radius: 0;
  background: var(--editorial-bg);
  color: var(--editorial-fg);
  font: 400 12px/1.5 var(--editorial-mono);
  letter-spacing: .025em;
  text-transform: none;
  box-shadow: none;
  backdrop-filter: none;
  mix-blend-mode: normal;
}
html[data-editorial-page] .editorial-header a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  color: var(--editorial-fg);
  text-decoration: none;
  opacity: 1;
  font: inherit;
  letter-spacing: inherit;
}
html[data-editorial-page] .editorial-header a:hover { text-decoration: underline; text-underline-offset: 5px; }
html[data-editorial-page] .editorial-home { justify-self: start; white-space: nowrap; gap: 8px; }
html[data-editorial-page] .editorial-trail {
  position: static;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0 20px;
  grid-column: 1 / -1;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  mix-blend-mode: normal;
  font: inherit;
  letter-spacing: inherit;
}
html[data-editorial-page] .editorial-trail a { color: var(--editorial-muted); }
html[data-editorial-page] .editorial-local-nav {
  position: static;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0 24px;
  width: 100%;
  margin: 0;
  padding: 0 clamp(16px, 3vw, 40px);
  border-bottom: 1px solid rgba(255,255,255,.2);
  background: #000;
  color: rgba(255,255,255,.67);
  font: 12px/1.5 var(--editorial-mono);
  letter-spacing: .025em;
  mix-blend-mode: normal;
}
html[data-editorial-page] .editorial-local-nav a { display: inline-flex; align-items: center; min-height: 44px; color: rgba(255,255,255,.67); opacity: 1; text-decoration: none; }
html[data-editorial-page] .editorial-local-nav a:hover { color: #fff; }
html[data-editorial-page] .editorial-role { color: var(--editorial-muted); font-size: 12px; padding-block: 12px; }
html[data-editorial-page] .editorial-language { display: flex; align-items: center; gap: 12px; justify-self: end; }
html[data-editorial-page] [data-i18n-toggle-slot] { min-width: 90px; min-height: 46px; }
html[data-editorial-page] .editorial-language-note { color: var(--editorial-muted); font-size: 12px; }
html:is([data-editorial-page], [data-editorial-index]) :is(.editorial-header, .editorial-index-controls) .site-lang-toggle {
  position: static;
  display: inline-flex;
  gap: 0;
  inset: auto;
  margin: 0;
  border: 1px solid var(--editorial-line);
  border-radius: 0;
  background: var(--editorial-bg);
  box-shadow: none;
  backdrop-filter: none;
}
html:is([data-editorial-page], [data-editorial-index]) :is(.editorial-header, .editorial-index-controls) .site-lang-toggle__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 0;
  color: var(--editorial-muted);
  background: var(--editorial-bg);
  font: 400 12px/1 var(--editorial-mono);
  letter-spacing: .04em;
  box-shadow: none;
  text-transform: none;
}
html:is([data-editorial-page], [data-editorial-index]) :is(.editorial-header, .editorial-index-controls) .site-lang-toggle__button.is-active { color: #000; background: #fff; }
html[data-editorial-page] .editorial-header button:disabled { cursor: not-allowed; color: rgba(255,255,255,.47); }
html[data-editorial-page] .editorial-header a:focus-visible,
html[data-editorial-page] .editorial-header button:focus-visible,
html[data-editorial-index] .editorial-index-controls button:focus-visible,
html[data-editorial-page] .editorial-related a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
html[data-editorial-page] .editorial-skip {
  position: fixed;
  left: 16px;
  top: -100px;
  z-index: 10002;
  padding: 12px 16px;
  background: #fff;
  color: #000;
  font: 14px/1.5 var(--editorial-mono);
}
html[data-editorial-page] .editorial-skip:focus { top: 12px; }
html[data-editorial-page] .editorial-context {
  position: static;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  width: 100%;
  max-width: none;
  margin: 0 0 40px;
  padding: 0 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.67);
  background: #000;
  font: 12px/1.8 var(--editorial-mono);
}
html[data-editorial-page] .editorial-context a { color: #fff; text-decoration: none; }
html[data-editorial-page] .editorial-context a:hover { text-decoration: underline; text-underline-offset: 4px; }
html[data-editorial-page] .editorial-context [data-lang] { display: inline; }
html[data-editorial-page] .editorial-related {
  display: block;
  width: min(1200px, calc(100% - 48px));
  max-width: none;
  margin: 0 auto;
  padding: 40px 0;
  border: 0;
  color: #fff;
  background: #000;
  font: 400 16px/1.8 system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
}
html[data-editorial-page] .editorial-related h2 {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
  color: rgba(255,255,255,.67);
  font: 400 12px/1.5 var(--editorial-mono);
  letter-spacing: .08em;
}
html[data-editorial-page] .editorial-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid rgba(255,255,255,.2); border-left: 1px solid rgba(255,255,255,.2); }
html[data-editorial-page] .editorial-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 24px;
  border: 0;
  border-right: 1px solid rgba(255,255,255,.2);
  border-bottom: 1px solid rgba(255,255,255,.2);
  color: #fff;
  background: #000;
  text-decoration: none;
}
html[data-editorial-page] .editorial-card:hover { background: rgba(255,255,255,.067); }
html[data-editorial-page] .editorial-card-label { color: rgba(255,255,255,.67); font: 12px/1.6 var(--editorial-mono); }
html[data-editorial-page] .editorial-card strong { color: #fff; font: 400 clamp(18px, 2vw, 24px)/1.5 system-ui, sans-serif; }
html[data-editorial-page] .editorial-card p { max-width: none; margin: 0; color: rgba(255,255,255,.67); font-size: 14px; }
html[data-editorial-page] .editorial-card .editorial-card-meta { color: rgba(255,255,255,.67); font: 12px/1.5 var(--editorial-mono); }
html[data-editorial-page] .editorial-card span[lang="en"] { display: block; }
html[data-editorial-page] .editorial-table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
html[data-editorial-page] .editorial-table-scroll:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Shared reading palette. The canvas-led pieces retain their authored scenes. */
/* The source byline pairs Japanese and Latin names. English needs one name. */
html[data-editorial-layout="article"][lang="en"] .article-header .byline .author + span { display: none; }
@media screen {
  html[data-editorial-page]:not([data-editorial-layout="immersive"]):not([data-editorial-layout="flow"]) {
    color-scheme: dark;
    --bg: #000; --background: #000; --paper: #000; --paper-light: #000;
    --fg: #fff; --ink: #fff; --text: #fff; --muted: rgba(255,255,255,.67); --dim: rgba(255,255,255,.67); --faint: rgba(255,255,255,.67);
    --accent: #fff; --accent-soft: rgba(255,255,255,.067); --line: rgba(255,255,255,.2); --quote: rgba(255,255,255,.067); --radius: 0; --shadow: none;
    --text-faint: rgba(255,255,255,.67);
    background: #000;
  }
  html[data-editorial-page]:not([data-editorial-layout="immersive"]):not([data-editorial-layout="flow"]) body { background: #000; }
  html[data-editorial-layout="article"] .prose .question { color: rgba(255,255,255,.8); }
  html[data-editorial-layout="article"] .references li:target { background: rgba(255,255,255,.067); outline-color: rgba(255,255,255,.067); }
  html[data-editorial-layout="article"] .desktop-toc { top: 128px; max-height: calc(100svh - 152px); }
  html[data-editorial-layout="article"] main > .editorial-related,
  html[data-editorial-layout="archive"] main > .editorial-related { width: 100%; margin-top: 48px; }
  html[data-editorial-layout="article"] .eyebrow,
  html[data-editorial-layout="article"] .toc li,
  html[data-editorial-layout="article"] .toc li::before,
  html[data-editorial-layout="article"] .toc-title { font-size: 12px; }
  html[data-editorial-layout="concept"] .toc { top: 128px; }
  html[data-editorial-layout="concept"] .subtitle { color: rgba(255,255,255,.8); }
  html[data-editorial-layout="concept"][lang="en"] h1 { word-break: normal; overflow-wrap: normal; font-size: clamp(32px, 6vw, 84px); line-height: 1.1; }
  html[data-editorial-layout="artwork"] .hero { min-height: calc(100svh - 104px); padding-top: clamp(48px, 8vw, 96px); }
  html[data-editorial-layout="publication"] .lead { color: rgba(255,255,255,.8); }
  html[data-editorial-layout="publication"][lang="en"] h1 { font-size: clamp(32px, 6vw, 84px); line-height: 1.1; }
  html[data-editorial-layout="publication"] .hero > * { min-width: 0; }
  html[data-editorial-layout="publication"] figure { background: #000; }
  html[data-editorial-layout="archive"] :is(.spec, figure img, figure video, .thumb, .callout, .vlabel, .item) { border-radius: 0; }
  html[data-editorial-layout="archive"] :is(.spec > div, .callout, .item) { background: #000; }
  html[data-editorial-layout="archive"] main { width: min(1120px, calc(100% - 48px)); }
  html[data-editorial-layout="archive"] .spec dt,
  html[data-editorial-layout="archive"] .spec small { font-size: 12px; }
  html[data-editorial-layout="archive"][lang="en"] h1 { font-size: clamp(28px, 5.5vw, 64px); line-height: 1.12; word-break: normal; overflow-wrap: anywhere; text-wrap: balance; }
  html[data-editorial-layout="archive"][lang="en"] h2 { font-size: 20px; line-height: 1.5; text-transform: none; letter-spacing: .03em; }
  html[data-editorial-layout="paper"] body { width: 100%; margin: 0; padding: 0; }
  html[data-editorial-layout="paper"] .editorial-paper { width: min(860px, 100%); margin: 0 auto; padding: clamp(24px, 5vw, 64px); }
  html[data-editorial-layout="paper"] :is(.abstract, .claim-box, .status-card, .canonical-formula, blockquote) { background: #000; }
  html[data-editorial-layout="paper"] :is(h3, h4, a) { color: #fff; }
  html[data-editorial-layout="paper"] :is(code, th) { background: rgba(255,255,255,.067); color: #fff; border-radius: 0; }
  html[data-editorial-layout="paper"] .math-block { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
  html[data-editorial-layout="paper"] :is(p, li, figcaption, .formula-label) { overflow-wrap: anywhere; }
  html[data-editorial-page] :is(button, input, select, textarea) { border-radius: 0; }
  html[data-editorial-layout="institute"] > body > .site-header { position: static; top: auto; }
  html[data-editorial-layout="flow"] #stage { top: 104px; }
  html[data-editorial-layout="flow"] .editorial-header { position: fixed; }
}
@media (max-width: 600px) {
  html[data-editorial-page] .editorial-header { gap: 0 8px; }
  html[data-editorial-page] .editorial-language-note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  html[data-editorial-page] .editorial-trail { gap: 0 14px; }
  html[data-editorial-page] .editorial-role { display: none; }
  html[data-editorial-page] .editorial-card-grid { grid-template-columns: minmax(0, 1fr); }
  html[data-editorial-page] .editorial-card { padding: 20px; }
  html[data-editorial-page] .editorial-related { padding: 28px 0; }
}
@media (prefers-reduced-motion: reduce) { html[data-editorial-page] { scroll-behavior: auto; } }
@media print {
  html[data-editorial-page] .editorial-header,
  html[data-editorial-page] .editorial-skip,
  html[data-editorial-page] .editorial-context,
  html[data-editorial-page] .editorial-related { display: none !important; }
}
