:root {
  --paper: #F6F8FA;
  --surface: #FFFFFF;
  --ink: #111A2E;
  --ink-2: #48526A;
  --ink-3: #6E7890;
  --rule: #DCE2EA;
  --grid: #E8ECF1;
  --signal: #FF5A1F;
  --signal-soft: #FFE6DB;
  --ref-blue: #2F5BEA;
  --ref-red: #C93838;
  --ok: #13795B;
  --x: #107C41;
  --p: #C43E1C;
  --w: #185ABD;

  --display: "Familjen Grotesk", "Hanken Grotesk", system-ui, sans-serif;
  --body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

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

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
code { font: 500 0.88em var(--mono); }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.025em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--ref-blue); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only, .hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { top: 12px; }

/* Navigation */
.nav { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.nav.scrolled { border-bottom-color: var(--rule); }
.nav-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.25rem/1 var(--display); letter-spacing: -0.03em; }
.nav nav { display: flex; gap: 22px; margin-left: auto; }
.nav nav a { text-decoration: none; color: var(--ink-2); font-size: 0.95rem; font-weight: 500; }
.nav nav a:hover { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 22px; border: 0; border-radius: 8px;
  background: var(--ink); color: #fff; text-decoration: none; cursor: pointer;
  font: 600 1rem/1 var(--body);
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { background: #1E2A44; }
.btn:active { transform: translateY(1px); }
.btn-small { height: 38px; padding: 0 16px; font-size: 0.92rem; }

/* Hero */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(56px, 8vw, 112px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
h1 { font-size: clamp(2.7rem, 5.6vw, 4.75rem); line-height: 1.02; font-weight: 700; letter-spacing: -0.035em; }

/* The signature: the second line is a selected cell with its fill handle. */
.h1-second { position: relative; display: inline-block; margin-top: 0.12em; padding: 0.02em 0.14em 0.06em; box-shadow: inset 0 0 0 0.06em var(--ink); }
.h1-second::after { content: ""; position: absolute; right: -0.09em; bottom: -0.09em; width: 0.2em; height: 0.2em; background: var(--signal); box-shadow: 0 0 0 0.035em var(--paper); }

.lede { margin-top: 28px; max-width: 34em; font-size: 1.15rem; color: var(--ink-2); }
.join { position: relative; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; max-width: 30rem; }
.join input[type="email"] {
  flex: 1 1 14rem; min-width: 0; height: 48px; padding: 0 14px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--surface);
  font: 400 1rem var(--body); color: var(--ink);
}
.join input[type="email"]:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ref-blue) 25%, transparent); }
.join-status { flex-basis: 100%; min-height: 1.5em; font-size: 0.95rem; color: var(--ink-2); }
.join-status.ok { color: var(--ok); }
.join-status.err { color: var(--ref-red); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.92rem; color: var(--ink-3); }
.facts li { display: inline-flex; align-items: center; gap: 8px; }
.facts li::before { content: ""; width: 6px; height: 6px; background: var(--signal); }

