/* Zeit(t)raum: the DVD as a website. Front cover = gate, back cover = film. Light only. */
@font-face { font-family: 'Amatic SC'; font-weight: 700; src: url(/fonts/amatic-700.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Archivo'; font-weight: 100 900; font-stretch: 62% 125%; src: url(/fonts/archivo.woff2) format('woff2'); font-display: swap; }

:root {
  --paper: #e9e7e1;
  --sheet: #f4f3ef;
  --card: #fbfaf7;
  --ink: #1f1d1a;
  --ink-2: #4a4741;
  --pencil: #8b877e;
  --ink-3: #6b675f;
  --screen: #111;
  --green: #2e6a55;
  --green-deep: #24533f;
  --on-green: #f6f5f1;
  --alarm: #a63a2a;
  --hand: 'Amatic SC', 'Chalkboard SE', 'Comic Neue', cursive;
  --sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--paper); overflow-x: clip; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; position: relative; isolation: isolate;
  color: var(--ink); font: 400 1rem/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
/* crumpled paper with coffee rings, from the film's own end credits */
body::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: url(/img/paper-tile.jpg) center top / max(100%, 1400px) auto repeat-y, var(--paper);
}
::selection { background: color-mix(in oklab, var(--green) 26%, transparent); color: var(--ink); }
:focus-visible { outline: 2px dashed var(--green); outline-offset: 4px; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hand { font-family: var(--hand); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; line-height: 1.05; }

.wrap {
  max-width: 1240px; margin: 0 auto;
  padding-block: max(clamp(20px, 4vw, 56px), env(safe-area-inset-top, 0px)) 28px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* state: one page, two covers */
html[data-state="gate"] .film, html[data-state="film"] .gate { display: none; }

/* ---------- torn paper (9-slice rasters) ---------- */
.torn { border: 34px solid transparent; border-image: url(/img/torn-frame.png) 40 round; border-image-outset: 6px; margin: 0; }
.torn > .inner { background: var(--sheet); }

/* ---------- the title, traced from the cover; the insert strokes (caret + T) are written at unlock ---------- */
.title-svg { display: block; width: 100%; height: auto; overflow: visible; }
.title-svg path { fill: none; stroke: var(--ink); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; }
.title-svg .base path { animation: write .5s var(--ease-out) forwards; animation-delay: calc(var(--i) * 70ms + 150ms); }
html[data-state="film"] .title-svg .insert path { animation: write .45s var(--ease-out) forwards; animation-delay: calc(var(--i) * 160ms + 1250ms); }
html[data-unlocking] .gate .title-svg .insert path { animation: write .42s var(--ease-out) forwards; animation-delay: calc(var(--i) * 150ms + 60ms); }
html[data-shown] .title-svg .base path, html[data-shown] .film .title-svg .insert path { animation: none; stroke-dashoffset: 0; }
@keyframes write { to { stroke-dashoffset: 0; } }

.cable { display: block; width: 100%; height: auto; overflow: visible; }
.cable path { fill: none; stroke: var(--pencil); stroke-width: 1.6; stroke-linecap: round; opacity: .75; }
.logo { display: block; width: 100%; height: auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em; min-height: 52px; cursor: pointer;
  text-decoration: none; font: 800 .95rem/1 var(--sans); font-stretch: 88%; letter-spacing: .12em; text-transform: uppercase;
  color: var(--on-green); background: var(--green); border: 3px solid var(--green); padding: .95em 1.4em .9em;
  box-shadow: inset 0 0 0 2px var(--on-green); transition: background-color .2s, border-color .2s, transform .15s var(--ease-out);
  touch-action: manipulation; white-space: nowrap;
}
.btn:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] svg { animation: nudge .9s var(--ease-out) infinite; }
@keyframes nudge { 50% { transform: translateX(3px); } }

/* ---------- gate: the front cover ---------- */
.front { display: grid; grid-template-columns: 1.05fr 1fr; gap: 0 28px; align-items: start; }
.front .t { grid-column: 1; grid-row: 1; padding-top: 12px; max-width: 600px; position: relative; z-index: 2; }
.front .sub { grid-column: 1; grid-row: 1; align-self: end; font-size: clamp(1.5rem, 2.4vw, 2.1rem); margin: 0 0 96px 8px; }
.front .t .cable { position: absolute; left: 34%; top: -6%; width: 78%; z-index: -1; transform: rotate(8deg); }
.front .photo { grid-column: 2; grid-row: 1; transform: rotate(1.6deg); margin-top: 6px; }
.front .photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: 58% 50%; }

.band { grid-column: 1 / -1; grid-row: 2; margin: -84px -10px 0; position: relative; z-index: 3; transform: rotate(-.6deg);
  border: 30px solid transparent; border-image: url(/img/torn-band.png) 36 fill stretch; }
.band .inner { padding: 14px clamp(14px, 3vw, 40px) 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; justify-items: start; }
.band.shake .inner { animation: shake .42s var(--ease-out); }
@keyframes shake { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-2px); } }

