/*****************************************************
site.css — home graph and section pages.
Sizes and positions follow the original PixiJS site
(main.js params, SubItem/MainItem, ContentDefault/ContentWorks).
Motion: only transform / opacity / filter.
*****************************************************/

:root {
  --bg: #111111;
  --node: #ffcc00;
  /* section content: left edge = tlPos.x + margin.x (170 + 40), phones 8 + 10 */
  --sc-x: 210px;
  /* frame width: the original 650 px, growing with the screen up to a standard
     1140 px container (same formula as frameWidth() in sections.js) */
  --sc-frame: min(1140px, max(min(650px, 100vw - 170px), 100vw - 230px));
  /* content column inside it (originally 550 px), cards up to 900 px */
  --sc-w: min(calc(var(--sc-frame) - 100px), 900px);
  color-scheme: dark;
}

* {
  -webkit-font-smoothing: antialiased;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #ffcc00 #1a1a1a; /* the original's yellow scroll thumb */
}
html::-webkit-scrollbar {
  width: 8px;
}
html::-webkit-scrollbar-track {
  background: #1a1a1a;
}
html::-webkit-scrollbar-thumb {
  background: #ffcc00;
}

body {
  margin: 0;
  background: var(--bg);
  color: #f3f3f3;
  font: 16px/1.4 Helvetica, Arial, sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--node);
  color: #111;
  transform: translateY(-200%);
}
.skip:focus {
  transform: none;
}

/* ── Graph (stage.js) ──────────────────────────────────────────────────── */

/* Everything you see is drawn on two canvases (like the Pixi stage):
   back canvas (z 0) under the content (z 1): lines to the frame corners
   front canvas (z 2): frame, curves, web, nodes and captions.
   The <a> nodes (z 3) are invisible click / focus / screen-reader targets. */
