/* Visual controls: all decorative effects share this small, WebGL-free layer. */
:root {
  --ambient-violet: #9770ee;
  --ambient-blue: #527ee5;
  --ambient-rose: #ab78b4;
  --ambient-intensity: .36;
  --ambient-duration: 26s;
  --glass-blur: 16px;
  --glass-fill: #201b38e8;
  --glass-edge: #c5b7ff40;
  --glass-highlight: #ffffff38;
  --surface-radius: 18px;
}
html[data-theme=light] {
  --ambient-violet: #c5b0ed;
  --ambient-blue: #a0bceb;
  --ambient-rose: #e0bfdc;
  --ambient-intensity: .5;
  --glass-fill: #f7f3fff0;
  --glass-edge: #6240b538;
  --glass-highlight: #ffffffcc;
}
.ambient-gradient {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -2;
  pointer-events: none;
  opacity: var(--ambient-intensity);
  /* The left side stays quiet so both language variants remain legible. */
  mask-image: linear-gradient(90deg, transparent, #000 65%);
}
.ambient-gradient::before, .ambient-gradient::after {
  content: '';
  position: absolute;
  inset: -25%;
  background: radial-gradient(ellipse at 78% 34%, var(--ambient-violet), transparent 46%),
    radial-gradient(ellipse at 65% 80%, var(--ambient-blue), transparent 44%);
  animation: ambient-drift var(--ambient-duration) ease-in-out infinite alternate;
  animation-play-state: paused;
}
.ambient-gradient::after {
  background: radial-gradient(ellipse at 92% 48%, var(--ambient-rose), transparent 38%);
  animation-direction: alternate-reverse;
}
html[data-ambient-running=true] .ambient-gradient::before,
html[data-ambient-running=true] .ambient-gradient::after { animation-play-state: running; }
@keyframes ambient-drift {
  from { transform: translate3d(-3%, -2%, 0) rotate(-7deg) scale(1); }
  to { transform: translate3d(5%, 4%, 0) rotate(8deg) scale(1.08); }
}
/* Opaque fallback first; blur enhances only supported browsers. No page capture. */
.surface-glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-edge);
  border-radius: var(--surface-radius);
  box-shadow: inset 0 1px 0 var(--glass-highlight), inset 0 -1px 0 #8872bc20, 0 8px 28px #08051c12;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .surface-glass {
    background: linear-gradient(135deg, #ffffff0e, #ffffff00 55%), color-mix(in srgb, var(--glass-fill) 82%, transparent);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(135%);
    backdrop-filter: blur(var(--glass-blur)) saturate(135%);
  }
}
.header nav.surface-glass { padding: 11px 22px; border-radius: 100px; }
.header nav a { line-height: 1.6; }
.header-note { color: var(--muted); }
.libby-detail.surface-glass { padding: 12px 16px; }
.libby-detail>span { color: var(--muted); line-height: 1.6; }
.opening .scene-top { color: var(--muted); }
.opening .eyebrow { letter-spacing: .18em; font-weight: 500; }
.opening-bottom p { max-width: 440px; }
.opening-foot { border-top: 1px solid var(--line); padding-top: 18px; }
.opening .network-stage { --network-opacity: .48; }
.scene-top { font-variant-numeric: tabular-nums; }
.screen { border-radius: 12px; }
.catalog { transform: none; }
.project-list article { transition: border-color .25s ease; }
.project-list article:hover { border-color: var(--accent); }
.details-link { text-underline-offset: 5px; }
.header nav a:focus-visible { outline-offset: 3px; border-radius: 3px; }
.language-switch button { opacity: 1; color: var(--muted); }
.language-switch button[aria-pressed=true] { color: var(--paper); }
@media(min-width:901px) and (min-height:761px) {
  .opening-body { padding-bottom: 12px; }
  .opening-bottom { margin-top: 36px; }
}
@media(max-width:1100px) { .header nav.surface-glass { padding: 9px 16px; } }
@media(max-width:900px),(max-height:600px) {
  :root { --glass-blur: 10px; }
  .ambient-gradient::after { display: none; }
  .ambient-gradient::before { animation: none; }
  .libby-detail.surface-glass { justify-self: start; }
  .opening-foot { padding-top: 20px; }
}
@media(max-width:700px) {
  .header nav.surface-glass {
    bottom: 9px; padding: 4px 8px; display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr)); align-items: center; gap: 2px;
  }
  /* Same display and height for every item, including the restored Journey link. */
  .header nav.surface-glass > a[href] {
    min-height: 36px; display: flex; align-items: center; justify-content: center;
    gap: 4px; padding: 4px 2px; line-height: 1.2; white-space: nowrap;
    font-size: clamp(10px,2.8vw,12px);
  }
  .opening { gap: 36px; }
  .opening h1 { font-size: clamp(40px, 9.2vw, 64px); line-height: 1.09; }
  .opening-bottom { gap: 16px; }
  .opening-bottom p { font-size: 14px; line-height: 1.8; }
  .opening .scene-top { font-size: 8px; }
}
/* Respect the system default; an explicit visitor choice can enable effects. */
@media(prefers-reduced-motion:reduce) {
  html:not(.motion-enabled) *, html:not(.motion-enabled) *::before, html:not(.motion-enabled) *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  html.motion-ready:not(.motion-enabled) .reveal { opacity: 1; transform: none; pointer-events: auto; }
  html:not(.motion-enabled) .network-sculpture { transform: none !important; }
}
@media(forced-colors:active) {
  .ambient-gradient, .network-stage { display: none; }
  .surface-glass { border: 1px solid CanvasText; background: Canvas; box-shadow: none; }
  .opening h1 .serif { background: none; color: CanvasText; }
}
