/* human-memory.ai — the homepage.
   See site/DESIGN.md for the plan this implements. Tokens first, then type,
   then the document, then the two figures, then the form. */

/* ---------------------------------------------------------------- tokens -- */

:root {
  color-scheme: light dark;

  --paper: #EDF0EF;
  --sheet: #FAFCFB;
  --ink: #0F1719;
  --ink-soft: #4E5B5E;
  --rule: #C9D3D2;
  --rule-firm: #A8B6B5;
  --accent: #14586B;
  --accent-soft: #DCE9EC;
  --secondhand: #9BA9AC;

  --display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --text: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --ledger: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --s--2: 0.82rem;
  --s--1: 0.92rem;
  --s-0: 1rem;
  --s-1: 1.19rem;
  --s-2: 1.5rem;
  --s-3: 1.9rem;
  --s-4: clamp(2.1rem, 1.4rem + 3vw, 3.1rem);

  --measure: 65ch;
  --gap: 1.15rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1214;
    --sheet: #141B1D;
    --ink: #E7EDEC;
    --ink-soft: #97A6A8;
    --rule: #263134;
    --rule-firm: #3B4A4D;
    --accent: #77C6D8;
    --accent-soft: #10282F;
    --secondhand: #5E6E71;
  }
}

:root[data-theme="dark"] {
  --paper: #0D1214;
  --sheet: #141B1D;
  --ink: #E7EDEC;
  --ink-soft: #97A6A8;
  --rule: #263134;
  --rule-firm: #3B4A4D;
  --accent: #77C6D8;
  --accent-soft: #10282F;
  --secondhand: #5E6E71;
}

/* ------------------------------------------------------------------ base -- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--text);
  font-synthesis-weight: none;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

p, li { margin: 0; }
p + p { margin-top: 0.85em; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
a:hover { text-decoration-thickness: 2px; }

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

strong { font-weight: 600; }

.mono, code {
  font-family: var(--ledger);
  font-variant-numeric: tabular-nums;
  font-size: 0.88em;
  letter-spacing: -0.01em;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--sheet);
  border: 1px solid var(--rule-firm);
  padding: 0.5rem 0.8rem;
  font-family: var(--display);
  font-size: var(--s--1);
}

/* -------------------------------------------------------------- document -- */

.page {
  max-width: 66rem;
  margin: 0 auto;
  padding: 0 1.35rem;
}

/* Masthead — a band, not a hero. */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 1.5rem;
  padding: 1.4rem 0 1.1rem;
  border-bottom: 1px solid var(--rule-firm);
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--s-0);
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.masthead nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.15rem;
  font-family: var(--display);
  font-size: var(--s--1);
}
@media (max-width: 34rem) {
  .masthead nav { margin-left: 0; }
}
.masthead nav a { color: var(--ink-soft); text-decoration: none; }
.masthead nav a:hover { color: var(--accent); text-decoration: underline; }

.standfirst {
  font-family: var(--ledger);
  font-size: var(--s--2);
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  flex-basis: 100%;
}

/* Sections carry a running head in the left margin on wide screens. */

.band {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem var(--gap);
  padding: 2.6rem 0;
  border-bottom: 1px solid var(--rule);
}
.band:last-of-type { border-bottom: 0; }

.runhead {
  font-family: var(--display);
  font-size: var(--s--2);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-top: 0.35em;
}

.body { min-width: 0; }
.body > * + * { margin-top: 1.1rem; }
.body p, .body li { max-width: var(--measure); }

@media (min-width: 62rem) {
  .band {
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 0 3rem;
  }
  .runhead {
    text-align: right;
    border-right: 1px solid var(--rule);
    padding-right: 0.9rem;
    padding-top: 0.5em;
  }
}

h1.lead {
  font-size: var(--s-4);
  font-weight: 600;
  max-width: 20ch;
}

h2 {
  font-size: var(--s-3);
  max-width: 24ch;
}

h3 {
  font-size: var(--s-1);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.lede {
  font-size: var(--s-1);
  line-height: 1.5;
}

.note {
  font-size: var(--s--1);
  color: var(--ink-soft);
  max-width: 62ch;
}

/* The figures strip under the masthead. */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 1.6rem;
}

.figures div {
  background: var(--sheet);
  padding: 0.85rem 1rem 0.95rem;
}

.figures dt, .figures .k {
  font-family: var(--display);
  font-size: var(--s--2);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}

.figures dd, .figures .v {
  font-family: var(--ledger);
  font-variant-numeric: tabular-nums;
  font-size: var(--s-1);
  margin: 0;
  line-height: 1.2;
}

