/* Jenni Toriseva — personal portfolio.
   Same type families as Nølla Studio; its own palette and editorial layout. */

:root {
  --paper: #f5f1ea;
  --paper-2: #ece6dc;
  --ink: #1d1b18;
  --ink-soft: #46413a;
  --muted: #8a8378;
  --line: #d9d1c4;
  --accent: #a8502b;          /* clay */
  --accent-soft: #ead8cc;

  /* flat tiles used when a project has no image */
  --t-clay: #d9b8a3;
  --t-moss: #b9c2a5;
  --t-stone: #cfc8bc;
  --t-sky: #b8c4cc;
  --t-sand: #e2d2b3;

  --serif: "Cormorant Garamond", "Cormorant", Garamond, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --wrap: 1200px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 6px;
  --label: 220px;
  --col-gap: 24px;
  --offset: calc(var(--label) + var(--col-gap)); /* left edge of main content */
  --rule-gap: clamp(32px, 3.6vw, 52px); /* space between a section's top line and its headline */
  --spec-pad: clamp(20px, 2.4vw, 30px); /* inner padding of the speciality boxes */
  --tight-label: calc(var(--spec-pad) + 56px - var(--col-gap)); /* label column for rows aligned with the tight headings */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
figure { margin: 0; }
::selection { background: var(--accent-soft); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
.display { font-family: var(--serif); font-weight: 400; line-height: 1.04; letter-spacing: -0.015em; margin: 0; }
.muted { color: var(--muted); }
.arrow { display: inline-block; transition: transform .2s ease; }
.link { color: var(--accent); display: inline-flex; gap: 8px; align-items: center; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.link:hover .arrow { transform: translateX(3px); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; transition: border-color .3s ease; }
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 96px; padding-top: 12px; }
html { scroll-padding-top: 104px; } /* anchor links land below the sticky header */
.logo { display: inline-flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 500; letter-spacing: .02em; }
.logo b { font-weight: inherit; }
.logo-mark { height: 40px; width: auto; flex: none; transition: transform .4s ease; }
.logo:hover .logo-mark { transform: rotate(-8deg); }
.logo span { color: var(--muted); font-weight: 400; }
.nav { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.nav a { color: var(--ink-soft); position: relative; }
.nav a:hover { color: var(--ink); }
.nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -3px; height: 1px; background: var(--accent); transition: right .25s ease; }
.nav a:hover::after { right: 0; }
.menu-toggle { display: none; }

/* Hero */
.hero { padding-top: clamp(64px, 12vw, 160px); padding-bottom: clamp(56px, 8vw, 110px); }
.hero h1 { font-size: clamp(48px, 8.6vw, 124px); max-width: 12em; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-foot { display: grid; grid-template-columns: var(--label) 1fr; column-gap: var(--col-gap); margin-top: clamp(40px, 6vw, 72px); }
.hero-foot .mono { color: var(--muted); padding-top: 4px; }
.hero-intro { font-size: clamp(18px, 1.7vw, 21px); color: var(--ink-soft); max-width: 32em; margin: 0 0 22px; }
.current { display: inline-flex; gap: 10px; align-items: center; font-size: 15px; color: var(--ink-soft); }
.current .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.current a { color: var(--ink); border-bottom: 1px solid var(--line); }
.current a:hover { border-color: var(--ink); }

/* Section framing: label column + content */
.section { margin-top: clamp(72px, 10vw, 140px); }
.section-top { display: grid; grid-template-columns: var(--label) 1fr; column-gap: var(--col-gap); align-items: baseline; border-top: 1px solid var(--ink); padding-top: var(--rule-gap); margin-bottom: clamp(36px, 5vw, 64px); }
.section-top .mono { color: var(--muted); }
.section-top h2 { font-size: clamp(36px, 4.8vw, 64px); }
/* Specialities and Selected work: headline lines up with the titles inside the speciality boxes */
.section-top-tight { grid-template-columns: calc(var(--spec-pad) + 44px) 1fr; column-gap: 12px; }
.section-top p { grid-column: 2; color: var(--muted); max-width: 34em; margin: 14px 0 0; }
.indent { margin-left: var(--offset); }

/* Work index */
.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row { border-bottom: 1px solid var(--line); }
/* first column is sized so project titles start where the 'Selected work' heading starts */
.row > a, .row > div { display: grid; grid-template-columns: var(--tight-label) 1fr 200px 168px; gap: var(--col-gap); align-items: center; padding: 22px 0; }
.row .year { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.row h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 34px); line-height: 1.12; margin: 0; transition: color .2s ease; }
.row p { margin: 6px 0 0; color: var(--muted); font-size: 15px; max-width: 34em; }
.row .cat { font-size: 13px; color: var(--ink-soft); }
.cat-logo { display: block; height: 18px; width: auto; max-width: 110px; object-fit: contain; object-position: left; margin-bottom: 8px; opacity: .75; }
.client-logo { display: block; height: 30px; width: auto; max-width: 180px; object-fit: contain; object-position: left; margin: 32px 0 18px; opacity: .85; }
.thumb { aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--t-stone); transition: transform .4s ease; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb[style] { background: transparent; }
.row > a:hover h3 { color: var(--accent); }
.row > a:hover .thumb { transform: scale(1.03); }
.go { color: var(--accent); font-size: 14px; display: inline-flex; gap: 6px; margin-top: 8px; }

.t-clay { background: var(--t-clay); } .t-moss { background: var(--t-moss); } .t-stone { background: var(--t-stone); }
.t-sky { background: var(--t-sky); } .t-sand { background: var(--t-sand); }

/* About */
.about { display: grid; grid-template-columns: var(--label) minmax(0, 300px) 1fr; column-gap: var(--col-gap); align-items: start; }
.about .bio { grid-column: 3; padding-left: clamp(8px, 3vw, 40px); }
.portrait { grid-column: 1 / 3; margin: 0; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: var(--t-sand); display: grid; place-items: center; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait .ph { font-family: var(--mono); font-size: 12px; color: rgba(40,35,30,.5); letter-spacing: .12em; }
.bio { font-size: 19px; color: var(--ink-soft); max-width: 32em; }
.bio p { margin: 0 0 18px; }
.bio p:first-child { font-family: var(--serif); font-size: clamp(26px, 2.6vw, 32px); line-height: 1.3; color: var(--ink); }
.bio a { color: var(--accent); border-bottom: 1px solid currentColor; }

.cv { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 56px); margin: clamp(56px, 7vw, 88px) 0 0 var(--offset); }
.cv h3 { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.cv ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.cv li { display: grid; grid-template-columns: 112px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cv .when { font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding-top: 3px; }
.cv strong { font-weight: 500; display: block; }
.cv span.org { color: var(--ink-soft); }
.cv small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Speaking & writing */
.talks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.talk > a, .talk > div { display: grid; grid-template-columns: var(--label) 120px 1fr 24px; gap: 24px; align-items: baseline; padding: 18px 0; border-bottom: 1px solid var(--line); }
.talk .when { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.pill { justify-self: start; font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--ink-soft); white-space: nowrap; }
.talk h3 { font-weight: 500; font-size: 17px; margin: 0; }
.talk p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.talk .ext { color: var(--accent); }
.talk > a:hover h3 { color: var(--accent); }

/* Contact */
.contact-big { display: inline-block; font-family: var(--serif); font-size: clamp(36px, 6.4vw, 92px); line-height: 1.05; letter-spacing: -0.015em; border-bottom: 2px solid var(--accent); padding-bottom: 4px; transition: color .2s ease; word-break: break-word; }
.contact-big:hover { color: var(--accent); }
.contact-text { color: var(--ink-soft); max-width: 32em; margin: 0 0 32px; font-size: 18px; }
.elsewhere { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 40px; font-size: 15px; }
.elsewhere a { color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.elsewhere a:hover { color: var(--ink); border-color: var(--ink); }

/* Footer */
.site-footer { margin-top: clamp(96px, 12vw, 160px); border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 28px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

/* ---------- Case study pages ---------- */
.intro { padding-top: clamp(48px, 8vw, 104px); }
.back { font-size: 14px; color: var(--muted); display: inline-flex; gap: 8px; margin-bottom: clamp(32px, 5vw, 56px); }
.back:hover { color: var(--ink); }
.intro .meta { color: var(--muted); margin: 0 0 18px; }
.intro h1 { font-size: clamp(44px, 7vw, 96px); max-width: 12em; }
.intro .lede { font-size: clamp(18px, 1.7vw, 21px); color: var(--ink-soft); max-width: 34em; margin: 28px 0 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 24px; margin: clamp(44px, 6vw, 72px) 0 0; padding: 22px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.facts dt { font-family: var(--mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.facts dd { margin: 0; font-size: 15px; }

.media { border-radius: var(--radius); overflow: hidden; position: relative; display: grid; place-items: center; }
.media > img, .media > video, .media > iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.media > .ph { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: rgba(40,35,30,.5); text-transform: uppercase; text-align: center; padding: 0 16px; }
.media-hero { aspect-ratio: 16 / 9; margin-top: clamp(40px, 6vw, 64px); max-height: 80vh; margin-left: auto; margin-right: auto; }
.media-hero[style] { width: auto; max-width: 100%; }
.media-hero > img { object-fit: contain; }

.block { margin-top: 48px; }
.block-head { padding-top: clamp(72px, 10vw, 128px); }
.section-head { display: grid; grid-template-columns: var(--label) 1fr; column-gap: var(--col-gap); align-items: baseline; border-top: 1px solid var(--line); padding-top: var(--rule-gap); }
.section-head .num { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.section-head h2 { font-size: clamp(32px, 4vw, 50px); margin-bottom: 24px; }
.body { margin-left: var(--offset); max-width: 36em; }
.body p, .body li { color: var(--ink-soft); font-size: 18px; }
.body p { margin: 0 0 20px; }
.body a { color: var(--accent); border-bottom: 1px solid currentColor; }
.pull { font-family: var(--serif); font-style: italic; font-size: clamp(28px, 3vw, 40px); line-height: 1.25; margin: clamp(48px, 6vw, 72px) 0 0 var(--offset); max-width: 18em; padding-left: 24px; border-left: 2px solid var(--accent); }
.pull cite { display: block; font-style: normal; font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 14px; }

.gallery { display: grid; gap: 16px; }
.gallery.n1 .media { aspect-ratio: 16 / 9; }
.gallery.n2 { grid-template-columns: 1fr 1fr; }
.gallery.n3 { grid-template-columns: repeat(3, 1fr); }
.gallery.n4 { grid-template-columns: 1fr 1fr; }
.gallery.n2 .media, .gallery.n3 .media, .gallery.n4 .media { aspect-ratio: 4 / 5; }
figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Carousel: one slide at a time, whole image visible, swipe or arrows */
.carousel-stage { position: relative; }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; outline: none; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: var(--radius); }
.carousel-slide { flex: 0 0 100%; scroll-snap-align: start; margin: 0; min-width: 0; }
.carousel-media { aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); display: grid; place-items: center; }
.carousel-media img { width: 100%; height: 100%; object-fit: contain; }
.carousel-media .ph { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: rgba(40,35,30,.5); text-transform: uppercase; }
.carousel-caption { display: grid; grid-template-columns: var(--label) 1fr; column-gap: var(--col-gap); margin-top: 20px; font-family: inherit; font-size: inherit; color: inherit; }
.carousel-count { font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 8px; }
.carousel-caption h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 34px); margin: 0 0 10px; }
.carousel-caption p { color: var(--ink-soft); font-size: 17px; max-width: 38em; margin: 0 0 14px; }
/* Arrow buttons sit in an overlay the same size as the image, so both are centred on it */
.carousel-frame { position: absolute; top: 0; left: 0; right: 0; aspect-ratio: 16 / 10; pointer-events: none; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); cursor: pointer; display: grid; place-items: center; pointer-events: auto; transition: background .2s ease, opacity .2s ease; }
.carousel-btn svg { display: block; }
.carousel-prev svg { transform: scaleX(-1); }
.carousel-btn:hover { background: var(--accent); }
.carousel-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.carousel-btn:disabled { opacity: .25; cursor: default; background: var(--ink); }
/* Wide screens: outside the photo, in the page margin */
.carousel-prev { left: -60px; }
.carousel-next { right: -60px; }
/* Narrower screens: no room in the margin, so the pair sits just under the photo, on the right */
@media (max-width: 1240px) {
  .carousel-btn { top: calc(100% + 16px); transform: none; }
  .carousel-prev { left: auto; right: 54px; }
  .carousel-next { right: 0; }
  .carousel-caption { padding-right: 112px; }
}
@media (max-width: 720px) {
  .carousel-caption { grid-template-columns: 1fr; row-gap: 6px; padding-right: 0; }
  .carousel-count { padding-top: 0; min-height: 44px; display: flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) { .carousel-track { scroll-behavior: auto; } }
.video .media { aspect-ratio: 16 / 9; }

.states { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.state { display: flex; flex-direction: column; justify-content: flex-start; padding: 22px 20px 26px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; font: inherit; color: inherit; transition: background .3s ease; }
.state:last-child { border-right: 0; }
.state .mono { color: var(--muted); }
.state h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 8px 0 6px; }
.state p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.state[aria-pressed="true"] { background: var(--paper-2); }
.state[aria-pressed="true"] .mono { color: var(--accent); }
.device { margin-top: 16px; aspect-ratio: 21 / 9; border-radius: var(--radius); display: grid; place-items: center; background: var(--paper-2); }
.knob { width: clamp(120px, 18vw, 180px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffdf9, #ddd5c8 72%); box-shadow: 0 18px 40px rgba(60,45,30,.14), inset 0 -4px 10px rgba(0,0,0,.05); position: relative; transition: transform .5s cubic-bezier(.3,.7,.2,1); }
.knob::after { content: ""; position: absolute; top: 12%; left: calc(50% - 2px); width: 4px; height: 18%; border-radius: 2px; background: var(--ink-soft); }
.ring { position: absolute; inset: -14px; border-radius: 50%; border: 2px solid transparent; transition: border-color .4s ease, inset .4s ease; }
.device[data-s="1"] .knob { transform: scale(.97); }
.device[data-s="1"] .ring { border-color: rgba(168,80,43,.35); }
.device[data-s="2"] .knob { transform: rotate(120deg); }
.device[data-s="2"] .ring { border-color: var(--accent); inset: -20px; }
.device[data-s="3"] .knob { transform: rotate(120deg) scale(.95); }
.device[data-s="3"] .ring { border-color: #6d8059; inset: -8px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-left: var(--offset); }
.metric { border-top: 1px solid var(--ink); padding-top: 18px; }
.metric strong { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(46px, 5.6vw, 68px); line-height: 1; margin-bottom: 10px; }
.metric span { color: var(--muted); font-size: 15px; }
.learnings { list-style: none; padding: 0; margin: 0 0 0 var(--offset); max-width: 36em; border-top: 1px solid var(--line); }
.learnings li { padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); }

.next { display: grid; grid-template-columns: var(--label) 1fr; column-gap: var(--col-gap); align-items: baseline; margin-top: clamp(80px, 11vw, 140px); border-top: 1px solid var(--ink); padding-top: var(--rule-gap); }
.next .mono { color: var(--muted); }
.next h2 { font-size: clamp(34px, 4.6vw, 60px); transition: color .2s ease; }
.next:hover h2 { color: var(--accent); }
.next:hover .arrow { transform: translateX(4px); }

/* Reveal */
.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; }
  .knob, .ring, .thumb { transition: none; }
  html { scroll-behavior: auto; }
}

/* Responsive */
@media (max-width: 1000px) {
  :root { --label: 140px; }
  .row > a, .row > div { grid-template-columns: var(--tight-label) 1fr 136px; }
  .row .cat { display: none; }
  .about { grid-template-columns: var(--label) 1fr; }
  .portrait { grid-column: 1 / -1; max-width: 460px; }
  .about .bio { grid-column: 2; margin-top: 32px; }
  .about .bio { padding-left: 0; }
  .cv { grid-template-columns: 1fr; }
  .talk > a, .talk > div { grid-template-columns: var(--label) 1fr 24px; }
  .talk .pill { display: none; }
  .gallery.n3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  :root { --label: 0px; --offset: 0px; }
  .menu-toggle { display: inline-flex; background: none; border: 1px solid var(--ink); border-radius: 999px; padding: 5px 14px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
  .nav { position: absolute; top: 96px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 18px; display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; font-size: 18px; }
  .nav a::after { display: none; }
  .logo span { display: none; }
  .hero-foot, .section-top, .section-head, .next { grid-template-columns: 1fr; gap: 8px; }
  .section-top p { grid-column: 1; }
  .row > a, .row > div { grid-template-columns: 1fr 96px; gap: 6px 16px; }
  .row .year { grid-column: 1 / -1; }
  .about { grid-template-columns: 1fr; }
  .portrait, .about .bio { grid-column: 1; }
  .cv li { grid-template-columns: 92px 1fr; }
  .talk > a, .talk > div { grid-template-columns: 1fr 20px; gap: 4px 12px; }
  .talk .when { grid-column: 1 / -1; }
  .gallery.n2, .gallery.n3, .gallery.n4 { grid-template-columns: 1fr; }
  .state { border-right: 0; border-bottom: 1px solid var(--line); }
  .state:last-child { border-bottom: 0; }
  .device { aspect-ratio: 4 / 3; }
  .pull { padding-left: 16px; }
}

/* Images that open in the lightbox */
.zoom-trigger { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: inherit; }
.zoom-trigger img { width: 100%; height: 100%; object-fit: cover; }
.carousel-media .zoom-trigger img { object-fit: contain; }
.zoom-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.carousel-media, .carousel-frame { aspect-ratio: var(--ratio, 16 / 10); }

/* Lightbox */
html.lb-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(22, 20, 18, .96); color: var(--paper); }
.lightbox::backdrop { background: rgba(22, 20, 18, .6); }
.lb-stage { position: absolute; inset: 0 0 72px 0; display: grid; grid-template: 100% / 100%; place-items: center; overflow: hidden; touch-action: none; cursor: zoom-out; }
.lb-img { max-width: calc(100% - 128px); max-height: calc(100% - 48px); object-fit: contain; transform-origin: center; user-select: none; cursor: zoom-in; will-change: transform; }
.lb-stage.zoomed, .lb-stage.zoomed .lb-img { cursor: grab; }
.lb-stage.zoomed:active, .lb-stage.zoomed:active .lb-img { cursor: grabbing; }
.lb-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 0; background: rgba(245, 241, 234, .12); color: var(--paper); display: grid; place-items: center; cursor: pointer; transition: background .2s ease, opacity .2s ease; }
.lb-btn:hover { background: rgba(245, 241, 234, .24); }
.lb-btn:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
.lb-btn:disabled { opacity: .3; cursor: default; }
.lb-btn[hidden] { display: none; }
.lb-close { position: absolute; top: 16px; right: 16px; }
.lb-prev, .lb-next { position: absolute; top: calc(50% - 36px); transform: translateY(-50%); }
.lb-prev { left: 16px; } .lb-next { right: 16px; }
.lb-prev svg { transform: scaleX(-1); }
.lb-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; }
.lb-caption { margin: 0; font-family: var(--mono); font-size: 12.5px; color: rgba(245, 241, 234, .75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.lb-level { font-family: var(--mono); font-size: 12.5px; min-width: 4.5ch; text-align: center; color: rgba(245, 241, 234, .85); }
@media (max-width: 720px) {
  .lb-img { max-width: 100%; max-height: 100%; }
  .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; z-index: 1; }
  .lb-prev { left: 16px; } .lb-next { left: 68px; right: auto; }
  .lb-bar { justify-content: flex-end; }
  .lb-caption { display: none; }
}

/* Download link (e.g. a thesis PDF) */
.download { margin-left: var(--offset); margin-top: clamp(56px, 7vw, 88px); max-width: 36em; } /* same width as the text above */
.download-link { display: flex; justify-content: flex-start; text-align: left; gap: 24px; align-items: center; padding: 26px 32px 26px 26px; border: 1px solid var(--ink); border-radius: 999px; transition: background .2s ease, color .2s ease; }
.download-link:hover { background: var(--ink); color: var(--paper); }
.download-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.download-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; flex: none; transition: background .2s ease, color .2s ease; }
.download-link:hover .download-icon { background: var(--paper); color: var(--ink); }
.download-label { display: block; font-family: var(--serif); font-size: clamp(24px, 2.4vw, 30px); line-height: 1.15; }
.download-note { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }
.download-link:hover .download-note { color: rgba(245, 241, 234, .7); }
@media (max-width: 720px) { .download { margin-left: 0; } .download-link { border-radius: var(--radius); align-items: flex-start; } }

/* CV timeline with a map */
.cv-timeline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 1.5fr); gap: clamp(32px, 5vw, 72px); align-items: start; margin: clamp(56px, 7vw, 88px) 0 0; } /* starts at the same left edge as the photo */
.tl-head { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 1px; background: var(--line); }
.tl-item { position: relative; display: grid; grid-template-columns: 104px 1fr; gap: 16px; padding: 14px 14px 14px 38px; border-radius: var(--radius); transition: background .2s ease; }
.tl-item[data-place] { cursor: default; }
.tl-item:focus { outline: none; }
.tl-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tl-item.is-active { background: var(--paper-2); }
.tl-dot { position: absolute; left: 6px; top: 19px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--muted); transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.tl-item.is-active .tl-dot { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.tl-item .when { font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding-top: 3px; }
.tl-kind { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.tl-item strong { font-weight: 500; display: block; }
.tl-item .org { color: var(--ink-soft); }
.tl-item small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.tl-place { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }
.tl-item.is-active .tl-place { color: var(--accent); }

.cv-map { position: sticky; top: 120px; margin: 0;
  /* reach out to the right edge of the window */
  --bleed: calc(var(--gutter) + max(0px, (100vw - var(--wrap)) / 2));
  margin-right: calc(-1 * var(--bleed)); }
#about { overflow-x: clip; } /* the bleeding map never causes sideways scrolling */
/* soft fade on the right and bottom edges (the place dots stay crisp) */
.map-frame img { -webkit-mask-image: linear-gradient(to right, #000 55%, transparent 100%), linear-gradient(to bottom, #000 55%, transparent 100%); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, #000 55%, transparent 100%), linear-gradient(to bottom, #000 55%, transparent 100%); mask-composite: intersect; }
.map-frame { position: relative; width: 100%; }
.map-frame img, .map-dots { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-dot { fill: var(--muted); opacity: .55; }
.map-active { transition: transform .7s cubic-bezier(.22, .8, .25, 1); }
.map-active .core { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.map-active .ring { fill: var(--accent); opacity: .18; transform-origin: center; transform-box: fill-box; animation: map-pulse 2.4s ease-out infinite; }
@keyframes map-pulse { 0% { transform: scale(.6); opacity: .35; } 100% { transform: scale(1.6); opacity: 0; } }
.map-label { margin-right: var(--bleed); font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.map-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
@media (prefers-reduced-motion: reduce) { .map-active { transition: none; } .map-active .ring { animation: none; } }
@media (max-width: 1000px) {
  .cv-timeline { grid-template-columns: minmax(0, 1fr) minmax(240px, 1fr); }
}
@media (max-width: 720px) {
  .cv-timeline { grid-template-columns: 1fr; }
  .cv-map { position: static; order: -1; max-width: none; }
  .tl-item { grid-template-columns: 1fr; gap: 2px; padding-left: 34px; }
}

/* Languages, under the timeline */
.langs-head { margin-top: clamp(48px, 6vw, 72px); }
.langs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); border-top: 1px solid var(--line); }
.langs li { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.lang-name { font-weight: 500; }
.lang-level { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Speaking & writing, now part of About */
.about-talks { margin-top: clamp(64px, 8vw, 104px); scroll-margin-top: 120px; }

/* Specialities: boxes span the full width under the section line; click to expand */
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2vw, 24px); align-items: start; }
.spec { border: 1px solid var(--line); border-radius: var(--radius); background: transparent; transition: background .25s ease, border-color .25s ease; interpolate-size: allow-keywords; }
.spec-lead { background: var(--paper-2); border-color: transparent; }
.spec[open] { grid-column: 1 / -1; }
.spec:not(.spec-lead)[open] { background: var(--paper-2); border-color: transparent; }
.spec summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 44px minmax(0, 1fr) 40px; gap: 12px; align-items: start; padding: var(--spec-pad); border-radius: inherit; }
.spec summary::-webkit-details-marker { display: none; }
.spec summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.spec-num { font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding-top: 12px; }
.spec-head { display: flex; flex-direction: column; gap: 8px; }
.spec-title { font-family: var(--serif); font-size: clamp(28px, 2.8vw, 36px); line-height: 1.1; }
.spec-lead .spec-title { font-size: clamp(34px, 3.6vw, 48px); }
.spec-short { color: var(--ink-soft); font-size: 16px; max-width: 36em; }
.spec-toggle { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--ink); transition: background .2s ease, transform .3s ease; margin-top: 4px; }
.spec-toggle::before, .spec-toggle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 1.5px; background: var(--ink); transform: translate(-50%, -50%); transition: background .2s ease; }
.spec-toggle::after { transform: translate(-50%, -50%) rotate(90deg); }
.spec[open] .spec-toggle { transform: rotate(45deg); }
.spec summary:hover .spec-toggle { background: var(--ink); }
.spec summary:hover .spec-toggle::before, .spec summary:hover .spec-toggle::after { background: var(--paper); }
.spec::details-content { block-size: 0; overflow: clip; transition: block-size .35s ease, content-visibility .35s allow-discrete; }
.spec[open]::details-content { block-size: auto; }
.spec-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); padding: 0 clamp(20px, 2.4vw, 30px) clamp(24px, 2.6vw, 34px) calc(clamp(20px, 2.4vw, 30px) + 56px); }
.spec-text { margin: 0; color: var(--ink-soft); font-size: 16.5px; line-height: 1.65; max-width: 38em; }
.spec-points { list-style: none; margin: 0 0 20px; padding: 0; border-top: 1px solid var(--line); }
.spec-points li { padding: 12px 0 12px 22px; border-bottom: 1px solid var(--line); position: relative; font-size: 15.5px; }
.spec-points li::before { content: ""; position: absolute; left: 2px; top: 19px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.spec-rel { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.spec-rel > span:first-child { flex-basis: 100%; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.spec-rel a { color: var(--accent); border-bottom: 1px solid currentColor; }
.spec-rel a:hover { color: var(--ink); }
.spec-norel { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .spec::details-content { transition: none; } .spec-toggle { transition: none; } }
@media (max-width: 720px) {
  .specs { grid-template-columns: 1fr; }
  .spec summary { grid-template-columns: minmax(0, 1fr) 40px; }
  .spec-num { grid-column: 1 / -1; padding-top: 0; }
  .spec-body { grid-template-columns: 1fr; padding-left: clamp(20px, 2.4vw, 30px); }
}


/* Images block with "Keep original proportions": no cropping, one row at equal height */
.gallery-natural { display: flex; gap: 16px; align-items: flex-start; }
.gallery-natural figure { flex: var(--r) 1 0; min-width: 0; margin: 0; }
.gallery-natural .media { background: var(--paper-2); }
.gallery-natural .zoom-trigger img { object-fit: contain; }
@media (max-width: 720px) { .gallery-natural { flex-direction: column; } .gallery-natural figure { width: 100%; flex: none; } }

/* Project titles: "Name — description" */
.t-name { color: var(--ink); }
.t-sub { color: var(--ink-soft); font-style: italic; }
.intro h1 .t-name { display: block; }
.intro h1 .t-sub { display: block; font-size: .5em; line-height: 1.25; margin-top: .35em; max-width: 24em; }

/* Contact text lines up with the tight headings (same left edge as the project titles) */
.indent.indent-tight { margin-left: calc(var(--spec-pad) + 56px); }
@media (max-width: 720px) { .indent.indent-tight { margin-left: 0; } }

/* Icon row: transparent icons on the page, title and a short description */
.icon-row { list-style: none; margin: clamp(40px, 5vw, 64px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: clamp(24px, 3vw, 40px); }
.icon-row li { display: grid; grid-template-rows: 48px auto auto; justify-items: center; text-align: center; }
.icon-row img { display: block; width: auto; object-fit: contain; align-self: end; margin: 0; } /* height is set per icon so they look equally heavy; all sit on one baseline */
.icon-row h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.15; margin: 28px 0 8px; }
.icon-row p { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
@media (max-width: 720px) { .icon-row { grid-template-columns: 1fr 1fr; } }

/* PDF reader */
.pdf-reader { margin-top: clamp(56px, 7vw, 88px); }
.pdf-title { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.pdf-stage { position: relative; display: flex; justify-content: center; gap: 6px; min-height: 320px; padding: 0; outline: none; }
.pdf-stage:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: 2px; }
.pdf-page { display: block; background: #fff; box-shadow: 0 1px 2px rgba(29,27,24,.08), 0 6px 24px rgba(29,27,24,.08); }
.pdf-page[hidden] { display: none; }
.pdf-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--muted); background: var(--paper-2); border-radius: var(--radius); }
.pdf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; row-gap: 14px; margin-top: 18px; }
.pdf-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); display: grid; place-items: center; cursor: pointer; transition: background .2s ease, opacity .2s ease; }
.pdf-btn svg { width: 18px; height: 18px; }
.pdf-prev svg { transform: scaleX(-1); }
.pdf-btn:hover { background: var(--accent); }
.pdf-btn:disabled { opacity: .25; cursor: default; background: var(--ink); }
.pdf-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pdf-count { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); min-width: 13ch; text-align: center; }
.pdf-page { cursor: zoom-in; }
.pdf-enlarge { margin-left: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 0 0 1px; background: none; border: 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }
.pdf-enlarge:hover { color: var(--accent); border-color: currentColor; }
.pdf-enlarge:disabled { opacity: .4; cursor: default; }
.lb-stage.loading::after { content: 'Loading…'; position: absolute; font-family: var(--mono); font-size: 12.5px; color: rgba(245, 241, 234, .6); }
.pdf-download { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.pdf-download:hover { color: var(--accent); border-color: currentColor; }
.pdf-note { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* PDF reader: chapter thumbnails on the left */
.pdf-reader.has-toc { display: grid; grid-template-columns: 196px minmax(0, 1fr); column-gap: 28px; align-items: start; }
.pdf-reader.has-toc .pdf-title { grid-column: 1 / -1; }
.pdf-toc { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 4px; }
.pdf-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pdf-chapter { width: 100%; display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; padding: 6px 8px 6px 6px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; color: var(--ink-soft); transition: background .2s ease, color .2s ease; }
.pdf-chapter:hover { background: var(--paper-2); color: var(--ink); }
.pdf-chapter:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pdf-chapter[aria-current] { background: var(--paper-2); color: var(--ink); }
.pdf-chapter[aria-current] .pdf-thumb { outline: 2px solid var(--accent); outline-offset: 1px; }
.pdf-thumb { display: block; width: 56px; height: auto; aspect-ratio: 210 / 297; background: #fff; box-shadow: 0 1px 2px rgba(29,27,24,.12); }
.pdf-chapter b { display: block; font-weight: 500; font-size: 14px; line-height: 1.3; }
.pdf-chapter small { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
@media (max-width: 900px) {
  .pdf-reader.has-toc { grid-template-columns: 1fr; }
  .pdf-toc { overflow-x: auto; overflow-y: hidden; margin: 0 0 16px; padding: 0 0 6px; }
  .pdf-toc ol { grid-auto-flow: column; grid-auto-columns: 104px; gap: 8px; }
  .pdf-chapter { grid-template-columns: 1fr; gap: 6px; padding: 6px; align-items: start; }
  .pdf-thumb { width: 56px; }
  .pdf-chapter b { font-size: 12.5px; }
}

/* Transparent PNGs blend with the page instead of sitting on a tinted frame */
.media:has(> .zoom-trigger img[src$=".png"]), .media:has(> img[src$=".png"]) { background: none; }
.lb-img[src$=".png"] { background: var(--paper); }

/* Project pages: headings and text line up with the home page's section headings
   (a narrower number column, matching .section-top-tight) */
@media (min-width: 721px) {
  .page-project { --label: calc(var(--spec-pad) + 32px); --offset: calc(var(--spec-pad) + 56px); }
}

/* ---------- Password-protected projects (see unlock.js) ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lock-box { margin: clamp(56px, 7vw, 88px) 0 0 var(--offset); max-width: 36em; padding: 28px 28px 24px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--paper-2) 45%, var(--paper)); }
.lock-box h2 { font-family: var(--sans, inherit); font-size: 20px; font-weight: 500; margin: 0 0 6px; }
.lock-text p { margin: 0 0 18px; color: var(--ink-soft); }
.lock-text a { color: var(--accent); border-bottom: 1px solid currentColor; }
.lock-form { display: flex; gap: 8px; flex-wrap: wrap; }
.lock-form input { flex: 1 1 200px; min-width: 0; padding: 11px 14px; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.lock-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.lock-form button { padding: 11px 20px; font: inherit; color: var(--paper); background: var(--ink); border: 0; border-radius: 8px; cursor: pointer; }
.lock-form button:disabled { opacity: .6; cursor: progress; }
.lock-error { margin: 12px 0 0; color: var(--accent); font-size: 15px; }
.locked { user-select: none; }
.locked .rb { display: block; height: .72em; margin: .62em 0; border-radius: 3px; background: color-mix(in srgb, var(--ink) 9%, transparent); }
.locked .body li { list-style: none; }
.locked .body ul { padding-left: 0; }
.locked .pull { border-left-color: var(--line); }
.locked figcaption .rb { height: .6em; margin: .4em 0; }
.redacted-media { overflow: hidden; background: var(--paper-2); }
.redacted-media img { width: 100%; height: 100%; object-fit: cover; filter: blur(28px) saturate(.7); transform: scale(1.35); }

/* ---------- How I work: approach cards (separate from Selected work) ---------- */
.approaches { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.5vw, 36px); }
.approach > a { display: flex; flex-direction: column; height: 100%; padding: 0 0 22px; border-top: 1px solid var(--ink); }
.approach-img { aspect-ratio: 4 / 3; margin: 22px 0 18px; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); }
.approach-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.approach-num { font-size: 13px; color: var(--muted); }
.approach h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 2.6vw, 36px); line-height: 1.08; margin: 6px 0 0; transition: color .2s ease; }
.approach-sub { font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.3; color: var(--ink-soft); margin: 6px 0 0; }
.approach-sum { color: var(--muted); font-size: 15px; margin: 12px 0 0; }
.approach .go { margin-top: auto; padding-top: 16px; }
.approach > a:hover h3 { color: var(--accent); }
.approach > a:hover .approach-img img { transform: scale(1.03); }
@media (max-width: 900px) { .approaches { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .approaches { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .approach-img img { transition: none; } }

/* Optional caption under a project's large top image (e.g. an illustration credit) */
.hero-figure { margin: 0; }
.hero-figure figcaption { text-align: center; }
