/* shell.css — the catalogue design system, applied site-wide.
 * The same fonts, inks, paper grounds and drawn ornaments the studio uses,
 * factored out so every page of the site reads as one continuous object.
 * Foundation (fonts / themes / base / masthead / footer) is shared with the
 * studio; the components below (cover index, page heads, entry lists, cards)
 * are the general-site pieces. Pencil rules and drawn titles are painted at
 * runtime by graphite.js + masthead.js; without JS the crisp borders remain. */

/* ---------- fonts ---------- */
@font-face { font-family: "Happy Times"; src: url("fonts/HappyTimes-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Happy Times"; src: url("fonts/HappyTimes-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Happy Times"; src: url("fonts/HappyTimes-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Redaction 100"; src: url("fonts/Redaction_100-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Routed Gothic"; src: url("fonts/routed-gothic.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Routed Gothic"; src: url("fonts/routed-gothic-half-italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Routed Gothic Narrow"; src: url("fonts/routed-gothic-narrow.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Courrrier"; src: url("fonts/Courrrier.otf") format("opentype"); font-display: swap; }

:root {
  --paper-rgb: 231, 228, 221;
  --ink-rgb: 28, 26, 22;
  --paper: rgb(var(--paper-rgb));
  --paper-deep: rgb(222, 218, 209);
  --ink: rgb(var(--ink-rgb));
  --ink-soft: #4a463f;
  --ink-faint: #8b857a;
  --rule: rgba(var(--ink-rgb), 0.22);
  --rule-faint: rgba(var(--ink-rgb), 0.1);
  --sanguine: #9c3d1e;
  --sang-rgb: 156, 61, 30;

  --font-display: "Happy Times", serif;
  --font-text: "Happy Times", georgia, serif;
  --font-mono: "Routed Gothic", monospace;
  --font-code: "Courrrier", monospace;
  --font-degraded: "Redaction 100", serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* faint paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.4vw, 34px) 96px;
}
.wrap.narrow { max-width: 820px; }

/* ---------- themes: white / cream (default) / dark ---------- */
html[data-theme="white"] {
  --paper-rgb: 250, 250, 247;
  --paper-deep: #efeeea;
}
html[data-theme="dark"] {
  --paper-rgb: 25, 24, 21;
  --paper-deep: #211f1b;
  --ink-rgb: 226, 221, 210;
  --ink-soft: #b5afa2;
  --ink-faint: #7d786d;
  --sanguine: #c05f38;
  --sang-rgb: 192, 95, 56;
}

.theme-picker { display: inline-flex; gap: 5px; align-items: center; }
.theme-picker button {
  width: 13px; height: 13px; border: 1px solid var(--rule); cursor: pointer; padding: 0;
}
.theme-picker button[data-t="white"] { background: #fafaf7; }
.theme-picker button[data-t="cream"] { background: rgb(231, 228, 221); }
.theme-picker button[data-t="dark"] { background: #191815; }
.theme-picker button.cur { outline: 1px solid var(--sanguine); outline-offset: 1px; }

/* ---------- top bar (site nav, on inner pages) ---------- */
.topbar {
  position: relative; z-index: 2;
  max-width: 1180px; margin: 0 auto;
  padding: 20px clamp(16px, 2.4vw, 34px) 0;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px 20px; flex-wrap: wrap;
}
.topbar .home {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em;
  text-transform: lowercase; color: var(--ink-faint);
}
.topbar .home:hover { color: var(--sanguine); }
.topbar nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; }
.topbar nav a {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em;
  text-transform: lowercase; color: var(--ink-faint);
}
.topbar nav a:hover, .topbar nav a.cur { color: var(--sanguine); }
.topbar .theme-picker { margin-left: 4px; }
@media (max-width: 620px) {
  .topbar nav { gap: 12px; }
}

/* ---------- masthead ---------- */
header.mast { padding: clamp(28px, 5vh, 56px) 0 0; }
.mast .over {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.28em;
  text-transform: lowercase; color: var(--ink-faint);
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 8px 16px;
}
.mast .over a, .mast .over span { white-space: nowrap; }
.mast .over a:hover { color: var(--sanguine); }
@media (max-width: 520px) { .mast .over { flex-direction: column; } }

.mast h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(56px, 11vw, 128px); line-height: 0.94;
  letter-spacing: 0.01em; margin: 18px 0 0 -4px;
}
.mast-title { position: relative; margin-top: 18px; }
.mast-title h1 { margin-top: 0; }
#masthead-canvas { display: none; width: 100%; }
.mast-title.mast-drawn h1 {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.mast-title.mast-drawn #masthead-canvas { display: block; }

.mast .intro { max-width: 560px; margin: 26px 0 0; font-size: 15.5px; color: var(--ink-soft); }
.mast .rule { border: 0; border-top: 1px solid var(--ink); margin: 40px 0 0; }

/* ---------- drawn headings ---------- */
.drawn-title { position: relative; }
.drawn-title canvas { display: block; max-width: 100%; }
.drawn-title h1, .drawn-title h2 {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.drawn-title:not(:has(canvas[width])) h1,
.drawn-title:not(:has(canvas[width])) h2 { position: static; width: auto; height: auto; clip-path: none; }

/* ================================================================
   COVER — the homepage: masthead + colophon index of every section
   ================================================================ */
.cover-intro {
  max-width: 620px; margin: 30px 0 0;
  font-size: 16.5px; line-height: 1.72; color: var(--ink-soft);
}
.cover-intro em { font-style: italic; }

.index {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  border: 1px solid var(--ink);
  margin-top: 44px;
}
.index-list { padding: 8px 34px 20px; border-right: 1px solid var(--rule); }
.index-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 20px 0; border-bottom: 1px solid var(--rule-faint);
}
.index-row:last-child { border-bottom: 0; }
.index-row .rn {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  color: var(--sanguine); flex: none; width: 26px;
}
.index-row .body { flex: 1; min-width: 0; }
.index-row .nm {
  display: block;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(24px, 3.4vw, 34px); line-height: 1.04;
}
.index-row:hover .nm { color: var(--sanguine); }
.index-row .desc { display: block; font-size: 14px; color: var(--ink-faint); font-style: italic; margin-top: 4px; }
.index-row .ct {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  color: var(--sanguine); flex: none; align-self: center;
}

/* preview well on the cover (right column) */
.cover-well {
  padding: 22px 20px; background: var(--paper-deep);
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
}
.cover-well .frame {
  border: 1px solid var(--rule); background: var(--paper); padding: 8px;
  min-height: 300px; display: flex; align-items: center; justify-content: center;
}
.cover-well .frame img { max-width: 100%; max-height: 44vh; object-fit: contain; }
.cover-well .cap {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em;
  color: var(--ink-faint); text-align: center; text-transform: lowercase;
}
@media (max-width: 860px) {
  .index { grid-template-columns: 1fr; }
  .index-list { border-right: 0; }
  .cover-well { display: none; }
}

/* ================================================================
   INNER PAGE HEAD — back-link rail + drawn/plain title + standfirst
   ================================================================ */
.pagehead { padding: clamp(30px, 6vh, 64px) 0 0; }
.pagehead .kicker {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .28em;
  text-transform: lowercase; color: var(--sanguine); margin-bottom: 12px;
}
.pagehead h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(40px, 8vw, 86px); line-height: 0.96;
  letter-spacing: 0.01em; margin: 0 0 0 -3px;
}
.pagehead .standfirst {
  max-width: 620px; margin: 22px 0 0;
  font-size: 16.5px; line-height: 1.7; color: var(--ink-soft);
}
.pagehead .rule { border: 0; border-top: 1px solid var(--ink); margin: 34px 0 0; }

/* ---------- section heads (shared) ---------- */
.sect2 {
  display: flex; gap: 16px; align-items: baseline;
  margin: 64px 0 10px; border-bottom: 1px solid var(--ink); padding-bottom: 10px;
}
.sect2 .rn { font-family: var(--font-mono); font-size: 13px; color: var(--sanguine); letter-spacing: .1em; }
.sect2 h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 4vw, 36px); margin: 0; }
.sect2 .n { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); margin-left: auto; }
.sect-note { font-family: var(--font-text); font-style: italic; font-size: 14px; color: var(--ink-faint); max-width: 560px; margin: 0 0 26px; }

/* ================================================================
   ENTRY LIST — writings / linear catalogue rows
   ================================================================ */
.entries { margin-top: 30px; }
.entry {
  display: grid; grid-template-columns: 82px 1fr auto; gap: 22px;
  align-items: baseline; padding: 22px 0;
  border-bottom: 1px solid var(--rule-faint);
}
.entry:first-child { border-top: 1px solid var(--ink); }
.entry .date {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em;
  color: var(--ink-faint); text-transform: lowercase; white-space: nowrap;
}
.entry .lead { min-width: 0; }
.entry .title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(22px, 3vw, 30px); line-height: 1.1;
}
.entry:hover .title { color: var(--sanguine); }
.entry .dek { font-size: 15px; color: var(--ink-soft); margin-top: 5px; max-width: 620px; }
.entry .tag {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em;
  text-transform: lowercase; color: var(--sanguine); white-space: nowrap;
  align-self: center;
}
@media (max-width: 640px) {
  .entry { grid-template-columns: 1fr; gap: 6px; }
  .entry .tag { grid-row: 1; justify-self: start; }
}

/* ================================================================
   CARD GRID — collection / projects (image-led)
   ================================================================ */
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: clamp(26px, 3.4vw, 46px) clamp(22px, 2.6vw, 38px);
  margin-top: 32px;
}
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { display: block; }
.card .frame {
  border: 1px solid var(--rule); background: var(--paper-deep);
  aspect-ratio: 4 / 5; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.card.free .frame { aspect-ratio: auto; min-height: 200px; }
.card .frame img { width: 100%; height: 100%; object-fit: contain; background: var(--paper); }
.card .meta { margin-top: 11px; }
.card .t {
  font-family: var(--font-display); font-weight: 400;
  font-size: 18px; line-height: 1.14;
}
.card:hover .t { color: var(--sanguine); }
.card .by { font-size: 13.5px; color: var(--ink-soft); font-style: italic; margin-top: 2px; }
.card .yr {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em;
  color: var(--ink-faint); margin-top: 5px; text-transform: lowercase;
}

/* ---------- prose (about / long text) ---------- */
.prose { max-width: 660px; margin-top: 30px; }
.prose p { margin: 0 0 20px; font-size: 16.5px; line-height: 1.72; }
.prose p:first-child::first-letter,
.prose .drop::first-letter {
  font-family: var(--font-display); float: left; font-size: 3.4em;
  line-height: 0.78; padding: 6px 10px 0 0; color: var(--sanguine);
}
.prose h2 {
  font-family: var(--font-mono); font-weight: 500; font-size: 12px;
  letter-spacing: .28em; text-transform: lowercase; color: var(--sanguine);
  margin: 40px 0 14px;
}
.prose a { color: var(--sanguine); text-decoration: underline; text-underline-offset: 2px; }
.prose ul { padding-left: 20px; margin: 0 0 20px; }
.prose li { margin: 0 0 8px; font-size: 16px; }

/* dl for pinned facts (about) */
.facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px;
  margin-top: 28px; max-width: 620px;
}
.facts dt {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: lowercase; color: var(--ink-faint); align-self: baseline;
}
.facts dd { margin: 0; font-size: 15.5px; }
.facts dd a { color: var(--sanguine); }

img.g-under { filter: grayscale(0.9) contrast(0.86) sepia(0.16) brightness(1.04); }
img.g-under.g-resolved { filter: none; transition: filter 1.15s ease 0.12s; }

[data-die] { display: inline-flex; align-items: center; line-height: 0; }

.load-error {
  margin: 60px 0; border: 1px solid var(--sanguine); padding: 24px;
  font-family: var(--font-mono); font-size: 12px; color: var(--sanguine); letter-spacing: 0.04em;
}

/* ---------- footer ---------- */
footer.colophon {
  position: relative; z-index: 2;
  max-width: 1180px; margin: 110px auto 0;
  padding: 14px clamp(16px, 2.4vw, 34px) 60px;
  border-top: 1px solid var(--ink);
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px 24px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: lowercase; color: var(--ink-faint);
}
footer.colophon a:hover { color: var(--sanguine); }
footer.colophon .cols { display: flex; gap: 22px; flex-wrap: wrap; }
footer.colophon .theme-picker { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
