/* ------------------------------------------------------------------
   Tokens. Every colour used on the page resolves through one of these,
   so the dark theme is a token swap rather than a second stylesheet.
   ------------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  /* Layout */
  --container: 75rem;   /* 1200px */
  --reading: 45rem;     /* 720px  */
  --gutter: 2rem;
  --pad-lg: 7.5rem;
  --pad-md: 5.5rem;

  /* Three surfaces: narrative, structured, anchor */
  --bg: #ffffff;
  --surface: #f1f5fa;
  --panel: #ffffff;

  --fg: #14181d;
  --fg-2: #3d4753;
  --muted: #5c6672;

  --hairline: #dde3ec;
  --hairline-soft: #e7ecf3;

  --accent: #146ef5;
  --accent-strong: #0f58c9;
  --accent-wash: #ebf2fe;
  --on-accent: #ffffff;

  --valid: #14957c;
  --kind-y: #8a6d0b;

  /* The lifecycle anchor band */
  --anchor: #0b1a2e;
  --anchor-fg: #f2f6fa;
  --anchor-muted: #93a6bc;
  --anchor-faint: #61748a;
  --anchor-accent: #4a95ff;
  --anchor-line: #22344b;

  --frame-shadow: 0 1px 2px rgba(11, 26, 46, 0.04), 0 12px 32px -12px rgba(11, 26, 46, 0.14);
  --graph-edge: #c9d3e0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --surface: #151c23;
    --panel: #131a21;

    --fg: #f0f4f8;
    --fg-2: #c3cdd8;
    --muted: #96a3b0;

    --hairline: #253039;
    --hairline-soft: #1e262e;

    --accent: #4a95ff;
    --accent-strong: #6ca8ff;
    --accent-wash: rgba(74, 149, 255, 0.12);
    --on-accent: #0b1015;

    --valid: #35b89d;
    --kind-y: #e3c46a;

    /* Darker than the page, so the anchor still reads as depth */
    --anchor: #070c11;
    --anchor-fg: #f0f4f8;
    --anchor-muted: #8fa1b4;
    --anchor-faint: #5d6e80;
    --anchor-accent: #6ca8ff;
    --anchor-line: #1c2836;

    --frame-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -14px rgba(0, 0, 0, 0.55);
    --graph-edge: #34414d;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  font-family: ui-sans-serif, system-ui, "Segoe UI", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* The icon sprite takes no room and never shows; its symbols are drawn
   by <use> elsewhere on the page. */
.sprite { position: absolute; }

/* ---- Layout primitives ---- */

.wrap {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.reading { max-width: var(--reading); }

section { padding: var(--pad-md) 0; }

.band { background: var(--surface); }

/* Two white sections in a row: a hairline marks the transition instead of
   another background, so the page gains a section without gaining a colour. */
.rule-top { border-top: 1px solid var(--hairline); }

/* ---- Type ---- */

h1, h2, h3 { text-wrap: balance; letter-spacing: -0.028em; line-height: 1.12; font-weight: 700; }

h1 { font-size: clamp(2.05rem, 3.7vw, 2.9rem); }
h2 { font-size: clamp(1.6rem, 2.5vw, 2.05rem); font-weight: 650; }
h3 { font-size: 1.03rem; font-weight: 650; letter-spacing: -0.012em; line-height: 1.3; }

.kicker {
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.lede { font-size: 1.125rem; color: var(--fg-2); }
.section-intro { color: var(--muted); margin-top: 0.9rem; }

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

.cta-button, .cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 3.125rem;
  padding: 0 1.6rem;
  border-radius: 0.5rem;
  font-size: 0.97rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.cta-button { background: var(--accent); color: var(--on-accent); }
.cta-button:hover { background: var(--accent-strong); }

.cta-secondary { background: transparent; color: var(--fg); border-color: var(--hairline); }
.cta-secondary:hover { border-color: var(--accent); color: var(--accent); }

.arw { transition: transform 0.18s ease; }
.cta-button:hover .arw { transform: translateX(3px); }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline-soft);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4.25rem;
}

