/* Vector Humanities: light by default, dark via prefers-color-scheme or html[data-theme="dark"]. */

:root {
  --bg: #f6f2e9;
  --surface: #fffdf8;
  --surface-alt: #efe7d8;
  --ink: #141518;
  --muted: #5b5d66;
  --blue: #1a1aff;
  --blue-hover: #1010c0;
  --sand: #8a5a2f;
  --red: #e8452a;
  --red-text: #b8341c;   /* the red darkened for small type: 4.8:1 or better on every light surface */
  --on-blue: #fff;
  --rule: #e2d9c8;
  --shadow: 0 1px 2px rgba(20, 21, 24, .04), 0 8px 28px rgba(20, 21, 24, .06);
  --serif: "Source Serif 4", Georgia, "Iowan Old Style", serif;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  --jp: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e1c;
    --surface: #141830;
    --surface-alt: #1b2040;
    --ink: #f3f1e8;
    --muted: #9b9aa8;
    --blue: #8a90ff;
    --blue-hover: #aeb2ff;
    --sand: #d2a26c;
    --red: #ff6a45;
    --red-text: #ff6a45;
    --on-blue: #0c0e1c;
    --rule: #262b48;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0e1c;
  --surface: #141830;
  --surface-alt: #1b2040;
  --ink: #f3f1e8;
  --muted: #9b9aa8;
  --blue: #8a90ff;
  --blue-hover: #aeb2ff;
  --sand: #d2a26c;
  --red: #ff6a45;
  --red-text: #ff6a45;
  --on-blue: #0c0e1c;
  --rule: #262b48;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

a { color: var(--blue); text-decoration-color: color-mix(in srgb, var(--blue) 35%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--blue-hover); text-decoration-color: currentColor; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 32px; }

/* Header */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand span { font-family: var(--display); font-weight: 600; font-size: 1.15rem; letter-spacing: .16em; text-transform: uppercase; }
.site-nav { display: flex; align-items: center; gap: 22px; font-size: .92rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.theme-toggle {
  background: none; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted);
  width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
.theme-toggle svg { width: 16px; height: 16px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* Hero */

.hero {
  position: relative; min-height: min(88vh, 780px); display: flex; align-items: center; overflow: hidden;
  border-bottom: 1px solid var(--rule); background: #e9c891;
  /* the intarsia is a picture in wood: its text keeps the same colours in both themes */
  --h-ink: #141518; --h-muted: #3b2412; --h-label: #5e3519; --h-blue: #1a1aff;
}
#scene, #ground { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#scene { will-change: transform; }   /* its own layer: repainting the solid never repaints the wood */
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(233, 200, 145, .78) 0%, rgba(233, 200, 145, .45) 34%, rgba(233, 200, 145, 0) 58%);
}
.hero .wrap { position: relative; z-index: 1; width: 100%; padding-top: 40px; padding-bottom: 150px; }
.eyebrow { font-family: var(--mono); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--h-label); margin: 0 0 18px; }
.hero h1 {
  font-family: var(--display); font-weight: 500; font-size: clamp(3rem, 8.4vw, 6.6rem);
  line-height: .95; letter-spacing: -.005em; margin: 0 0 24px; color: var(--h-ink);
}
.hero h1 em { font-style: italic; color: var(--h-blue); }
.hero .lede { max-width: 31rem; font-size: 1.16rem; color: var(--h-muted); margin: 0 0 32px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px;
  font-family: var(--mono); font-size: .8rem; letter-spacing: .06em; text-decoration: none;
  border: 1px solid var(--ink); color: var(--ink); background: transparent; transition: all .2s ease;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.btn.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: var(--on-blue); }
