/* ==========================================================================
   Portfolio — Swiss grid
   One 12-column grid everywhere (4 columns on phones).
   Columns 1–2: labels and index numbers.
   Columns 3–12: headings.  Columns 7–12: running text.
   Vertical rhythm: multiples of --u (8px). Flush left, ragged right.
   Edit the tokens in :root to re-theme the whole site.
   ========================================================================== */

:root {
  --bg: #e8e5e1;
  --paper: #ffffff;
  --ink: #1d1d1b;
  --muted: #5f5c57;
  --rule: #1d1d1b;
  --dot: rgba(29, 29, 27, 0.10);
  --grid-col: rgba(214, 64, 40, 0.09);
  --grid-edge: rgba(214, 64, 40, 0.35);

  --font-display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --display-weight: 900;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --display-size: clamp(48px, 9.5vw, 124px);
  --u: 8px;
  --cols: 12;
  --gap: 24px;
  --max: 1280px;
  --gutter: clamp(16px, 4vw, 48px);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1918;
    --paper: #282725;
    --ink: #eceae6;
    --muted: #a39f98;
    --rule: #eceae6;
    --dot: rgba(236, 234, 230, 0.08);
    --grid-col: rgba(255, 120, 90, 0.08);
    --grid-edge: rgba(255, 120, 90, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1918;
  --paper: #282725;
  --ink: #eceae6;
  --muted: #a39f98;
  --rule: #eceae6;
  --dot: rgba(236, 234, 230, 0.08);
  --grid-col: rgba(255, 120, 90, 0.08);
  --grid-edge: rgba(255, 120, 90, 0.35);
  color-scheme: dark;
}
/* The visitor's own choice from the footer switch. It uses its own attribute, so it
   never competes with a host page that sets data-theme, and it comes last so it wins. */
:root[data-site-theme="light"] {
  --bg: #e8e5e1; --paper: #ffffff; --ink: #1d1d1b; --muted: #5f5c57; --rule: #1d1d1b;
  --dot: rgba(29, 29, 27, 0.10); --grid-col: rgba(214, 64, 40, 0.09); --grid-edge: rgba(214, 64, 40, 0.35);
  color-scheme: light;
}
:root[data-site-theme="dark"] {
  --bg: #1a1918; --paper: #282725; --ink: #eceae6; --muted: #a39f98; --rule: #eceae6;
  --dot: rgba(236, 234, 230, 0.08); --grid-col: rgba(255, 120, 90, 0.08); --grid-edge: rgba(255, 120, 90, 0.35);
  color-scheme: dark;
}

@media (max-width: 760px) {
  :root { --cols: 4; --gap: 16px; --display-size: clamp(34px, 12vw, 64px); }
}

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

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

/* Home only: dotted canvas. Static dots are the fallback; the interactive
   dot field replaces them once JS starts it */
body:has(> .dot-field) {
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 24px 24px;
}
.dot-field { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; display: none; }
body.has-dot-field { background-image: none; }
.has-dot-field .dot-field { display: block; }

[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.skip-link { position: absolute; left: -9999px; top: 12px; background: var(--ink); color: var(--bg); padding: 8px 14px; }
.skip-link:focus { left: 12px; z-index: 100; }

/* ---------- The grid ---------- */

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: start;
}
.grid > * { min-width: 0; }

/* Column positions, named by role */
.c-label { grid-column: 1 / 3; }
.c-head  { grid-column: 3 / -1; }
.c-head-narrow { grid-column: 3 / 11; }
.c-text  { grid-column: 7 / -1; }
.c-full  { grid-column: 1 / -1; }

@media (max-width: 760px) {
  .c-label, .c-head, .c-head-narrow, .c-text, .c-full { grid-column: 1 / -1; }
  .grid > .c-label { margin-bottom: calc(var(--u) * 2); }
}

/* Rows: a hairline, then content hanging from it */
.row { border-top: 1px solid var(--rule); padding-top: calc(var(--u) * 2); }
.row-heavy { border-top: 2px solid var(--rule); padding-top: calc(var(--u) * 2); }

.section { margin-top: calc(var(--u) * 12); }
@media (max-width: 760px) { .section { margin-top: calc(var(--u) * 8); } }

/* ---------- Type ---------- */

.display, .h-xl, .h-lg, .h-md {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: -0.03em;
  word-spacing: 0.06em;
  line-height: 0.98;
  margin: 0;
  text-wrap: balance;
}
.display { font-size: var(--display-size); line-height: 0.92; }
.h-xl { font-size: clamp(36px, 7vw, 88px); }
.h-lg { font-size: clamp(32px, 4.6vw, 56px); }
.h-md { font-size: clamp(26px, 2.6vw, 34px); line-height: 1.05; }

.label {
  font-size: 13px;
  line-height: 24px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 20px; }

.index { font-variant-numeric: tabular-nums; }

/* Text for screen readers only */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.link { display: inline-block; border-bottom: 1px solid currentColor; }
.link:hover { border-bottom-width: 2px; }

/* Arrow link: a 2px line with a sharp head that stretches on hover,
   growing from one grid unit (24px) to three (72px) */
.cta { display: inline-flex; align-items: center; gap: calc(var(--u) * 1.5); border-bottom: 0; }
.cta:hover { border-bottom-width: 0; }
.arrow {
  position: relative; display: inline-block; flex: none;
  width: 24px; height: 2px; background: currentColor;
  transition: width .45s cubic-bezier(.2, .8, .2, 1);
}
.arrow::after {
  content: ""; position: absolute; right: 1px; top: 50%;
  width: 8px; height: 8px;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}
.project:hover .arrow,
.project:focus-visible .arrow { width: 72px; }

/* Home: earlier work, a compact index of archive case studies */
.archive { list-style: none; margin: 0; padding: 0; }
.archive li + li .archive-item { border-top: 1px solid var(--rule); }
.archive-item { padding-block: calc(var(--u) * 3); align-items: start; }
.archive-meta, .archive-title, .archive-desc, .archive-item .pills { grid-column: 1 / 9; margin: 0; }
.archive-meta { color: var(--muted); text-transform: none; letter-spacing: 0; }
.archive-title { margin-top: var(--u); font-family: var(--font-display); font-weight: var(--display-weight); font-size: 19px; line-height: 1.2; letter-spacing: -0.01em; word-spacing: 0.06em; }
.archive-desc { margin-top: var(--u); }
/* left edge stays put and the point travels right: the margin gives up exactly what the width gains */
/* Nudge: a short arrow that shifts 8px to the right on hover */
.archive-item .arrow { grid-column: 12; grid-row: 1 / span 4; justify-self: end; align-self: center; width: 28px; margin-right: 8px; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.archive-item:hover .arrow, .archive-item:focus-visible .arrow { width: 28px; transform: translateX(8px); }
@media (prefers-reduced-motion: reduce) { .archive-item .arrow { transition: none; } }
@media (max-width: 760px) {
  .archive-meta, .archive-title, .archive-desc, .archive-item .pills { grid-column: 1 / 4; }
  .archive-item .arrow { grid-column: 4; }
}

/* Previous / next project at the foot of each case study: two words in the
   heading face, with an arrow that is sized to the text and stretches on hover. */
.nowrap { white-space: nowrap; }
.project-nav { padding-top: calc(var(--u) * 6); }
.pn { display: inline-flex; align-items: center; gap: 0.3em; }
.pn-prev { grid-column: 1 / 7; justify-self: start; }
.pn-next { grid-column: 7 / -1; justify-self: end; }
.pn .arrow { width: 1.4em; height: 0.12em; }
.pn .arrow::after { width: 0.36em; height: 0.36em; right: -0.03em; border-width: 0.12em; }
.arrow-back { transform: rotate(180deg); }
.pn:hover .arrow,
.pn:focus-visible .arrow { width: 2.6em; }
@media (max-width: 760px) {
  .pn-prev { grid-column: 1 / 3; }
  .pn-next { grid-column: 3 / -1; }
}

/* ---------- Masthead ---------- */

.masthead { padding-block: calc(var(--u) * 3); align-items: baseline; }
.masthead p { margin: 0; }
.masthead .name { grid-column: 1 / 4; font-family: var(--font-display); font-weight: var(--display-weight); font-size: 18px; line-height: 24px; letter-spacing: -0.02em; }
.masthead .role { grid-column: 4 / 7; }
.masthead nav   { grid-column: 7 / -1; justify-self: end; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; gap: calc(var(--u) * 3); }
/* Nav underline grows out from the centre on hover; the current page keeps it */
.menu a { position: relative; border-bottom: 0; }
.menu a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: center; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.menu a:hover::after,
.menu a:focus-visible::after,
.menu a[aria-current="page"]::after { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .menu a::after { transition: none; } }

@media (max-width: 760px) {
  .masthead { display: flex; justify-content: space-between; column-gap: calc(var(--u) * 2); }
  .masthead .role { display: none; }
  .masthead { flex-wrap: wrap; row-gap: var(--u); }
  .masthead .name { white-space: nowrap; }
  .menu { gap: calc(var(--u) * 1.5); font-size: 13px; }
}

/* ---------- Home ---------- */

.hero { padding-block: calc(var(--u) * 17) calc(var(--u) * 8); }
.hero .hello { grid-column: 1 / 10; grid-row: 1; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; font-size: 20px; margin: 0 0 calc(var(--u) * 3) 4px; }
.hero .hello .dash { display: inline-block; width: 1.6em; height: 1px; background: currentColor; vertical-align: 0.32em; margin-right: 0.6em; }
.hero h1 { grid-column: 1 / -1; grid-row: 2; }
.hero h1 .nowrap { white-space: nowrap; }
.hero .intro { grid-column: 7 / -1; grid-row: 3; margin: calc(var(--u) * 5) 0 0; font-size: 17px; line-height: 26px; }

/* Nav in a row at the top right, level with the nav on inner pages */
.hero { position: relative; }
.hero-nav { position: absolute; top: calc(var(--u) * 3); right: var(--gutter); }
.menu-stack { flex-direction: row; gap: calc(var(--u) * 3); font-size: 18px; line-height: 24px; white-space: nowrap; }
@media (max-width: 760px) {
  .hero { padding-block: calc(var(--u) * 3) calc(var(--u) * 4); }
  .hero-nav { position: static; grid-column: 1 / -1; grid-row: 1; justify-self: start; margin: 0 0 calc(var(--u) * 9); }
  .menu-stack { flex-direction: row; gap: calc(var(--u) * 2); font-size: 15px; }
  .hero .hello { grid-row: 2; margin-bottom: calc(var(--u) * 2); }
  .hero h1 { grid-row: 3; }
  .hero .intro { grid-row: 4; margin-top: calc(var(--u) * 4); }
}
@media (max-width: 760px) { .hero .intro { grid-column: 1 / -1; font-size: 15px; line-height: 24px; } .hero .hello, .hero h1 { grid-column: 1 / -1; } }

/* Equal space above and below each project, so every separator sits
   exactly halfway between two rows. No separator under the heading. */
.projects { list-style: none; margin: 0; padding: 0; --row-pad: calc(var(--u) * 6); }
@media (max-width: 760px) { .projects { --row-pad: calc(var(--u) * 4); } }

.project { grid-column: 1 / -1; }
.projects .project { padding-block: var(--row-pad); }
.projects li:first-child .project { border-top: 0; }
.project .frame { grid-column: 1 / 7; aspect-ratio: 4 / 3; }
.project .text  { grid-column: 7 / -1; display: flex; flex-direction: column; align-self: stretch; }
.project .text .date { margin-bottom: calc(var(--u) * 2); }
.project .text .small { margin: calc(var(--u) * 2) 0 0; }
/* Card intros stop at three lines and end with an ellipsis */
.project .text .small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
/* Topic pills: audience and platform */
.pills { display: flex; flex-wrap: wrap; gap: var(--u); }
.pill { font-size: 12px; line-height: 18px; padding: 1px 10px; border: 1px solid var(--muted); border-radius: 999px; color: var(--muted); white-space: nowrap; }
.project .text .pills { margin-top: calc(var(--u) * 2); }
.archive-item .pills { margin-top: calc(var(--u) * 1.5); }
.project .text .link { margin-top: auto; padding-top: calc(var(--u) * 3); align-self: flex-start; }
.project:hover .frame { outline: 2px solid var(--ink); outline-offset: -2px; }

@media (max-width: 760px) {
  .project .frame { grid-column: 1 / -1; }
  .project .text  { grid-column: 1 / -1; margin-top: calc(var(--u) * 2); }
}

/* ---------- Image frames ---------- */

.frame { position: relative; max-width: 100%; background: var(--paper); }
.frame::after {
  content: attr(data-label);
  position: absolute; left: 12px; bottom: 8px;
  font-size: 12px; color: var(--muted);
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame:has(img)::after { content: none; }

/* ---------- Case study ---------- */

.cs-head { margin-top: calc(var(--u) * 6); }
.cs-head .summary { margin: calc(var(--u) * 5) 0 0; }
.cs-head .summary p { margin: 0; }
.cs-head .summary p + p { margin-top: 1em; }

.cover-video { position: relative; margin: calc(var(--u) * 6) 0 0; background: var(--paper); overflow: hidden; }
.cover-media { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-toggle {
  position: absolute; right: 12px; bottom: 12px; cursor: pointer;
  font: inherit; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: rgba(29, 29, 27, .72); border: 0; padding: 4px 10px;
}
.video-toggle:hover { background: rgba(29, 29, 27, .9); }
@media (max-width: 760px) { .video-toggle { right: 8px; bottom: 8px; font-size: 10px; padding: 2px 6px; } }
.walkthrough { margin-top: calc(var(--u) * 4); row-gap: calc(var(--u) * 3); }
.walk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--u) * 3); }
.walk-btn {
  display: inline-flex; align-items: center; gap: calc(var(--u) * 1.5); cursor: pointer;
  font: inherit; font-size: 15px; color: var(--ink); background: transparent;
  border: 2px solid var(--ink); padding: 8px 16px 8px 10px;
}
.walk-btn:hover { background: var(--ink); color: var(--bg); }
.walk-play { width: 28px; height: 28px; border-radius: 50%; background: currentColor; position: relative; flex: none; }
.walk-play::after { content: ""; position: absolute; left: 11px; top: 8px; border-style: solid; border-width: 6px 0 6px 9px; border-color: transparent transparent transparent var(--bg); }
.walk-btn:hover .walk-play::after { border-left-color: var(--ink); }
.walk-btn[aria-expanded="true"] .walk-play::after { left: 9px; top: 9px; width: 10px; height: 10px; border: 0; background: var(--bg); }
.walk-btn[aria-expanded="true"]:hover .walk-play::after { background: var(--ink); }
.walk-link { color: var(--muted); border-bottom: 1px solid currentColor; }
.walk-link:hover { color: var(--ink); }
.walk-player { aspect-ratio: 16 / 9; max-width: 100%; background: var(--paper); }
.walk-player iframe { width: 100%; height: 100%; border: 0; display: block; }
.cover { aspect-ratio: 2 / 1; margin-top: calc(var(--u) * 6); }

.facts { margin: calc(var(--u) * 3) 0 0; }
.facts > div { grid-column: span 3; }
.facts dt { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-size: 14px; line-height: 20px; }
@media (max-width: 760px) { .facts { row-gap: calc(var(--u) * 2); } .facts > div { grid-column: span 2; } }

.sec-head { margin: 0 0 calc(var(--u) * 4); }
.prose p { margin: 0 0 calc(var(--u) * 2); }
.prose ul { margin: 0 0 calc(var(--u) * 2); padding-left: 18px; }
.prose li { margin-bottom: var(--u); }
.prose strong { font-weight: 500; background: linear-gradient(transparent 62%, var(--paper) 62%); }

/* Metrics sit on the text columns, two columns each */
.metrics { grid-column: 7 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gap); margin: 0; }
.metric { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.metric dd { margin: 0 0 var(--u); font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: -0.03em; font-size: clamp(32px, 3.6vw, 48px); line-height: 1; font-variant-numeric: tabular-nums; }
.metric dt { font-size: 13px; line-height: 20px; color: var(--muted); }
@media (max-width: 760px) { .metrics { grid-column: 1 / -1; grid-template-columns: 1fr; row-gap: calc(var(--u) * 3); } }

/* Rows: heading in columns 3–6, text in columns 7–12 */
.rows { grid-column: 3 / -1; list-style: none; margin: 0; padding: 0; }
.rows > li {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--gap);
  border-top: 1px solid var(--rule); padding-block: calc(var(--u) * 2) calc(var(--u) * 3);
}
.rows > li:last-child { border-bottom: 1px solid var(--rule); }
/* Case study lists: rules only between items, none above the first or below the last */
.rows-decisions > li:first-child, .rows-assumptions > li:first-child { border-top: 0; }
.rows-decisions > li:last-child, .rows-assumptions > li:last-child { border-bottom: 0; }
.rows > li > :first-child { grid-column: 1 / 5; }
.rows > li > :last-child  { grid-column: 5 / -1; }
.rows h3 { font-family: var(--font-mono); font-weight: 500; font-size: 15px; line-height: 24px; margin: 0; }
.rows h3 .where { display: block; font-weight: 400; font-size: 13px; line-height: 20px; color: var(--muted); }
.rows p { margin: 0 0 var(--u); font-size: 14px; line-height: 22px; }
.rows p:last-child { margin-bottom: 0; }
.rows .tradeoff { color: var(--muted); margin-top: calc(var(--u) * 2); }
/* Before / after comparison, on columns 3–6 and 7–12 */

