/* Deer Labs, v3 the lab ledger. Tokens in design.md. JetBrains Mono in three cuts, Changa 500 for Arabic. */

@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Changa"; src: url("fonts/changa-500-arabic.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }

:root {
  --ink: #141414;
  --tile: #1F1E1D;
  --paper: #F2EFE9;
  --paper-press: #D9D5CE;
  --muted: #C4BFB7;
  --faint: #979189;
  --rule: #2F2C29;
  --rule-hi: #4A4642;
  --edge: #3F3C38;
  --red: #BA5E5F;

  --font: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --font-ar: "Changa", "Segoe UI", Tahoma, sans-serif;

  --cols: minmax(0, 1fr) 220px 220px 220px;
  --pad: 24px;
  --r-tape: 2px;
  --r-ctl: 6px;

  --ease-pen: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --z-skip: 100;
  color-scheme: dark;
}

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

html {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  padding-block: 32px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
p, dl, dd, figure { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.25em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--paper); color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: 12px; z-index: var(--z-skip);
  background: var(--paper); color: var(--ink);
  padding: 12px 16px; border-radius: var(--r-ctl);
  font-weight: 600; text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---------- shared marks ---------- */
.lbl { font-size: 0.75rem; line-height: 1.4; color: var(--faint); letter-spacing: 0.02em; }
.tape {
  display: inline-block;
  background: var(--paper); color: var(--ink);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; line-height: 1;
  padding: 6px 8px 5px; border-radius: var(--r-tape);
  white-space: nowrap;
}
.note {
  font-size: 0.75rem; font-weight: 400; line-height: 1.4; letter-spacing: 0;
  color: var(--faint); white-space: nowrap;
  border: 1px solid var(--rule-hi); border-radius: var(--r-tape);
  padding: 3px 6px 2px;
}
.ar { font-family: var(--font-ar); font-weight: 500; letter-spacing: 0; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--r-ctl);
  font: 600 0.9375rem/1 var(--font); letter-spacing: -0.01em;
  text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--paper); color: var(--ink); }
.btn-primary:hover { background: var(--paper-press); }

/* ---------- the frame: one ruled sheet, every row on one column template ---------- */
.sheet {
  max-width: 1360px; margin-inline: auto;
  padding-left: max(40px, env(safe-area-inset-left, 0px));
  padding-right: max(40px, env(safe-area-inset-right, 0px));
}
.frame { border: 1px solid var(--rule); }
.row { display: grid; grid-template-columns: var(--cols); border-top: 1px solid var(--rule); }
.row > * { min-width: 0; padding: 20px var(--pad); border-left: 1px solid var(--rule); }
.row > :first-child { border-left: 0; }
.c2 { grid-column: span 2; }

