/*
 * stigbord.alluv.dev: intricate intaglio line work cut into basalt.
 * The stone is CSS (a grain tile over slow mottling), so it shows without
 * JavaScript; the carvings are transparent canvases laid over it.
 * DESIGN.md has the rationale.
 */

/* Type ------------------------------------------------------------------ */
@font-face {
  font-family: Manrope; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/manrope-400.ttf") format("truetype");
}
@font-face {
  font-family: Manrope; font-style: normal; font-weight: 600;
  font-display: swap; src: url("fonts/manrope-600.ttf") format("truetype");
}
@font-face {
  font-family: Newsreader; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/newsreader.ttf") format("truetype");
}

/* Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --stone: #131617;
  --ink: #e2e6dc;
  --muted: #9ea69a;
  --accent: #b9c7a6;
  --line: #3c4440;

  /* The cut, read by stigbord.js: the matte floor of a groove, as r,g,b. */
  --cut: 196,204,190;

  --serif: Newsreader, Georgia, serif;
  --sans: Manrope, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-md: 16px;
  --text-lg: 19px;
  --display-sm: clamp(26px, 2.8vw, 34px);
  --display-xl: clamp(64px, 9vw, 112px);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --gutter: clamp(16px, 5.5vw, 80px);
  --measure: 60ch;
  --shell: 1360px;
  --side: 300px;

  /* Letters cut into stone: a dark lip above, a faint light edge below. */
  --carve: 0 -1px 0 rgba(0,0,0,.9), 0 1px 0 rgba(255,255,255,.07);
}

/* The stone ------------------------------------------------------------- */
* { box-sizing: border-box; }
html {
  background-color: var(--stone);
  background-image:
    url("stone.png"),
    radial-gradient(ellipse 60% 40% at 18% 22%, rgba(255,255,255,.028), transparent 70%),
    radial-gradient(ellipse 50% 45% at 82% 64%, rgba(255,255,255,.022), transparent 70%),
    radial-gradient(ellipse 70% 50% at 40% 90%, rgba(0,0,0,.18), transparent 70%),
    linear-gradient(115deg, rgba(255,255,255,.025), transparent 40%, rgba(255,255,255,.012) 70%, transparent);
  background-size: 256px 256px, 1600px 1400px, 1700px 1500px, 1500px 1800px, 100% 100%;
  color: var(--ink);
  font: 400 var(--text-md)/1.6 var(--sans);
}
body { margin: 0; overflow-x: hidden; }
.page { overflow-x: clip; }

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

.carved { text-shadow: var(--carve); }

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
code { font: 0.92em/1 var(--mono); color: var(--accent); }

.skip {
  position: absolute; left: var(--space-4); top: -60px; z-index: 10;
  background: var(--accent); color: var(--stone); padding: var(--space-2) var(--space-4);
}
.skip:focus { top: var(--space-4); }

/* Friezes: microtext between two cut rules ------------------------------ */
.frieze {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  padding: 5px 0;
  font: 7.5px/1 var(--mono);
  letter-spacing: .14em;
  color: rgba(200,208,192,.5);
  text-shadow: var(--carve);
  border-top: 1px solid rgba(0,0,0,.75);
  border-bottom: 1px solid rgba(0,0,0,.75);
  box-shadow: 0 1px 0 rgba(255,255,255,.06), inset 0 1px 0 rgba(255,255,255,.06);
  user-select: none;
}

/* Hero ------------------------------------------------------------------ */
.hero { position: relative; }
.hero .art { position: absolute; inset: 0; pointer-events: none; }
.hero .carving { width: 100%; height: 100%; display: block; }
.masthead {
  position: relative;
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--space-5); flex-wrap: wrap;
  min-height: 84px; padding-block: var(--space-4);
}
.wordmark { font: 400 24px/1 var(--serif); letter-spacing: .08em; text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.hero-body { position: relative; min-height: 600px; display: flex; justify-content: space-between; gap: var(--space-6); padding-block: var(--space-9) var(--space-8); }
.hero-text { max-width: 500px; }
.over { margin: 0; font-size: var(--text-xs); letter-spacing: .36em; text-transform: uppercase; color: var(--accent); }
h1 { font: 400 var(--display-xl)/1 var(--serif); letter-spacing: .02em; margin: var(--space-4) 0 var(--space-5); }
.lede { font: 400 22px/1.45 var(--serif); margin: 0; max-width: 28ch; }
.serial { position: absolute; right: var(--gutter); bottom: var(--space-5); margin: 0; text-align: right; font: 15px/1.4 var(--mono); letter-spacing: .16em; color: var(--accent); text-shadow: var(--carve); }
.serial small { display: block; font-size: var(--text-xs); letter-spacing: .06em; color: var(--muted); margin-top: var(--space-1); }

/* Sections -------------------------------------------------------------- */
.main { display: block; }
.caption { font-size: 12px; color: var(--muted); margin: var(--space-3) 0 0; }
.section { padding-block: var(--space-9); }
.section + .section { padding-top: 0; }
.split { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); gap: var(--space-8); }
h2 { font: 400 var(--display-sm)/1.15 var(--serif); margin: 0; }
h3 { font: 400 21px/1.3 var(--serif); margin: 0; }
.side { font-size: 14px; color: var(--muted); margin: var(--space-4) 0 0; }
.prose { font: 400 var(--text-lg)/1.55 var(--serif); max-width: var(--measure); }
.prose p { margin: 0 0 var(--space-4); }
.prose code { font-size: .8em; }
.term { font-style: italic; font-size: 34px; }
.term-kind { margin: var(--space-1) 0 0; font-size: 12px; letter-spacing: .08em; color: var(--muted); }