.hero .btn { border-color: var(--h-ink); color: var(--h-ink); }
.hero .btn:hover { background: var(--h-ink); color: #e9c891; }
.hero .btn.primary { background: var(--h-blue); border-color: var(--h-blue); color: #fff; }
.brand-mark { display: block; flex-shrink: 0; }
.hero-copy { max-width: 560px; pointer-events: auto; }
.hero .wrap { pointer-events: none; }   /* drags on the empty wall reach the scene */

/* Sections */

section { padding: 104px 0; }
section + section { border-top: 1px solid var(--rule); }
.section-head { display: grid; grid-template-columns: 180px 1fr; gap: 32px; margin-bottom: 48px; }
.section-head .num { font-family: var(--mono); font-size: .74rem; letter-spacing: .2em; color: var(--sand); padding-top: 14px; text-transform: uppercase; }
h2 { font-family: var(--display); font-weight: 500; font-size: clamp(2.1rem, 4.4vw, 3.2rem); line-height: 1.05; margin: 0; }
h3 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.2; margin: 0 0 8px; }
.prose { max-width: 40rem; }
.prose p { margin: 0 0 1.1em; }
.indent { margin-left: 212px; }

/* Project card */

.project {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; box-shadow: var(--shadow);
}
.project .cover {
  position: relative; padding: 30px 32px; background: var(--surface-alt);
  border-right: 1px solid var(--rule); display: flex; flex-direction: column; justify-content: space-between; min-height: 0;
}
.project .jp { font-family: var(--jp); font-size: clamp(2.2rem, 4.2vw, 3.1rem); line-height: 1.15; letter-spacing: .08em; margin: 0; writing-mode: vertical-rl; position: absolute; right: 30px; top: 28px; color: var(--ink); }
.project .cover-text { max-width: 70%; }
.project .cover h3 { font-size: 1.8rem; line-height: 1.1; margin-bottom: 10px; }
.project .cover .by { font-style: italic; color: var(--muted); margin: 0; }
.project + .project { margin-top: 24px; }
.project .mark { position: absolute; right: 18px; top: 10px; width: 190px; height: 190px; }
.project .mark img { display: block; width: 100%; height: 100%; }
/* a photograph filling the cover, darkened at the foot so the title reads */
.project .cover.photo { background-size: cover; background-position: 58% 45%; color: #fff; border-right-color: transparent; }
.project .cover.photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 6, 11, .15) 0%, rgba(4, 6, 11, .05) 40%, rgba(4, 6, 11, .82) 100%); }
.project .cover.photo > * { position: relative; }
.project .cover.photo.dense::before { background: linear-gradient(180deg, rgba(4, 6, 11, .35) 0%, rgba(4, 6, 11, .45) 30%, rgba(4, 6, 11, .9) 58%, rgba(4, 6, 11, .94) 100%); }
.project .cover.photo .cover-link, .project .cover .cover-link { position: absolute; inset: 0; z-index: 2; }
.project .cover.photo h3 { color: #fff; }
.project .cover.photo .by { color: rgba(255, 255, 255, .82); }
.project .cover.photo .tag { color: #fff; border-color: rgba(255, 255, 255, .7); background: rgba(4, 6, 11, .35); }
.project .cover.photo.paper { background-position: 50% 6%; color: #1c1712; }
.project .cover.photo.paper::before { background: linear-gradient(180deg, rgba(243, 236, 222, 0) 38%, rgba(243, 236, 222, .9) 78%, rgba(243, 236, 222, .97) 100%); }
.project .cover.photo.paper h3 { color: #1c1712; }
.project .cover.photo.paper .by { color: #4a3f33; }
.project .cover.photo.paper .tag { color: var(--red-text); border-color: var(--red-text); background: rgba(243, 236, 222, .85); }
.on-dark { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .on-light { display: none !important; } :root:not([data-theme="light"]) .on-dark { display: block !important; } }
:root[data-theme="dark"] .on-light { display: none !important; }
:root[data-theme="dark"] .on-dark { display: block !important; }
.tag { display: inline-block; font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--red-text); color: var(--red-text); }
.project .body { padding: 28px 32px; }
.project .body p { margin: 0 0 .8em; font-size: .93rem; line-height: 1.55; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 18px; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--rule); }
.stats div { display: flex; flex-direction: column; }
.stats b { font-variant-numeric: lining-nums; font-family: var(--display); font-weight: 600; font-size: 1.6rem; line-height: 1; color: var(--blue); }
.stats span { font-family: var(--mono); font-size: .64rem; letter-spacing: .06em; color: var(--muted); margin-top: 5px; line-height: 1.35; }
.more { margin-top: 28px; color: var(--muted); font-style: italic; }

/* Methods */

.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.method.shot { padding-top: 0; overflow: hidden; }
.method .shot-img { display: block; margin: 0 -28px 18px; height: 170px; overflow: hidden; border-bottom: 1px solid var(--rule); }
.method .shot-img img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 30% 30%; transition: transform .4s ease; }
.method .shot-img:hover img { transform: scale(1.03); }
.method.mark-shot .shot-img { background: #f6f2e9; }
.method.mark-shot .shot-img img { object-fit: contain; object-position: 50% 50%; padding: 8px 0; }
.method { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 28px; transition: transform .2s ease, box-shadow .2s ease; }
.method:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.method .glyph { width: 40px; height: 40px; margin-bottom: 16px; color: var(--sand); }
.method p { margin: 0 0 12px; font-size: .97rem; }
.method .src { font-family: var(--mono); font-size: .72rem; letter-spacing: .04em; color: var(--muted); margin: 0; }

/* Conventions */

.conventions { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 48px; }
.conventions li { padding: 22px 0; border-top: 1px solid var(--rule); }
.conventions b { display: block; font-family: var(--display); font-size: 1.3rem; font-weight: 600; margin-bottom: 4px; }
.conventions span { color: var(--muted); font-size: .97rem; }

/* Related */

.related { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.related a { display: block; padding: 26px; border: 1px solid var(--rule); border-radius: 14px; text-decoration: none; color: var(--ink); background: var(--surface); transition: border-color .2s ease; }
.related a:hover { border-color: var(--blue); color: var(--ink); }
.related b { font-family: var(--display); font-size: 1.4rem; font-weight: 600; display: block; margin-bottom: 4px; }
.related span { color: var(--muted); font-size: .93rem; }
.related .url { display: block; margin-top: 14px; font-family: var(--mono); font-size: .7rem; color: var(--blue); }

/* Footer */

.site-footer { border-top: 1px solid var(--rule); padding: 24px 0 36px; font-size: .72rem; line-height: 1.5; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer p { margin: 0; }

/* Reveal on scroll */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* Responsive */

@media (max-width: 900px) {
  .section-head { grid-template-columns: 1fr; gap: 10px; }
  .section-head .num { padding-top: 0; }
  .indent { margin-left: 0; }
  .project { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .project .cover { border-right: none; border-bottom: 1px solid var(--rule); min-height: 300px; }
  .methods, .conventions, .related { grid-template-columns: 1fr; }
}

/* stacked: the solid hangs above the copy; set by intarsia.js when there is no room beside it */
.hero.is-stacked { min-height: 860px; align-items: flex-start; }
.hero.is-stacked::after { background: linear-gradient(180deg, rgba(233, 200, 145, 0) 32%, rgba(233, 200, 145, .55) 46%, rgba(233, 200, 145, 0) 82%); }
.hero.is-stacked .wrap { padding-bottom: 40px; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .wrap { padding: 0 16px; }
  .site-nav { gap: 14px; }
  .site-nav .hide-sm { display: none; }
  .brand span { font-size: .95rem; letter-spacing: .1em; white-space: nowrap; }
  section { padding: 72px 0; }
  .project .cover, .project .body { padding: 28px 22px; }
  .project .jp { right: 20px; top: 26px; }
  .project .mark { right: 10px; top: 8px; width: 130px; height: 130px; }
  .project .cover.photo { min-height: 300px; }
  .method { padding: 22px; }
  .method .shot-img { margin: 0 -22px 16px; }
}

/* Notes */

.fnref { font-size: .7em; line-height: 0; margin-left: 1px; }
.fnref a { text-decoration: none; font-family: var(--mono); }
.footnotes { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); max-width: 40rem; }
.footnotes p { font-size: .86rem; line-height: 1.6; color: var(--muted); margin: 0; }
.fn-num { font-family: var(--mono); font-size: .75rem; color: var(--sand); margin-right: .4rem; }
.fn-back { text-decoration: none; margin-left: .2rem; }
:target { scroll-margin-top: 90px; }
.project .cover.lab { background-size: cover; background-position: center; }
.project .cover.lab::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--surface-alt) 10%, transparent) 0%, color-mix(in srgb, var(--surface-alt) 30%, transparent) 45%, color-mix(in srgb, var(--surface-alt) 92%, transparent) 100%); }
.project .cover.lab > * { position: relative; }
.project .cover.lab .tag { background: var(--surface-alt); }

/* Keyboard focus: a blue ring with a gap of page colour, so it shows on paper, night and the wood */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; box-shadow: 0 0 0 4px var(--bg); border-radius: 3px; }
.hero :focus-visible { outline-color: var(--h-blue); box-shadow: 0 0 0 4px #e9c891; }
.cover-link:focus-visible, .shot-img:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; box-shadow: none; }
.project .cover.photo:not(.paper) .cover-link:focus-visible { outline-color: #fff; }
.related a:focus-visible { border-color: var(--blue); }