.figures dd small, .figures .v small {
  display: block;
  font-family: var(--text);
  font-size: var(--s--2);
  color: var(--ink-soft);
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* Two-up: the two hows. */

.hows {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
@media (min-width: 46rem) {
  .hows { grid-template-columns: 1fr 1fr; }
}

.how {
  background: var(--sheet);
  padding: 1.35rem 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.how p { max-width: 46ch; }

.status {
  font-family: var(--display);
  font-size: var(--s--2);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.status.live { color: var(--accent); }

/* The five tabs, as a list of what they are. */

.tabs {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
.tabs li {
  display: grid;
  gap: 0.15rem 1.4rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
  max-width: none;
}
@media (min-width: 40rem) {
  .tabs li { grid-template-columns: 7.5rem minmax(0, 1fr); }
}
.tabs b {
  font-family: var(--ledger);
  font-weight: 500;
  font-size: var(--s--1);
  color: var(--ink);
}
.tabs span { max-width: 58ch; }

/* ---------------------------------------------------------------- figures -- */

figure {
  margin: 0;
  border: 1px solid var(--rule);
  background: var(--sheet);
}

.scroller {
  overflow-x: auto;
  padding: 1.2rem;
}
.scroller svg { display: block; }
@media (max-width: 44rem) {
  .scroller svg { min-width: 34rem; }
}

figcaption {
  border-top: 1px solid var(--rule);
  padding: 0.75rem 1.2rem 0.85rem;
  font-size: var(--s--1);
  color: var(--ink-soft);
  max-width: none;
}

/* SVG diagram parts. */
.dg-rule { stroke: var(--rule-firm); stroke-width: 1; fill: none; }
.dg-flow { stroke: var(--accent); stroke-width: 1.25; fill: none; }
.dg-box { fill: var(--paper); stroke: var(--rule-firm); stroke-width: 1; }
.dg-vault { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.25; }
.dg-t { font-family: var(--ledger); font-size: 12px; fill: var(--ink); }
.dg-h {
  font-family: var(--display); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.09em; fill: var(--ink-soft);
}
.dg-s { font-family: var(--display); font-size: 11px; fill: var(--ink-soft); }
.dg-mark { fill: var(--accent); }

/* The provenance ladder — a ranking, so a table. */

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--s--1);
}
.ledger th, .ledger td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.ledger thead th {
  font-family: var(--display);
  font-size: var(--s--2);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-firm);
  white-space: nowrap;
}
.ledger td:first-child, .ledger .rank {
  font-family: var(--ledger);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger tbody tr:last-child { color: var(--ink-soft); }

.bar {
  display: inline-block;
  vertical-align: middle;
  height: 7px;
  background: var(--accent);
  min-width: 2px;
  margin-right: 0.5rem;
}
.ledger td:last-child { white-space: nowrap; }
.bar.none { background: var(--secondhand); }

/* ---------------------------------------------------------------- honesty -- */

.honesty {
  background: var(--accent-soft);
  border-top: 1px solid var(--rule-firm);
  border-bottom: 1px solid var(--rule-firm);
  margin-top: 0;
}
.honesty .band { border-bottom: 0; }
@media (min-width: 62rem) {
  .honesty .runhead { border-right-color: var(--rule-firm); }
}

.leaves {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule-firm);
  max-width: var(--measure);
}
.leaves li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule-firm);
  max-width: none;
}
.leaves li b { font-weight: 600; }

/* ------------------------------------------------------------------- form -- */

.signup {
  border: 1px solid var(--rule-firm);
  background: var(--sheet);
  padding: 1.35rem 1.4rem 1.5rem;
  max-width: 34rem;
}

.field { display: block; margin-bottom: 0.9rem; }
.field span {
  display: block;
  font-family: var(--display);
  font-size: var(--s--2);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

input[type="email"], input[type="text"], textarea {
  width: 100%;
  font: 400 var(--s-0)/1.5 var(--text);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-firm);
  border-radius: 0;
  padding: 0.55rem 0.65rem;
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 4.5rem; }
input:focus-visible, textarea:focus-visible { outline-offset: 1px; }

.trap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

button {
  font: 600 var(--s--1)/1 var(--display);
  letter-spacing: 0.04em;
  color: var(--paper);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
}
button:hover { background: var(--ink); border-color: var(--ink); }
button[disabled] { opacity: 0.55; cursor: default; }

.result {
  margin-top: 0.85rem;
  font-size: var(--s--1);
  max-width: 46ch;
}
.result:empty { margin-top: 0; }
.result.bad { color: #a02020; }
:root:not([data-theme="light"]) .result.bad { color: #ff9b93; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .result.bad { color: #a02020; }
}

.cta {
  display: inline-block;
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--s--1);
  letter-spacing: 0.03em;
  color: var(--paper);
  background: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.65rem 1.3rem;
  text-decoration: none;
}
.cta:hover { background: var(--ink); border-color: var(--ink); }

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

.foot {
  border-top: 1px solid var(--rule-firm);
  padding: 1.5rem 0 4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  font-family: var(--display);
  font-size: var(--s--1);
  color: var(--ink-soft);
}
.foot a { color: var(--ink-soft); }
.foot a:hover { color: var(--accent); }
.foot .right { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