.margin { margin: var(--space-7) 0 0; }
.margin .carving { display: block; width: 100%; height: 220px; }
.margin.tall .carving { height: 520px; }

.numeral { font: 13px/1 var(--mono); color: var(--accent); text-shadow: var(--carve); }

.goals { list-style: none; margin: var(--space-7) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-7); }
.goals .numeral { display: block; margin-bottom: var(--space-4); }
.goals h3 { margin-bottom: var(--space-3); }
.goals p { margin: 0; font: 17px/1.55 var(--serif); color: var(--muted); }

.steps { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: var(--space-8); }
.steps li { break-inside: avoid; display: grid; grid-template-columns: 44px 1fr; padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.steps .numeral { padding-top: 6px; }
.steps p { margin: var(--space-1) 0 0; font-size: 14px; color: var(--muted); }
.motto { font: 400 26px/1.3 var(--serif); margin: var(--space-7) 0 0; letter-spacing: .02em; }

.code {
  margin: 0; padding: var(--space-5) 0; overflow-x: auto;
  font: 13px/1.6 var(--mono); color: var(--ink);
  border-top: 1px solid rgba(0,0,0,.75); border-bottom: 1px solid rgba(0,0,0,.75);
  box-shadow: 0 1px 0 rgba(255,255,255,.05), inset 0 1px 0 rgba(255,255,255,.05);
  text-shadow: var(--carve);
}
.code code { color: inherit; font: inherit; }
.code .c { color: var(--muted); }
.hash { margin: var(--space-3) 0 var(--space-6); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; vertical-align: top; padding: var(--space-4) var(--space-4) var(--space-4) 0; border-bottom: 1px solid var(--line); }
.table thead th { font: 600 var(--text-xs) var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.table tbody th { font: 400 20px var(--serif); white-space: nowrap; }
.table td { font-size: 14px; }
.table .state { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.table .state.running { color: var(--accent); }

.claims { margin: 0; padding-left: 1.1em; }
.claims li { margin-bottom: var(--space-3); }

.strict { text-align: center; }
.strict .inscription { font: 400 clamp(28px, 4vw, 48px)/1.15 var(--serif); letter-spacing: .02em; margin: var(--space-6) auto var(--space-6); max-width: 22ch; }
.strict .prose { margin: 0 auto; text-align: left; }

.lone { min-height: 50vh; }

.footer { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); align-items: baseline; padding-block: var(--space-6) var(--space-8); font-size: var(--text-sm); color: var(--muted); }
.wordmark-small { font: 20px var(--serif); color: var(--ink); letter-spacing: .06em; margin-right: auto; }

/* Narrow ---------------------------------------------------------------- */
@media (max-width: 1100px) {
  .goals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { columns: 1; }
}
@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .margin { max-width: 420px; }
  .margin.tall { display: none; }
  .hero-body { flex-direction: column; min-height: 0; padding-bottom: 380px; }
  .serial { position: static; text-align: left; }
}
@media (max-width: 600px) {
  .goals { grid-template-columns: minmax(0, 1fr); }
  .hero-body { padding-top: var(--space-7); padding-bottom: 300px; }
  .section { padding-block: var(--space-8); }
  /* Each role on its own: name and state, then job. */
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table tr { display: grid; grid-template-columns: 1fr auto; column-gap: var(--space-3); align-items: baseline; padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
  .table th, .table td { padding: 0; border: 0; }
  .table td:nth-of-type(1) { grid-column: 1 / -1; order: 3; margin-top: var(--space-1); }
  .table .state { order: 2; }
}

/* The carvings are decoration: gone in forced colors and in print. */
@media (forced-colors: active) {
  .carving, .frieze { display: none; }
}
@media print {
  html { background: #fff; color: #000; }
  .carving, .frieze, .skip { display: none; }
  .carved, .code, .serial, .numeral { text-shadow: none; }
}
