/* lo-Graph Atlas — design system
   Palette is taken from the diagram artifacts themselves: the strand blue and
   the ground of every generated SVG are the brand colours, so a plate dissolves
   into the page instead of sitting in a box. */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-var.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("/assets/fonts/martianmono-latin-var.woff2") format("woff2");
  font-weight: 300 700;
  font-stretch: 75% 112.5%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --ground: #faf9f7;
  --field: #eceef2;
  --field-deep: #e2e5ec;
  --plate: #ffffff;

  --ink: #12161d;
  --ink-2: #4d5462;
  --ink-3: #79818f;

  --strand: #1b3bd0;
  --strand-tint: #e3e7fb;
  --neg: #a2144f;
  --neg-tint: #f7e2eb;

  --line: rgba(18, 22, 29, .13);
  --line-strong: rgba(18, 22, 29, .28);

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --jp: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;

  --gutter: clamp(1.1rem, 4vw, 3.5rem);
  --max: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0e1116;
    --field: #171b23;
    --field-deep: #1f242e;
    --plate: #121620;

    --ink: #e6e9ef;
    --ink-2: #a9b1c0;
    --ink-3: #7b8492;

    --strand: #7d97ff;
    --strand-tint: #1c2540;
    --neg: #ff8ab8;
    --neg-tint: #351c2a;

    --line: rgba(230, 233, 239, .15);
    --line-strong: rgba(230, 233, 239, .34);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans), var(--jp);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

:lang(ja) { font-family: var(--sans), var(--jp); }

a { color: inherit; }
img { max-width: 100%; }

h1, h2, h3 {
  font-weight: 600;
  font-stretch: 84%;
  letter-spacing: -.015em;
  line-height: 1.05;
  margin: 0;
}

.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.wrap-wide { max-width: 1440px; margin: 0 auto; padding-inline: var(--gutter); }

/* ── utility type ─────────────────────────────────────────────── */

