/* Projects: shared styles for the hub and every project page (pages are generated by generate.py). */
:root {
  --paper: #f2f0e6;
  --ink: #151512;
  --muted: #6a665a;
  --hair: rgba(21, 21, 18, .16);
  --serif: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Segoe UI", "Helvetica Neue", "Hiragino Sans", "Yu Gothic", Arial, sans-serif;
  --mono: "Courier New", Courier, monospace;
}
body.projects-body { min-height: 100vh; background: linear-gradient(rgba(20,20,18,.02) 1px, transparent 1px), linear-gradient(90deg, rgba(20,20,18,.018) 1px, transparent 1px), var(--paper); background-size: 32px 32px; color: var(--ink); font-family: var(--sans); letter-spacing: 0; line-height: 1.7; }
#navbar.projects-nav { background: rgba(242,240,230,.94); border-bottom: 2px solid var(--ink); backdrop-filter: blur(10px); }
.projects-nav .menu-link { color: var(--ink); font-size: .9rem; font-weight: 700; letter-spacing: .08em; text-shadow: none; text-transform: uppercase; }
.projects-nav .menu-link::after, .projects-nav .menu-link.active::after { background: var(--ink); }
.projects-nav .menu-link:hover, .projects-nav .menu-link.active { color: var(--ink); }