.js .graph {
  visibility: hidden;
}
.js .graph.ready {
  visibility: visible;
}
.lines {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.lines-back {
  z-index: 0;
}
.lines-front {
  z-index: 2;
}

.js .node {
  position: fixed;
  z-index: 3;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  color: transparent;
  text-decoration: none;
  outline: none;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.js .dot {
  position: absolute;
  border-radius: 50%;
  cursor: pointer;
}
.js .sub .dot {
  width: 30px;
  height: 30px;
  left: -15px;
  top: -15px;
}
.js .home .dot {
  width: 40px;
  height: 40px;
  left: -20px;
  top: -20px;
}
.js .label {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1px;
  pointer-events: none;
  user-select: none;
}

/* Home screen: graph only, no scrolling */
.js [data-view="home"] {
  overflow: hidden;
}

/* Without JavaScript the graph is a plain menu */
html:not(.js) .graph {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 20px;
}
html:not(.js) .lines {
  display: none;
}
html:not(.js) .node {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font: 12px Arial, sans-serif;
  letter-spacing: 1.5px;
}
html:not(.js) .home {
  order: -1;
}
html:not(.js) .dot {
  display: inline-block;
  border-radius: 50%;
  background: var(--node);
  position: static;
  width: 12px;
  height: 12px;
}

/* ── Section pages ─────────────────────────────────────────────────────── */

.content {
  position: relative;
  z-index: 1;
  outline: none;
}
.js .sc {
  visibility: hidden; /* sections.js reveals it as the in-animation starts */
}
.sc {
  position: relative;
  padding-left: var(--sc-x);
  padding-bottom: 80px;
  min-height: var(--frame-bottom, 0);
}

/* Title: bold 72 px, letter-spacing 1.5, outlined in the background colour */
.sc-title {
  margin: 0 0 0 -5px;
  font: bold 72px/1.2 Helvetica, Arial, sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #f3f3f3;
  outline: none;
  will-change: transform, opacity;
}
.sc-list .sc-title {
  padding-top: 178px;
  text-shadow:
    5px 0 0 var(--bg), -5px 0 0 var(--bg), 0 5px 0 var(--bg), 0 -5px 0 var(--bg),
    3.5px 3.5px 0 var(--bg), -3.5px 3.5px 0 var(--bg), 3.5px -3.5px 0 var(--bg), -3.5px -3.5px 0 var(--bg),
    4.6px 1.9px 0 var(--bg), -4.6px 1.9px 0 var(--bg), 4.6px -1.9px 0 var(--bg), -4.6px -1.9px 0 var(--bg),
    1.9px 4.6px 0 var(--bg), -1.9px 4.6px 0 var(--bg), 1.9px -4.6px 0 var(--bg), -1.9px -4.6px 0 var(--bg);
}

/* Not-found page: the original plain list (every section is a patch now) */
.sc-items {
  list-style: none;
  margin: 38px 0 0;
  padding: 0;
  width: min(var(--sc-w), 70ch); /* readable line length */
  max-width: calc(100vw - var(--sc-x) - 20px);
  font-family: Helvetica, Arial, sans-serif;
  font-size: max(13px, 1.3333vmax);
  line-height: calc(1em + 7px);
  color: #fff;
}
.sc-item {
  position: relative;
  margin-bottom: 20px;
  will-change: transform, opacity;
}
.sc-info {
  margin-bottom: 30px;
}
.sc-item a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.sc-item a:focus-visible {
  outline: 1px solid var(--node);
  outline-offset: 3px;
}

/* Opening a work from the archive morphs its image into the detail gallery
   (cross-document view transition; browsers without it simply navigate) */
@view-transition {
  navigation: auto;
}

/* ── Section patch: every section page (views.js, sections.js) ──────────
   A header, the section's node docked under it, and its content as
   sub-nodes: works as uncropped images in columns (no cropping anywhere),
   texts as whole rows. sections.js places them, newest work first, and
   glides them to their new places when the column count changes. */
.sc-archive {
  display: flow-root; /* keeps the title's top margin inside, so the frame height lines up */
  padding-bottom: 0;
  box-sizing: border-box;
  --arc-w: min(calc(var(--sc-frame) - 80px), 1060px);
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --data: "JetBrains Mono", Menlo, Consolas, monospace;
}
/* Title, intro and each work sit on their own ground: the graph's lines pass
   behind them instead of through the letters and images */
.sc-archive .arc-title,
.sc-archive .arc-intro,
.arc-item,
.arc-end {
  position: relative;
  background: var(--bg);
}
.sc-archive .arc-title,
.sc-archive .arc-intro {
  width: fit-content;
}
.sc-archive .arc-title {
  /* up beside HOME, the capitals level with the HOME label (cap top at y 46).
     The face's cap top sits 0.153 em under the top of its line box. */
  margin-top: calc(46px - 0.153em);
  padding: 0 14px 0 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(56px, 6.6vw, 96px);
  font-variation-settings: "wdth" 100, "wght" 300;
  line-height: 1;
  letter-spacing: -0.025em;
  text-shadow: none;
}
.arc-ch {
  display: inline-block;
  will-change: transform, opacity;
}
.sc-archive .arc-intro {
  /* tucked under the title; below it the node, and the cords' fall to the first row */
  margin: 0 0 140px;
  font: 400 13px/1.5 var(--data);
  letter-spacing: 0.04em;
  color: #9a9a9a;
  font-variant-numeric: tabular-nums;
}

/* a page without a count line (About) keeps the first row where every page has it:
   the count line's 19.5 px plus its 140 px margin */
.sc-archive .arc-title + .arc-list {
  margin-top: 159.5px;
}

/* Columns (JS sets each item's width and position) */
.arc-list {
  position: relative;
  width: var(--arc-w);
  max-width: none;
  list-style: none;
  margin: 0;
  padding: 0;
}
.js .arc-item {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}
.sc-archive .arc-list > li {
  margin: 0;
}
.arc-card {
  display: block;
  color: #f3f3f3;
  text-decoration: none;
  outline: none;
}
.arc-pic {
  display: block;
  outline: 1px solid transparent;
  outline-offset: 5px;
  transition: outline-color 0.35s;
}
.arc-pic img {
  display: block;
  width: 100%;
  height: auto; /* the image's own proportions, never cropped */
}
/* keyboard focus only: on mouse hover the name alone answers */
.arc-card:focus-visible .arc-pic {
  outline-color: #ffcc00;
}
.arc-cap {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 3px 12px;
  align-items: baseline;
  padding: 12px 0 0;
}
/* the year always sits at the same place, so the chronology reads at a glance */
.arc-year {
  font: 500 13px/1 var(--data);
  color: #f3f3f3;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.arc-name {
  margin: 0;
  font: 400 clamp(20px, 1.6vw, 24px)/1.15 var(--display);
  font-variation-settings: "wdth" 100, "wght" 400;
  letter-spacing: -0.005em;
  text-wrap: balance;
  transition: color 0.3s;
}
.arc-data {
  grid-column: 2;
  font: 400 12px/1.45 var(--data);
  letter-spacing: 0.03em;
  color: #9a9a9a;
  text-wrap: pretty;
}
a.arc-card:hover .arc-name,
a.arc-card:focus-visible .arc-name {
  color: #ffcc00;
}

/* Texts: an intro or the About text, and rows (courses, addresses, links)
   captioned like a work. Each takes a whole row; its inlet sits at its top
   left, so the text starts a little under it. */
.arc-text {
  padding-top: 10px;
}
.arc-lead {
  margin: 0;
  max-width: 62ch;
  font: 300 clamp(18px, 1.45vw, 21px)/1.5 var(--display);
  font-variation-settings: "wdth" 100, "wght" 300;
  color: #f3f3f3;
  text-wrap: pretty;
}
.arc-lead a {
  color: inherit;
  text-decoration-color: #ffcc00;
  text-underline-offset: 0.2em;
}
.arc-row .arc-cap {
  padding: 0;
}
.arc-row .arc-data {
  max-width: 64ch;
}
/* rows without a label column: the name and data line start at the inlet */
.arc-row.no-label .arc-cap {
  grid-template-columns: minmax(0, 1fr);
}
.arc-row.no-label .arc-data {
  grid-column: 1;
}
/* course codes are wider than years */
.sc-teaching .arc-cap {
  grid-template-columns: 64px minmax(0, 1fr);
}
.arc-row a.arc-card:focus-visible {
  outline: 1px solid #ffcc00;
  outline-offset: 5px;
}
.arc-end {
  margin: 72px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  width: var(--arc-w);
  font: 400 13px/1.5 var(--data);
  letter-spacing: 0.04em;
  color: #9a9a9a;
  font-variant-numeric: tabular-nums;
}
.arc-end a {
  color: #ffcc00;
  text-underline-offset: 0.25em;
}
::selection {
  background: #ffcc00;
  color: #111;
}
/* Without JavaScript: a plain grid, images still uncropped */
html:not(.js) .arc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 56px 28px;
  align-items: start;
}
html:not(.js) .arc-text {
  grid-column: 1 / -1;
}

html:not(.js) .sc {
  padding-left: 20px;
}
html:not(.js) .sc-list .sc-title {
  padding-top: 20px;
}

/* ── Phones (original mobile params: content at x 8 + 10, smaller title) ── */

@media (max-width: 759px) {
  .sc-archive {
    --arc-w: calc(100vw - 38px);
  }
  .sc-archive .sc-title.arc-title {
    margin-top: 160px;
    padding-top: 0;
  }
  :root {
    --sc-x: 18px;
    --sc-w: calc(100vw - 38px);
  }
  .sc-title {
    letter-spacing: 0;
  }
  .sc-list .sc-title {
    font-size: 58px;
    padding-top: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arc-pic,
  .arc-name {
    transition: none;
  }
}
