/*
 * OptiCord landing.
 * Palette taken from road signage: cool asphalt-white ground, deep navy ink, motorway-sign
 * blue as the single accent. The three ETA segment colours are a validated categorical set
 * (CVD-safe in both themes) and are only used where they encode a part of the journey.
 */

:root {
  color-scheme: light;

  --ground: #F1F3F6;
  --ground-alt: #E7EBF0;
  --surface: #FFFFFF;
  --ink: #111A26;
  --ink-soft: #2B3747;
  --muted: #566375;
  --line: #D3DAE3;
  --accent: #1F4EA6;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCE5F5;
  --closing: #13223A;
  --closing-ink: #F1F3F6;

  /* Journey segments (validated: dataviz validate_palette, light vs #FFFFFF). */
  --seg-to: #2C5BB8;
  --seg-wait: #C9810F;
  --seg-after: #13917A;

  /* Queue tones, semantic only. */
  --q-low: #23864A;
  --q-moderate: #B8740A;
  --q-high: #C8372B;
  --q-closed: #8C97A6;

  /* Telegram surfaces for the app and chat mock-ups (Telegram's own day palette). */
  --tg-bg: #FFFFFF;
  --tg-secondary: #EFEFF4;
  --tg-text: #000000;
  --tg-hint: #8E8E93;
  --tg-link: #2481CC;
  --tg-button: #3390EC;
  --tg-button-text: #FFFFFF;
  --tg-sep: rgba(60, 60, 67, 0.16);
  --tg-accent-soft: rgba(51, 144, 236, 0.14);
  --tg-skeleton: #E4E6EB;
  --chat-bg: #DCE3EA;
  --key-bg: rgba(17, 26, 38, 0.38);
  --key-ink: #FFFFFF;

  --font-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --font-body: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem);
  --step-3: clamp(1.875rem, 1.2rem + 2.8vw, 3.25rem);

  --radius: 10px;
  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0F151D;
    --ground-alt: #141C26;
    --surface: #18212C;
    --ink: #E7ECF2;
    --ink-soft: #C6CFDA;
    --muted: #93A0AF;
    --line: #2A3646;
    --accent: #7FA4F0;
    --accent-ink: #0B1220;
    --accent-soft: #1E2C45;
    --closing: #1A2B47;
    --closing-ink: #E7ECF2;
    --seg-to: #5B86DE;
    --seg-wait: #BC7E1E;
    --seg-after: #16A086;
    --q-low: #3DB36A;
    --q-moderate: #D9962C;
    --q-high: #E5594C;
    --q-closed: #6B7787;
    --tg-bg: #17212B;
    --tg-secondary: #232E3C;
    --tg-text: #F5F5F5;
    --tg-hint: #708499;
    --tg-link: #6AB3F3;
    --tg-button: #5288C1;
    --tg-button-text: #FFFFFF;
    --tg-sep: rgba(255, 255, 255, 0.07);
    --tg-accent-soft: rgba(106, 179, 243, 0.14);
    --tg-skeleton: #2A3747;
    --chat-bg: #0E1621;
    --key-bg: rgba(255, 255, 255, 0.1);
    --key-ink: #F5F5F5;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0F151D;
  --ground-alt: #141C26;
  --surface: #18212C;
  --ink: #E7ECF2;
  --ink-soft: #C6CFDA;
  --muted: #93A0AF;
  --line: #2A3646;
  --accent: #7FA4F0;
  --accent-ink: #0B1220;
  --accent-soft: #1E2C45;
  --closing: #1A2B47;
  --closing-ink: #E7ECF2;
  --seg-to: #5B86DE;
  --seg-wait: #BC7E1E;
  --seg-after: #16A086;
  --q-low: #3DB36A;
  --q-moderate: #D9962C;
  --q-high: #E5594C;
  --q-closed: #6B7787;
  --tg-bg: #17212B;
  --tg-secondary: #232E3C;
  --tg-text: #F5F5F5;
  --tg-hint: #708499;
  --tg-link: #6AB3F3;
  --tg-button: #5288C1;
  --tg-button-text: #FFFFFF;
  --tg-sep: rgba(255, 255, 255, 0.07);
  --tg-accent-soft: rgba(106, 179, 243, 0.14);
  --tg-skeleton: #2A3747;
  --chat-bg: #0E1621;
  --key-bg: rgba(255, 255, 255, 0.1);
  --key-ink: #F5F5F5;
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

