/* hella.digital — shared styles. Tokens first, then components. */

/* Self-hosted font (SIL Open Font License; the licence sits beside the file). */
@font-face { font-family: "Space Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/fonts/SpaceMono-Regular.woff2") format("woff2"); }

:root {
  --ink:    #0D120E; /* text, rules, dark cards, primary buttons */
  --muted:  #45553D; /* secondary text */
  --moss:   #6D7E5F; /* WIP status fill ONLY. Never text. */
  --sage:   #92A079; /* active nav tile */
  --lichen: #C4C8AC; /* hover/selected rows, preview placeholders */
  --paper:  #E8E9E0; /* page background */

  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --pad: 64px;
  --max: 1312px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/22px var(--mono);
}

main { flex: 1; }

a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- type ---------- */

.m, .tag, .btn, h1, h2, dt {
  font-family: var(--mono);
  font-weight: 400;
  text-transform: uppercase;
}
.m, .tag, .btn, dt { font-size: 12px; line-height: 16px; letter-spacing: 0.02em; }
.micro { font: 400 11px/16px var(--mono); text-transform: uppercase; letter-spacing: 0.02em; }
h1 { font-size: clamp(32px, 5vw, 64px); line-height: 1.15; overflow-wrap: anywhere; }
h2 { font-size: 24px; line-height: 32px; }
.body { text-transform: lowercase; }
.small { font-size: 12px; line-height: 18px; }
.muted { color: var(--muted); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--paper); padding: 12px 16px; z-index: 10; }
.skip:focus { left: 0; }

.tag { white-space: nowrap; }
.sbox { flex: none; display: inline-block; vertical-align: -1px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--lichen); }
.btn-ink, .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--ink); text-decoration: underline; }

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid var(--ink); position: relative; min-height: 57px; }
.hd {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 6px var(--pad);
}
.brand { text-decoration: none; justify-self: start; min-height: 44px; display: inline-flex; align-items: center; }
.site-nav { display: flex; gap: 32px; }
.tile { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; white-space: nowrap; }
.tile.is-active { text-decoration: underline; text-underline-offset: 6px; }
.tile.is-disabled { color: var(--muted); cursor: default; }
a.tile:hover { text-decoration: underline; text-underline-offset: 6px; }
.mbox { display: block; width: 88px; height: 40px; border: 1px solid var(--ink); }
.mbox svg { display: block; width: 88px; height: 40px; margin: -1px; }
.counts { justify-self: end; text-align: right; display: flex; gap: 16px; align-items: center; min-height: 16px; }
.counts span { display: inline-flex; gap: 6px; align-items: center; }
.burger { display: none; width: 44px; height: 44px; border: 1px solid var(--ink); align-items: center; justify-content: center; justify-self: end; }
.burger[aria-expanded="true"] { background: var(--ink); color: var(--paper); }

/* ---------- page headings ---------- */

.hero-status { display: flex; gap: 8px; align-items: center; }

/* 404 heading */
.phead { padding-top: 48px; }
.phead h1 { font-size: 24px; line-height: 32px; }
.phead-404 { padding-bottom: 96px; }