/* Demo */
.demo { margin: 0; position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 1px 0 rgba(17,26,46,.04), 0 24px 48px -28px rgba(17,26,46,.28); overflow: hidden; }
.demo figcaption { padding: 10px 16px 12px; font-size: 0.78rem; color: var(--ink-3); border-top: 1px solid var(--grid); }
.demo-pane { padding: 16px 16px 12px; border-bottom: 1px solid var(--grid); }
.demo-ask { display: flex; gap: 10px; align-items: flex-start; }
.demo-ask img { margin-top: 3px; flex: none; }
.demo-ask p { background: #F2F4F7; border-radius: 10px; padding: 8px 12px; font-size: 0.94rem; line-height: 1.45; }
.ledger { list-style: none; margin: 12px 0 0 26px; padding: 0; display: grid; gap: 4px; font-size: 0.86rem; color: var(--ink-3); }
.ledger li { position: relative; padding-left: 20px; transition: color .3s; }
.ledger li::before { content: ""; position: absolute; left: 0; top: 0.36em; width: 12px; height: 12px; box-sizing: border-box; border: 1.5px solid var(--rule); border-radius: 50%; transition: all .3s; }
.ledger li.doing { color: var(--ink-2); }
.ledger li.doing::before { border-color: var(--ink-3); border-top-color: transparent; animation: spin .8s linear infinite; }
.ledger li.done { color: var(--ink); }
.ledger li.done::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2l2 2 4-4.4' fill='none' stroke='white' stroke-width='1.6'/%3E%3C/svg%3E") center/100% no-repeat; }
.ledger code { font-size: 0.82rem; color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.sheet { font-family: var(--mono); font-size: 0.8rem; }
.fx { display: flex; align-items: center; height: 32px; border-bottom: 1px solid var(--grid); color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.fx-name { width: 56px; padding: 0 10px; border-right: 1px solid var(--grid); color: var(--ink); }
.fx-label { padding: 0 10px; font-style: italic; color: var(--ink-3); }
.fx-formula { color: var(--ink); }
.fx-formula b { font-weight: 500; }
.ref-b { color: var(--ref-blue); }
.ref-r { color: var(--ref-red); }
.grid-scroll { position: relative; overflow-x: auto; }
.grid { border-collapse: collapse; width: 100%; min-width: 440px; table-layout: fixed; font-variant-numeric: tabular-nums; }
.grid th, .grid td { height: 30px; padding: 0 6px; overflow: hidden; border: 1px solid var(--grid); white-space: nowrap; }
.grid thead th, .grid tbody th { background: #F7F8FA; color: var(--ink-3); font-weight: 400; text-align: center; font-size: 0.74rem; }
.grid thead th:first-child { width: 28px; }
.grid thead th:nth-child(2) { width: 22%; }
.grid td.t { font-family: var(--body); font-size: 0.86rem; }
.grid td.hd { text-align: right; color: var(--ink-2); font-weight: 500; }
.grid td.n { text-align: right; }
.grid td.in { color: var(--ref-blue); }
.grid .muted { color: var(--ink-3); }
.grid tr:first-child td { border-bottom-color: var(--grid); }
.sel { position: absolute; left: 0; top: 0; width: 0; height: 0; border: 2px solid var(--ink); pointer-events: none; opacity: 0; transition: left .35s ease, top .35s ease, width .35s ease, height .35s ease, opacity .2s; }
.sel i { position: absolute; right: -5px; bottom: -5px; width: 8px; height: 8px; background: var(--signal); box-shadow: 0 0 0 1.5px var(--surface); }

.flows { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 16px 16px; background: #FAFBFC; border-top: 1px solid var(--grid); }
.flow { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; transition: opacity .5s ease, transform .5s ease; }
.flow-app { font: 500 0.72rem/1 var(--mono); color: var(--ink-3); }
.flow strong { font: 600 0.98rem/1.25 var(--display); letter-spacing: -0.01em; }
.flow p { font-size: 0.88rem; line-height: 1.45; color: var(--ink-2); }
.flow mark { background: var(--signal-soft); color: var(--ink); padding: 0 3px; border-radius: 3px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 34px; margin-top: auto; }
.bars i { flex: 1; height: 62%; background: #C9D2DF; border-radius: 2px 2px 0 0; }
.bars i:nth-child(2) { height: 66%; }
.bars i:nth-child(3) { height: 70%; }
.bars i:nth-child(4) { height: 74%; }
.bars i:nth-child(5) { height: 79%; }
.bars i:last-child { height: 84%; background: var(--ink); }

/* Animation states, set by app.js. Without JavaScript the final state shows. */
.demo.is-playing [data-cell] { opacity: 0; }
.demo [data-cell] { transition: opacity .25s ease; }
.demo [data-cell].on { opacity: 1; }
.demo.is-playing .flow { opacity: 0; transform: translateY(6px); }
.demo .flow.on { opacity: 1; transform: none; }

/* Sections */
.band { padding: clamp(64px, 9vw, 120px) 0; border-top: 1px solid var(--rule); }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.75rem); line-height: 1.08; font-weight: 700; max-width: 18em; }
.section-lede { margin-top: 18px; max-width: 40em; color: var(--ink-2); font-size: 1.08rem; }
.split { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 88px); align-items: start; }

.apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 48px; }
.app { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; }
.app h3 { font-size: 1.3rem; line-height: 1.2; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.tag { font: 500 0.75rem/1 var(--mono); letter-spacing: 0; padding: 5px 8px; border-radius: 4px; color: #fff; }
.tag-x { background: var(--x); }
.tag-p { background: var(--p); }
.tag-w { background: var(--w); }
.app ul { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; color: var(--ink-2); font-size: 0.98rem; }
.app li { padding-left: 16px; position: relative; }
.app li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 6px; height: 6px; border: 1.5px solid var(--ink-3); }

.checklist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.checklist li { position: relative; padding: 16px 0 16px 40px; border-bottom: 1px solid var(--rule); color: var(--ink-2); }
.checklist li::before { content: ""; position: absolute; left: 0; top: 18px; width: 20px; height: 20px; border-radius: 50%; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2l2 2 4-4.4' fill='none' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E") center/100% no-repeat; }
.checklist b { color: var(--ink); font-weight: 600; }

.modes { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modes div { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; }
.modes div:nth-child(3) { box-shadow: inset 0 0 0 2px var(--ink); position: relative; }
.modes div:nth-child(3)::after { content: ""; position: absolute; right: -4px; bottom: -4px; width: 9px; height: 9px; background: var(--signal); box-shadow: 0 0 0 2px var(--paper); }
.modes dt { font: 600 1.05rem var(--display); }
.modes dd { margin: 6px 0 0; color: var(--ink-2); font-size: 0.95rem; }

.table-scroll { margin-top: 40px; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.results { width: 100%; border-collapse: collapse; min-width: 520px; }
.results th, .results td { padding: 16px 20px; text-align: left; border-bottom: 1px solid var(--grid); }
.results tbody tr:last-child > * { border-bottom: 0; }
.results thead th { font: 500 0.8rem var(--mono); color: var(--ink-3); background: #FAFBFC; }
.results tbody th { font-weight: 500; }
.results td { font-family: var(--mono); color: var(--ink-3); white-space: nowrap; }
.score { font: 700 1.5rem var(--display); color: var(--ink); letter-spacing: -0.02em; }

.band-dark { background: var(--ink); color: #E9EDF4; border-top: 0; }
.band-dark .section-lede { color: #AEB8CB; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid #2A3550; }
.points li { padding: 18px 0; border-bottom: 1px solid #2A3550; color: #AEB8CB; }
.points b { color: #fff; font-weight: 600; }

.faq { margin-top: 32px; max-width: 48rem; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; padding: 18px 32px 18px 0; position: relative; font: 600 1.1rem var(--display); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 4px; top: 50%; width: 10px; height: 10px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-70%) rotate(45deg); transition: transform .2s; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { padding: 0 0 20px; color: var(--ink-2); max-width: 40em; }

.band-join { background: var(--surface); }
.join-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; }
.join-wrap img { margin-bottom: 24px; }
.join-wrap > p { margin-top: 14px; color: var(--ink-2); }
.join-wrap .join { width: 100%; justify-content: center; }
.join-wrap .join-status { text-align: center; }

.foot { padding: 40px 0 56px; border-top: 1px solid var(--rule); font-size: 0.9rem; color: var(--ink-3); }
.foot-inner { display: grid; gap: 12px; }
.foot .brand { font-size: 1.05rem; color: var(--ink); }
.foot .tm { font-size: 0.8rem; max-width: 46em; }

/* Plain pages: privacy, 404 */
.page { padding: clamp(48px, 8vw, 96px) 0; }
.page .wrap { max-width: 760px; }
.page h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
.page h2 { font-size: 1.35rem; margin-top: 40px; }
.page p, .page li { color: var(--ink-2); margin-top: 12px; }
.page .meta { color: var(--ink-3); font-size: 0.92rem; }

@media (max-width: 960px) {
  .hero-grid, .split { grid-template-columns: minmax(0, 1fr); }
  .apps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .nav nav { display: none; }
  .nav-inner { justify-content: space-between; }
  .flows { grid-template-columns: minmax(0, 1fr); }
  .modes { grid-template-columns: minmax(0, 1fr); }
  .join .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
