@import url("playfair.css");

:root {
  color-scheme: dark;
  font: 16px/1.5 Georgia, "Times New Roman", serif;
  color: #fff1d1;
  background: #0c1826;
}
* { box-sizing: border-box; }
body, h1, h2, figure, p { margin: 0; }
a, button { color: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #ffe4af; outline-offset: 2px; }
.flight {
  --control-row: calc(52px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto var(--control-row);
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.film-frame { position: relative; min-width: 0; min-height: 0; overflow: hidden; container-type: size; }
video { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.invitation-band {
  padding: clamp(8px, 2vh, 20px) 18px;
  border-top: 1px solid #e8ce9633;
  background: linear-gradient(#142331, #0c1826);
  text-align: center;
  font-size: clamp(1.375rem, calc(.875rem + 1.4vw), 2.375rem);
  line-height: 1.22;
  text-wrap: balance;
}
.scene-invitation { display: grid; align-items: center; }
.scene-invitation p { grid-area: 1 / 1; }
/* Keep the band tall enough for the longest invitation, including on a narrow phone. */
.scene-invitation p[hidden] { display: block; visibility: hidden; }
.invitation-band em { color: #ffd18c; }
.invitation-fallback small { display: block; margin-top: .3em; color: #f5d398; }
.flight:is([data-phase="intro"], [data-phase="end"]) {
  grid-template-rows: minmax(0, 1fr) 0 var(--control-row);
}
.flight:is([data-phase="intro"], [data-phase="end"]) .invitation-band { display: none; }
.film-intro, .release { display: none; position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.flight[data-phase="intro"] .film-intro {
  display: grid;
  align-content: end;
  padding: 0 clamp(26px, 7vw, 130px) clamp(62px, 13vh, 150px);
  background: linear-gradient(to top, #07101cee 0%, #111722ab 25%, #141b2640 60%, #17202a1a),
              url("winter-evening.webp") center / cover, #101a25;
  opacity: var(--intro-opacity, 1);
}
.intro-copy { text-shadow: 0 2px 8px #091118ad; }
.intro-setting {
  max-width: 20em;
  font: 400 clamp(2.1rem, 4.7vw, 5.2rem)/1.12 "Playfair Evening", Georgia, serif;
  text-wrap: balance;
}
.intro-season {
  margin-top: .7em;
  color: #f5d398;
  font: italic clamp(1.15rem, 2.15vw, 2.15rem)/1.3 Georgia, serif;
  text-wrap: balance;
}
.intro-word { white-space: nowrap; }
.intro-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#skip-intro {
  position: absolute;
  right: clamp(12px, 3vw, 40px);
  bottom: 8px;
  border: 0;
  color: #f5e3c4;
  font: 1rem Georgia, serif;
  text-decoration: underline;
  text-underline-offset: .25em;
  pointer-events: auto;
}
.flight[data-phase="end"] .release {
  display: grid;
  justify-items: center;
  align-items: end;
  padding: 1rem 1rem clamp(2.2rem, 8vh, 6rem);
  background: linear-gradient(to top, #07101df5, #09111a99 16%, transparent 40%);
}
.release h2 {
  color: #ffe8bb;
  font: 400 clamp(1.8rem, 4.3vw, 4rem)/1.2 "Playfair Evening", Georgia, serif;
  text-align: center;
  text-shadow: 0 1px 7px #070b11;
}
@media (max-aspect-ratio: 1/1) {
  .flight[data-phase="intro"] .film-intro { background-position: 40% center; }
}
@keyframes reveal-date {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  .film-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background: black;
    opacity: var(--cut-shade, 0);
    pointer-events: none;
  }
  .scene-invitation { opacity: var(--caption-opacity, 1); }
  .flight[data-phase="end"] .release { animation: reveal-date .85s ease-out both; }
}
header, .hud { position: absolute; left: 16px; right: 16px; display: flex; align-items: center; }
header { top: max(16px, env(safe-area-inset-top)); justify-content: space-between; z-index: 2; }
h1 { font: 400 24px/1.25 Georgia, serif; text-shadow: 0 1px 4px #000, 0 0 12px #08131f; }
h1 i { color: #edc786; }
nav, .hud { background: #11222eeb; border: 1px solid #e8ce9670; }
nav { display: flex; }
nav a, button, summary { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 12px; }
nav a { text-decoration: none; }
nav a[aria-current] { color: #edc786; text-decoration: underline; text-underline-offset: 4px; }
.hud { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); right: auto; z-index: 1; font-size: 15px; }
button, summary { background: transparent; border: 0; border-left: 1px solid #e8ce963d; font: inherit; cursor: pointer; }
[hidden] { display: none; }
button:hover, nav a:hover, summary:hover, details[open] summary:hover { background: #2b4650; }
summary { gap: 8px; color: #edc786; }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: translateY(2px) rotate(-45deg);
}
details[open] summary::after { transform: translateY(-2px) rotate(135deg); }
.contact-links {
  --menu-width: 10.5em;
  position: absolute;
  width: var(--menu-width);
  left: max(0px, calc(100% - var(--menu-width)));
  bottom: calc(100% + 6px);
  display: grid;
  max-width: calc(100vw - 32px);
  background: #11222e;
  border: 1px solid #e8ce9670;
  box-shadow: 0 4px 16px #0008;
}
.contact-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 14px;
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}
.contact-links a + a { border-top: 1px solid #e8ce963d; }
.contact-links a:focus-visible { outline-offset: -4px; }
@media (max-width: 420px) {
  .hud { left: 8px; right: auto; max-width: calc(100% - 16px); font-size: 14px; }
  summary, button { padding-inline: 8px; }
}
/* Keep the language switch and transport controls off the landscape picture. */
@media (min-aspect-ratio: 1/1) {
  header {
    top: auto;
    left: auto;
    bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
  header h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

#picture-playback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  touch-action: manipulation;
}
#picture-playback:focus-visible { outline-offset: -4px; }
header { pointer-events: none; }
header nav { pointer-events: auto; }

/* Pin the lower edge so that every numbered game reply survives a wide crop.
   Native controls use the same unmagnified shot on both language pages. */
.film-frame[data-scene="encounter"] video { object-position: center bottom; }
video[controls] {
  /* Put the browser's transport bar beneath the recorded reply buttons. */
  object-position: center calc(100% - 56px);
  background: #0c1826;
}

/* Enlarge the actual German game UI on wide screens. Keep the two people
   and the complete reply stack in frame, clear of the cropped map edge. */
.film-frame[data-scene="encounter"]:not(.localized) video {
  position: absolute;
  left: 75%;
  bottom: 0;
  width: max(100cqw, min(135cqw, 300cqh), calc(100cqh * 16 / 9));
  height: auto;
  aspect-ratio: 16 / 9;
  transform: translateX(-75%);
}
@media (min-aspect-ratio: 1/1) {
  .film-frame:is([data-scene="lanes"], [data-scene="aerial"]) video { object-position: center top; }
}

/* English and compact screens reflow the recorded dialogue. Scale the shot to
   cover the visible rectangle using only source pixels above the game plates.
   The first recorded plate starts below 76% of the source height. */
.film-frame[data-scene="encounter"].localized video {
  position: absolute;
  left: 50%;
  top: 100%;
  width: max(135cqw, calc(100cqh * 16 / 9 / .62));
  height: auto;
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -75%);
}
@media (min-aspect-ratio: 1/1) {
  .film-frame[data-scene="encounter"].localized video { transform: translate(-56%, -75%); }
}
@media (max-aspect-ratio: 1/1) {
  .film-frame[data-scene="encounter"].localized video {
    width: max(100cqw, calc(100cqh * 16 / 9 / .43));
    transform: translate(-50%, -75%);
  }
}

.conversation {
  position: absolute;
  inset: auto 3% clamp(8px, 3cqh, 26px);
  display: grid;
  justify-items: center;
  color: #fff1d1;
  text-align: center;
  pointer-events: none;
  font: 400 clamp(18px, 1.65vw, 30px)/1.25 "Playfair Evening", Georgia, serif;
}
.conversation[hidden], .conversation [hidden] { display: none; }
.speaker {
  color: #f4d18b;
  font-variant-caps: all-small-caps;
  letter-spacing: .16em;
  text-shadow: 0 1px 3px #000, 0 0 6px #000;
}
.speech, .replies li {
  border: 1px solid rgb(207 169 94 / 50%);
  border-radius: 2px;
  background: rgb(8 14 20 / 89%);
  padding: .22em .75em .3em;
}
.replies {
  list-style: none;
  margin: .25em 0 0;
  padding: 0;
  display: grid;
  justify-items: center;
  gap: .16em;
  font-size: .91em;
}
.replies li:last-child { color: #e2dbcc; }
.conversation[data-cue="choice"] li:first-child { border-color: #ffd18c; color: #ffe4af; }
.conversation[data-cue="choice"] li ~ li { display: none; }
@media (min-aspect-ratio: 1/1) {
  .conversation { inset-inline: 2% auto; width: 36%; }
}
@media (max-height: 480px) and (min-aspect-ratio: 1/1) {
  .conversation { font-size: 16px; }
}
.transcript { max-width: 42rem; margin: 1rem auto; padding: 0 1rem; }
.transcript summary { border: 0; padding: 0; }
.transcript p, .transcript ol { margin: .75em 0; }