/* Undo the global section/heading rules from style.css without outranking the classes below */
.projects-body :where(section) { padding: 0; border-bottom: 0; }
.projects-body :where(h1, h2, h3, p, figure, ul, ol, dl) { margin: 0; }
.projects-body :where(h1, h2, h3, h4, strong) { text-shadow: none; }
.projects-body a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.stage { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 120px 0 96px; }
.kicker { color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.projects-body .kicker a { text-decoration: none; }
.projects-body .kicker a:hover { text-decoration: underline; }

/* Hub header */
.hub-head { padding-bottom: 32px; border-bottom: 1px solid var(--ink); }
.hub-head h1 { margin-top: 10px; font-family: var(--serif); font-size: clamp(40px, 5.6vw, 68px); font-weight: 400; line-height: 1; letter-spacing: -.01em; }
.hub-head .lead { max-width: 620px; margin-top: 22px; color: var(--muted); font-size: 16px; }

/* Hub grid: each card is a single link */
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 56px 32px; margin-top: 48px; }
.projects-body a.pcard { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; }
.pcard-img { aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--hair); background: #1d1d1a; }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.25) contrast(.96); transition: transform .6s cubic-bezier(.2, .7, .2, 1), filter .4s ease; }
.pcard-img.is-document { background: #fff; }
.pcard-img.is-document img { object-fit: contain; padding: 14px; filter: none; }
.pcard:hover .pcard-img img, .pcard:focus-visible .pcard-img img { transform: scale(1.035); filter: none; }
.pcard:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.pcard-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--ink); color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.pcard h2 { margin-top: 10px; font-family: var(--serif); font-size: 27px; font-weight: 400; line-height: 1.15; }
.pcard:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.pcard p { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.pcard .pcard-tree { margin-top: 10px; padding: 0; list-style: none; font-family: var(--mono); font-size: 11.5px; line-height: 1.75; }
.pcard-tree li::before { content: "└ "; color: var(--muted); }

/* Two-column blocks: label on the left, content on the right */
.block { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; margin-top: 88px; padding-top: 18px; border-top: 1px solid var(--ink); }
.block > h2 { font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.25; }
.block-body { min-width: 0; }
.stack > * + * { margin-top: 24px; }

/* Threads */
.threads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.thread h3 { display: grid; gap: 4px; font-family: var(--serif); font-size: 19px; font-weight: 400; line-height: 1.35; }
.thread h3 span { color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.thread ol { margin-top: 14px; padding: 0; list-style: none; }
.thread li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-top: 1px solid var(--hair); font-size: 14px; line-height: 1.5; }
.thread time { color: var(--muted); font-family: var(--mono); font-size: 12px; padding-top: 1px; }
.projects-body .thread a { text-decoration: none; }
.projects-body .thread a:hover { text-decoration: underline; }
.thread small { display: block; color: var(--muted); font-size: 12px; }

/* Project head */
.p-head h1 { margin-top: 10px; font-family: var(--serif); font-size: clamp(38px, 5.6vw, 72px); font-weight: 400; line-height: 1.05; letter-spacing: -.01em; }
.p-head .p-sub { max-width: 780px; margin-top: 18px; font-family: var(--serif); font-size: clamp(19px, 2.2vw, 24px); line-height: 1.5; }
.p-cover { margin-top: 36px; aspect-ratio: 21 / 9; overflow: hidden; border: 1px solid var(--hair); background: #1d1d1a; }
.p-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.p-cover.is-document { background: #fff; }
.p-cover.is-document img { object-fit: contain; padding: 24px; }
.p-text p { max-width: 700px; font-size: 17px; line-height: 1.9; }
.p-text p + p { margin-top: 14px; }
:lang(ja) .p-text p { font-size: 16px; line-height: 2; }

/* Meta column */
.meta { display: grid; gap: 18px; align-content: start; font-size: 14px; }
.meta dt { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.meta dd { margin: 4px 0 0; line-height: 1.6; }
.thread-tag { display: block; }
.thread-tag b { display: inline-block; min-width: 26px; font-family: var(--mono); font-size: 12px; }
.thread-tag.is-adjacent { color: var(--muted); }
.links { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.node .links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.links a { font-weight: 600; }
.links a[target]::after { content: " ↗"; font-weight: 400; }
.links code { display: block; color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.btn { border: 1px solid var(--ink); background: transparent; color: var(--ink); padding: 4px 10px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }
.btn:hover, .btn[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Fractal tree: every level is the same node; nested levels hang off a rule */
.tree { margin: 0; padding: 0; list-style: none; }
.node { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 0 16px; padding: 28px 0; border-top: 1px solid var(--hair); }
.tree > .node:first-child { padding-top: 0; border-top: 0; }
.node-no { color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 700; padding-top: 9px; }
.node-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.node-head h3 { font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.2; }
.node-head time { flex: none; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.node-sub { margin-top: 4px; color: var(--muted); font-size: 14.5px; }
.node-tags { margin-top: 6px; font-size: 13px; }
.node-tags .thread-tag { display: inline; margin-right: 14px; }
.node-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 14px; }
.node-body.has-image { grid-template-columns: minmax(0, 1fr) 260px; }
.node-body > img { width: 100%; border: 1px solid var(--hair); }
.node-text > p { max-width: 640px; font-size: 15px; line-height: 1.85; }
.node-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 24px; margin-top: 14px; }
.node .tree { margin-top: 26px; padding-left: 22px; border-left: 1px solid var(--ink); }
.node .node { grid-template-columns: 52px minmax(0, 1fr); padding: 22px 0; }
.node .tree > .node:first-child { padding-top: 2px; }
.node .node .node-head h3 { font-size: 21px; }

/* Publications */
.pubs { margin: 0; padding: 0; list-style: none; }
.pub { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--hair); }
.block .pubs > .pub:first-child { border-top: 0; padding-top: 0; }
.node .pubs { margin-top: 18px; }
.pub-date { color: var(--muted); font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.pub-date span { display: block; margin-top: 2px; color: var(--ink); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.pub-title { display: block; font-size: 15px; font-weight: 700; line-height: 1.5; }
.pub-line { display: block; color: var(--muted); font-size: 13px; line-height: 1.65; }
.pub-line .self { color: var(--ink); font-weight: 700; }
.pub-line a { overflow-wrap: anywhere; }
.status { margin-left: 6px; padding: 0 4px; border: 1px solid var(--muted); font-family: var(--mono); font-size: 10.5px; }
.pubs.is-related .pub-title { font-weight: 600; }

/* Media */
.figure img { display: block; width: 100%; border: 1px solid var(--hair); background: #151512; }
.figure figcaption { margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.node .figure { margin-top: 18px; max-width: 560px; }
.video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--hair); background: #151512; }
.node .video { margin-top: 18px; max-width: 640px; }

/* Live preview: nothing loads until the reader asks for it */
.preview { border: 1px solid var(--ink); background: #1d1d1a; }
.preview[hidden] { display: none; }
.node .preview { margin-top: 18px; }
.preview-bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 12px; }
.preview-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.projects-body .preview-bar a { color: var(--paper); font-weight: 700; text-decoration: none; }
.preview-viewport { position: relative; overflow: hidden; background: #fff; }
.preview-viewport iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; }
.preview-load { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 16 / 10; border: 0; background: #1d1d1a center / cover no-repeat; cursor: pointer; }
.preview-load span { border: 1px solid var(--paper); background: rgba(21,21,18,.84); color: var(--paper); padding: 10px 16px; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.preview-load:hover span, .preview-load:focus-visible span { background: var(--paper); color: var(--ink); }

/* Long-form sections included from _partials */
.lede { max-width: 700px; color: var(--muted); font-size: 15px; line-height: 1.85; }
.figures { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.figures img { display: block; width: 100%; border: 1px solid var(--hair); background: #fff; }
.figures figcaption { margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.columns h3 { padding-bottom: 6px; border-bottom: 1px solid var(--ink); font-family: var(--serif); font-size: 19px; font-weight: 400; }
.columns ul { margin-top: 10px; padding-left: 1.1em; color: var(--muted); font-size: 14.5px; line-height: 1.85; }
.columns p { margin-top: 10px; color: var(--muted); font-size: 14.5px; line-height: 1.9; }
.columns-single p { font-size: 15px; line-height: 1.9; }
.columns-single p + p { margin-top: 12px; }
.steps { margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--hair); font-size: 15px; line-height: 1.85; }
.stack > * + .steps { margin-top: 24px; }
.steps li:first-child { border-top: 0; padding-top: 0; }
.steps b { font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1.4; }
.audio { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 24px; margin: 0; padding: 0; list-style: none; }
.audio li { padding: 12px 0; border-top: 1px solid var(--hair); }
.audio b { font-family: var(--serif); font-size: 18px; font-weight: 400; }
.audio audio { display: block; width: 100%; height: 34px; margin-top: 6px; }
.columns-single p b { font-weight: 700; }

/* System diagram: two zones joined by the links that cross between them */
.arch { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); align-items: stretch; }
.arch-zone { padding: 14px 16px 18px; border: 1px solid var(--ink); background: rgba(255,255,255,.4); }
.arch-label { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.arch-label b, .arch-lane h3 b { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.arch-note { margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.arch-lane { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--hair); }
.arch-lane h3 { display: flex; align-items: baseline; gap: 8px; font-family: var(--serif); font-size: 17px; font-weight: 400; line-height: 1.3; }
.arch-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; margin: 8px 0 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 11.5px; line-height: 1.4; }
.arch-flow li { display: flex; align-items: center; }
.arch-flow li + li::before { content: "→"; margin: 0 5px; color: var(--muted); }
.arch-flow span { padding: 2px 6px; border: 1px solid var(--ink); background: var(--paper); }
.arch-links { display: flex; flex-direction: column; justify-content: center; gap: 22px; margin: 0; padding: 0 10px; list-style: none; }
.arch-links li { font-size: 11.5px; line-height: 1.45; text-align: center; }
.arch-links b { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; }
.arch-links span:not(.arch-wire) { display: block; color: var(--muted); font-family: var(--mono); }
.arch-wire { display: block; position: relative; height: 1px; margin: 0 -10px 6px; background: var(--ink); }
.arch-wire::after { content: ""; position: absolute; right: 0; top: -4px; border-left: 7px solid var(--ink); border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.arch figcaption { grid-column: 1 / -1; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
/* Numbered design judgments */
.judgments { margin: 0; padding: 0; list-style: none; counter-reset: judgment; }
.judgments li { counter-increment: judgment; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 0 16px; padding: 20px 0; border-top: 1px solid var(--hair); }
.judgments li:first-child { padding-top: 0; border-top: 0; }
.judgments li::before { content: counter(judgment, decimal-leading-zero); grid-row: span 2; padding-top: 5px; color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.judgments h3 { font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1.4; }
.judgments p { grid-column: 2; max-width: 700px; margin-top: 6px; font-size: 15px; line-height: 1.9; }

footer { border-top: 1px solid var(--ink); background: rgba(242,240,230,.92); color: var(--muted); }

@media (max-width: 980px) {
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .threads { grid-template-columns: 1fr; }
  .block { grid-template-columns: 1fr; gap: 20px; margin-top: 72px; }
  .node-body.has-image { grid-template-columns: minmax(0, 1fr) 200px; }
}
@media (max-width: 640px) {
  #navbar ul { flex-wrap: wrap; gap: 8px 14px; padding: .8rem 1rem; }
  #navbar li { margin: 0; }
  .stage { width: calc(100% - 32px); padding-top: 128px; }
  .pgrid { grid-template-columns: 1fr; gap: 44px; }
  .p-cover { aspect-ratio: 4 / 3; }
  .node, .node .node { grid-template-columns: 1fr; }
  .node-no { padding-top: 0; }
  .node-head { flex-direction: column; gap: 2px; }
  .node-body.has-image, .figures, .columns { grid-template-columns: 1fr; }
  .node-body.has-image > img { order: -1; }
  .node .tree { padding-left: 14px; }
  .pub, .steps li { grid-template-columns: 1fr; gap: 2px; }
  .arch { grid-template-columns: 1fr; }
  .judgments li { grid-template-columns: 1fr; }
  .judgments li::before { grid-row: auto; padding-top: 0; }
  .judgments p { grid-column: 1; }
  .arch-links { flex-direction: row; gap: 8px; padding: 0; }
  .arch-links li { flex: 1; min-width: 0; padding-bottom: 8px; }
  .arch-wire { width: 1px; height: 22px; margin: 0 auto 6px; }
  .arch-wire::after { right: auto; top: auto; left: -4px; bottom: 0; border-top: 7px solid var(--ink); border-left: 4.5px solid transparent; border-right: 4.5px solid transparent; border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { .pcard-img img { transition: none; } .pcard:hover .pcard-img img { transform: none; } }

/* Slide decks: one slide at a time with a control bar, in the manner of Docswell / Speaker Deck */
.deck { margin-top: 20px; max-width: 760px; }
.deck-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--ink); border-bottom: 0; background: #fff; }
.deck-slide { display: block; width: 100%; height: 100%; object-fit: contain; }
.deck-hit { position: absolute; top: 0; bottom: 0; width: 35%; border: 0; background: transparent; cursor: pointer; }
.deck-hit[data-act="prev"] { left: 0; cursor: w-resize; }
.deck-hit[data-act="next"] { right: 0; cursor: e-resize; }
.deck-hit:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.deck-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 12px; }
.deck-btn { min-width: 28px; height: 26px; border: 1px solid rgba(242,240,230,.4); background: transparent; color: var(--paper); font-size: 14px; line-height: 1; cursor: pointer; }
.deck-btn:hover, .deck-btn:focus-visible { background: var(--paper); color: var(--ink); outline: none; }
.deck-btn:disabled { opacity: .35; cursor: default; background: transparent; color: var(--paper); }
.deck-count { min-width: 56px; text-align: center; }
.deck-count b { font-weight: 700; }
.deck-range { flex: 1; min-width: 60px; height: 16px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.deck-range::-webkit-slider-runnable-track { height: 2px; background: rgba(242,240,230,.35); }
.deck-range::-moz-range-track { height: 2px; background: rgba(242,240,230,.35); }
.deck-range::-webkit-slider-thumb { width: 10px; height: 10px; margin-top: -4px; border: 0; border-radius: 50%; background: var(--paper); -webkit-appearance: none; appearance: none; }
.deck-range::-moz-range-thumb { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--paper); }
.deck-range:focus-visible { outline: 1px solid var(--paper); outline-offset: 2px; }
.projects-body .deck-link { color: var(--paper); font-weight: 700; text-decoration: none; letter-spacing: .08em; }
.projects-body .deck-link:hover { text-decoration: underline; }
.deck figcaption { margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.deck:fullscreen { display: flex; flex-direction: column; justify-content: center; max-width: none; margin: 0; padding: 2vh 2vw; background: #0d0d0c; }
.deck:fullscreen .deck-stage { flex: 1; aspect-ratio: auto; border: 0; background: #0d0d0c; }
.deck:fullscreen figcaption { display: none; }
@media (max-width: 640px) { .deck-range { display: none; } .deck-count { flex: 1; } }