.compare { grid-column: 3 / -1; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--gap); margin-bottom: calc(var(--u) * 5); }
.compare-col { border-top: 2px solid var(--rule); padding-top: calc(var(--u) * 2); display: grid; gap: calc(var(--u) * 2); align-content: start; }
.compare-col:first-child { grid-column: 1 / 5; }
.compare-col:last-child { grid-column: 5 / -1; }
.compare-col p { margin: 0; }
.compare-col ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.compare-col.is-before { color: var(--muted); border-top-color: var(--muted); }
.compare-col.is-before .h-md { text-decoration: line-through; text-decoration-thickness: 2px; }
.compare-text { margin-bottom: calc(var(--u) * 4); }

/* Concept card: cooperative housing mix */
.mix { margin: calc(var(--u) * 5) 0; display: grid; gap: var(--u); }
.mix-card { background: var(--paper); padding: calc(var(--u) * 3); display: grid; gap: calc(var(--u) * 2); }
.mix-card p { margin: 0; }
.mix-title { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 22px; line-height: 1.15; letter-spacing: -0.01em; word-spacing: 0.06em; }
.mix-bar { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 4px; }
.mix-unit, .mix-legend i { aspect-ratio: 1; background: color-mix(in srgb, var(--ink) 12%, var(--paper)); }
.mix-unit.is-two, .mix-legend i.is-two { background: color-mix(in srgb, var(--ink) 28%, var(--paper)); }
.mix-unit.is-three, .mix-legend i.is-three { background: color-mix(in srgb, var(--ink) 50%, var(--paper)); }
.mix-unit.is-fit, .mix-legend i.is-three { background: var(--ink); }
.mix-legend { display: flex; flex-wrap: wrap; gap: calc(var(--u) * 2); font-size: 13px; }
.mix-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mix-legend i { display: inline-block; width: 12px; }
.mix-fit { font-size: 15px; }
.mix-fit strong { font-weight: 500; border-bottom: 2px solid var(--ink); }
.mix-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(var(--u) * 2); margin: 0; border-top: 1px solid var(--rule); padding-top: calc(var(--u) * 2); }
.mix-facts dt { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mix-facts dd { margin: 4px 0 0; font-size: 14px; }
.mix-facts dd span { font-size: 11px; color: var(--muted); border: 1px solid var(--rule); padding: 0 4px; margin-left: 4px; white-space: nowrap; }
.mix figcaption { font-size: 12px; line-height: 18px; color: var(--muted); }
@media (max-width: 760px) {
  .mix-bar { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .mix-facts { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .compare { grid-column: 1 / -1; grid-template-columns: 1fr; row-gap: calc(var(--u) * 4); }
  .compare-col:first-child, .compare-col:last-child { grid-column: 1 / -1; }
}
.rows-key { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sub-key { margin: calc(var(--u) * 4) 0 var(--u); font-weight: 400; line-height: 24px; }
.rows-assumptions h3, .rows-decisions h3 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 19px; line-height: 1.2; letter-spacing: -0.01em; word-spacing: 0.06em; text-wrap: balance; }
@media (max-width: 760px) {
  .rows { grid-column: 1 / -1; }
  .rows > li { grid-template-columns: 1fr; row-gap: var(--u); }
  .rows > li > :first-child,
  .rows > li > :last-child { grid-column: 1 / -1; }
}

.figure { margin-inline: 0; margin-bottom: 0; }
.figure .frame { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.figure figcaption { grid-column: 7 / -1; margin-top: var(--u); font-size: 12px; line-height: 18px; color: var(--muted); }
@media (max-width: 760px) { .figure figcaption { grid-column: 1 / -1; } }


/* ---------- About ---------- */

.portrait { grid-column: 3 / 7; aspect-ratio: 4 / 5; }
.portrait img { object-position: 50% 100%; } /* crop from the top only */
@media (max-width: 760px) { .portrait { grid-column: 1 / -1; margin-bottom: calc(var(--u) * 3); } }
/* About: portrait and bio sit side by side under the heading */
.cs-head .about-portrait { grid-row: 2; margin-top: calc(var(--u) * 5); }
.cs-head .about-bio { grid-row: 2; align-self: start; }
@media (max-width: 760px) { .cs-head .about-portrait, .cs-head .about-bio { grid-row: auto; } }

.tags { display: flex; flex-wrap: wrap; gap: var(--u); list-style: none; padding: 0; margin: 0; }
.tags li { font-size: 13px; line-height: 20px; padding: 2px 8px; background: var(--paper); }

/* ---------- Footer ---------- */

.site-footer { margin-top: calc(var(--u) * 16); padding-bottom: calc(var(--u) * 4); }
.site-footer .email { overflow-wrap: anywhere; font-size: 18px; line-height: 24px; }
.site-footer .email:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.footer-row { margin-top: calc(var(--u) * 6); padding-top: calc(var(--u) * 4); font-size: 13px; color: var(--muted); }
.footer-row .copy { grid-column: 1 / 5; }
.footer-row .toggle { grid-column: 5 / 10; }
.footer-row ul { grid-column: 10 / -1; list-style: none; margin: 0; padding: 0; display: flex; justify-content: flex-end; gap: calc(var(--u) * 3); white-space: nowrap; }
.footer-row a:hover { color: var(--ink); }
.footer-row .toggle { display: flex; flex-wrap: nowrap; gap: calc(var(--u) * 3); align-items: baseline; white-space: nowrap; }
/* Footer switches: a label with an on/off track next to it */
.switch { display: inline-flex; align-items: center; gap: var(--u); font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.switch:hover, .switch[aria-checked="true"] { color: var(--ink); }
.switch-track { position: relative; flex: none; width: 28px; height: 16px; border: 1px solid currentColor; border-radius: 8px; transition: background-color .2s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: currentColor; transition: transform .2s cubic-bezier(.2, .8, .2, 1), background-color .2s; }
.switch[aria-checked="true"] .switch-track { background: var(--ink); border-color: var(--ink); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(12px); background: var(--bg); }
.switch:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }
@media (max-width: 760px) {
  .footer-row { row-gap: var(--u); }
  .footer-row .copy, .footer-row .toggle, .footer-row ul { grid-column: 1 / -1; }
  .footer-row ul { justify-content: flex-start; }
}

/* ---------- Grid overlay ---------- */

.grid-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 90; display: none; }
.show-grid .grid-overlay { display: block; }
.grid-overlay .container, .grid-overlay .grid { height: 100%; }
.grid-overlay .grid { align-items: stretch; }
.grid-overlay span { background: var(--grid-col); border-inline: 1px solid var(--grid-edge); }
@media (max-width: 760px) { .grid-overlay span:nth-child(n+5) { display: none; } }
.project .para { display: block; }
.project .para + .para { margin-top: 1em; }