.brand {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  text-decoration: none;
}

.brand .dot { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 1.1rem; }

.header-login {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.header-login:hover { color: var(--fg); }

.header-cta { height: 2.4rem; padding: 0 1rem; font-size: 0.88rem; white-space: nowrap; }

/* ---- Language picker ---- */

.lang { display: flex; align-items: center; gap: 0.2rem; }

/* Kaks keelt ei vaja rippmenüüd: mõlemad on korraga näha ja valitud on esile
   tõstetud. Lipp üksi ei tähista keelt, seetõttu on kõrval alati keelekood. */
.lang-opt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.55rem;
  border-radius: 0.4rem;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.lang-opt:hover { color: var(--fg); background: var(--surface); }

.lang-opt[aria-current="true"] {
  color: var(--accent);
  background: var(--accent-wash);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.flag {
  width: 1.15rem;
  height: 0.75rem;
  display: block;
  border-radius: 1px;
  /* Eesti lipu alumine triip on valge - ilma selleta sulaks see heleda taustaga kokku. */
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--fg) 18%, transparent);
}

.lang-opt:not([aria-current="true"]) .flag { opacity: 0.7; }
.lang-opt:hover .flag { opacity: 1; }

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

.hero { padding: 5.75rem 0 var(--pad-lg); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 3.6rem;
  align-items: center;
}

.hero-copy { max-width: 34rem; }
.hero-copy h1 { margin-bottom: 1.35rem; }
.hero-copy .lede { margin-bottom: 1.1rem; }
.hero-body { color: var(--muted); margin-bottom: 2.1rem; }

/* ---- Hero visual: the conceptual view ---- */
/* Actors above, the shared knowledge below, the two flows between them.
   Drawn as a diagram with no browser chrome on purpose, and captioned as
   conceptual, so nobody mistakes it for a product screenshot. */

.concept { min-width: 0; }

.concept-box {
  border: 1px solid var(--hairline);
  border-radius: 0.875rem;
  background: var(--panel);
  box-shadow: var(--frame-shadow);
  padding: 1.15rem;
}

.concept-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

.actors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  list-style: none;
}

.actor {
  min-width: 0;
  border: 1px solid var(--hairline);
  border-radius: 0.6rem;
  padding: 0.7rem 0.75rem;
  background: var(--bg);
}

.actor svg { display: block; color: var(--accent); margin-bottom: 0.45rem; }

.actor b {
  display: block;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.actor small { display: block; font-size: 0.75rem; color: var(--muted); line-height: 1.4; }

.flows { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; padding: 0.35rem 0; }

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--fg-2);
}

.flow-arrow svg { flex: none; color: var(--accent); }
.flow-arrow.in svg { color: var(--valid); }

.store {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--hairline));
  border-radius: 0.7rem;
  overflow: hidden;
}

/* Governance sits on the store's edge: everything in or out passes it. */
.store-gate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
  padding: 0.55rem 0.8rem;
  background: var(--accent-wash);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 0.75rem;
  color: var(--fg-2);
}

.store-gate b { font-weight: 650; color: var(--accent); margin-right: 0.15rem; }
.store-gate span:not(:last-child)::after { content: " \00b7"; color: var(--muted); }

.store-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.85rem 0;
}

.store-head b { font-size: 0.92rem; font-weight: 650; letter-spacing: -0.01em; }
.store-head span { font-size: 0.75rem; color: var(--muted); }

/* Capped so the labels stay near body size on a wide hero column. */
.graph { display: block; width: 100%; max-width: 27.5rem; height: auto; margin: 0.35rem auto 0; }

.g-edge { stroke: var(--graph-edge); stroke-width: 1.3; fill: none; }
.g-prop { stroke: var(--valid); stroke-width: 1.3; stroke-dasharray: 3 3; fill: none; }
.g-label { fill: var(--fg-2); font-family: inherit; font-size: 11.5px; }
.g-label.prop { fill: var(--valid); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10.5px; }