h1 {
  font-size: var(--step-3);
}

h2 {
  font-size: var(--step-2);
}

h3 {
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.3;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--ground-alt);
  white-space: nowrap;
}

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

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

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--ink);
  z-index: 100;
}

.skip:focus {
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.fine {
  font-size: var(--step--1);
  color: var(--muted);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 8px;
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 var(--step-0) / 1 var(--font-body);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ground);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
}

.btn--small {
  min-height: 38px;
  padding: 0 14px;
  font-size: var(--step--1);
}

.btn--inverse {
  background: var(--closing-ink);
  border-color: var(--closing-ink);
  color: var(--closing);
}

.btn--inverse-ghost {
  background: transparent;
  border-color: var(--closing-ink);
  color: var(--closing-ink);
}

.btn--inverse:hover,
.btn--inverse-ghost:hover {
  background: transparent;
  border-color: var(--closing-ink);
  color: var(--closing-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}

.site-header__row {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.site-nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9375rem;
}

.site-nav a:hover {
  color: var(--accent);
}

@media (max-width: 760px) {
  .site-nav {
    display: none;
  }

  .lang {
    margin-left: auto;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(40px, 7vw, 88px) clamp(48px, 7vw, 96px);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.hero__copy {
  display: grid;
  gap: 24px;
  padding-top: clamp(0px, 2vw, 24px);
}

.hero__copy h1 {
  max-width: 14ch;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 34em;
}

.formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding-block: 18px;
  border-block: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.formula__term {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.formula__term i {
  width: 22px;
  height: 8px;
  border-radius: 2px;
}

.formula__term--to i {
  background: var(--seg-to);
}

.formula__term--wait i {
  background: var(--seg-wait);
}

.formula__term--after i {
  background: var(--seg-after);
}

.formula__op {
  color: var(--muted);
}

.formula__result {
  font-weight: 500;
  color: var(--accent);
}

@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }

  .hero__copy h1 {
    max-width: 18ch;
  }
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(64px, 9vw, 120px);
}

.section--alt {
  background: var(--ground-alt);
}

.section__head {
  display: grid;
  gap: 14px;
  max-width: 44rem;
  margin-bottom: clamp(32px, 4vw, 48px);
}

.section__lead {
  color: var(--ink-soft);
  font-size: 1.0625rem;
  max-width: 40em;
}

/* ---------- Tabs ---------- */

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 9px;
  background: var(--ground-alt);
}

.section--alt .tabs {
  background: var(--ground);
}

.tab {
  appearance: none;
  border: 0;
  padding: 8px 14px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font: 500 0.9375rem / 1.2 var(--font-body);
  cursor: pointer;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(17, 26, 38, 0.12);
}

/* ---------- Comparison chart ---------- */

.chart-card {
  position: relative;
  padding: clamp(18px, 3vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.chart-card__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.sw--to {
  background: var(--seg-to);
}

.sw--wait {
  background: var(--seg-wait);
}

.sw--after {
  background: var(--seg-after);
}

.chart {
  --label-w: 170px;
  --total-w: 92px;
  display: grid;
  gap: 10px;
}

.chart__row {
  display: grid;
  grid-template-columns: var(--label-w) minmax(0, 1fr) var(--total-w);
  align-items: center;
  gap: 14px;
}

.chart__name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.9375rem;
  min-width: 0;
}

.chart__rank {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  width: 1.4em;
  flex: none;
}

.chart__label {
  overflow-wrap: anywhere;
}

.chart__track {
  position: relative;
  height: 22px;
}

.chart__bar {
  display: flex;
  gap: 2px;
  height: 100%;
  transition: width 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.chart__seg {
  height: 100%;
  min-width: 2px;
  cursor: default;
  transition: flex-grow 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.15s;
}

.chart__seg:first-child {
  border-radius: 4px 0 0 4px;
}

.chart__seg:last-child {
  border-radius: 0 4px 4px 0;
}

.chart__seg--to {
  background: var(--seg-to);
}

.chart__seg--wait {
  background: var(--seg-wait);
}

.chart__seg--after {
  background: var(--seg-after);
}

.chart__total {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.chart__row.is-out .chart__name,
.chart__row.is-out .chart__total {
  color: var(--muted);
}

.chart__row.is-out .chart__seg {
  opacity: 0.38;
}

.chart__row.is-top .chart__label {
  font-weight: 600;
}

.chart__badge {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  line-height: 1.3;
}

.chart__cut {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart__cut::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--line);
}

.chart__axis {
  display: grid;
  grid-template-columns: var(--label-w) minmax(0, 1fr) var(--total-w);
  gap: 14px;
  margin-top: 4px;
}

.chart__ticks {
  position: relative;
  height: 20px;
  border-top: 1px solid var(--line);
}

.chart__tick {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
}

.chart__tick:first-child {
  transform: none;
}

.chart__tick:last-child {
  transform: translateX(-100%);
}

.chart__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart__grid span {
  position: absolute;
  top: -4px;
  bottom: -4px;
  border-left: 1px solid var(--line);
  opacity: 0.6;
}

.chart-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  max-width: 48em;
}

.chart-note strong {
  color: var(--ink);
}

.tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--ground);
  font-size: var(--step--1);
  line-height: 1.4;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}