.label {
  font-family: var(--mono);
  font-weight: 400;
  font-stretch: 87.5%;
  font-size: .58rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.num { font-family: var(--mono); font-weight: 400; font-variant-numeric: tabular-nums; }
.lede { color: var(--ink-2); font-size: 1.02rem; max-width: 52ch; }

/* ── shell ────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 58px;
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand .mark { width: 29px; height: 29px; color: var(--ink); --mark-vertex: var(--strand); flex: none; }
.brand b { font-weight: 600; font-stretch: 80%; font-size: 1rem; letter-spacing: -.01em; white-space: nowrap; }
.brand b i { font-style: normal; color: var(--strand); }

.topbar nav { display: flex; gap: 1.1rem; margin-left: auto; }
.topbar nav a {
  font-family: var(--mono);
  font-size: .6rem;
  font-stretch: 87.5%;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  padding: .3rem 0;
  border-bottom: 2px solid transparent;
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--strand); }

.lang {
  display: flex;
  font-family: var(--mono);
  font-size: .58rem;
  letter-spacing: .04em;
  border: 1px solid var(--line-strong);
}
.lang a { padding: .22rem .45rem; text-decoration: none; color: var(--ink-3); }
.lang a[aria-current="true"] { background: var(--ink); color: var(--ground); }

footer {
  margin-top: 5rem;
  padding: 2rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: .8rem;
}
footer .foot-grid { max-width: var(--max); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; }
footer a { text-decoration-color: var(--line-strong); }

main { padding-bottom: 1rem; }

/* ── o-data ───────────────────────────────────────────────────── */
/* The literal is the record. Only the signs are coloured; nothing else is
   added to it. */

.odata {
  display: block;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.7;
  letter-spacing: -.01em;
  color: var(--ink-3);
  overflow-x: auto;
  white-space: nowrap;
  padding: .2rem 0;
}
.odata .p { color: var(--strand); }
.odata .n { color: var(--neg); }
.odata .v { color: var(--ink-3); }
.label + .odata { margin-top: .25rem; }

/* ── home ─────────────────────────────────────────────────────── */

.hero { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.5rem, 5vw, 4rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .92fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero h1 { font-size: clamp(3.2rem, 7.4vw, 5.8rem); font-stretch: 76%; letter-spacing: -.035em; }
.hero h1 i { font-style: normal; color: var(--strand); }
.hero .lede { margin: 1.6rem 0 2.2rem; font-size: 1.06rem; max-width: 44ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .62rem 1rem;
  font-family: var(--mono);
  font-size: .62rem;
  font-stretch: 87.5%;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.btn:hover { border-color: var(--strand); color: var(--strand); }
.btn-solid { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.btn-solid:hover { background: var(--strand); border-color: var(--strand); color: #fff; }

/* the thesis: a raw code and the picture it projects to */
.demo { padding: 1.2rem; border: 1px solid var(--line); }
.demo-step { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.demo-plate { background: var(--plate); display: grid; place-items: center; padding: 1rem; }
.demo-plate img { width: 100%; height: clamp(260px, 30vw, 380px); object-fit: contain; }
.demo-arrow { display: flex; justify-content: center; padding: .9rem 0 .7rem; color: var(--ink-3); }
.demo-arrow hr { flex: 1; border: 0; border-top: 1px solid var(--line-strong); margin: 0; }
.demo-foot { display: flex; justify-content: space-between; gap: 1rem; padding-top: .8rem; }

/* area pipeline — the site's own map, and the area navigation */
.pipeline { border-top: 1px solid var(--line-strong); }
.pipe-row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) minmax(0, 1fr) 5rem;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.pipe-row:hover { background: var(--field); }
.pipe-row.head { padding: .55rem 0; border-bottom-color: var(--line-strong); }
.pipe-area { font-weight: 600; font-stretch: 84%; font-size: 1.15rem; }
.pipe-area small { display: block; font-family: var(--mono); font-size: .56rem; font-weight: 400; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.pipe-cell { font-size: .84rem; color: var(--ink-2); min-width: 0; }
.pipe-cell b { display: block; font-weight: 500; color: var(--ink); font-size: .9rem; }
.pipe-count { font-family: var(--mono); font-size: .68rem; text-align: right; color: var(--ink-3); }
.pipe-count b { color: var(--ink); font-weight: 500; }

.band { background: var(--field); padding: clamp(2.5rem, 5vw, 4rem) 0; margin-top: clamp(2.5rem, 5vw, 4rem); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.6rem; }
.section-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.section-head p { margin: .5rem 0 0; color: var(--ink-2); font-size: .9rem; max-width: 46ch; }

/* ── index table ──────────────────────────────────────────────── */

.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.5rem 0 1rem; }
.chip {
  font-family: var(--mono);
  font-size: .6rem;
  font-stretch: 87.5%;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .34rem .6rem;
  border: 1px solid var(--line-strong);
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ground); }

.table-scroll { overflow-x: auto; }
table.records { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.records th {
  text-align: left;
  padding: .55rem .7rem;
  font-family: var(--mono);
  font-weight: 400;
  font-size: .56rem;
  font-stretch: 87.5%;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
table.records td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.records tbody tr:hover { background: var(--field); }
table.records a { text-decoration: none; }
table.records .obj { font-weight: 600; font-stretch: 88%; font-size: 1rem; white-space: nowrap; }
table.records .obj small { display: block; font-weight: 400; font-stretch: 100%; font-size: .72rem; color: var(--ink-3); }
table.records .thumb { width: 54px; }
table.records .thumb img { display: block; width: 54px; height: 40px; object-fit: contain; }
table.records .id { font-family: var(--mono); font-size: .64rem; color: var(--ink-3); white-space: nowrap; }
td.center, th.center { text-align: center; }

.area-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .58rem;
  letter-spacing: .03em;
  padding: .18rem .42rem;
  background: var(--field-deep);
  color: var(--ink-2);
  white-space: nowrap;
}


/* a Gauss code stays on one line in a table and keeps its own tracking */
td.code-cell { font-size: .78rem; letter-spacing: .02em; white-space: nowrap; color: var(--strand); }
.pi1-cell .formula { background: none; padding: 0; font-size: .72rem; line-height: 1.7; margin-bottom: .35rem; }
.pi1-cell { min-width: 20rem; }

/* ── evidence classes ─────────────────────────────────────────── */

.ev {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  font-family: var(--mono);
  font-size: .56rem;
  font-stretch: 87.5%;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.ev::before { content: ""; width: 7px; height: 7px; flex: none; }
.ev-verified-computation::before { background: var(--strand); }
.ev-computed::before { background: var(--strand); opacity: .45; }
.ev-reported::before { background: var(--ink-3); }
.ev-uncomputed::before { border: 1px solid var(--line-strong); }
.ev-not-applicable::before { background: repeating-linear-gradient(45deg, var(--line-strong) 0 1px, transparent 1px 3px); }
.ev-unknown::before { background: var(--neg); }

.dash { color: var(--ink-3); font-family: var(--mono); }

/* ── object page ──────────────────────────────────────────────── */

.obj-head { padding: clamp(2rem, 4vw, 3.2rem) 0 1.6rem; }
.crumb { display: flex; gap: .5rem; font-family: var(--mono); font-size: .6rem; color: var(--ink-3); margin-bottom: 1.4rem; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--strand); }
.obj-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem 1.4rem; }
.obj-title h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); font-stretch: 76%; }
.obj-title .kind { color: var(--ink-2); font-size: .92rem; }
.obj-id { font-family: var(--mono); font-size: .66rem; color: var(--ink-3); margin-top: .8rem; }

.record { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 1.5rem; align-items: start; }
.plate { background: var(--plate); border: 1px solid var(--line); padding: .9rem; }
.plate img { display: block; width: 100%; height: clamp(300px, 42vw, 460px); object-fit: contain; }
.plate figcaption { display: flex; justify-content: space-between; gap: 1rem; padding-top: .7rem; margin-top: .7rem; border-top: 1px solid var(--line); }

.rail { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.rail > div { background: var(--ground); padding: .55rem .8rem; }
.rail dt { font-family: var(--mono); font-size: .56rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.rail dd { margin: .18rem 0 0; font-size: .95rem; font-weight: 500; }
.rail dd.big { font-size: 1.9rem; font-stretch: 84%; font-weight: 600; line-height: 1; padding: .1rem 0; }

section.block { padding-top: clamp(1.7rem, 3vw, 2.6rem); }
section.block > h2 { font-size: 1.35rem; margin-bottom: .3rem; }
section.block > .label { display: block; margin-bottom: .55rem; }
section.block > p { color: var(--ink-2); margin: .2rem 0 .9rem; max-width: 62ch; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.kv > div { background: var(--ground); padding: .5rem .7rem; }
.kv dt { font-family: var(--mono); font-size: .56rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.kv dd { margin: .2rem 0 0; font-size: .9rem; }

.formula {
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.85;
  padding: .2rem 0;
  overflow-x: auto;
  word-break: break-word;
}
.formula .gen { color: var(--strand); }

.note {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1.2rem;
  padding: 1rem 1.1rem;
  background: var(--field);
  border-left: 3px solid var(--neg);
}
.note p { margin: 0; color: var(--ink-2); font-size: .88rem; }

.commentary { background: var(--field); padding: clamp(1.4rem, 3vw, 2.2rem); border-top: 3px solid var(--strand); }
.commentary h2 { font-size: 1.5rem; margin: .5rem 0 .8rem; }
.commentary p { color: var(--ink-2); max-width: 62ch; }

.empty {
  padding: clamp(2rem, 5vw, 3.4rem);
  background: var(--field);
  border: 1px dashed var(--line-strong);
  text-align: center;
}
.empty h3 { font-size: 1.15rem; margin: .6rem 0 .5rem; }
.empty p { color: var(--ink-2); margin: 0 auto; max-width: 46ch; font-size: .9rem; }

.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.legend-grid > div { background: var(--ground); padding: 1rem 1.1rem; }
.legend-grid p { margin: .45rem 0 0; font-size: .85rem; color: var(--ink-2); }




/* ── masthead ─────────────────────────────────────────────────── */

.masthead { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 2.1rem; }
.masthead .mark { width: 104px; height: 104px; color: var(--ink); --mark-vertex: var(--strand); flex: none; }
.masthead span { font-weight: 600; font-stretch: 78%; font-size: 1.7rem; letter-spacing: -.02em; line-height: 1.1; }
.masthead span i { font-style: normal; color: var(--strand); }

/* ── plate grid ───────────────────────────────────────────────── */

.plate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.plate-card {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 1rem 1rem 1.1rem;
  background: var(--ground);
  text-decoration: none;
  transition: background 140ms ease;
}
.plate-card:hover { background: var(--field); }
.plate-card-figure { --fig-h: 190px; display: block; height: var(--fig-h); }
.plate-card-figure img { display: block; width: 100%; height: var(--fig-h); object-fit: contain; }
.plate-card-name { font-weight: 600; font-stretch: 88%; font-size: 1.15rem; letter-spacing: -.01em; }
.plate-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--ink-3);
}

.viewbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.6rem 0 1.2rem; }
.viewbar .filters { margin: 0; }
.absent { color: var(--ink-3); font-size: .9rem; }
p.no-match { padding: 2.5rem 0; color: var(--ink-3); text-align: center; }
.kv.stack { grid-template-columns: 1fr; }
.kv.stack dd { max-width: 68ch; }


/* ── hand-written passages ────────────────────────────────────── */
/* Machine-generated fields carry the record; a manuscript adds prose beside
   them and is set apart by a rule rather than a panel. */

.prose {
  margin-top: 1.5rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--strand);
  max-width: 62ch;
}
.prose h3 { font-size: 1.05rem; font-weight: 600; font-stretch: 88%; margin: 1.2rem 0 .4rem; }
.prose h3:first-child { margin-top: 0; }
.prose p { margin: .5rem 0; color: var(--ink-2); }
.prose ul { margin: .5rem 0; padding-left: 1.1rem; color: var(--ink-2); }
.prose li { margin: .25rem 0; }
.prose a { color: var(--strand); }
.prose code { font-family: var(--mono); font-size: .82em; }

.commentary .prose { border-left: 0; padding-left: 0; margin-top: .6rem; }
.commentary .prose h3 { font-size: 1.5rem; font-stretch: 84%; letter-spacing: -.015em; margin-bottom: .7rem; }
.obj-head .prose { margin-top: 1.4rem; }

/* ── utilities used by generated markup ───────────────────────── */

.page-title { font-size: clamp(2rem, 4vw, 3rem); margin-top: .5rem; }
.page-lede { margin-top: 1rem; }
.band-tight { padding-top: 1.4rem; }
.spaced { margin-top: .9rem; }
.demo, .plate { margin: 0; }
.demo-open { color: var(--strand); }
.h1-value { font-size: clamp(2rem, 4.6vw, 2.6rem); font-stretch: 80%; }
.val { font-size: 1rem; }
.label.plain { text-transform: none; }
.label-block { display: block; margin: 1.6rem 0 .5rem; }
table.records td.obj.compact { font-size: .9rem; }
.rail dd.small, .kv dd.small { font-size: .84rem; font-weight: 400; }
.kv dt.filename { text-transform: none; font-size: .7rem; color: var(--ink); }
.empty.flush { text-align: left; }
.empty.flush p { margin-left: 0; }

/* ── motion ───────────────────────────────────────────────────── */

a:focus-visible, .chip:focus-visible { outline: 2px solid var(--strand); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* Japanese display sizing: no width axis in the fallback face, so the display
   sizes are set independently rather than inherited from the latin scale. */
:lang(ja) .hero h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  letter-spacing: -.02em;
  line-height: 1.28;
  word-break: keep-all;
  overflow-wrap: normal;
}
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 { letter-spacing: -.01em; line-height: 1.3; }
:lang(ja) .obj-title h1, :lang(ja) .rail dd.big { line-height: 1.1; }

/* ── responsive ───────────────────────────────────────────────── */

@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; }
  .record { grid-template-columns: 1fr; }
  .pipe-row { grid-template-columns: 7rem repeat(2, minmax(0, 1fr)) 4rem; row-gap: .5rem; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  /* The bar becomes two rows: identity and language stay put, the sections
     scroll sideways rather than shrinking past legibility. */
  .topbar {
    position: static;
    height: auto;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    padding-block: .6rem;
  }
  .topbar nav {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    gap: 1.1rem;
    overflow-x: auto;
    padding-bottom: .15rem;
  }
  .topbar nav a { font-size: .58rem; white-space: nowrap; }
  .lang { margin-left: auto; }
  .brand b { font-size: .9rem; }
  .note { grid-template-columns: 1fr; gap: .4rem; }
  .pipe-row { grid-template-columns: 5.5rem minmax(0, 1fr) 3.4rem; }
  .pipe-row .pipe-cell:nth-child(3) { display: none; }
  .demo-plate img { height: 200px; }
  .masthead .mark { width: 64px; height: 64px; }
  .masthead span { font-size: 1.25rem; }
  .plate-grid { grid-template-columns: repeat(2, 1fr); }
  .plate-card-figure { --fig-h: 132px; }
}
