/* Glei website. Layout: one narrow column of text, widgets shown at iOS sizes (1 CSS px = 1 pt), scaled up in the hero. */
:root {
  --page: #fbfaf7;
  --ink: #1b1c1f;
  --muted: #6b6d73;
  --line: #e4e2dc;
  --flap: #f5c84b;

  /* iOS system colours (light) for the widget replicas. */
  --widget: #f2f2f7;
  --label: #000;
  --secondary: rgba(60, 60, 67, 0.6);
  --tint: #007aff;
  --red: #ff3b30;

  --long-distance: #ab0020;
  --regional: #0060f0;
  --bus: #646464;
  --westbahn: #1e9e4a;
  --sev: #ebc81e;

  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0f1012;
    --ink: #f2f1ee;
    --muted: #9a9ca3;
    --line: #26282d;
    --widget: #1c1c1e;
    --label: #fff;
    --secondary: rgba(235, 235, 245, 0.6);
    --tint: #0a84ff;
    --red: #ff453a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 17px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 3px; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* Header */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-block: 24px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.top img { width: 32px; height: 32px; border-radius: 7.5px; }

/* Split-flap board: dark in both appearances, like the boards at the station. */
.board {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 0.6%;
  width: min(1200px, calc(100% - 2 * max(16px, env(safe-area-inset-left))));
  margin: clamp(24px, 8vw, 88px) auto 0;
  padding: 1.4%;
  border-radius: 10px;
  background: #141414;
  box-shadow: inset 0 0 0 1px #000, 0 24px 48px -28px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.cell {
  position: relative;
  aspect-ratio: 0.7;
  perspective: 300px;
  font: 700 8.6cqw/1 var(--display);
  font-stretch: condensed;
  color: #f4f3ef;
}
.half {
  position: absolute;
  left: 0; right: 0;
  height: 50%;
  overflow: hidden;
  background: #262626;
  backface-visibility: hidden;
}
.half b {
  position: absolute;
  left: 0; right: 0;
  height: 200%;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.half.upper { top: 0; border-radius: 3px 3px 0 0; background: #2b2b2b; transform-origin: bottom; }
.half.lower { bottom: 0; border-radius: 0 0 3px 3px; transform-origin: top; }
.half.lower b { top: -100%; }
.half.upper b { top: 0; }
/* The split between the flaps. */
.cell::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: calc(50% - 0.5px);
  height: 1px;
  background: #0b0b0b;
  z-index: 2;
}
.leaf { z-index: 1; }

.reveal { transition: opacity 0.7s ease 0.25s, transform 0.7s ease 0.25s; }
.intro .reveal { opacity: 0; transform: translateY(12px); }
/* During the intro the board sits in the middle of the window (board.js sets the offset), then glides up. */
.board.landing { transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.2, 1); }

/* Hero: what it does on the left, the working widget on the right. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  grid-template-areas: "lead stage" "get stage";
  column-gap: 64px;
  align-items: start;
  padding-block: 72px 112px;
}
.lead { grid-area: lead; padding-top: 50px; } /* level with the widget below the size tabs */
.stage { grid-area: stage; }
.get { grid-area: get; margin-top: 36px; }
.hero p { margin: 0; max-width: 30ch; font-size: 23px; line-height: 1.45; letter-spacing: -0.01em; }

/* "glei" in running text: the app icon, centred on the line like a word. */
.inline-icon {
  width: 1.3em;
  height: 1.3em;
  border-radius: 22.5%;
  vertical-align: -0.3em;
  margin-right: 0.1em;
}

/* Apple's badge, unaltered; at least 40px high. */
.store { display: inline-block; }
.store img { display: block; height: 48px; width: auto; }

/* The widget stage: size tabs, the widget at iOS size (scaled to fit), what was just tapped. */
.stage { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.tabs button {
  font: 600 12px/1 var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 9px 11px;
  cursor: pointer;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-pressed="true"] { background: #141414; color: #f4f3ef; }
.scale { zoom: var(--zoom, 1); }
/* Follows the widget's size, so the caption stays right below it. */
.box { width: 338px; display: flex; justify-content: center; }
.caption {
  min-height: 3.2em;
  max-width: 36ch;
  margin: 0;
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

/* Dictionary entry. */
.define { padding-block: 120px 136px; border-top: 1px solid var(--line); }
.define .hw { margin: 0; font: 700 clamp(56px, 10vw, 104px)/1 var(--display); letter-spacing: -0.04em; }
.define .pron { margin-left: 0.3em; font: 400 0.3em var(--text); letter-spacing: 0; color: var(--muted); vertical-align: middle; }
.define .pos { margin: 18px 0 28px; font-style: italic; color: var(--muted); }
.define ol { margin: 0; padding-left: 1.4em; max-width: 34ch; font-size: 22px; line-height: 1.45; }
.define li { padding-left: 0.3em; margin-bottom: 14px; }
.define li::marker { color: var(--muted); font-weight: 600; }
.define q { quotes: "„" "“"; font-style: italic; }

footer {
  border-top: 1px solid var(--line);
  padding-block: 32px 48px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
}
footer nav { display: flex; gap: 20px; }

/* Text pages (privacy, imprint) */
.text { max-width: 680px; padding-block: 24px 72px; }
.text h1 { font: 700 36px/1.1 var(--display); letter-spacing: -0.03em; margin: 0 0 24px; }
.text h2 { font-size: 20px; margin: 36px 0 8px; }
.text p, .text li { color: var(--ink); }
.text .meta { color: var(--muted); font-size: 15px; }

@media (max-width: 420px) {
  .tabs button { padding: 9px 7px; letter-spacing: 0.04em; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "lead" "stage" "get"; row-gap: 48px; padding-block: 40px 80px; }
  /* One column: text, widget and badge share the centre line. */
  .lead { padding-top: 0; text-align: center; }
  .hero p { margin-inline: auto; }
  .get { margin-top: 0; justify-self: center; }
  /* On the phone the widget comes first, its size tabs below it. */
  .stage .scale { order: 1; }
  .stage .tabs { order: 2; }
  .stage .caption { order: 3; }
  .define { padding-block: 80px 96px; }
}

/* ===== Widget replicas: same measures as the SwiftUI views (pt = px). ===== */
.widget {
  background: var(--widget);
  color: var(--label);
  border-radius: 22px;
  padding: 16px;
  font-family: var(--text);
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  overflow: hidden;
}
.widget.medium { width: 338px; height: 158px; }
.widget.small { width: 158px; height: 158px; }

.w-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.w-head .title, .w-head .count { font-size: 15px; font-weight: 600; white-space: nowrap; }
.w-head .title { overflow: hidden; text-overflow: ellipsis; }
.w-rows { display: flex; flex-direction: column; gap: 6px; }
.w-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }

.row { display: flex; align-items: center; gap: 6px; height: 18px; }
.row .dep { width: 50px; font-size: 14px; font-weight: 600; position: relative; font-variant-numeric: tabular-nums; }
.row .dep.late { color: var(--red); }
.row .dep .pill {
  position: absolute; left: 34px; top: -8px;
  font-size: 9px; font-weight: 800; color: #fff;
  background: var(--red); border-radius: 99px; padding: 0 3px;
  box-shadow: 0 0 0 1px var(--widget);
}
.row .arr { width: 34px; text-align: right; font-size: 12px; color: var(--secondary); font-variant-numeric: tabular-nums; }
.bar { flex: 1; display: flex; align-items: center; gap: 3px; min-width: 0; }
.plat {
  min-width: 21px; height: 16px; padding: 0 3px;
  border: 1px solid var(--secondary); border-radius: 4px;
  font-size: 10px; font-weight: 700; color: var(--secondary);
  display: grid; place-items: center;
}
.seg {
  height: 16px; border-radius: 3px; color: #fff;
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
  white-space: nowrap; overflow: hidden; padding: 0 3px;
}
.seg.rjx { background: var(--long-distance); }
.seg.s { background: var(--regional); }
.seg.wb { background: var(--westbahn); }
.seg.bus { background: var(--bus); }
.seg.sev { background: var(--sev); color: #000; }
.gap { width: 10px; flex: none; display: flex; justify-content: center; gap: 1.5px; }
.gap i { width: 2.5px; height: 2.5px; border-radius: 50%; background: var(--secondary); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--tint);
  background: color-mix(in srgb, var(--tint) 12%, transparent);
  border-radius: 7px; padding: 3px 8px;
}
.chip svg { width: 13px; height: 13px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--tint) 30%, transparent); }
.dots i.on { background: var(--tint); }

/* Small */
.pair { display: grid; grid-template-columns: 13px 1fr; column-gap: 7px; font-size: 12px; font-weight: 600; color: var(--secondary); line-height: 15px; }
.pair svg { width: 13px; height: 15px; }
.pair .stem { display: flex; justify-content: center; gap: 0; height: 5px; }
.pair .stem i { width: 2px; height: 2px; border-radius: 50%; background: var(--secondary); }
.big { font: 700 26px/1.1 var(--display); margin-top: auto; font-variant-numeric: tabular-nums; }
.next { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Lock screen rectangular */
.rect { text-align: left; width: 170px; margin: 0 auto; font-size: 13px; line-height: 1.3; }
.rect .t { font-weight: 600; font-size: 15px; }
.rect .plat { border-color: rgba(255, 255, 255, 0.7); color: #fff; display: inline-grid; vertical-align: -3px; }

/* Working widget: sizes morph into each other, buttons react. */
.widget { transition: width 0.45s cubic-bezier(0.3, 0.7, 0.2, 1), height 0.45s cubic-bezier(0.3, 0.7, 0.2, 1), background-color 0.3s; }
.widget .content { display: flex; flex-direction: column; height: 100%; transition: opacity 0.15s; }
.widget.fading .content { opacity: 0; }
.widget.large { width: 338px; height: 354px; }
.widget button { font-family: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.widget .chip { color: var(--tint); background: color-mix(in srgb, var(--tint) 12%, transparent); padding: 3px 8px; }
.widget .chip:active, .widget .loc:active { transform: scale(0.94); }
.widget .loc { width: 14px; height: 14px; color: var(--secondary); display: grid; place-items: center; }
.widget .loc svg { width: 12px; height: 12px; }
.widget .row { cursor: pointer; }
.spin svg { animation: spin 0.7s ease; }
@keyframes spin { to { transform: rotate(360deg); } }
.section-gap { flex: 1; min-height: 6px; display: flex; align-items: center; }
.section-gap hr { width: 100%; border: 0; border-top: 0.5px solid var(--secondary); opacity: 0.5; margin: 0; }

/* Lock screen: the clock with the inline widget above and the rectangular one below. */
.widget.lockscreen { width: 300px; height: 250px; background: #141414; color: #fff; text-align: center; justify-content: center; }
.lockscreen .content { justify-content: center; align-items: center; cursor: pointer; }
.lockscreen .inline { font-size: 15px; font-weight: 600; opacity: 0.85; }
.lockscreen .clock { font: 600 84px/1 var(--display); letter-spacing: -0.02em; margin: 2px 0 14px; font-variant-numeric: tabular-nums; }