.tooltip b {
  font-weight: 600;
}

@media (max-width: 640px) {
  .chart {
    --label-w: 1fr;
  }

  .chart__row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
  }

  .chart__name {
    grid-column: 1;
  }

  .chart__total {
    grid-column: 2;
    grid-row: 1;
  }

  .chart__track {
    grid-column: 1 / -1;
  }

  .chart__axis {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart__axis > :first-child,
  .chart__axis > :last-child {
    display: none;
  }
}

/* ---------- Queue board + map ---------- */

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.map {
  margin: 0;
  display: grid;
  gap: 10px;
}

.map svg {
  width: 100%;
  max-width: 460px;
  height: auto;
  display: block;
}

.map figcaption {
  font-size: var(--step--1);
  color: var(--muted);
}

.map .country {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  fill: var(--muted);
}

.map .border-line {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.map .side-pl {
  fill: var(--ground-alt);
}

.section--alt .map .side-pl {
  fill: var(--ground);
}

.map .city circle {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.5;
}

.map .city text {
  font-size: 12px;
  fill: var(--muted);
}

.map .kpp {
  cursor: pointer;
}

.map .kpp circle.hit {
  fill: transparent;
}

.map .kpp circle.mark {
  stroke: var(--surface);
  stroke-width: 2;
  transition: r 0.15s;
}

.map .kpp text {
  font-size: 12px;
  font-weight: 500;
  fill: var(--ink);
}

.map .kpp text.wait {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  fill: var(--muted);
}

.map .kpp.is-active circle.mark {
  r: 9;
}

.map .kpp.is-active text:not(.wait) {
  font-weight: 600;
}

.map .kpp:focus-visible {
  outline: none;
}

.map .kpp:focus-visible circle.mark {
  stroke: var(--accent);
  stroke-width: 3;
}

.tone-low {
  fill: var(--q-low);
}

.tone-moderate {
  fill: var(--q-moderate);
}

.tone-high {
  fill: var(--q-high);
}

.tone-closed {
  fill: var(--q-closed);
}

.board {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2.5vw, 24px);
  display: grid;
  gap: 16px;
}

.board .tabs {
  background: var(--ground-alt);
}

.board__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.board__table th {
  text-align: left;
  font-weight: 500;
  font-size: var(--step--1);
  color: var(--muted);
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
}

.board__table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}

.board__table tr:last-child td {
  border-bottom: 0;
}

.board__table tbody tr {
  cursor: pointer;
}

.board__table tbody tr:hover td,
.board__table tbody tr.is-active td {
  background: var(--accent-soft);
}

.board__table tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.board__name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.board__name small {
  display: block;
  font-size: var(--step--1);
  color: var(--muted);
}

