/* Geist, selbst gehostet (SIL Open Font License, siehe assets/fonts/OFL.txt) */
@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --page: #F2F2F2;
  --surface: #FFFFFF;
  --ink: #000000;
  --muted: #666666;
  --field: #F2F2F2;
  --card: #000000;
  --card-muted: #8C8C8C;
  --error: #B3140D;

  /* Kurven nach Emil Kowalski */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --gutter: 1.25rem;
  --font: "Geist", "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
html.locked { overflow: hidden; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.demo-note {
  font-size: .8125rem; text-align: center; color: var(--muted);
  padding: calc(.6rem + env(safe-area-inset-top, 0px)) var(--gutter) 0;
}

/* ---------- Seite ---------- */
.page {
  max-width: 62rem; margin: 0 auto;
  padding: 1.25rem var(--gutter) calc(7.5rem + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 2rem;
}
.demo-note[hidden] + .page { padding-top: calc(1.25rem + env(safe-area-inset-top, 0px)); }

/* ---------- Das Ticket ---------- */
.pass {
  perspective: 1200px;
  width: 100%; max-width: 24rem; justify-self: center;
  animation: pass-in 800ms var(--ease-out) both;
}
.pass__inner {
  container-type: inline-size;
  position: relative;
  background: var(--card); color: #fff;
  border-radius: 28px;
  padding: 10px 10px 0;
  transform-style: preserve-3d;
  will-change: transform;
}
/* Konzentrische Radien: 28 aussen = 18 innen + 10 Abstand */
.pass__photo {
  position: relative; aspect-ratio: 4 / 3;
  border-radius: 18px; overflow: hidden;
  background: #3A4A36;
  transform: translateZ(0); /* Safari: Radius beim Video sauber zuschneiden */
}
/* 16:9-Video auf 4:3 zuschneiden, Person und Fontäne bleiben im Bild */
.pass__photo video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 50%;
}

/* Pause/Play: Pflicht bei Bewegtbild über 5 Sekunden (WCAG 2.2.2), Trefferfläche 44 px */
.vid-toggle {
  position: absolute; right: 4px; bottom: 4px; z-index: 2;
  width: 44px; height: 44px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; cursor: pointer; color: #fff;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease-out);
}
.vid-toggle::before {
  content: ""; grid-area: 1 / 1; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background-color 160ms ease;
}
.vid-toggle svg {
  grid-area: 1 / 1; width: 14px; height: 14px; fill: currentColor; position: relative;
  transition: opacity 150ms ease, transform 150ms var(--ease-out);
}
.vid-toggle[data-state="playing"] .i-play,
.vid-toggle[data-state="paused"] .i-pause { opacity: 0; transform: scale(.7); }
.vid-toggle:active { transform: scale(0.94); }
.vid-toggle:focus-visible { outline: none; }
.vid-toggle:focus-visible::before { box-shadow: 0 0 0 2px #fff; }
@media (hover: hover) and (pointer: fine) {
  .vid-toggle:hover::before { background: rgba(0, 0, 0, .65); }
}

.chip {
  position: absolute; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 8px;
  background: #fff; color: #000;
  border-radius: 999px;
  font-size: .8125rem; font-weight: 600;
  opacity: 0; transform: translateY(-4px) scale(.95);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.chip[data-show] { opacity: 1; transform: none; }
.chip svg { width: 16px; height: 16px; }

.pass__main { padding: 18px 12px 20px; }
.year {
  display: flex;
  font-size: 45cqw;
  font-weight: 600;
  line-height: .82;
  letter-spacing: -0.055em;
  clip-path: inset(-0.1em -0.1em 0 -0.1em);
  padding-bottom: .02em;
}
.year span { display: inline-block; animation: digit-in 700ms var(--ease-out) both; animation-delay: 250ms; }
.year span:nth-child(2) { animation-delay: 305ms; }
.year span:nth-child(3) { animation-delay: 360ms; }
.year span:nth-child(4) { animation-delay: 415ms; }
.pass h1 {
  margin-top: 12px;
  font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15;
}

/* Abriss mit Kerben */
.pass__tear {
  position: relative; height: 24px; margin: 0 -10px;
}
.pass__tear::before, .pass__tear::after {
  content: ""; position: absolute; top: 0; width: 24px; height: 24px;
  border-radius: 50%; background: var(--page);
}
.pass__tear::before { left: -12px; }
.pass__tear::after { right: -12px; }
.pass__tear span {
  position: absolute; left: 22px; right: 22px; top: 11px;
  border-top: 2px dashed #333;
}
.pass__stub {
  display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 12px;
  padding: 6px 12px 22px;
}
.pass__stub dt { font-size: .75rem; color: var(--card-muted); }
.pass__stub dd { font-size: .9375rem; font-weight: 500; line-height: 1.3; }
.rel { display: block; margin-top: 2px; font-size: .8125rem; font-weight: 400; color: var(--card-muted); font-variant-numeric: tabular-nums; }
.rel:empty { display: none; }

/* ---------- Text neben dem Ticket ---------- */
.copy { display: grid; gap: 1rem; max-width: 24rem; justify-self: center; width: 100%; }
.copy > * { animation: fade-up 500ms var(--ease-out) both; animation-delay: 450ms; }
.copy > :nth-child(2) { animation-delay: 510ms; }
.copy > :nth-child(3) { animation-delay: 570ms; }
.lead { font-size: 1.3rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; }
.note { color: var(--muted); }
.foot { color: var(--muted); font-size: .9375rem; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3.25rem; padding: .8rem 1.5rem;
  border-radius: 999px;
  font-size: 1rem; font-weight: 600; letter-spacing: -0.005em;
  background: var(--ink); color: #fff;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn--quiet { background: var(--field); color: var(--ink); }
.btn[aria-busy="true"] { cursor: progress; }
.btn__label { display: inline-block; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #262626; }
  .btn--quiet:hover { background: #E6E6E6; }
}

.cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 1.5rem var(--gutter) calc(1rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--page) 62%, rgba(242,242,242,0));
  animation: fade-up 500ms var(--ease-out) both; animation-delay: 650ms;
}
.cta .btn { width: 100%; max-width: 24rem; margin: 0 auto; display: flex; }

/* ---------- Bottom Sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0,0,0,.4);
  opacity: 0;
  transition: opacity 300ms ease;
}
.overlay[data-open] { opacity: 1; transition-duration: 500ms; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  width: 100%; max-width: 34rem; margin: 0 auto;
  max-height: calc(100dvh - 2.5rem);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 300ms var(--ease-drawer);
}
.sheet[data-open] { transform: translateY(0); transition-duration: 500ms; }
.sheet__head {
  flex: none;
  padding: 10px 1.25rem 0;
  touch-action: none; cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.sheet__head:active { cursor: grabbing; }
.handle { width: 40px; height: 5px; border-radius: 999px; background: #D6D6D6; margin: 0 auto 14px; }
.sheet__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sheet__bar h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.sheet__bar h2:focus { outline: none; }
.close {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--field); cursor: pointer;
  display: grid; place-items: center;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.close:active { transform: scale(0.95); }
.close:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.close svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) { .close:hover { background: #E6E6E6; } }

.sheet__body {
  overflow-y: auto; overscroll-behavior: contain;
  padding: .5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
.hint { color: var(--muted); font-size: .9375rem; }

form { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
fieldset { border: 0; padding: 0; min-width: 0; }
.lbl { display: block; font-size: .875rem; font-weight: 500; color: var(--muted); margin-bottom: .4rem; }
.opt { font-weight: 400; }

/* Segmented Control: Kopie mit clip-path für einen sauberen Farbwechsel */
.seg {
  position: relative;
  background: var(--field); border-radius: 999px; padding: 4px;
}
.seg__base, .seg__active {
  display: grid; grid-template-columns: repeat(3, 1fr);
}
.seg__base input { position: absolute; opacity: 0; pointer-events: none; }
.seg__base label, .seg__active span {
  display: grid; place-items: center; text-align: center;
  min-height: 2.75rem; padding: 0 .25rem;
  font-size: .9375rem; font-weight: 600; letter-spacing: -0.01em;
  border-radius: 999px;
}
.seg__base label { cursor: pointer; color: #444; -webkit-tap-highlight-color: transparent; }
.seg__base input:focus-visible + label { outline: 2px solid var(--ink); outline-offset: -2px; }
.seg__active {
  position: absolute; inset: 4px;
  background: var(--ink); color: #fff; border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  clip-path: inset(0 100% 0 0 round 999px);
  transition: clip-path 280ms var(--ease-in-out), opacity 150ms ease;
}

input[type="text"], textarea {
  width: 100%; font: inherit; font-size: 1.0625rem; color: var(--ink);
  background: var(--field); border: 0; border-radius: 12px;
  padding: .8rem .9rem; min-height: 3.125rem;
  transition: box-shadow 150ms ease;
}
textarea { min-height: 5.5rem; resize: vertical; }
input[type="text"]:focus-visible, textarea:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--error); }
.field-hint { margin-top: .4rem; color: var(--muted); font-size: .875rem; }
.err { margin-top: .4rem; color: var(--error); font-size: .875rem; font-weight: 500; }
.row2 { display: grid; gap: 1.25rem; }

/* Personen-Stepper */
.stepper {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--field); border-radius: 12px; padding: 4px; min-height: 3.125rem;
}
.stepper button {
  width: 42px; height: 42px; border-radius: 9px; border: 0; background: #fff; cursor: pointer;
  display: grid; place-items: center;
  transition: transform 160ms var(--ease-out), opacity 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
.stepper button:active { transform: scale(0.94); }
.stepper button:disabled { opacity: .35; cursor: default; transform: none; }
.stepper button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.stepper svg { width: 14px; height: 14px; }
.stepper__val { overflow: hidden; min-width: 2.5rem; text-align: center; }
.stepper output { display: inline-block; font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.submit { width: 100%; margin-top: .25rem; }

/* Bestätigung */
.done { padding-top: .5rem; }
.done__icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center;
}
.done__icon svg { width: 26px; height: 26px; }
.done__icon path { stroke-dasharray: 30; stroke-dashoffset: 30; }
.done[data-play] .done__icon path { animation: draw 450ms var(--ease-out) 150ms forwards; }
.done h3 { margin-top: 1rem; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.done p { margin-top: .4rem; color: var(--muted); }
.done__actions { display: grid; gap: .6rem; margin-top: 1.5rem; }
.done__actions .btn { width: 100%; }

/* ---------- Ladebewegung: einmal, beim ersten Öffnen ---------- */
@keyframes pass-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
@keyframes digit-in { from { transform: translateY(105%); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .pass, .copy > *, .cta { animation: fade 300ms ease both; }
  .year span { animation: none; }
  .sheet, .sheet[data-open] { transform: none; transition: opacity 200ms ease; }
  .sheet { opacity: 0; }
  .sheet[data-open] { opacity: 1; }
  .seg__active { transition: opacity 150ms ease; }
  .done .done__icon path { stroke-dashoffset: 0; animation: none; }
  @keyframes fade { from { opacity: 0; } }
}

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  :root { --gutter: 3rem; }
  .page {
    min-height: 100dvh; align-content: center;
    grid-template-columns: 26rem minmax(0, 24rem);
    justify-content: center; align-items: center;
    column-gap: 5rem;
    padding-bottom: 3rem;
  }
  .pass { max-width: 26rem; }
  .copy { justify-self: start; }
  .lead { font-size: 1.6rem; }
  .cta {
    position: static; padding: 0; background: none; animation: none;
  }
  .cta .btn { width: auto; margin: .5rem 0 0; display: inline-flex; }
  .sheet { bottom: 1.5rem; border-radius: 24px; max-height: calc(100dvh - 3rem); }
  .sheet:not([data-open]) { transform: translateY(calc(100% + 1.5rem)); }
  .handle { display: none; }
  .sheet__head { cursor: default; padding-top: 1.25rem; }
}

/* ---------- 404 ---------- */
.notfound {
  min-height: 100dvh; display: grid; place-content: center; gap: 1rem;
  padding: 2rem var(--gutter); text-align: center;
}
.notfound h1 { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; }
.notfound p { color: var(--muted); }
.notfound .btn { justify-self: center; text-decoration: none; }
