/* Topolearn website. Colours come from the logo and the app's progress colours. */
:root {
  --ink: #13203f;          /* headings, logo-navy */
  --text: #3a4660;         /* body copy */
  --muted: #66708a;
  --paper: #ffffff;
  --surface: #f2f5fb;      /* quiet panels */
  --line: #dde3ee;
  --blue: #2563eb;         /* "ready to learn" in the app; links */
  --blue-deep: #1e40af;
  --green: #12a37a;        /* "understood" */
  --green-soft: #e3f6ef;
  --ready-soft: #e8efff;
  --node: #ffffff;
  --node-line: #c9d1e1;
  --focus: #f5b13d;        /* logo amber, used only for keyboard focus */

  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 66ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef2fb;
    --text: #c3cbdd;
    --muted: #8c96ad;
    --paper: #0f1730;
    --surface: #16203d;
    --line: #26325a;
    --blue: #7aa2ff;
    --blue-deep: #a9c2ff;
    --green: #3fd0a1;
    --green-soft: #12372f;
    --ready-soft: #1a2b5c;
    --node: #16203d;
    --node-line: #35436e;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--body);
}

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

a { color: var(--blue); text-underline-offset: 0.18em; }
a:hover { color: var(--blue-deep); }

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

h1, h2, h3 {
  font-family: var(--display);
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
}

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

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

.site-header {
  padding-block: 20px;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font: 700 1.3rem/1 var(--display);
  letter-spacing: -0.02em;
}

.brand img { width: 40px; height: auto; }
.brand:hover { color: var(--ink); }

.site-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-nav a { color: var(--text); text-decoration: none; font-size: 0.98rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

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

.hero {
  padding-block: 40px 72px;
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.2vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 13ch;
}

.hero p.lede {
  font-size: 1.2rem;
  max-width: 34ch;
  margin: 20px 0 28px;
}

.availability {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.98rem;
}

/* The tree */
.tree-figure { margin: 0; }

.tree { width: 100%; max-width: 560px; height: auto; overflow: visible; display: block; margin-inline: auto; }

.tree .edge { fill: none; stroke: var(--node-line); stroke-width: 2.2; }
.tree .edge.done { stroke: var(--green); }

.tree .node rect { fill: var(--node); stroke: var(--node-line); stroke-width: 2; }
.tree .node text {
  font: 700 16px var(--body);
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
}
.tree .node.known rect { fill: var(--green-soft); stroke: var(--green); }
.tree .node.ready rect { fill: var(--ready-soft); stroke: var(--blue); stroke-width: 2.6; }
.tree .node.target rect { stroke: var(--ink); stroke-width: 2.6; }
.tree .tick { fill: var(--green); font: 700 13px var(--body); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  justify-content: center;
  margin-top: 14px;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  color: var(--muted);
}

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

.swatch {
  width: 18px; height: 12px; border-radius: 4px;
  border: 2px solid var(--node-line); background: var(--node);
}
.swatch.known { border-color: var(--green); background: var(--green-soft); }
.swatch.ready { border-color: var(--blue); background: var(--ready-soft); }

/* One orchestrated moment: foundations appear first, the goal last. */
@media (prefers-reduced-motion: no-preference) {
  .tree .node, .tree .edge { opacity: 0; animation: appear 0.5s ease-out forwards; }
  .tree [data-step="1"] { animation-delay: 0.15s; }
  .tree [data-step="2"] { animation-delay: 0.55s; }
  .tree [data-step="3"] { animation-delay: 0.95s; }
  .tree [data-step="4"] { animation-delay: 1.35s; }
  .tree .node.ready rect { animation: ready-glow 1.4s ease-in-out 2.1s 2; }
  @keyframes appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes ready-glow { 50% { stroke-width: 5; } }
}

/* -------------------------------------------------------------- how it works */

.how {
  background: var(--surface);
  padding-block: 64px;
}

.how h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); max-width: 22ch; }

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 36px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
}

.steps li { counter-increment: step; }

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font: 700 1rem var(--display);
  margin-bottom: 14px;
}

.steps h3 { font-size: 1.2rem; margin-bottom: 6px; }
.steps p { margin: 0; }

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

.doc {
  padding-block: 32px 72px;
}

.doc article {
  max-width: var(--measure);
}

.doc h1 { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 800; }
.doc .updated { color: var(--muted); margin: 10px 0 32px; }
.doc h2 { font-size: 1.4rem; margin: 40px 0 10px; }
.doc h3 { font-size: 1.1rem; margin: 24px 0 6px; }
.doc p, .doc li { max-width: var(--measure); }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 6px; }

.callout {
  background: var(--surface);
  border-left: 4px solid var(--blue);
  padding: 16px 20px;
  border-radius: 0 10px 10px 0;
  margin: 24px 0;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 28px 40px;
  font-size: 0.95rem;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
.site-footer a { color: var(--muted); }

/* --------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 32px; }
  .hero h1, .hero p.lede { max-width: none; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 0.92rem; }
  .steps { grid-template-columns: 1fr; }
  .hero { padding-block: 16px 48px; }
}
