/* The tokens share their names and defaults with app/static/style.css, so a
   client page gets its colours from the same palette() as the app
   (website/build.py writes the overrides into the page). */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff4ff;
  --accent-hover: #3b74f0;
  --accent-border: #c7d7fe;
  --accent-ink: #1e3a8a;
  --accent-shadow: rgba(37, 99, 235, .3);
  --accent-focus: rgba(37, 99, 235, .15);
  --on-accent: #ffffff;
  --sidebar: #0f1b33;
  --sidebar-2: #16274a;
  --sidebar-text: #c7d2fe;
  --sidebar-edge: transparent;
  --sidebar-title: #ffffff;
  --sidebar-subtitle: #93a4c9;
  --sidebar-active: rgba(96, 140, 255, .18);
  --sidebar-line: rgba(255, 255, 255, .08);
  --row-current: #e8effd;
  --radius: 12px;
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .16), 0 4px 12px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------------ header */

.top {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  border-bottom: 1px solid var(--sidebar-edge);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--sidebar-title); text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.brand span { font-size: 18px; color: var(--sidebar-subtitle); }
.brand strong { color: var(--sidebar-title); font-weight: 700; }
.brand img.logo { width: auto; height: 52px; max-width: 260px; object-fit: contain; }

/* -------------------------------------------------------------------- hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 56px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 80px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 16px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(32px, 4.4vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead { margin: 0 0 32px; font-size: 18px; color: var(--text-2); max-width: 34em; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 18px var(--accent-shadow);
  transition: background .15s, transform .15s;
}
.button:hover { background: var(--accent-hover); transform: translateY(-1px); }
.button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-focus), 0 6px 18px var(--accent-shadow); }
.button svg { width: 20px; height: 20px; }
.button[aria-disabled="true"] { opacity: .5; pointer-events: none; box-shadow: none; }

.download-meta { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.download-note { margin: 10px 0 0; font-size: 14px; color: var(--text-2); }

/* A drawing of the app window in the edition's colours. */
.preview { perspective: 1600px; }
.window {
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: rotateY(-6deg) rotateX(2deg);
}
.window-bar { display: flex; gap: 6px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.window-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.window-body { display: grid; grid-template-columns: 30% 1fr; min-height: 320px; }

.window-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 14px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  border-right: 1px solid var(--sidebar-edge);
}
.side-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--sidebar-title); font-size: 13px; font-weight: 700; }
.side-brand img { width: 22px; height: 22px; }
.side-brand img.logo { width: 100%; height: 34px; object-fit: contain; object-position: left; }
.side-item { height: 26px; border-radius: 7px; background: var(--sidebar-line); }
.side-item.active { background: var(--sidebar-active); }

.window-main { padding: 18px; background: var(--bg); }
.main-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.main-head b { width: 40%; height: 14px; border-radius: 4px; background: var(--text); opacity: .8; }
.pill { padding: 5px 10px; border-radius: 7px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stats span { height: 50px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); }
.stats span:first-child { background: var(--accent-soft); border-color: var(--accent-border); }
.rows { border-radius: 9px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.row { display: grid; grid-template-columns: 1fr 22% auto; gap: 12px; align-items: center; padding: 11px 12px; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; }
.row.current { background: var(--row-current); }
.row b { height: 9px; border-radius: 3px; background: var(--text-2); opacity: .35; }
.row i { height: 9px; border-radius: 3px; background: var(--muted); opacity: .25; }
.row em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 7px; border-radius: 99px; }

/* ------------------------------------------------------------------- login */

.top-link, .top-account button {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--sidebar-line);
  background: transparent;
  color: var(--sidebar-title);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.top-link:hover, .top-account button:hover { background: var(--sidebar-active); }
.top-account { margin: 0; }

.login-card {
  padding: 28px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  scroll-margin-top: 24px;
}
.login-card h2 { margin: 0 0 4px; font-size: 22px; }
.login-card > p { margin: 0 0 18px; color: var(--text-2); }
.login-card form { display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.login-card input {
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-focus); }
.login-card .button { justify-content: center; border: 0; cursor: pointer; margin-top: 4px; }
.login-card .login-hint { margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.login-error {
  margin: 0 0 16px !important;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c !important;
  font-size: 14px;
}

.editions { display: grid; gap: 10px; margin: 20px 0 28px; padding: 0; list-style: none; }
.editions li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.legal .button { border: 0; cursor: pointer; }

/* ---------------------------------------------------------------- features */

.band { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; padding-top: 56px; padding-bottom: 56px; }
.features h2 { margin: 0 0 8px; font-size: 17px; }
.features h2::before { content: ""; display: block; width: 28px; height: 4px; margin-bottom: 14px; border-radius: 2px; background: var(--accent); }
.features p { margin: 0; font-size: 15px; color: var(--text-2); }

/* ----------------------------------------------------------------- install */

.install { padding-top: 64px; padding-bottom: 72px; }
.install h2 { margin: 0 0 24px; font-size: 24px; }
.install ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.install li { counter-increment: step; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.install li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}
.install strong { display: block; margin-bottom: 4px; }
.install span { font-size: 15px; color: var(--text-2); }
code { font-size: .9em; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ footer */

.foot { border-top: 1px solid var(--border); }
.foot-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 24px; padding-bottom: 32px; font-size: 14px; color: var(--muted); }
.foot nav { display: flex; gap: 20px; }
.foot a { color: var(--muted); }

/* ------------------------------------------------------------- legal pages */

.legal { max-width: 760px; padding-top: 48px; padding-bottom: 72px; }
.legal h1 { font-size: 34px; }
.legal h2 { margin: 32px 0 8px; font-size: 18px; }
.legal p { margin: 0; color: var(--text-2); }

/* ------------------------------------------------------------------ narrow */

@media (max-width: 920px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 48px; padding-top: 48px; }
  .window { transform: none; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .install ol { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .features { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .button { width: 100%; justify-content: center; }
  .window-body { min-height: 240px; }
}