/* ---------- index ---------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 16px 0; min-height: 48px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.state { padding: 48px 0; }

.cols { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; padding-bottom: 96px; }
.list-wrap { flex: 0 1 320px; min-width: 0; }
.list { border-top: 1px solid var(--ink); }
.row {
  display: grid;
  grid-template-columns: 10px 20px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--ink);
  text-align: left;
}
.row .row-w { text-transform: lowercase; }
.row[aria-current="true"], .row:hover { background: var(--lichen); }
.row:focus-visible { outline-offset: -2px; }

.preview { flex: 999 1 560px; min-width: 0; border: 1px solid var(--ink); }

/* Side by side: the list is exactly as tall as the preview panel and scrolls inside itself. */
@media (min-width: 1040px) {
  .cols { flex-wrap: nowrap; align-items: stretch; }
  .list-wrap { position: relative; }
  .list { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
}
.pv-head { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--ink); }
.pv-media { padding: 24px; }
.frame { position: relative; }
.still { aspect-ratio: 16 / 9; width: 100%; background: var(--lichen); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.still img { width: 100%; height: 100%; object-fit: cover; }
.crop { position: absolute; width: 16px; height: 16px; pointer-events: none; }
.crop.tl { top: -8px; left: -8px; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.crop.tr { top: -8px; right: -8px; border-top: 1px solid var(--ink); border-right: 1px solid var(--ink); }
.crop.bl { bottom: -8px; left: -8px; border-bottom: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.crop.br { bottom: -8px; right: -8px; border-bottom: 1px solid var(--ink); border-right: 1px solid var(--ink); }
.pv-info { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 16px; border-top: 1px solid var(--ink); min-height: 132px; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; border-top: 1px solid var(--ink); min-height: 77px; align-items: center; }

dl.spec > div { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--ink); }
dl.spec > div:first-child { border-top: 1px solid var(--ink); }
dl.spec dt { color: var(--muted); padding-top: 2px; }
dl.spec dd { font-size: 13px; line-height: 20px; text-transform: lowercase; overflow-wrap: anywhere; }
dl.spec dd .tag { margin-right: 6px; }

.mob { display: none; }

/* ---------- project page ---------- */

/* top bar: breadcrumb left, previous / next right */
.pbar { border-bottom: 1px solid var(--ink); }
.pbar-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 32px; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 44px; }
.crumbs li + li::before { content: "/"; margin-right: 8px; }
.crumbs a { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.pn { display: flex; flex-wrap: wrap; gap: 0 24px; }
.pn > * { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; text-decoration: none; }
.crumbs a:hover, .pn a:hover { text-decoration: underline; }

/* title row */
.ptop { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 24px; align-items: center; padding-top: 20px; }
.ptop .hero-status { grid-column: 1 / -1; margin: 0; }
.ptop h1 { font-size: 24px; line-height: 32px; }
.ptop .pactions { display: flex; gap: 8px; }
.ptop .lede { grid-column: 1 / -1; }

.pcols { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; padding-top: 16px; padding-bottom: 64px; }
.pcols .aside { flex: 0 0 280px; }
.pcols .pmain { flex: 1 1 480px; min-width: 0; }
/* 8px margin leaves room for the crop marks, whose top edge lines up with the spec sheet */
.embed-frame { margin: 8px; }
.embed-frame iframe { display: block; width: 100%; height: 520px; border: 1px solid var(--ink); background: var(--ink); }
.notes { margin-top: 48px; }
.notes h2 { margin-bottom: 16px; }
.notes .body > * + * { margin-top: 16px; }


/* ---------- simple pages ---------- */

/* about: a bordered panel in the same language as the micrographic boxes */
.about { padding-top: 32px; padding-bottom: 96px; }
.panel { border: 1px solid var(--ink); max-width: 880px; margin: 0 auto; }
.panel .pv-head { align-items: center; }
.panel-ruler { height: 12px; border-bottom: 1px solid var(--ink); }
.panel-ruler svg { display: block; }
.panel-body { padding: 16px 32px 32px; }
.panel-label { display: flex; justify-content: space-between; margin-bottom: 20px; }
.panel-copy { padding: 24px; min-height: 160px; max-width: 64ch; }
.panel-copy > * + * { margin-top: 16px; }
.panel-foot { display: grid; gap: 16px; padding: 16px; border-top: 1px solid var(--ink); }
.panel-foot dl.spec a { display: inline-flex; align-items: center; min-height: 24px; }
/* Equal-width boxes; the gap between them matches the panel's 16px padding,
   so the spacing is the same between graphics and out to the panel border. */
.micro-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 16px; }
.micro-row .mbox { width: auto; height: auto; aspect-ratio: 88 / 40; }
.micro-row .mbox svg { width: calc(100% + 2px); height: calc(100% + 2px); }
.micro-row .mbox svg * { vector-effect: non-scaling-stroke; }

.centered-actions { margin-top: 32px; }

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

.site-footer { border-top: 1px solid var(--ink); }
.ft { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 14px var(--pad); }
.ft > * { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.ft a:hover { text-decoration: underline; }

/* ---------- mobile ---------- */

/* The index fits one desktop screen: the preview still stretches to fill the
   height left over, so the whole panel, buttons included, is visible without scrolling. */
@media (min-width: 1040px) {
  body.fit-index { height: 100vh; height: 100dvh; min-height: 560px; }
  body.fit-index main { display: flex; flex-direction: column; min-height: 0; }
  body.fit-index main > .wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  body.fit-index #app { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  body.fit-index .cols { flex: 1; min-height: 0; padding-bottom: 24px; }
  body.fit-index .preview { display: flex; flex-direction: column; min-height: 0; }
  body.fit-index .pv-media { flex: 1; min-height: 0; padding: 16px; }
  body.fit-index .pv-media .frame { height: 100%; }
  body.fit-index .still { aspect-ratio: auto; height: 100%; }
  body.fit-index .still img { object-fit: contain; }
  body.fit-index .pv-info { min-height: 0; }
  body.fit-index .ft { padding-top: 6px; padding-bottom: 6px; }
  body.fit-index .ft > * { min-height: 32px; }
}

/* Project pages with no process notes fit one desktop screen: the embed
   stretches to fill whatever height is left, so nothing sits below the fold. */
@media (min-width: 960px) {
  body.fit { height: 100vh; height: 100dvh; min-height: 560px; }
  body.fit main { display: flex; flex-direction: column; min-height: 0; }
  body.fit #app { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  body.fit .pcols { flex: 1; min-height: 0; flex-wrap: nowrap; align-items: stretch; padding-bottom: 24px; }
  body.fit .aside { overflow: auto; }
  body.fit .pmain { display: flex; flex-direction: column; min-height: 0; }
  body.fit .embed-frame { flex: 1; min-height: 0; }
  body.fit .embed-frame iframe { height: 100%; }
  body.fit .ft { padding-top: 6px; padding-bottom: 6px; }
  body.fit .ft > * { min-height: 32px; }
}

@media (max-width: 700px) {
  :root { --pad: 20px; }

  .hd { grid-template-columns: 1fr auto; }
  .counts { display: none; }
  .burger { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    z-index: 5;
    flex-direction: column;
    gap: 0;
    background: var(--paper);
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
  }
  .site-nav.is-open { display: flex; }
  .site-nav .tile { display: flex; padding: 0 var(--pad); min-height: 52px; }
  .site-nav .tile + .tile { border-top: 1px solid var(--ink); }


  .desk { display: none; }
  .mob { display: block; padding-bottom: 64px; }

  .strip { display: flex; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 4px 0; }
  .strip > * { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
  .strip .sl { color: var(--muted); padding: 0 1px; }
  .strip span.lt { min-width: 14px; }
  .strip a.lt { min-width: 28px; background: var(--ink); color: var(--paper); text-decoration: none; }

  .card { border: 1px solid var(--ink); margin-top: 24px; scroll-margin-top: 16px; }
  .card .pv-media { padding: 20px; }
  .card .card-body { padding: 16px; border-top: 1px solid var(--ink); }
  .card .card-body .btn { margin-top: 16px; width: 100%; }

  .lines { margin-top: 24px; border-top: 1px solid var(--ink); }
  .lines li { display: grid; grid-template-columns: 10px 20px 1fr auto; gap: 12px; align-items: center; min-height: 44px; padding: 4px 0; border-bottom: 1px solid var(--ink); scroll-margin-top: 16px; }
  .lines .row-w { text-transform: lowercase; }
  .lines li:target, .card:target { background: var(--lichen); }

  .ptop { grid-template-columns: 1fr; }
  .ptop .pactions { order: 1; flex-wrap: wrap; }
  .panel-body { padding: 12px 20px 20px; }
  .micro-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .panel-copy { padding: 12px; }
  .pcols .aside { flex: 1 1 100%; }
  .embed-frame iframe { height: 60vh; }

  .ft { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

[hidden] { display: none !important; }