.board__wait,
.board__age {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.board__age,
.board__trend {
  color: var(--muted);
  font-size: 0.875rem;
}

.board__trend {
  white-space: nowrap;
}

.board__scroll {
  overflow-x: auto;
  min-width: 0;
}

.board__wait.is-closed {
  font-family: var(--font-body);
  color: var(--muted);
}

.board__age small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--q-moderate);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}

.dot--low {
  background: var(--q-low);
}

.dot--moderate {
  background: var(--q-moderate);
}

.dot--high {
  background: var(--q-high);
}

.dot--closed {
  background: var(--q-closed);
}

.tone-key {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: var(--step--1);
  color: var(--muted);
}

.tone-key li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 900px) {
  .board-layout {
    grid-template-columns: 1fr;
  }

  .map svg {
    max-width: 380px;
    margin-inline: auto;
  }
}

@media (max-width: 640px) {
  .board__table th:nth-child(3),
  .board__table td:nth-child(3) {
    display: none;
  }
}

/* ---------- Tracking ---------- */

.trip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
}

.trip__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  display: grid;
}

.trip__steps::before {
  content: "";
  position: absolute;
  left: 63px;
  top: 18px;
  bottom: 18px;
  border-left: 2px solid var(--line);
}

.trip__step {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: 48px 32px minmax(0, 1fr);
  align-items: start;
  gap: 0;
  padding: 12px 12px 12px 0;
  border-radius: 8px;
}

.trip__step:hover {
  background: var(--ground);
}

.trip__time {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted);
  padding-top: 1px;
  font-variant-numeric: tabular-nums;
}

.trip__pin {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin: 6px 0 0 10px;
  border-radius: 50%;
  background: var(--ground-alt);
  border: 2px solid var(--muted);
}

.trip__text {
  display: grid;
  gap: 2px;
}

.trip__text strong {
  font-weight: 600;
}

.trip__text span {
  font-size: 0.875rem;
  color: var(--muted);
}

.trip__step[aria-selected="true"] {
  background: var(--surface);
}

.trip__step[aria-selected="true"] .trip__pin {
  background: var(--accent);
  border-color: var(--accent);
}

.trip__step[aria-selected="true"] .trip__time {
  color: var(--ink);
}

.trip__panel {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 8px;
  padding: 16px 12px;
  background: var(--chat-bg);
  border-radius: 18px;
}

.trip__note {
  font-size: var(--step--1);
  color: var(--muted);
  padding: 6px 4px 0;
}

@media (max-width: 860px) {
  .trip {
    grid-template-columns: 1fr;
  }

  .trip__panel {
    position: static;
  }
}

/* ---------- Closing + footer ---------- */

.closing {
  background: var(--closing);
  color: var(--closing-ink);
  padding-block: clamp(56px, 8vw, 96px);
}

.closing__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
}

.closing h2 {
  max-width: 20ch;
}

.site-footer {
  padding-block: 32px 40px;
  font-size: var(--step--1);
  color: var(--muted);
}

.site-footer__row {
  display: grid;
  gap: 6px;
}

.site-footer strong {
  color: var(--ink);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* ---------- Language switch ---------- */

.lang {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--ground-alt);
}

.lang__btn {
  appearance: none;
  border: 0;
  padding: 5px 9px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 500 0.75rem / 1.2 var(--font-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang__btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
}

@media (max-width: 420px) {
  .header-cta {
    display: none;
  }
}

/* ---------- Buttons: block + disabled ---------- */

.btn--block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--ghost:disabled:hover {
  background: transparent;
  color: var(--accent);
}

/* ---------- Mini App mock-up ---------- */

.device-wrap {
  margin: 0;
  justify-self: end;
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 12px;
}

.device-wrap figcaption {
  font-size: var(--step--1);
  color: var(--muted);
  padding-inline: 4px;
}

.device {
  display: flex;
  flex-direction: column;
  height: 640px;
  max-height: 82vh;
  min-height: 520px;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: var(--tg-secondary);
  color: var(--tg-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, var(--font-body);
  font-size: 15px;
  line-height: 1.35;
  box-shadow: 0 24px 48px -28px rgba(17, 26, 38, 0.45);
}

.app-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 54px;
  padding: 0 14px 0 18px;
  background: var(--tg-bg);
  border-bottom: 1px solid var(--tg-sep);
  flex: none;
}

.app-head__back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--tg-link);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -8px;
  border-radius: 50%;
  cursor: pointer;
}

