@font-face {
  font-family: "Sora";
  src: url("../fonts/sora-latin-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --night: #03070d; /* sampled from the plate's sky, so the page field and the image are one night */
  --ink: #efe7da;
  --ink-soft: #cdc3b4;
  --ink-muted: #9d9487;
  --flame: #e3261b;
  --gutter: max(16px, 2.9vw);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--night);
  color: var(--ink);
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--flame); color: var(--ink); }

a { color: inherit; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:focus-visible { outline: 2px solid var(--flame); outline-offset: 4px; border-radius: 2px; }

/* ---------- Stage: the veiled monument ---------- */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--night);
  touch-action: pinch-zoom; /* one-finger drags reach the gust code instead of being cancelled */
}

/*
 * The scene box keeps the plate's aspect and covers the viewport full-bleed, but never so far
 * that the monument is cut. Only past that point does it stop growing; then it sits on the
 * bottom edge (plaza to the floor) and its open edge fades into the night.
 */
.scene {
  --ar: 1.5;       /* plate width / height */
  --max-w: 113vw;  /* monument spans ~88% of the plate width */
  --max-h: 133svh; /* monument top (7.8%) to plaza line (77%) stays visible with the 4% top crop below */
  --focus-y: 0.35;
  --w: min(max(100vw, calc(100svh * var(--ar))), var(--max-w), calc(var(--max-h) * var(--ar)));
  position: absolute;
  left: 50%;
  width: var(--w);
  aspect-ratio: var(--ar);
  /* crop the overflow mostly from the plaza, never more than 4% off the top (the monument starts at 7.8%) */
  top: max(calc((100svh - var(--w) / var(--ar)) * var(--focus-y)), calc(var(--w) / var(--ar) * -0.04));
  translate: -50% 0;
}

/* Wide screens (16:10 and wider): the monument keeps air above and the plaza stays deep enough for the
   placard; the box stops short of the sides, which fade into the night. */
@media (min-aspect-ratio: 16/10) {
  .scene {
    --max-h: 110svh;
    --focus-y: 0.3;
  }
}

@media (min-aspect-ratio: 165/100) {
  .scene {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
  }
}

/* Box shorter than the viewport (squarish landscape): sit on the floor, fade the sky's top edge. */
@media (min-aspect-ratio: 1001/1000) and (max-aspect-ratio: 1327/1000) {
  .scene {
    --focus-y: 1;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 6%);
    mask-image: linear-gradient(to bottom, transparent, #000 6%);
  }
}

@media (max-aspect-ratio: 1/1) {
  .scene {
    --ar: 0.6667;
    --max-w: 116vw;
    --max-h: 140svh;
    --focus-y: 0.4;
  }
}

@media (max-aspect-ratio: 1/1) and (min-aspect-ratio: 933/1000) {
  .scene {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
  }
}

/* Phones: the box is shorter than the screen; the monument stays near the middle and the
   box's top and bottom edges fade into the night. */
@media (max-aspect-ratio: 5747/10000) {
  .scene {
    --focus-y: 0.5;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 5%, #000 92%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 5%, #000 92%, transparent);
  }
}

.scene img,
.scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.scene canvas {
  opacity: 0;
  transition: opacity 900ms cubic-bezier(0.16, 1, 0.3, 1);
}

.scene.is-live canvas { opacity: 1; }

/* ---------- Placard ---------- */

.placard {
  position: absolute;
  left: var(--gutter);
  bottom: max(16px, 4.6svh);
  max-width: min(66rem, calc(100vw - 2 * var(--gutter)));
  text-shadow: 0 0 2px rgb(3 7 13 / 0.6), 0 1px 12px rgb(3 7 13 / 0.6);
}

.placard h1 {
  margin: 0 0 0.2em;
  font-size: clamp(1.75rem, 2.66vw, 3.5rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.placard p {
  margin: 0;
  font-size: clamp(0.9375rem, 1.3vw, 1.5rem);
  line-height: 1.45;
  color: var(--ink-soft);
  text-wrap: balance;
}

.colophon {
  position: absolute;
  right: var(--gutter);
  bottom: max(16px, 5.2svh);
  display: flex;
  align-items: baseline;
  gap: 1.6em;
  font-size: clamp(0.875rem, 1.02vw, 1.25rem);
  line-height: 1;
  color: var(--ink-soft);
  text-shadow: 0 0 2px rgb(3 7 13 / 0.6), 0 1px 12px rgb(3 7 13 / 0.6);
}

.colophon a {
  text-decoration: none;
  transition: color 200ms ease-out;
}

.colophon a:hover { color: var(--ink); text-decoration: underline; }

/* A quiet code tag beside the Impressum, like a build id: I2A9 = Lukas 12,49 (hover title). */
.colophon .ref {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.8em;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  cursor: help;
}

@media (max-width: 640px) {
  .placard { bottom: calc(max(16px, 4.6svh) + 2.25rem); }
}

/* Wide screens and phones (floodlight reflections run under the text):
   the floor darkens under the text. */
@media (min-aspect-ratio: 16/10), (max-aspect-ratio: 5747/10000) {
  .stage::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 34svh;
    background: linear-gradient(to top, rgb(3 7 13 / 0.82), rgb(3 7 13 / 0));
    pointer-events: none;
  }
  .placard, .colophon { z-index: 1; }
}

/* ---------- Text page (Impressum) ---------- */

html:has(> body.page) { scrollbar-color: #3a3634 var(--night); }

.page {
  min-height: 100%;
  padding: clamp(32px, 6vw, 88px) var(--gutter) 64px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  max-width: 40rem;
  margin: 0 auto clamp(40px, 7vw, 96px);
}

.home {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9375rem;
}

.home:hover { color: var(--ink); }

.home svg { width: 2.1rem; height: auto; }

.prose {
  max-width: 40rem;
  margin: 0 auto;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.prose h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.prose h2 {
  margin: 3rem 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--ink);
}

.prose dl {
  display: grid;
  grid-template-columns: minmax(8rem, auto) 1fr;
  gap: 0.4rem 1.5rem;
  margin: 0;
}

.prose dt { color: var(--ink-muted); }
.prose dd { margin: 0; color: var(--ink); }
.prose p { margin: 0 0 1rem; }
.prose ul { margin: 0 0 1rem; padding-left: 1.2rem; }
.prose li { margin-bottom: 0.35rem; }
.prose a:hover { color: var(--ink); }

@media (max-width: 480px) {
  .prose dl { grid-template-columns: 1fr; gap: 0.1rem; }
  .prose dd { margin-bottom: 0.75rem; }
}
