/* Memonary landing — styles for /de/ and /en/.
   Colors only from memonary/docs/marke/marke.md, light design only (E6).
   Navy = action and frame; sand never as text. */

/* ── Fonts (Fontsource, SIL OFL 1.1, see /fonts/OFL-*.txt) ─────────────── */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/playfair-display-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/playfair-display-latin-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/playfair-display-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/playfair-display-latin-600-italic.woff2") format("woff2");
}

/* ── Tokens ────────────────────────────────────────────────────────────── */

:root {
  --text:        #111111;
  --bg:          #FAF9F7;
  --navy:        #1F3A66;
  --navy-hover:  #182E52;
  --on-navy:     #FAF9F7;
  --grey:        #6B6B6B;
  --surface:     #E4E2DE;   /* marke.md: Statistik-Karte Land */
  --danger:      #B4433A;   /* marke.md: errors only */

  --font-body:    "Inter", system-ui, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  --gutter: 16px;
  --head-h: 56px;
  --pw:     min(72vw, 280px);   /* phone width in the phases */
  --gap:    72px;               /* space between phases */
  --dot:    14px;
  --rail:   28px;               /* mobile column for line and dots */
  --dot-top: 6px;               /* mobile: dot aligned with the number line */
}

@media (min-width: 900px) {
  :root {
    --gutter: 32px;
    --pw:     260px;
    --gap:    48px;
  }
}

/* ── Base ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--navy); }

body {
  margin: 0;
  background: var(--navy);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, p, figure, ol { margin: 0; }

[hidden] { display: none !important; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ── Head (navy frame, full width) ─────────────────────────────────────── */

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--head-h);
  padding: 0 var(--gutter);
  color: var(--on-navy);
}

.head :focus-visible { outline-color: var(--on-navy); }

.brand { display: block; }
.brand img { display: block; height: 24px; width: auto; }

.lang {
  display: flex;
  gap: 4px;
  font-size: 0.875rem;
}

.lang a {
  padding: 6px 8px;
  text-decoration: none;
  opacity: 0.72;
  transition: opacity 150ms ease;
}

.lang a[aria-current="page"] {
  opacity: 1;
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .lang a:hover { opacity: 1; }
}

/* ── Window (light content, rounded top) ───────────────────────────────── */

.window {
  min-height: calc(100vh - var(--head-h));
  background: var(--bg);
  border-radius: 20px 20px 0 0;
}

/* ── Hero ──────────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  gap: 56px;
  padding-top: 56px;
  padding-bottom: 96px;
}

.hero h1 {
  max-width: 11ch;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.75rem, 1.4rem + 5.6vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.lede {
  max-width: 34ch;
  margin-top: 24px;
  font-size: 1.1875rem;
  line-height: 1.5;
}

.phone-hero {
  --pw: min(78vw, 300px);
  justify-self: center;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 64px;
    padding-top: 32px;
    padding-bottom: 96px;
  }

  /* Whole phone within the first screen: phone height is about 2.08 x its
     width (frame + 390:844 screen), so width = (viewport - head - padding-top
     - 32px air) * 0.48, capped at 300px. */
  .phone-hero {
    --pw: min(300px, calc((100vh - 120px) * 0.48));
    justify-self: end;
  }

  @supports (height: 100svh) {
    .phone-hero { --pw: min(300px, calc((100svh - 120px) * 0.48)); }
  }
}

/* ── Signup form (no function in L2) ───────────────────────────────────── */

.signup {
  max-width: 480px;
  margin-top: 36px;
}

.signup-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signup input[type="email"] {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--grey);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.signup input[type="email"]::placeholder { color: var(--grey); }

.signup input[type="email"]:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
  border-color: var(--navy);
  border-radius: 12px;
}

.signup button,
.notice-form button {
  height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--navy);
  color: var(--on-navy);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}

.signup button:active,
.notice-form button:active { transform: scale(0.97); }

.signup button:disabled,
.notice-form button:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .signup button:hover,
  .notice-form button:hover { background: var(--navy-hover); }
}

@media (min-width: 560px) {
  .signup-row { flex-direction: row; }
  .signup input[type="email"] { flex: 1; }
}

.signup-note {
  margin-top: 12px;
  color: var(--grey);
  font-size: 0.875rem;
}

.signup-note a {
  color: var(--navy);
  text-underline-offset: 2px;
}

.signup-done {
  margin-top: 12px;
  font-size: 1rem;
}

.signup-turnstile { margin-top: 12px; }
.signup-turnstile:empty { display: none; }