.n-a { fill: var(--accent); }
.n-v { fill: var(--valid); }
.n-y { fill: var(--kind-y); }
.n-m { fill: var(--muted); }
.n-p { fill: var(--panel); stroke: var(--valid); stroke-width: 1.5; stroke-dasharray: 3 2; }

.store-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  list-style: none;
  padding: 0.4rem 0.85rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  color: var(--muted);
}

.concept figcaption {
  margin-top: 0.9rem;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}

/* ---- Shared context: three columns, one hairline vocabulary ---- */

.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 3rem;
  list-style: none;
}

.col { min-width: 0; padding: 0 1.9rem; border-left: 1px solid var(--hairline); }
.col:first-child { padding-left: 0; border-left: 0; }
.col:last-child { padding-right: 0; }

.col h3 { margin-bottom: 0.55rem; }
.col p { font-size: 0.9375rem; color: var(--muted); }

/* ---- Workflows: one unit of work, then the applications ---- */

.run { margin-top: 3rem; position: relative; }

.run-rail { position: absolute; top: 1.06rem; left: 0; right: 0; height: 1px; background: var(--hairline); }

.run-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  list-style: none;
}

.run-steps li { min-width: 0; }

/* The fill matches the band behind it, so the rail stops at each circle. */
.step-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  font-variant-numeric: tabular-nums;
}

/* The step that writes back carries the same green as "propose changes". */
.run-steps li:last-child .step-num { color: var(--valid); }

.run-steps h3 { margin-bottom: 0.45rem; }
.run-steps p { font-size: 0.9375rem; color: var(--muted); }

.apps {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 3rem;
  margin-top: 3.5rem;
  padding-top: 2.75rem;
  border-top: 1px solid var(--hairline);
}

.apps-intro h3 { font-size: 1.2rem; margin-bottom: 0.6rem; }
.apps-intro p { font-size: 0.9375rem; color: var(--muted); }

.app-list { list-style: none; }

.app-list li {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--hairline);
}

.app-list li:first-child { border-top: 0; padding-top: 0; }
.app-list b { font-size: 0.9375rem; font-weight: 650; letter-spacing: -0.01em; }
.app-list span { font-size: 0.9375rem; color: var(--muted); }

/* ---- Lifecycle anchor ---- */

.life { background: var(--anchor); color: var(--anchor-fg); padding: 6.5rem 0; text-align: center; }

.life .kicker { color: var(--anchor-accent); margin-bottom: 1.6rem; }

.life-quiet {
  font-size: clamp(1.02rem, 1.5vw, 1.15rem);
  color: var(--anchor-muted);
  line-height: 1.55;
  max-width: 34rem;
  margin: 0 auto 1rem;
}

.life-line {
  font-size: clamp(1.5rem, 2.9vw, 2.15rem);
  font-weight: 680;
  letter-spacing: -0.028em;
  line-height: 1.2;
  max-width: 34rem;
  margin: 0 auto 2.6rem;
  text-wrap: balance;
}

.chain {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.55rem 0.5rem;
  list-style: none;
  max-width: 52rem;
  margin: 0 auto;
}

.chain li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--anchor-fg);
  border: 1px solid var(--anchor-line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
}

.chain .sep { border: 0; padding: 0; color: var(--anchor-faint); }

.life-tail {
  max-width: 36rem;
  margin: 1.9rem auto 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--anchor-muted);
}

/* ---- Governance: two by two ---- */

.gov {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 3.5rem;
  margin-top: 2.75rem;
  list-style: none;
}

.gov li { min-width: 0; padding: 1.4rem 0; border-top: 1px solid var(--hairline); }
.gov h3 { margin-bottom: 0.45rem; }
.gov p { font-size: 0.9375rem; color: var(--muted); }

/* ---- Facts: verified operational facts only ---- */

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  list-style: none;
  margin-bottom: 3rem;
}