.app-head__title {
  font-size: 17px;
  font-weight: 600;
}

.app-head__icons {
  margin-left: auto;
  display: inline-flex;
  gap: 14px;
  color: var(--tg-hint);
}

.app-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 12px;
}

.app-foot {
  flex: none;
  background: var(--tg-bg);
  border-top: 1px solid var(--tg-sep);
  padding: 8px 12px 12px;
  display: grid;
  gap: 8px;
}

.app-tabs {
  display: flex;
  gap: 6px;
}

.app-tab {
  appearance: none;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 21px;
  background: transparent;
  color: var(--tg-hint);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.app-tab[aria-current="page"] {
  background: var(--tg-accent-soft);
  color: var(--tg-link);
  font-weight: 600;
}

.app-main {
  appearance: none;
  border: 0;
  min-height: 48px;
  border-radius: 12px;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.app-main:hover {
  filter: brightness(1.06);
}

.app-main:disabled {
  opacity: 0.6;
  cursor: progress;
}

.app-segment {
  display: flex;
  margin: 12px 14px 4px;
  padding: 2px;
  border-radius: 10px;
  background: var(--tg-sep);
}

.app-segment button {
  appearance: none;
  flex: 1;
  border: 0;
  padding: 7px 6px;
  border-radius: 8px;
  background: transparent;
  color: var(--tg-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.app-segment button[aria-pressed="true"] {
  background: var(--tg-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.app-section {
  margin: 0;
  padding: 18px 18px 8px;
  color: var(--tg-link);
  font-size: 14px;
  font-weight: 600;
}

.app-section--plain {
  color: var(--tg-hint);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.app-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--tg-bg);
}

.app-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 11px 18px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  position: relative;
}

button.app-cell {
  cursor: pointer;
}

button.app-cell:hover {
  background: var(--tg-accent-soft);
}

.app-list > li + li .app-cell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 42px;
  right: 0;
  border-top: 1px solid var(--tg-sep);
}

.app-cell__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.app-cell__sub,
.app-cell__desc {
  color: var(--tg-hint);
  font-size: 13.5px;
}

.app-cell__head {
  color: var(--tg-hint);
  font-size: 13px;
}

.app-cell__after {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.app-trend {
  color: var(--tg-hint);
  margin-left: 4px;
}

.app-icon {
  color: var(--tg-link);
  display: grid;
}

.app-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--q-closed);
}

.app-dot--low { background: var(--q-low); }
.app-dot--moderate { background: var(--q-moderate); }
.app-dot--high { background: var(--q-high); }

.app-slot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--tg-button);
}

.app-slot--from {
  background: var(--tg-button);
}

.app-hint {
  margin: 0;
  padding: 8px 18px;
  color: var(--tg-hint);
  font-size: 13px;
}

.app-best {
  background: var(--tg-bg);
  padding: 12px 18px 16px;
  display: grid;
  gap: 4px;
}