.cloze .hint { font: 400 1rem/1.5 var(--sans); color: var(--ink-2); margin: 0 0 1rem; max-width: 40ch; }
.cloze .line { font-family: var(--hand); font-weight: 700; font-size: clamp(2.1rem, 4.4vw, 3.4rem); line-height: 1.3; margin: 0; text-wrap: pretty; }
.cloze .blank { display: inline-block; vertical-align: baseline; }
.cloze .nowrap { white-space: nowrap; }
.cloze .nw2 { white-space: nowrap; }
.cloze input {
  font: inherit; color: var(--green-deep); background: transparent; border: 0; border-radius: 0; padding: 0 .1em; margin: 0 .05em;
  width: var(--w, 4.2em); max-width: 100%; text-align: center; text-transform: uppercase; line-height: 1.1;
  border-bottom: 3px solid var(--ink); outline: none; caret-color: var(--green); -webkit-appearance: none; appearance: none;
  transition: border-color .2s;
}
.cloze input:focus { border-bottom-color: var(--green); }
.cloze input.w-x { --w: 3.7em; }
.cloze input.w-y { --w: 4.5em; }
.cloze input[aria-invalid="true"] { border-bottom-color: var(--alarm); }
.cloze .msg { font: 500 .95rem/1.4 var(--sans); color: var(--alarm); margin: 1rem 0 0; min-height: 1.4em; }
.cloze .msg:empty { min-height: 0; margin: 0; }
.cloze .msg.ok { color: var(--green-deep); }
.noscript { font-weight: 600; color: var(--alarm); }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.btn:disabled { cursor: not-allowed; background: var(--ink-2); border-color: var(--ink-2); font-variant-numeric: tabular-nums; }

.foot { display: flex; justify-content: space-between; align-items: end; margin-top: 26px; gap: 20px; }
.foot .klasse { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin: 0; }
.foot .logo-box { width: 190px; }

/* ---------- film: the back cover ---------- */
.back-head { display: grid; grid-template-columns: minmax(220px, 340px) 1fr auto; align-items: end; gap: 24px; margin-bottom: 10px; }
.back-head .cable-box { align-self: center; max-width: 420px; }
.back-head p { margin: 0 0 18px; font-size: 1.7rem; text-align: right; }
.screen { transform: rotate(-.5deg); }
.screen > .inner { padding: 0; background: var(--screen); }

.player { position: relative; aspect-ratio: 2.4 / 1; max-width: 100%; background: var(--screen); overflow: hidden; }
.player video { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--screen); }
.player video:fullscreen { object-fit: contain; }
.player .play {
  position: absolute; inset: 0; display: grid; place-items: center; border: 0; padding: 0; cursor: pointer;
  background: linear-gradient(transparent 55%, rgba(0, 0, 0, .35)); transition: opacity .35s var(--ease-out);
}
.player .play svg { width: clamp(64px, 9vw, 112px); filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .35)); transition: transform .3s var(--ease-out); }
.player .play:hover svg, .player .play:focus-visible svg { transform: scale(1.06) rotate(-3deg); }
.player .play .ring { fill: none; stroke: var(--on-green); stroke-width: 5; stroke-linecap: round; }
.player .play .tri { fill: var(--on-green); }
.player .play:focus-visible { outline-offset: -8px; outline-color: var(--on-green); }
.player .meta { position: absolute; left: 16px; bottom: 12px; color: var(--on-green); font: 600 .8rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; pointer-events: none; transition: opacity .3s; }
.player.started .play, .player.started .meta { opacity: 0; pointer-events: none; }