.fact { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.75rem; align-items: start; }

.ticon {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 0.5rem;
  background: var(--accent-wash);
  color: var(--accent);
  display: grid;
  place-items: center;
}

.fact h3 { font-size: 0.97rem; margin-bottom: 0.25rem; }
.fact p { font-size: 0.9rem; color: var(--muted); line-height: 1.55; }

/* ---- Contact ---- */

.cta-panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 1.125rem;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
}

/* Padding sits on the halves, not the panel, so the divider runs the
   full height. */
.cta-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3.25rem 3.5rem;
}
.cta-copy h2 { margin-bottom: 1rem; }
.cta-copy p { color: var(--muted); }
.cta-copy .kicker { color: var(--accent); }
.cta-copy p + p { margin-top: 0.75rem; }

.cta-side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 1.25rem;
  padding: 3.25rem 3.5rem;
  border-left: 1px solid var(--hairline);
}

.cta-side .cta-button { justify-content: center; }

/* ---- Footer ---- */

footer {
  background: var(--surface);
  border-top: 1px solid var(--hairline);
  padding: 1.9rem 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-in { display: flex; align-items: center; justify-content: space-between; gap: 1.1rem; flex-wrap: wrap; }
.footer-left { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.footer-left .sep { opacity: 0.5; }

footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--fg); }

/* ---- Responsive ---- */

@media (max-width: 1040px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.9rem; }
  .hero-copy { max-width: var(--reading); }
  .concept { max-width: 36rem; }

  .apps { grid-template-columns: 1fr; gap: 1.6rem; }
}

@media (max-width: 900px) {
  :root { --pad-lg: 5rem; --pad-md: 4rem; --gutter: 1.4rem; }

  .cols-3 { grid-template-columns: 1fr; gap: 1.6rem; margin-top: 2.5rem; }
  .col, .col:first-child { padding: 0 0 0 1.1rem; border-left: 1px solid var(--hairline); }

  /* Stacked steps keep their numbers; the rail would cut through the text. */
  .run-rail { display: none; }
  .run-steps { grid-template-columns: 1fr; gap: 1.6rem; }

  .gov { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }

  .life { padding: 4.5rem 0; }

  .cta-panel { grid-template-columns: 1fr; }
  .cta-copy { padding: 2.1rem 2.1rem 1.9rem; }
  .cta-side { padding: 1.9rem 2.1rem 2.1rem; border-left: 0; border-top: 1px solid var(--hairline); }
}

@media (max-width: 720px) {
  .hero { padding-top: 3.5rem; }
}

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

  /* Brand, language and CTA were crowding each other. */
  .header-actions { gap: 0.6rem; }
  .header-cta { padding: 0 0.8rem; }
  .lang-opt { padding: 0.3rem 0.4rem; }

  /* A label column next to a sentence leaves the sentence two words wide. */
  .app-list li { grid-template-columns: 1fr; gap: 0.2rem; }

  /* Three tiles side by side split "Rakendused" mid-word on a phone, so
     the actors become a list: icon on the left, name and role beside it. */
  .concept-box { padding: 0.85rem; }
  .actors { grid-template-columns: 1fr; gap: 0.4rem; }
  .actor { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.65rem; align-items: center; padding: 0.5rem 0.7rem; }
  .actor svg { grid-row: span 2; margin-bottom: 0; }
  .flow-arrow { font-size: 0.66rem; }

  .cta-copy, .cta-side { padding-left: 1.4rem; padding-right: 1.4rem; }
}

/* On a 360px phone the English CTA pushed the header past the viewport.
   The flag carries the language on its own - the menu still names both. */
@media (max-width: 420px) {
  .lang-opt span { display: none; }
  .header-cta { font-size: 0.84rem; padding: 0 0.7rem; }
}

/* Below this there is no honest room for a header button. It is dropped
   rather than crammed edge to edge - the hero CTA sits just underneath. */
@media (max-width: 340px) {
  .header-cta { display: none; }
}