.app-best__total {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.app-best__total span {
  font-size: 15px;
  font-weight: 400;
  color: var(--tg-hint);
}

.app-eta {
  margin-top: 8px;
}

.app-eta__bar {
  display: flex;
  gap: 2px;
  height: 10px;
}

.app-eta__bar span:first-child { border-radius: 5px 0 0 5px; }
.app-eta__bar span:last-child { border-radius: 0 5px 5px 0; }

.app-eta__legend {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12.5px;
  color: var(--tg-hint);
}

.app-eta__legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-eta__legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.s-to { background: var(--seg-to); }
.s-wait { background: var(--seg-wait); }
.s-after { background: var(--seg-after); }

.app-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.app-actions__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.app-btn {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
}

.app-btn--soft {
  min-height: 36px;
  background: var(--tg-accent-soft);
  color: var(--tg-link);
  font-size: 13.5px;
}

.app-skeleton {
  display: grid;
  gap: 8px;
  padding: 14px 18px;
}

.app-skeleton span {
  height: 12px;
  border-radius: 6px;
  background: var(--tg-skeleton);
  animation: pulse 1.1s ease-in-out infinite alternate;
}

.app-skeleton span:last-child {
  width: 55%;
}

@keyframes pulse {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

@media (max-width: 900px) {
  .device-wrap {
    justify-self: start;
  }
}

/* ---------- Chat bubble + inline keyboard (tracking) ---------- */

.bubble--card {
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--tg-bg);
  color: var(--tg-text);
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-line;
  font-variant-numeric: tabular-nums;
}

.bubble--card b {
  font-weight: 600;
}

.keyboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.key {
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--key-bg);
  color: var(--key-ink);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

.key--wide {
  grid-column: 1 / -1;
}

/* ---------- Feature tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2.5vw, 28px);
}

.tile {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: clamp(20px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tile__text {
  display: grid;
  gap: 8px;
}

.tile__text p {
  color: var(--ink-soft);
  max-width: 36em;
}

.ui-panel {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--tg-bg);
  color: var(--tg-text);
  border: 1px solid var(--tg-sep);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, var(--font-body);
  font-size: 15px;
}

.ui-panel--list {
  padding: 0 0 6px;
}

.ui-panel--list .app-section {
  padding-top: 14px;
}

.ui-label {
  font-weight: 600;
}

.ui-sub {
  color: var(--tg-hint);
  font-size: 13.5px;
  margin-top: 2px;
}

.ui-section {
  margin: 0;
  padding: 14px 18px 6px;
  color: var(--tg-link);
  font-size: 14px;
  font-weight: 600;
}

.ui-button {
  appearance: none;
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 0;
  border-radius: 10px;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.ui-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ui-done {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 500;
}

.ui-done button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--tg-link);
  font: inherit;
  cursor: pointer;
  padding: 4px 0;
}

/* Confidence */

.conf-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
}

.conf-head strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.conf-meter {
  height: 8px;
  margin-top: 10px;
  border-radius: 4px;
  background: var(--tg-secondary);
  overflow: hidden;
}

.conf-meter span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--q-low);
  transition: width 0.25s ease-out, background-color 0.25s;
}

.conf-meter.is-medium span { background: var(--q-moderate); }
.conf-meter.is-low span { background: var(--q-high); }

.conf-level {
  margin-top: 6px;
  color: var(--tg-hint);
  font-size: 13.5px;
}

.conf-factors {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 13.5px;
}

.conf-factors li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.conf-factors b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--tg-hint);
}

.conf-factors .app-dot.is-full { background: var(--q-low); }
.conf-factors .app-dot.is-part { background: var(--q-moderate); }
.conf-factors .app-dot.is-none { background: var(--q-high); }

.conf-slider {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--tg-sep);
  font-size: 13.5px;
  color: var(--tg-hint);
}

