/* Automataria appearance. Images keep their original colours in every mode. */
:root {
  color-scheme: dark;
  --at-page: #0b0e11;
  --at-panel: #172026;
  --at-text: #f3f3ef;
  --at-muted: #c1c9cd;
  --at-line: #536068;
  --at-accent: #f0c193;
  --at-button: #eceee8;
  --at-button-text: #111814;
  --at-dark-edge: #0b0e11;
  background: var(--at-page);
}
:root[data-at-theme="light"] {
  color-scheme: light;
  --at-page: #f5f2e9;
  --at-panel: #ebe7dc;
  --at-text: #18261f;
  --at-muted: #47574e;
  --at-line: #9daba1;
  --at-accent: #285840;
  --at-button: #285840;
  --at-button-text: #fffdf5;
}
html:has(.studio), body { background: var(--at-page); }
body { color: var(--at-text); }
::selection { color: var(--at-button-text); background: var(--at-button); }

.at-theme-control {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .45rem;
  position: relative;
  flex: none;
  color: var(--at-text);
  font: 600 .73rem/1.2 system-ui, sans-serif;
}
.at-theme-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.at-theme-select {
  display: block;
  inline-size: 6.1rem;
  min-inline-size: 0;
  min-block-size: 2.75rem;
  border: 1px solid var(--at-line);
  border-radius: .55rem;
  padding: .25rem .48rem;
  color: var(--at-text);
  background: var(--at-panel);
  font: inherit;
  cursor: pointer;
}
.at-theme-select:hover { border-color: var(--at-accent); }
.at-theme-select:focus-visible { outline: 2px solid var(--at-accent); outline-offset: 3px; }
.at-theme-fallback { position: fixed; inset: max(1rem, env(safe-area-inset-top)) 1rem auto auto; z-index: 10; }
body:has(> .at-theme-fallback) .not-found { padding-top: max(5.25rem, calc(env(safe-area-inset-top) + 3.75rem)); }

/* v5 shell. Keep the moving image and text sitting on the same dark stage. */
:root[data-at-theme="light"] .studio {
  color-scheme: light;
  --ink: var(--at-page);
  --paper: var(--at-text);
  --mist: var(--at-muted);
  --copper: var(--at-accent);
  --line: var(--at-line);
}
:root[data-at-theme="light"] .studio-nav:not(.overlay) { border-color: var(--line); }
:root[data-at-theme="light"] .studio h1 em { color: #345f48; }
:root[data-at-theme="light"] .studio .action { background: #285840; color: #fffdf5; }
:root[data-at-theme="light"] .studio .action:hover { background: #1c4531; }
:root[data-at-theme="light"] .studio :is(input,textarea):not([type="checkbox"]):not([type="radio"]) {
  background: #fffcf4;
  color: var(--at-text);
  border-color: var(--at-line);
}
:root[data-at-theme="light"] .studio :is(input,textarea)::placeholder { color: #56665c; }

.studio-nav.overlay {
  color-scheme: dark;
  --at-panel: #172026;
  --at-text: #f3f3ef;
  --at-line: #66737a;
  --at-accent: #f0c193;
}
:root[data-at-theme="light"] .studio :is(.studio-nav.overlay,.studio-hero,.story) {
  color-scheme: dark;
  --ink: var(--at-dark-edge);
  --paper: #f3f3ef;
  --mist: #d3d9d7;
  --copper: #f0c193;
  --line: #536068;
  color: var(--paper);
}
:root[data-at-theme="light"] .studio .studio-hero h1 em { color: #e9c39b; }
:root[data-at-theme="light"] .studio .studio-hero .action {
  background: #eee7d7;
  color: #1a2820;
}
:root[data-at-theme="light"] .studio .studio-hero .action:hover { background: #f0c193; }
:root[data-at-theme="light"] .studio .story::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  z-index: 1;
  height: min(7vh, 3.5rem);
  background: linear-gradient(to bottom, transparent, var(--at-page));
  pointer-events: none;
}
:root[data-at-theme="light"] .studio .studio-intro + .story::before {
  content: "";
  position: absolute;
  inset: -1px 0 auto;
  z-index: 1;
  height: 1rem;
  background: linear-gradient(to bottom, var(--at-page), transparent);
  pointer-events: none;
}
:root[data-at-theme="light"] .studio .skip-link { background: #285840; color: #fffdf5; }

/* Legacy pages keep the same layout and use the same preference as v5. */
body:not(:has(.studio)) .page { background: var(--at-page); color: var(--at-text); }
body:not(:has(.studio)) :is(.site-header,.site-footer,.workflow,.contact-band,.detail-rows>div,.related-links li,.hero) { border-color: var(--at-line); }
body:not(:has(.studio)) :is(.intro,.eyebrow,.section-label,.updated,.research-credit,.workflow-note) { color: var(--at-muted); }
body:not(:has(.studio)) .languages a[aria-current=page] { border-color: var(--at-line); }
body:not(:has(.studio)) :is(.button,.skip-link) {
  background: var(--at-button);
  color: var(--at-button-text);
  border-color: var(--at-button);
}
body:not(:has(.studio)) .button:hover {
  background: var(--at-panel);
  color: var(--at-text);
  border-color: var(--at-line);
}
body:not(:has(.studio)) .inverse {
  color: var(--at-text);
  background: var(--at-panel);
}
body:not(:has(.studio)) .inverse :is(.intro,.eyebrow,.workflow-note) { color: var(--at-muted); }
body:not(:has(.studio)) a:focus-visible { outline-color: var(--at-accent); }

@media (min-width:64.0625rem) {
  .site-header:has(.at-theme-control) { grid-template-columns: auto minmax(0,1fr) auto auto; gap: clamp(.6rem,2vw,1.55rem); }
}
@media (max-width:57rem) {
  .studio-nav:has(.at-theme-control) { flex-wrap: wrap; gap: .25rem .65rem; }
  .studio-nav:has(.at-theme-control) .studio-menu { flex: 0 0 100%; order: 3; gap: .8rem; }
  .studio-nav:has(.at-theme-control) .studio-menu a { padding: .3rem 0 .5rem; }
  .studio-nav:has(.at-theme-control) .signature { white-space: nowrap; font-size: clamp(.98rem,4.1vw,1.25rem); margin-right: auto; }
  .studio-nav:has(.at-theme-control) .languages { gap: 0; padding-left: 0; border: 0; }
  .studio-nav:has(.at-theme-control) .languages a { min-width: 1.55rem; }
  .studio-nav:has(.at-theme-control) .at-theme-select { inline-size: 5.25rem; padding-inline: .32rem; }
  .studio-nav.overlay:has(.at-theme-control) + main .studio-hero { padding-top: max(8.25rem, calc(env(safe-area-inset-top) + 7.75rem)); }
  .site-header:has(.at-theme-control) { gap: .5rem; }
  .site-header .at-theme-select { inline-size: 5.25rem; }
}
@media (max-width:22rem) {
  .studio-nav:has(.at-theme-control) { column-gap: .4rem; }
  .studio-nav:has(.at-theme-control) .signature { gap: .38rem; }
  .studio-nav:has(.at-theme-control) .languages a { min-width: 1.38rem; font-size: .76rem; }
}

/* Keep navigation legible over both bright and dark sections of the film. */
.studio:has(.studio-hero) .studio-nav {
  background: linear-gradient(180deg, rgba(11,14,17,.95), rgba(11,14,17,.82));
}