.signup-error {
  margin-top: 12px;
  color: var(--danger);
  font-size: 0.9375rem;
}

/* ── Message page (worker, form POST without JS) ───────────────────────── */

.notice {
  max-width: 640px;
  padding-top: 72px;
  padding-bottom: 96px;
}

.notice-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem);
  line-height: 1.2;
}

.notice-text {
  max-width: 44ch;
  margin-top: 16px;
  font-size: 1.0625rem;
}

.notice-form {
  margin-top: 28px;
}

.notice-back {
  margin-top: 24px;
}

.notice-back a {
  color: var(--navy);
  text-underline-offset: 2px;
}

/* ── Phone frame (placeholder now, screenshot in L2b) ──────────────────── */

.phone {
  width: var(--pw);
  padding: calc(var(--pw) * 0.035);
  background: var(--text);
  border-radius: calc(var(--pw) * 0.16);
}

.screen {
  display: grid;
  place-items: center;
  aspect-ratio: 390 / 844;
  overflow: hidden;
  background: var(--surface);
  border-radius: calc(var(--pw) * 0.13);
}

.screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen span {
  color: var(--text);
  font-size: 0.875rem;
}

/* ── Phases on the route (dot, line, dot) ──────────────────────────────── */

.phases {
  padding-bottom: 128px;
}

.route {
  display: grid;
  gap: var(--gap);
  padding: 0;
  list-style: none;
}

.phase {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  column-gap: 12px;
  row-gap: 32px;
}

/* Line segment from this dot to the next one. */
.phase::before {
  content: "";
  position: absolute;
  left: calc(var(--rail) / 2 - 1px);
  top: calc(var(--dot-top) + var(--dot) / 2);
  width: 2px;
  height: calc(100% + var(--gap));
  background: var(--navy);
  transform-origin: top;
}

.phase:last-child::before { content: none; }

.dot {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: var(--dot);
  height: var(--dot);
  margin-top: var(--dot-top);
  border: 2px solid var(--navy);
  border-radius: 50%;
  background: var(--navy);
}

.phase-text {
  grid-column: 2;
  grid-row: 1;
  max-width: 36ch;
}

.phase-no {
  display: block;
  color: var(--grey);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}

.phase h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.875rem, 1.3rem + 2vw, 2.625rem);
  line-height: 1.1;
}

.phase p {
  margin-top: 14px;
  font-size: 1.0625rem;
}

.phase .phone {
  grid-column: 2;
  grid-row: 2;
}

@media (min-width: 900px) {
  .phase {
    grid-template-columns: 1fr 96px 1fr;
    align-items: center;
    row-gap: 0;
  }

  .phase::before {
    left: calc(50% - 1px);
    top: 50%;
  }

  .dot {
    grid-column: 2;
    margin-top: 0;
  }

  .phase-text {
    grid-column: 1;
    justify-self: end;
  }

  .phase .phone {
    grid-column: 3;
    grid-row: 1;
    justify-self: start;
  }

  .phase:nth-child(even) .phase-text {
    grid-column: 3;
    justify-self: start;
  }

  .phase:nth-child(even) .phone {
    grid-column: 1;
    justify-self: end;
  }
}

/* The route draws itself while scrolling; dots fill when reached.
   Without scroll-driven animations or with reduced motion the route is static. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .phase::before {
      animation: route-draw linear both;
      animation-timeline: view();
      animation-range: cover 25% cover 60%;
    }

    .dot {
      animation: dot-fill linear both;
      animation-timeline: view();
      animation-range: entry 100% cover 45%;
    }
  }
}

@keyframes route-draw {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

@keyframes dot-fill {
  from { background-color: var(--bg); }
  to   { background-color: var(--navy); }
}

/* ── Closing ───────────────────────────────────────────────────────────── */

.closing {
  padding-bottom: 128px;
}

.closing h2 {
  max-width: 18ch;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2rem, 1.3rem + 2.8vw, 3.25rem);
  line-height: 1.08;
}

/* ── Foot ──────────────────────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--surface);
}

.foot p {
  padding-top: 28px;
  padding-bottom: 40px;
  color: var(--grey);
  font-size: 0.875rem;
}

.foot a {
  text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
  .foot a:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
  }
}

/* Waitlist count: number only, set by the worker (src/worker.js); empty on failure. */
.foot-count {
  margin-top: -28px;
  padding-bottom: 24px;
  color: var(--grey);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.foot-count:empty { display: none; }