/* ---------- bar ---------- */
.bar { border-top: 0; }
.bar > * { display: flex; flex-direction: column; justify-content: center; min-height: 76px; padding-block: 14px; }
.brand { display: flex; align-items: center; align-self: flex-start; min-height: 44px; }
.brand img { width: 150px; height: auto; }
.fact { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.bar > .nav { flex-direction: row; justify-content: flex-end; align-items: center; }
.nav ul { display: flex; gap: 10px; }
.nav a {
  display: flex; align-items: center; min-height: 44px; padding-inline: 4px;
  font-size: 0.875rem; color: var(--muted); text-decoration: none;
}
.nav a:hover { color: var(--paper); text-decoration: underline; }

/* ---------- hero: the line and the sign ---------- */
.hero-copy { display: flex; flex-direction: column; justify-content: flex-end; min-height: 460px; }
.row > .hero-copy { padding-block: 48px 44px; }
.hero h1 { font-size: 4.5rem; letter-spacing: -0.055em; line-height: 0.98; }
.sub { margin-top: 22px; max-width: 40ch; font-size: 1.125rem; color: var(--muted); text-wrap: pretty; }

.fig { position: relative; display: flex; }
.row > .fig { padding: 48px 48px 64px; }
.box { position: relative; flex: 1; display: grid; place-items: center; }
.fig figcaption { position: absolute; bottom: 24px; left: 48px; }
.mk { position: absolute; width: 14px; height: 14px; border: 0 solid var(--muted); }
.mk.tl { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.mk.tr { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.mk.bl { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.mk.br { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

.sign { width: 220px; height: auto; aspect-ratio: 1; }
.sign-solid { fill: var(--paper); }
.sign-outline { fill: var(--red); }
.trace { fill: none; stroke: #fff; stroke-width: 150; stroke-dasharray: var(--len) var(--len); stroke-dashoffset: 0; }
.trace-branch { --len: 1168px; }
.trace-tine { --len: 330px; }
.trace-foot { --len: 355px; }
@media (prefers-reduced-motion: no-preference) {
  .sign.is-armed .trace { stroke-dashoffset: var(--len); }
  .sign.is-armed.is-in .trace { stroke-dashoffset: 0; }
  .sign.is-armed.is-in .trace-branch { animation: trace 900ms var(--ease-pen) 150ms both; }
  .sign.is-armed.is-in .trace-tine { animation: trace 420ms var(--ease-out) 540ms both; }
  .sign.is-armed.is-in .trace-foot { animation: trace 380ms var(--ease-out) 960ms both; }
}
@keyframes trace { from { stroke-dashoffset: var(--len); } }

/* ---------- the ledger: one row per experiment ---------- */
.thead { border-top-color: var(--rule-hi); }
.thead > * { padding-block: 12px; }

.app { --c: var(--muted); position: relative; }
.app[data-c="backwards"] { --c: #FF4E2E; }
.app[data-c="map-canvas"] { --c: #A9502F; --tape-ink: var(--paper); } /* the icon's rust; paper text on it reads at 4.7:1, ink would not */
.app[data-c="qaratees"] { --c: #D63A24; --tape: #E0503A; } /* tape lifted for 4.5:1 ink text; the bar keeps the icon red */
.app > * { display: flex; align-items: center; padding-block: 26px; }
.app > .who { gap: 24px; padding-left: calc(var(--pad) + 8px); box-shadow: inset 6px 0 0 var(--c); }
.app .tape { background: var(--tape, var(--c)); color: var(--tape-ink, var(--ink)); }
.app:not([data-c]) .tape { background: var(--paper); }
.app:not([data-c]) > .who { box-shadow: none; }

.ic { width: 80px; height: 80px; flex: none; border-radius: 22.5%; }
.ic.round { border-radius: 50%; }
.ic.edge { outline: 1px solid var(--edge); outline-offset: -1px; }
.ic.todo {
  display: grid; place-items: center; text-align: center;
  background: var(--tile); outline: 1px solid var(--edge); outline-offset: -1px;
  font-size: 0.75rem; line-height: 1.35; color: var(--faint);
}

.name {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  font-size: 2.75rem; letter-spacing: -0.05em; line-height: 1;
}
.name .ar { font-size: 2.125rem; }
.name .note { align-self: center; }
.line { margin-top: 10px; font-size: 1rem; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.orig { font-size: 1rem; line-height: 1.5; text-wrap: pretty; }
.val { font-size: 0.9375rem; white-space: nowrap; }

.app > .st { flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; }
.st a, .app-cue { font-size: 0.8125rem; color: var(--muted); text-decoration: underline; }
.st a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -13px; }

.app-link { text-decoration: none; }
.app-link::after { content: ""; position: absolute; inset: 0; }
.app-link:focus-visible { outline: none; }
.app-link:focus-visible::after { outline: 2px solid var(--paper); outline-offset: -4px; border-radius: 2px; }
.app-linked:hover .app-link { text-decoration: underline; text-decoration-thickness: 2px; }
.app-linked:hover .app-cue { color: var(--paper); }

/* ---------- about ---------- */
.about { border-top-color: var(--rule-hi); }
.about > * { padding-block: 44px 48px; }
.about h2 { font-size: 2.5rem; letter-spacing: -0.05em; line-height: 1; }
.about .lead { margin-top: 22px; max-width: 40ch; font-size: 1.25rem; line-height: 1.45; color: var(--paper); }
.rules li { padding-block: 12px; border-bottom: 1px solid var(--rule); color: var(--muted); }
.rules li:first-child { padding-top: 0; }
.rules li:last-child { border-bottom: 0; }

/* ---------- sign-off and contact ---------- */
.sig { padding: 52px var(--pad) 44px; border-top: 1px solid var(--rule-hi); }
.sig img { width: 100%; height: auto; }
.contact > * { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding-block: 22px 26px; }
.mail { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.3; }
.mail a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.mail a:hover { text-decoration: underline; }
.contact > .contact-fine { align-items: flex-start; gap: 0; }
.contact-fine p { font-size: 0.875rem; color: var(--muted); }
.contact-fine a { display: inline-block; padding-block: 10px; margin-block: -10px; }

/* ---------- privacy document and 404, inside the frame ---------- */
.wrap { padding-inline: var(--pad); }
.lead { margin-top: 16px; color: var(--muted); max-width: 44ch; }
.spec { border-top: 1px solid var(--rule); }
.spec div {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 16px;
  padding-block: 12px; border-bottom: 1px solid var(--rule);
}
.spec dt { font-size: 0.75rem; color: var(--faint); padding-top: 4px; }
.spec dd { font-size: 1rem; min-width: 0; overflow-wrap: anywhere; }

.doc { padding-block: 56px 96px; border-top: 1px solid var(--rule); }
.doc-wrap > * { max-width: 44rem; }
.doc-title { margin-top: 20px; font-size: clamp(2.25rem, 1.5rem + 3vw, 3.75rem); line-height: 1.02; letter-spacing: -0.045em; }
.doc-meta { margin-top: 32px; }
.doc .lead { margin-top: 32px; font-size: 1.125rem; color: var(--paper); }
.doc h2 { margin-top: 44px; font-size: 1.125rem; letter-spacing: -0.01em; }
.doc h2 + p { margin-top: 10px; }
.doc p { color: var(--muted); }
.doc .lead, .doc a { color: var(--paper); }
.doc .tape { color: var(--ink); }
.doc .spec dd a { display: inline-block; padding-block: 10px; margin-block: -10px; }

.lost { padding-block: 88px 120px; border-top: 1px solid var(--rule); }
.lost-title { font-size: clamp(6rem, 3rem + 14vw, 13rem); line-height: 0.9; letter-spacing: -0.06em; }
.lost .lead { margin-top: 24px; }
.lost .btn { margin-top: 32px; }

/* ---------- phone: two columns, rows stack ---------- */
@media (max-width: 720px) {
  :root { --pad: 16px; }
  body { padding-block: 12px; }
  .sheet {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
  .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  br.d { display: none; }

  .bar > * { min-height: 60px; }
  .bar > .bar-fact { align-items: flex-end; text-align: right; }
  .bar > .nav { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); justify-content: flex-start; min-height: 52px; padding-block: 4px; }
  .nav ul { gap: 20px; }
  .nav a { padding-inline: 0; }

  .row > .hero-copy { min-height: 0; padding-block: 32px; }
  .hero h1 { font-size: 2.5rem; text-wrap: pretty; }
  .sub { font-size: 1rem; }
  .row > .fig, .thead { display: none; }

  .app { border-top-color: var(--rule-hi); }
  .app > * { padding-block: 12px; }
  .app > .who { grid-column: 1 / -1; gap: 16px; padding-top: 20px; padding-left: calc(var(--pad) + 6px); box-shadow: inset 5px 0 0 var(--c); }
  .app > .orig { display: block; border-left: 0; border-top: 1px solid var(--rule); }
  .app > .val { display: block; border-top: 1px solid var(--rule); }
  .orig::before, .val::before { content: attr(data-k); display: block; font-size: 0.75rem; line-height: 1.6; color: var(--faint); }
  .app > .st { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; border-left: 0; border-top: 1px solid var(--rule); }
  .ic { width: 56px; height: 56px; }
  .name { font-size: 1.75rem; gap: 4px 8px; }
  .name .ar { font-size: 1.375rem; }

  .about > * { padding-block: 32px; }
  .about > .rules { border-left: 0; border-top: 1px solid var(--rule); }
  .about h2 { font-size: 2rem; }
  .about .lead { font-size: 1.125rem; }

  .sig { padding: 32px var(--pad); }
  .contact > * { padding-block: 16px; }
  .contact > .contact-fine { flex-direction: column; align-items: flex-start; gap: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .mail { font-size: 1.25rem; }

  .doc { padding-block: 40px 64px; }
  .lost { padding-block: 64px 88px; }
}