.below { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 40px; margin-top: 30px; align-items: start; }
.tech { background: var(--card); border: 1.5px solid var(--ink); padding: 14px 16px 16px; }
.tech h2 { margin: 0 0 8px; font: 800 .82rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.tech dl { margin: 0 0 14px; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: .92rem; }
.tech dt { color: var(--ink-2); }
.tech dd { margin: 0; font-variant-numeric: tabular-nums; }
.tech .btn { width: 100%; }
.tech .alt { margin: 10px 0 0; font-size: .86rem; color: var(--ink-2); }

.stills { display: grid; grid-template-columns: repeat(3, 1fr); border: 26px solid transparent; border-image: url(/img/torn-strip.png) 40 round; border-image-outset: 4px; }
.stills img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border: 6px solid var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.stills img:nth-child(1) { transform: rotate(-1.2deg); }
.stills img:nth-child(2) { transform: rotate(.8deg) translateY(4px); }
.stills img:nth-child(3) { transform: rotate(-.4deg); }

.end { display: flex; justify-content: space-between; align-items: center; gap: 16px 32px; margin-top: 34px; }
.end .logo-box { width: 170px; flex: none; }
.colophon { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 4px 0; margin: 0;
  font: 500 .8rem/1.4 var(--sans); color: var(--ink-2); letter-spacing: .04em; }
.colophon > * + *::before { content: '·'; display: inline-block; margin: 0 .55em; color: var(--pencil); text-decoration: none; }

/* ---------- privacy note: a torn sheet laid over the page ---------- */
.link { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: var(--pencil); touch-action: manipulation; }
.link:hover { color: var(--ink); text-decoration-color: currentColor; }
.privacy { border: 0; padding: 0; background: transparent; color: var(--ink-2); max-width: min(600px, calc(100vw - 24px)); width: 100%; overflow: visible; }
.privacy::backdrop { background: rgba(31, 29, 26, .42); }
.privacy[open] { animation: sheet-in .42s var(--ease-out) both; }
.privacy[open]::backdrop { animation: fade-in .3s ease-out both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) rotate(-1.6deg); } to { opacity: 1; transform: rotate(-.4deg); } }
@keyframes fade-in { from { opacity: 0; } }
.privacy .sheet {
  position: relative; max-height: min(82dvh, 720px); overflow: auto; overscroll-behavior: contain;
  border: 30px solid transparent; border-image: url(/img/torn-frame.png) 40 fill round;
  padding: 4px 8px 6px; font-size: .92rem; line-height: 1.55;
}
.privacy h2 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); margin: 0 40px 10px 0; color: var(--ink); }
.privacy p { margin: 0 0 10px; }
.privacy dl { margin: 0 0 10px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.privacy dt { font-weight: 700; color: var(--ink); }
.privacy dd { margin: 0; }
.privacy .close { position: absolute; top: 0; right: 0; width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; cursor: pointer; color: var(--ink); touch-action: manipulation; }
.privacy .close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.privacy .close:hover { color: var(--green); }
html:has(.privacy[open]) { overflow: hidden; }

/* ---------- page change: cover -> back cover ---------- */
::view-transition-old(root) { animation: .38s var(--ease-out) both cover-out; }
::view-transition-new(root) { animation: .55s var(--ease-out) both cover-in; }
@keyframes cover-out { to { opacity: 0; transform: translateY(-14px) rotate(-.4deg); filter: blur(2px); } }
@keyframes cover-in { from { opacity: 0; transform: translateY(18px); } }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .front { grid-template-columns: 1fr; }
  .front .t { grid-row: 1; max-width: 340px; }
  .front .sub { grid-row: 2; align-self: start; font-size: 1.25rem; margin: -26vw 0 0 4px; max-width: 5.3em; }
  .front .sub br { display: none; }
  .front .t .cable { display: none; }
  .front .photo { grid-column: 1; grid-row: 3; margin: -14vw -6px 0 32%; }
  .band { grid-row: 4; margin: -48px calc(-1 * var(--gutter) + 2px) 0; transform: rotate(-.8deg); }
  .band .inner { grid-template-columns: 1fr; padding: 6px max(18px, var(--gutter)) 14px; }
  .band .btn { width: 100%; }
  .cloze .line { font-size: 1.9rem; }
  .cloze input.w-y { --w: 3.4em; }
  .foot .logo-box { width: 140px; }

  .back-head { grid-template-columns: 1fr; gap: 0; }
  .back-head .cable-box, .back-head p { display: none; }
  .back-head .t { max-width: 230px; }
  .screen { margin: 0 -14px; transform: none; border-width: 18px; }
  .below { grid-template-columns: 1fr; gap: 26px; }
  .stills { grid-template-columns: repeat(3, 72%); overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--gutter)); scrollbar-width: none; }
  .stills::-webkit-scrollbar { display: none; }
  .stills img { scroll-snap-align: center; }
  .end { flex-direction: column; align-items: flex-start; gap: 14px; }
  .colophon { flex-direction: column; align-items: flex-start; gap: 6px; }
  .colophon > * + *::before { content: none; }
  .privacy .sheet { border-width: 24px; }
  .privacy dl { grid-template-columns: 1fr; gap: 0; }
  .privacy dd { margin-bottom: 6px; }
}

@media (max-width: 374px) { .cloze .nw2 { white-space: normal; } }

@media (prefers-reduced-motion: reduce) {
  .title-svg path { animation: none !important; stroke-dashoffset: 0; }
  html[data-state="gate"]:not([data-unlocking]) .gate .title-svg .insert path { stroke-dashoffset: 1; }
  .band.shake .inner, .btn[aria-busy="true"] svg { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .privacy[open], .privacy[open]::backdrop { animation: none; }
}