.conf-slider output {
  color: var(--tg-text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.conf-slider input {
  width: 100%;
  accent-color: var(--tg-button);
}

.conf-note {
  margin-top: 10px;
  min-height: 2.6em;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--q-moderate);
  visibility: hidden;
}

.conf-note.is-visible {
  visibility: visible;
}

/* Report chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  appearance: none;
  border: 0;
  padding: 8px 13px;
  border-radius: 18px;
  background: var(--tg-secondary);
  color: var(--tg-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--tg-button);
  color: var(--tg-button-text);
}

/* Recent routes */

.recent {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent .app-cell {
  grid-template-columns: auto minmax(0, 1fr);
}

.recent li + li .app-cell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 52px;
  right: 0;
  border-top: 1px solid var(--tg-sep);
}

.recent__result {
  color: var(--tg-hint);
  font-size: 13.5px;
}

.recent__result.is-ready {
  color: var(--tg-text);
}

/* Share */

.share {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: var(--chat-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, var(--font-body);
}

.share__input {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 20px;
  background: var(--tg-bg);
  color: var(--tg-text);
  font-size: 15px;
}

.share__bot {
  color: var(--tg-link);
}

.share__caret {
  width: 1.5px;
  height: 18px;
  background: var(--tg-link);
  animation: caret 1s steps(1) infinite;
}

@keyframes caret {
  50% { opacity: 0; }
}

.share__msg {
  justify-self: end;
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px 14px 4px 14px;
  background: var(--tg-bg);
  color: var(--tg-text);
  font-size: 14px;
  line-height: 1.45;
}

.share__foot {
  margin-top: 6px;
  color: var(--tg-hint);
  font-size: 13px;
}

@media (max-width: 820px) {
  .tiles {
    grid-template-columns: 1fr;
  }
}

/* ---------- Privacy: GPS demo ---------- */

.gps {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.gps__stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(14px, 2.5vw, 24px);
  display: grid;
  gap: 14px;
}

.gps__stage svg {
  width: 100%;
  height: auto;
  display: block;
}

.gps__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.gps__count {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.gps__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gps .road {
  fill: none;
  stroke: var(--ground-alt);
  stroke-width: 22;
  stroke-linecap: round;
}

.gps .road-mark {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
  stroke-dasharray: 10 10;
}

.gps .end text,
.gps .pt-label {
  font-family: var(--font-mono);
  font-size: 12px;
  fill: var(--muted);
}

.gps .end circle {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 2;
}

.gps .barrier {
  stroke: var(--q-high);
  stroke-width: 4;
  stroke-dasharray: 6 4;
}

.gps .pt-latest {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 3;
}

.gps .pt-recalc {
  fill: var(--surface);
  stroke: var(--seg-after);
  stroke-width: 3;
}

.gps .pt-label--latest {
  fill: var(--accent);
  font-weight: 500;
}

.gps .pt-label--recalc {
  fill: var(--seg-after);
  font-weight: 500;
}

.gps .pt-ghost {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
  animation: ghost 1.1s ease-out forwards;
}

@keyframes ghost {
  from { opacity: 0.9; }
  to { opacity: 0; }
}

.gps__facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.gps__facts li {
  padding-block: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}

.gps__facts li:last-child {
  border-bottom: 1px solid var(--line);
}

.gps__facts strong {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

@media (max-width: 900px) {
  .gps {
    grid-template-columns: 1fr;
  }
}

/* ---------- Pricing ---------- */

.plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.5vw, 24px);
  align-items: stretch;
}

.plan {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 14px;
  padding: clamp(22px, 3vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.plan--featured {
  border: 2px solid var(--accent);
}

.plan__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan__top h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--muted {
  background: var(--ground-alt);
  color: var(--ink-soft);
}

.plan__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.plan__price span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.5rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.plan__price small {
  color: var(--muted);
  font-size: 0.9375rem;
}

.plan__price--text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.15;
  min-height: 2.5rem;
  align-items: center;
}

.plan__for {
  color: var(--ink-soft);
}

.plan__list {
  list-style: none;
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 10px;
}

.plan__list li {
  position: relative;
  padding-left: 22px;
}

.plan__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.plan__list b {
  font-weight: 600;
}

@media (max-width: 900px) {
  .plans {
    grid-template-columns: 1fr;
    max-width: 520px;
  }
}

/* Auxiliary pages use the landing type and spacing. */
.status-page { max-width: 840px; padding-block: clamp(48px, 12vh, 140px); }
.status-page .brand { margin-bottom: 48px; }
.status-page h1 { margin-bottom: 24px; }
.status-page .cta-row { margin-top: 32px; }

.footer-links { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.legal-page { max-width: 860px; padding-block: 48px 80px; }
.legal-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 48px; }
.legal-page h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.25; }
.legal-page h2 { font-size: 1.25rem; margin-top: 36px; margin-bottom: 12px; }
.legal-page table { width: 100%; border-collapse: collapse; }
.legal-page th, .legal-page td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }
.legal-page .table-wrap { overflow-x: auto; }
.privacy-control { display: flex; align-items: flex-start; gap: 12px; margin-block: 20px; }
.privacy-control input { margin-top: 7px; flex-shrink: 0; }
