/* ==========================================================================
   Anna Volkova — portfolio
   Desktop reference: 1440px wide. Art-directed areas (hero, project visuals,
   collage) are laid out in design pixels and scaled with a container unit:
   --u = one design pixel at the current container width.
   ========================================================================== */

/* Custom fonts, served from assets/. They're loaded only from these files
   (no local() lookup), so a preview on a machine with the fonts installed
   shows exactly what visitors get. The Fiyona Test trial files cover
   letters, digits and ! , - . ? only; other characters fall back to Georgia. */
@font-face {
  font-family: "Fiyona Test";
  src: url("../assets/fiyonatest-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Fiyona Test";
  src: url("../assets/fiyonatest-semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Fiyona Test";
  src: url("../assets/fiyonatest-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Fiyona Test";
  src: url("../assets/fiyonatest-extrabold.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Fiyona Test";
  src: url("../assets/fiyonatest-black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "Achilleus";
  src: url("../assets/AchilleusScript-V4rXy.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #F6F4F5;
  --panel: #E9E2E5;
  --ink: #201619;
  --plum: #271A21;
  --body: #513F49;
  --line: #7A5D6C;
  --line-pale: #BDADB5;
  --cream: #FCFBF8;
  --blue: #C9DBE9;
  --accent: #91255C;
  --white: #FFFFFF;

  --font-serif: "Fiyona Test", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-script: "Achilleus", var(--font-serif);

  --soft-shadow:
    0 366px 103px rgba(86, 46, 46, 0),
    0 234px 94px rgba(86, 46, 46, 0.01),
    0 132px 79px rgba(86, 46, 46, 0.03),
    0 59px 59px rgba(86, 46, 46, 0.05),
    0 15px 32px rgba(86, 46, 46, 0.06);
  --object-shadow:
    drop-shadow(3px 4px 5.5px rgba(47, 9, 19, 0.09))
    drop-shadow(13px 15px 10px rgba(47, 9, 19, 0.08))
    drop-shadow(28px 34px 13px rgba(47, 9, 19, 0.05));

  --tab-h: 51px;

  /* Scroll stops on desktop: how far below the top of the window each
     section comes to rest. */
  --stop-work: 112px;    /* top edge of the work showcase */
  --stop-quests: 20px;   /* the "Side quests" heading */
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img { display: block; max-width: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.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;
}

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--white);
  border: 1px solid var(--body);
  border-radius: 40px;
  font-family: var(--font-mono);
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* Images that failed to load are hidden instead of showing a broken icon. */
img.is-missing { visibility: hidden; }

/* ---------- Header ---------- */

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 50;
}

.nav {
  position: fixed;
  top: clamp(12px, 4.375vw, 28px);
  right: clamp(16px, 3.33vw, 48px);
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(702px, calc(100vw - 32px));
  height: 66px;
  padding: 0 36px;
  border: 1px solid var(--body);
  border-radius: 40px;
  background: rgba(246, 244, 245, 0.7);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--body);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}
.nav-links li { display: flex; align-items: center; gap: 22px; }
.nav-links li + li::before {
  content: "";
  width: 3px; height: 3px;
  border-radius: 50%;
  background: currentColor;
}

.nav a {
  text-decoration: none;
  white-space: nowrap;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 3px;
  transition: background-size 0.25s ease;
}
.nav a:hover,
.nav a[aria-current] { background-size: 100% 1px; }

.nav-rule {
  flex: 1;
  min-width: 16px;
  height: 1px;
  background: currentColor;
}

/* Over the halftone trees, the case study ←'s colours there: darkened
   glass, the rim and the words in the page's colour (is-on-dark;
   js/main.js). Phones have the menu button instead. */
@media (min-width: 720px) {
  .nav { transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease; }
  .nav.is-on-dark { border-color: var(--bg); background: rgba(39, 26, 33, 0.3); color: var(--bg); }
}

/* Phones only (see the end of the file). */
.menu-toggle,
.nav-brand { display: none; }

/* ---------- 1. Hero ---------- */

.hero {
  position: relative;
  container-type: inline-size;
  background: var(--bg);
  aspect-ratio: 1440 / 921;
  overflow: hidden;
}

.hero > * {
  --u: calc(100cqw / 1440);
  position: absolute;
}

.stipple {
  display: block;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.stipple--hero {
  left: 0;
  top: 0;
  width: calc(1343 * var(--u));
  height: calc(652 * var(--u));
}

.hero-photo {
  left: 0;
  top: calc(404 * var(--u));
  width: calc(1456 * var(--u));
  height: calc(517 * var(--u));
  overflow: hidden;
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

.hero-name { inset: 0; }
.hero-name img { position: absolute; height: auto; }
.hero-name-anna {
  left: calc(108.97 * var(--u));
  top: calc(158.01 * var(--u));
  width: calc(737.06 * var(--u));
}
.hero-name-volkova {
  left: calc(391 * var(--u));
  top: calc(437.99 * var(--u));
  width: calc(1006 * var(--u));
}

.hero-intro {
  left: calc(932 * var(--u));
  top: calc(309 * var(--u));
  max-width: calc(100% - 932 * var(--u) - 16px);
  font-size: 16px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: -0.05em;
  text-transform: lowercase;
  color: var(--body);
}

/* Page-load intro. html.intro hides the hero (set in <head> unless reduced
   motion is on); html.intro-play, added once the hero images are ready,
   plays it: the photo dissolves in, the name slides up into place, then
   the intro line and the menu arrive. Text comes out of a blur as it
   arrives, as on billguo.me's case studies. */
.intro:not(.intro-play) :is(.hero-photo, .stipple--hero, .hero-intro, .nav, .menu-toggle) { opacity: 0; }
.intro:not(.intro-play) .hero-name img { opacity: 0; }

.intro-play .hero-photo { animation: intro-fade 1.6s ease backwards; }
.intro-play .stipple--hero { animation: intro-fade 1.4s ease 0.5s backwards; }
.intro-play .hero-name-anna { animation: intro-name 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s backwards; }
.intro-play .hero-name-volkova { animation: intro-name 1s cubic-bezier(0.22, 1, 0.36, 1) 0.45s backwards; }
.intro-play .hero-intro { animation: intro-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.4s backwards; }
.intro-play :is(.nav, .menu-toggle) { animation: intro-drop 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.5s backwards; }

@keyframes intro-fade { from { opacity: 0; } }
@keyframes intro-slide { from { opacity: 0; transform: translateY(40px); } }
@keyframes intro-name { from { opacity: 0; transform: translateY(40px); filter: blur(12px); } }
@keyframes intro-rise { from { opacity: 0; transform: translateY(10px); filter: blur(12px); } }
@keyframes intro-drop { from { opacity: 0; translate: 0 -12px; -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px); } }

/* ---------- 2. Selected work ---------- */

.work {
  display: grid;
  grid-template-columns: calc(100% / 3) minmax(0, 1fr);
  grid-template-rows: var(--tab-h) auto;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  scroll-margin-top: 100px;
}

.work-tabs {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.work-tabs::-webkit-scrollbar { display: none; }

.work-tab {
  flex: 1 0 0;
  padding: 0 24px;
  border: 0;
  border-right: 1px solid var(--body);
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  line-height: 26px;
  letter-spacing: -0.07em;
  color: var(--body);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.work-tab:last-child { border-right: 0; }
.work-tab:hover { background: rgba(233, 226, 229, 0.5); }
.work-tab[aria-selected="true"] { background: var(--panel); cursor: default; }
.work-tab:focus-visible { outline-offset: -3px; }

.work-panel {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: calc(100% / 3) minmax(0, 1fr);
  min-height: calc(666px - var(--tab-h));
}
.work-panel[hidden] { display: none; }

/* Switching projects: the current one fades out, then the new one comes in.
   Only what changes moves: the picture fades and the text rises out of a
   blur, one block after another. The paper and the borders stay put; a
   picture's grain (the social post's) comes and goes with it. */
.work-panel.is-leaving :is(.shot, .grain, .work-body, .work-footer > *) { animation: panel-out 0.16s ease-in both; }
.work-panel.is-entering :is(.shot, .grain) { animation: panel-fade 0.5s ease both; }
.work-panel.is-entering .work-body > *,
.work-panel.is-entering .work-footer > * { animation: panel-rise 0.7s cubic-bezier(0.2, 0.6, 0.2, 1) var(--arrive, 0s) both; }
.work-panel.is-entering .work-body > :nth-child(2) { animation-delay: calc(var(--arrive, 0s) + 0.06s); }
.work-panel.is-entering .work-body > :nth-child(3) { animation-delay: calc(var(--arrive, 0s) + 0.12s); }
.work-panel.is-entering .work-footer > * { animation-delay: calc(var(--arrive, 0s) + 0.18s); }

/* Until the showcase comes into view, the open project waits, hidden, to
   play its entrance then: the picture first, the text after a pause
   (--arrive; js/main.js). html.work-waiting does the same from the first
   paint, on a page that opens on the work (preview.html). */
:is(.work.is-waiting, .work-waiting .work) .work-panel :is(.shot, .grain, .work-body > *, .work-footer > *) { opacity: 0; }

@keyframes panel-out { to { opacity: 0; } }
@keyframes panel-fade { from { opacity: 0; } }
@keyframes panel-rise { from { opacity: 0; transform: translateY(12px); filter: blur(12px); } }
.work-panel:focus-visible { outline-offset: -2px; }

/* Project visual: Figma's picture area (480 by 664, its right edge the
   border), pulled up beside the tab row. Pictures are placed in its units
   on the stage, which is centred in it. */
.work-visual {
  position: relative;
  margin-top: calc(-1 * var(--tab-h));
  overflow: hidden;
  background: var(--bg);
  border-right: 1px solid var(--body);
  container-type: size;
  --u: calc(100cqw / 479);
}

/* No transform on the stage: it must not become a stacking context, so the
   colour-burn grain blends with the panel colour behind it. */
.stage {
  position: absolute;
  left: 0;
  top: calc(50% - 332 * var(--u));
  width: calc(479 * var(--u));
  height: calc(664 * var(--u));
}
.stage > * { position: absolute; }

/* Grain textures are landscape files turned to portrait, multiplied in. */
.grain {
  width: calc(758 * var(--u));
  height: calc(537 * var(--u));
  transform: rotate(-90deg);
  mix-blend-mode: color-burn;
  pointer-events: none;
}
/* The social post's grain, over the whole picture (paper and post). */
.grain--smm { left: calc(-139 * var(--u)); top: calc(100.76 * var(--u)); height: calc(510.48 * var(--u)); }

/* While the pointer is over the picture area, the picture leans towards it
   in 3D. js/main.js sets --lean-x and --lean-y on the area, each from -1 to
   1, and --lean, how far it leans in all, from 0 to 1. */
.tilt {
  --tilt: perspective(calc(1000 * var(--u))) rotateX(calc(var(--lean-y, 0) * 2.5deg)) rotateY(calc(var(--lean-x, 0) * -2.5deg));
  transform: var(--tilt);
}
/* Or, instead, it rises a little while the pointer is over the area,
   straight up, as the lore page's papers do (--rise; js/rise.js). */
.rise { translate: 0 var(--rise, 0px); }
.shot img { width: 100%; height: 100%; object-fit: cover; }

.shot--post {
  left: calc(60.03 * var(--u));
  top: calc(118.37 * var(--u));
  width: calc(365.64 * var(--u));
  height: calc(457.05 * var(--u));
  border: 1px solid #C5B7BD;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  transform: var(--tilt) rotate(4.68deg);
}

/* Each picture lies on paper, filling the picture area: On My Disk's
   file manager and PeARS' search page run off its right edge (Figma:
   Component 1). All are Figma's renders, flattened. The screens rise under
   the pointer. */
.work-paper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.shot--screen {
  left: calc(80 * var(--u));
  top: calc(42 * var(--u));
  width: calc(1080 * var(--u));
  height: calc(645 * var(--u));
  overflow: hidden;
  border: calc(6 * var(--u)) solid #f4f2f3;
  border-radius: calc(16 * var(--u));
  background: var(--white);
  box-shadow:
    0 -197px 55px rgba(243, 210, 217, 0),
    0 -126px 50px rgba(243, 210, 217, 0.01),
    0 -71px 43px rgba(243, 210, 217, 0.05),
    0 -32px 32px rgba(243, 210, 217, 0.09),
    0 -8px 17px rgba(243, 210, 217, 0.1);
}
.shot--pears { left: calc(64 * var(--u)); top: calc(74 * var(--u)); }

/* The phone is one picture, frame and all, centred in the picture area. As
   it leans, its edge shows on the side that comes forward, light slides
   across the glass and the shadow shifts the other way. The phone in the
   picture is 1.3 narrower than its box each side, with 41 corners. */
.shot--files {
  left: calc(116 * var(--u));
  top: calc(74.5 * var(--u));
  width: calc(272 * var(--u));
  height: calc(565 * var(--u));
}
.shot--files > * { position: absolute; }
.phone-front { inset: 0; }

/* The shadow's box sits well inside the phone and the shadow is spread back
   out to the phone's outline, so the box itself (which a box-shadow leaves
   bare) stays hidden behind the phone as the shadow moves. */
.phone-shadow {
  inset: calc(8 * var(--u)) calc(9.3 * var(--u));
  border-radius: calc(33 * var(--u));
  box-shadow:
    0 234px 94px calc(8 * var(--u)) rgba(86, 46, 46, 0.01),
    0 132px 79px calc(8 * var(--u)) rgba(86, 46, 46, 0.03),
    0 59px 59px calc(8 * var(--u)) rgba(86, 46, 46, 0.05),
    0 15px 32px calc(8 * var(--u)) rgba(86, 46, 46, 0.06);
  translate: calc(var(--lean-x, 0) * -6 * var(--u)) calc(var(--lean-y, 0) * -6 * var(--u));
}

/* The phone's edge, behind the picture, leaning with it and pushed out
   towards the side that comes forward. */
.phone-side {
  inset: 0 calc(1.3 * var(--u));
  border-radius: calc(41 * var(--u));
  background: linear-gradient(135deg, #6b6b70, #1c1c1e 30%, #0b0b0c 50%, #1c1c1e 70%, #5a5a5f);
  translate: calc(var(--lean-x, 0) * 3 * var(--u)) calc(var(--lean-y, 0) * 3 * var(--u));
  opacity: min(1, var(--lean, 0) * 5);
}

.phone-glare {
  position: absolute;
  inset: 0 calc(1.3 * var(--u));
  border-radius: calc(41 * var(--u));
  background: linear-gradient(115deg, transparent 44%, rgb(255 255 255 / 0.3) 50%, transparent 56%) no-repeat;
  background-size: 300% 300%;
  background-position: calc(50% - var(--lean-x, 0) * 15%) calc(50% - var(--lean-y, 0) * 15%);
  opacity: calc(var(--lean, 0) * 0.5);
  pointer-events: none;
}

/* Project details */
.work-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.work-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 32px;
  padding: 48px 184px 48px 32px;
}

/* At most 738px: Figma's 742, less what browsers set this type narrower by
   than Figma does, so the lines break where Figma's do ("local- / first",
   "an / open-source"). */
.work-title {
  max-width: 738px;
  font-family: var(--font-serif);
  font-size: 64px;
  font-weight: 400;
  line-height: 0.875;
  letter-spacing: -0.09em;
  color: var(--ink);
  text-box: trim-both cap alphabetic;
}

.work-meta-wrap { position: relative; }

.work-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  color: var(--body);
}

.meta-row {
  grid-column: span 2;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 37.8px;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  line-height: 1;
}
.meta-row--half { grid-column: span 1; min-height: 35.5px; border-bottom: 0; }
.meta-row--half:nth-last-child(2) { border-right: 1px solid var(--line); }

.meta-row dt {
  flex: none;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.05em;
}
.meta-row dd {
  font-size: 16px;
  letter-spacing: -0.04em;
}

.work-desc {
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: -0.02em;
  color: var(--body);
}
.work-desc p + p { margin-top: 1.2em; }

.work-footer {
  display: flex;
  align-items: center;
  height: 51px;
  padding: 0 8px;
  border-top: 1px solid var(--line);
}

.cta,
.work-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 400;
  line-height: 26px;
  letter-spacing: -0.07em;
  color: var(--body);
  text-decoration: none;
}
.cta--strong { font-weight: 600; }
.cta .arrow {
  width: 19.667px;
  height: 19.667px;
  transform: rotate(180deg);
  transition: transform 0.2s ease;
}
.cta:hover .arrow { transform: rotate(180deg) translateX(-3px); }
.cta:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* "View study": with a mouse over a project's picture that has a study (or
   a paper with one in the case studies' folder, or a side quest with one),
   a pill takes the pointer's place and follows it, and a click there opens
   the study (js/main.js). It comes in as a circle round the arrow, then
   opens out to the words, which come out of a blur as the site's text
   does; on the way out it closes up first. The page's brown with a cream
   rim (Figma: Component 1, Variant5). */
.work-visual.has-study,
.lore-folder:not(.is-dragging) .sheet.is-top[data-href] .sheet-hit,
a.piece[href] { cursor: none; }
.view-study {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  height: 45px;
  padding: 0 11.5px;   /* a circle round the arrow */
  border: 1px solid #f5f1ed;
  border-radius: 40px;
  background: rgba(81, 63, 73, 0.92);
  -webkit-backdrop-filter: blur(15.4px);
  backdrop-filter: blur(15.4px);
  box-shadow:
    0 1px 1.5px rgba(152, 129, 129, 0.08),
    0 6px 3px rgba(152, 129, 129, 0.07),
    0 13px 4px rgba(152, 129, 129, 0.04),
    0 23px 4.5px rgba(152, 129, 129, 0.01);
  color: #f5f1ed;
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: normal;
  letter-spacing: -0.05em;
  white-space: nowrap;
  pointer-events: none;
  translate: calc(var(--x, 0px) - 50%) calc(var(--y, 0px) - 50%);
  opacity: 0;
  scale: 0.5;
  transition: padding 0.25s ease, opacity 0.2s ease 0.2s, scale 0.25s ease 0.2s;
}
.view-study.is-shown {
  padding: 0 30.5px;
  opacity: 1;
  scale: 1;
  transition: opacity 0.25s ease, scale 0.4s cubic-bezier(0.22, 1, 0.36, 1), padding 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}
.view-study-label {
  display: grid;
  grid-template-columns: 0fr;
  transition: grid-template-columns 0.25s ease;
}
.view-study-label > span {
  overflow: hidden;
  opacity: 0;
  filter: blur(6px);
  transition: opacity 0.15s ease, filter 0.15s ease;
}
.view-study-label > span > span { display: block; padding-right: 8px; }   /* the gap to the arrow */
.view-study.is-shown .view-study-label {
  grid-template-columns: 1fr;
  transition: grid-template-columns 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}
.view-study.is-shown .view-study-label > span {
  opacity: 1;
  filter: blur(0);
  transition: opacity 0.45s ease 0.25s, filter 0.55s ease 0.25s;
}
.view-study svg { flex: none; }

/* ---------- 3. Side quests ---------- */

/* Above the contact stipple, which reaches up under the collage. */
.quests {
  position: relative;
  z-index: 1;
  padding: 24px 0 16px;
  scroll-margin-top: 100px;
}

/* The heading is shown as the hand lettering; the text stays for screen
   readers (and as the scroll stop). */
.quests .section-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.section-title {
  padding-left: 160px;
  font-family: var(--font-serif);
  font-size: 64px;
  font-weight: 400;
  line-height: 90px;
  letter-spacing: -0.09em;
  text-transform: capitalize;
  color: var(--plum);
}

.quests-layout {
  position: relative;
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 880fr) minmax(0, 433fr);
  column-gap: 30px;
  align-items: start;
  padding: 0 40px 0 56px;
}

/* Hand lettering, placed as in Figma relative to the collage and scaled
   with it: --uq is one design pixel at the collage's current width. */
.quests-lettering {
  --uq: calc((100cqw - 30px) / 1313);
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.quests-lettering picture { display: contents; }
.quests-counter { display: none; }
.quests-lettering img { position: absolute; height: auto; }
.lettering-side { left: calc(56px + 43.9 * var(--uq)); top: calc(-5.1 * var(--uq)); width: calc(593 * var(--uq)); }
.lettering-quests { left: calc(56px + 84.9 * var(--uq)); top: calc(229.9 * var(--uq)); width: calc(933 * var(--uq)); }

/* Collage stage: 880 × 600 design px. Each piece's box and turn come from
   the Figma layout (rotation applied around the box centre). */
.collage {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 880 / 600;
  margin-top: calc(156 * (100cqw - 30px) / 1313);
}

.piece {
  --u: calc(100cqw / 880);
  --r: 0deg;
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
  padding: 0;
  border: 0;
  background: none;
  transform: rotate(var(--r));
}
.piece:focus-visible { outline-offset: 4px; }

/* The visible part of a piece. It lifts straight up on screen when the piece
   is hovered (undoing the piece's rotation for the move); the button itself
   stays put, so the hover area doesn't slide out from under the pointer. */
.piece-inner {
  --lift: 0px;
  position: absolute;
  inset: 0;
  transform: rotate(calc(-1 * var(--r))) translateY(var(--lift)) rotate(var(--r));
  transition: transform 0.3s ease;
}
.piece.is-lifted .piece-inner { --lift: -6px; }
.piece img { width: 100%; height: 100%; }

.paper {
  border: 1px solid var(--line-pale);
  border-radius: 5px;
  overflow: hidden;
}
.paper > img { position: absolute; inset: 0; object-fit: cover; }
.paper .paper-grain { object-fit: fill; mix-blend-mode: color-burn; opacity: 0.99; }
.paper .paper-grain--soft { opacity: 0.42; }

.piece--health { --x: 483.56; --y: 352.48; --w: 356.68; --h: 220.03; --r: 4.31deg; }
.piece--health .paper { border-radius: 3px; }

.piece--lastfm { --x: 107.39; --y: 36.6; --w: 435.43; --h: 209.49; --r: -5.05deg; }
.piece--lastfm .piece-inner { filter: drop-shadow(0 15px 16px rgba(86, 46, 46, 0.06)) drop-shadow(0 59px 29.5px rgba(86, 46, 46, 0.05)); }
.paper--card { background: var(--white); padding: calc(24 * var(--u)); }
.paper--card .lastfm-shot {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 353;
  object-fit: cover;
  object-position: 0 70%;
  mix-blend-mode: multiply;
}

.piece--albums { --x: 232.18; --y: 170.39; --w: 266.08; --h: 332.59; --r: 14.97deg; }
.piece--albums .paper { box-shadow: var(--soft-shadow); }

.piece--phone {
  --x: 16; --y: 179; --w: 171; --h: 350;
  border-radius: calc(29 * var(--u));
}
.piece--phone .piece-inner {
  border-radius: calc(29 * var(--u));
  overflow: hidden;
  box-shadow:
    3px 4px 11px rgba(47, 9, 19, 0.09),
    13px 15px 20px rgba(47, 9, 19, 0.08),
    28px 34px 26px rgba(47, 9, 19, 0.05),
    51px 60px 31px rgba(47, 9, 19, 0.01);
}
.piece--phone img { object-fit: cover; }

.piece--coffee { --x: 497.27; --y: 184.92; --w: 226.2; --h: 223.47; --r: 62.93deg; }
.piece--coffee .piece-inner { filter: var(--object-shadow); }
.piece--coffee img { object-fit: fill; }
/* Only the cup and saucer respond to the pointer, so the image's empty
   corners don't catch hovers meant for the pieces underneath. */
.piece--coffee { pointer-events: none; }
.piece--coffee .piece-hit {
  position: absolute;
  left: 2.9%;
  top: 1.4%;
  width: 94%;
  height: 97%;
  border-radius: 50%;
  pointer-events: auto;
}

/* Project notes share one slot to the right of the collage, level with its
   top (the width of the second grid column); the active note fades in. */
.quest {
  position: absolute;
  left: calc(100% + 30px);
  top: calc(-4 * 100cqw / 880);
  width: calc(100% * 433 / 880);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  opacity: 0;
  visibility: hidden;
  translate: 0 8px;
  transition: opacity 0.25s ease, translate 0.25s ease, visibility 0s linear 0.25s;
}
.quest.is-active {
  opacity: 1;
  visibility: visible;
  translate: none;
  transition: opacity 0.25s ease, translate 0.25s ease, visibility 0s;
}

.quest-title {
  margin-bottom: 40px;
  font-family: var(--font-serif);
  font-size: 56px;
  font-weight: 600;
  line-height: 58px;
  letter-spacing: -0.09em;
  color: var(--ink);
}
.quest-title--caps { max-width: 294px; text-transform: capitalize; }

.quest p {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.02em;
  color: var(--body);
}

.quest .cta {
  height: 50px;
  margin-top: 8px;
  padding: 0 4px 0 24px;
  font-weight: 500;
}

/* ---------- 4. Contact ---------- */

/* A box of its own only on phones (see the phone styles). */
.contact-tuck { display: contents; }

.contact {
  position: relative;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 72px 16px 16px;
  text-align: center;
  background: var(--bg);
  overflow-x: clip;
  scroll-margin-top: 100px;
}

.stipple--contact {
  --u: calc(100cqw / 1440);
  position: absolute;
  z-index: 0;
  left: calc(-28 * var(--u));
  top: calc(-336 * var(--u));
  width: calc(1343 * var(--u));
  height: calc(652 * var(--u));
}

/* Above phones: room around the stipple for the dots the mouse pushes and
   tilts past its edges, so they aren't cut off (js/particles.js draws the
   layer inside it). */
@media (min-width: 720px) {
  .stipple--contact {
    --stipple-pad: 200px;
    margin: calc(-1 * var(--stipple-pad));
    width: calc(1343 * var(--u) + 2 * var(--stipple-pad));
    height: calc(652 * var(--u) + 2 * var(--stipple-pad));
  }
}

.contact > :not(.stipple) { position: relative; z-index: 1; }

.contact-title {
  font-family: var(--font-serif);
  font-size: 58px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.09em;
  color: var(--ink);
  text-box: trim-both cap alphabetic;
}

.contact-sub {
  max-width: 720px;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--body);
}

.booking {
  position: relative;
  z-index: 1;
  width: min(944px, 100%);
  min-height: 440px;
  border-radius: 7px;
  overflow: hidden;
  box-shadow: var(--soft-shadow);
}

/* Cal.com sizes its iframe to the calendar's height. */
.booking-embed { width: 100%; min-height: 440px; overflow: auto; max-height: 465.7px;}
/* Desktop: the calendar doesn't scroll inside its box. */
@media (min-width: 1024px) {
  .booking-embed { overflow: hidden; overflow: clip; }
}

/* ---------- "Get in touch" message ---------- */

.nudge {
  width: min(520px, calc(100vw - 32px));
  padding: 40px 32px 32px;
  border: 1px solid var(--body);
  border-radius: 24px;
  color: var(--body);
  background: hsla(45, 40%, 98%, 0.7);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.nudge::backdrop {
  background: rgba(39, 26, 33, 0.25);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* Ease in rather than pop up: the page dims and blurs first, then the
   message fades in and rises into place. The blurs fade with them (a blur
   doesn't fade with opacity); keyframes without an end value animate to
   the blur set in the rules above. */
.nudge[open] { animation: nudge-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
.nudge[open]::backdrop { animation: nudge-backdrop-in 0.6s ease both; }

@keyframes nudge-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px); }
  to { opacity: 1; transform: none; }
}
@keyframes nudge-backdrop-in {
  from { opacity: 0; -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px); }
  to { opacity: 1; }
}

/* Closing is the opening played backwards: same durations, reversed
   easing, and the message leaves before the page clears. */
.nudge.is-closing { animation: nudge-out 0.7s cubic-bezier(0.64, 0, 0.78, 0) both; }
.nudge.is-closing::backdrop { animation: nudge-backdrop-out 0.6s cubic-bezier(0.75, 0, 0.75, 0.9) 0.25s both; }

@keyframes nudge-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(24px) scale(0.98); -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px); }
}
@keyframes nudge-backdrop-out {
  from { opacity: 1; }
  to { opacity: 0; -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px); }
}

.nudge-close {
  position: absolute;
  top: 12px;
  right: 16px;
  padding: 4px 8px;
  border: 0;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: var(--body);
  cursor: pointer;
}

.nudge-text {
  margin-bottom: 24px;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.03em;
  color: var(--ink);
}

h1.nudge-text {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.09em;
  color: var(--ink);
  text-box: trim-both cap alphabetic;
}

.nudge-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nudge-form label {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: -0.05em;
}
.nudge-form input,
.nudge-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
}
.nudge-form textarea { resize: vertical; }
.nudge-honey { position: absolute; left: -9999px; }

.nudge-send {
align-self: flex-start;
  margin-top: 16px;
  padding: 8px 22px;
  border: 1px solid var(--body);
  border-radius: 12px;
  background-color: var(--body);
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: -0.05em;
  color: var(--white);
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-weight: 800;
  letter-spacing: -12.4%;
}
.nudge-send:hover { background: hsla(330, 17%, 49%, 0.25); color: var(--ink);border: 1px solid hsla(346, 48%, 5%, 0.25);}
.nudge-send:disabled { opacity: 0.5; cursor: default; }

.nudge-status { font-size: 14px; color: var(--body); }
.nudge-status:empty { display: none; }

/* ---------- 5. Footer ---------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  flex-wrap: wrap;
  padding: 24px 40px;
  color: var(--ink);
}

.footer-credit {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  line-height: 1;
  letter-spacing: -0.05em;
}
.footer-credit img { width: 14.733px; height: 13px; }

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: 16px;
  letter-spacing: -0.01em;
}
.footer-links li { display: flex; align-items: center; gap: 8px; }
.footer-links li + li::before {
  content: "";
  width: 3px; height: 3px;
  border-radius: 50%;
  background: currentColor;
}
.footer-links a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.footer-links a:hover { color: var(--accent); }

/* ---------- 6. Lore (lore.html) ---------- */

/* The Figma frame, 1440 wide: the stipple and the "About me" lettering
   behind an open folder of papers. Everything is placed in its units. */
.lore {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 1440 / 797;
  overflow-x: clip;
  /* Below the menu bar, where the screen is too narrow for the frame to
     leave room for it. */
  margin-top: max(0px, 118px - 139 * 100vw / 1440);
}
.lore > * {
  --u: calc(100cqw / 1440);
  position: absolute;
}
.lore-backdrop { inset: 0; pointer-events: none; }
.lore-backdrop > * { position: absolute; }
.stipple--lore {
  left: calc(-68 * var(--u));
  top: calc(55 * var(--u));
  width: calc(1508 * var(--u));
  height: calc(732 * var(--u));
}
.lore-lettering { height: auto; }
.lore-lettering--about { left: calc(59 * var(--u)); top: calc(107.3 * var(--u)); width: calc(1123.38 * var(--u)); }
.lore-lettering--me { left: calc(588.3 * var(--u)); top: calc(367.03 * var(--u)); width: calc(793.49 * var(--u)); }

/* The folder: 948 x 622 units, its own shadow reaching beyond. */
.lore-folder {
  left: calc(246 * var(--u));
  top: calc(165 * var(--u));
  width: calc(948 * var(--u));
  height: calc(622 * var(--u));
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.lore-folder:focus { outline: none; }
.lore-folder.is-tabbed:focus-visible { outline: 1px solid var(--body); outline-offset: calc(24 * var(--u)); border-radius: calc(24 * var(--u)); }   /* reached with Tab (js/lore.js) */
.lore-folder > * { position: absolute; }
.folder-base {
  left: calc(-88 * var(--u));
  top: calc(-53 * var(--u));
  width: calc(1125 * var(--u));
  height: auto;
  pointer-events: none;
}
.folder-label {
  left: calc(218 * var(--u));
  top: calc(275 * var(--u));
  font-family: var(--font-script);
  font-size: calc(40 * var(--u));
  line-height: calc(22 * var(--u));
  letter-spacing: -0.02em;
  color: #fff;
  pointer-events: none;
}
.folder-arrow {
  left: calc(186 * var(--u));
  top: calc(294 * var(--u));
  width: calc(105 * var(--u));
  height: auto;
  pointer-events: none;
}

/* A sheet (a paper in the folder): its picture (with its own shadow) in the
   box Figma renders it in, and, over the paper itself (--cx/--cy/--cw/--ch,
   turned by --cr), the area that takes the pointer, a deeper shadow for
   when it's lifted, and the vellum's frosting. js/lore.js moves it. */
.sheet {
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
  pointer-events: none;
  transform-origin: calc((var(--cx) + var(--cw) / 2) * var(--u)) calc((var(--cy) + var(--ch) / 2) * var(--u));
  will-change: transform;
}
.sheet-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-user-drag: none;
}
.sheet-hit,
.sheet-lift,
.sheet-frost {
  position: absolute;
  left: calc(var(--cx) * var(--u));
  top: calc(var(--cy) * var(--u));
  width: calc(var(--cw) * var(--u));
  height: calc(var(--ch) * var(--u));
  transform-origin: 0 0;
  rotate: var(--cr, 0deg);
}
.sheet-hit { pointer-events: auto; }
.sheet.is-top .sheet-hit { cursor: grab; }
.lore-folder.is-dragging,
.lore-folder.is-dragging .sheet-hit { cursor: grabbing; }
.sheet-lift {
  box-shadow: 0 calc(8 * var(--u)) calc(22 * var(--u)) rgba(39, 26, 33, 0.28);
  opacity: var(--lift, 0);
}
/* Tracing paper: what's under it shows through, blurred (Figma's
   background blur, 5.7). */
.sheet-frost {
  -webkit-backdrop-filter: blur(calc(2.85 * var(--u)));
  backdrop-filter: blur(calc(2.85 * var(--u)));
}

/* The buttons and the caption, shown over a paper while it's hovered: they
   fade in, rising a little into place (--rise is where they settle). */
.pill {
  position: absolute;
  left: calc(var(--px) * var(--u));
  top: calc(var(--py) * var(--u));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border: 1px solid #f5f1ed;
  border-radius: 40px;
  background: rgba(248, 244, 240, 0.82);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  box-shadow:
    0 1px 1.5px rgba(152, 129, 129, 0.08),
    0 6px 3px rgba(152, 129, 129, 0.07),
    0 13px 4px rgba(152, 129, 129, 0.04),
    0 23px 4.5px rgba(152, 129, 129, 0.01);
  font-family: var(--font-mono);
  font-size: clamp(12px, calc(16 * var(--u)), 16px);
  line-height: 1.3;
  letter-spacing: -0.05em;
  color: #513f49;
  text-decoration: none;
  white-space: nowrap;
  translate: -50% calc(var(--rise, -50%) + 6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, translate 0.35s ease, background-color 0.25s ease, visibility 0s linear 0.35s;
}
.pill svg { flex: none; }
/* The caption: a tooltip just above the pointer, shown with a mouse only,
   while the pointer rests on the photo of the cloister (js/lore.js). It
   never takes the pointer itself. */
.pill--caption {
  left: var(--tx, 0);
  top: var(--ty, 0);
  --rise: calc(-100% - 18px);
  width: clamp(270px, calc(359 * var(--u)), 359px);
  padding: 12px 22px;
  white-space: normal;
  text-align: center;
  text-wrap: balance;
}
.lore-folder > .pill { z-index: 200; }
.lore-folder:has([data-sheet="resume"].is-top:is(.is-hovered, .is-revealed)) .pill--resume,
.lore-folder:has([data-sheet="envelope"].is-top:is(.is-hovered, .is-revealed)) .pill--inquiry,
.pill:focus-visible {
  pointer-events: auto;
}
.lore-folder:has([data-sheet="resume"].is-top:is(.is-hovered, .is-revealed)) .pill--resume,
.lore-folder:has([data-sheet="envelope"].is-top:is(.is-hovered, .is-revealed)) .pill--inquiry,
.pill--caption.is-shown,
.pill:focus-visible {
  opacity: 1;
  visibility: visible;
  translate: -50% var(--rise, -50%);
  transition: opacity 0.35s ease, translate 0.35s ease, background-color 0.25s ease, visibility 0s;
}
.pill:is(a, button) { cursor: pointer; }
.pill:is(a, button):hover { background: rgba(252, 250, 248, 0.92); }
.pill:focus-visible { outline: 1px solid var(--body); outline-offset: 3px; }

.lore-hint { display: none; }

/* The folder's shadow reaches down into the contact section, which has no
   stipple to blend here, so no background of its own either. */
.contact--lore { background: none; }

/* Page-load intro (html.intro / html.intro-play, as on the homepage): the
   stipple, "About me" and the menu fade in gently together, leaving the
   stage to the folder, which rises into place, and its papers, from the bottom of the pile up
   (--deal), each sliding in turned a little (--deal-turn) and settling. A paper's picture and the vellum's frosting
   fade in rather than the paper itself: a fading paper would cut the
   frosting off from what's under it. */
.intro:not(.intro-play) .lore :is(.stipple--lore, .lore-lettering, .lore-folder, .lore-hint) { opacity: 0; }
.intro-play :is(.stipple--lore, .lore-lettering, .page-lore .menu-toggle) { animation: intro-fade 1.4s ease 0.6s backwards; }
@media (min-width: 720px) {
  .intro-play .page-lore .nav { animation: intro-fade 1.4s ease 0.6s backwards; }
}
.intro-play .lore .lore-folder > :is(.folder-base, .folder-label, .folder-arrow) {
  animation: intro-slide 1.8s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
/* The pile slides up into the folder all at once (--deal 0, straight),
   then the vellum and the photo of me are laid on top one at a time, each
   solid within its first moments: the vellum 0.55s after the pile, the
   photo of me only 0.25s after the vellum. In the pile, the top paper
   fades in first and the ones under it (--deal-under) just after, so
   nothing shows through it. */
.intro-play .lore .sheet {
  --deal-at: calc(0.9s + var(--deal) * 0.7s - var(--deal) * var(--deal) * 0.15s);
  animation: intro-deal calc(0.75s - var(--deal) * 0.035s) cubic-bezier(0.4, 0, 0.2, 1) var(--deal-at) backwards;
}
.intro-play .lore .sheet > :is(.sheet-img, .sheet-frost) {
  animation: intro-fade calc(0.25s - var(--deal) * 0.01s) ease calc(var(--deal-at) + var(--deal-under, 0) * 0.25s) backwards;
}
.intro-play .lore .lore-hint { animation: intro-rise 1.6s cubic-bezier(0.22, 1, 0.36, 1) 3.2s backwards; }

@keyframes intro-deal {
  from { translate: calc(24 * var(--u)) calc(120 * var(--u)); rotate: var(--deal-turn); }
}

/* Touch screens: no hover, so the two buttons show once the pile on the
   right is gone. */
@media (hover: none) {
  .lore-folder.is-through > .pill:is(a, button) {
    opacity: 1;
    visibility: visible;
    translate: -50% var(--rise, -50%);
    pointer-events: auto;
    transition: opacity 0.35s ease, translate 0.35s ease, background-color 0.25s ease, visibility 0s;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Desktop scroll stops: scrolling settles on the hero, the work showcase,
   the side-quests collage and the end of the page (contact + footer).
   Firm stops need a window tall enough to show the whole work showcase
   (--stop-work + 666px); shorter windows get gentle stops so nothing is
   left unreachable between them. */
@media (min-width: 1024px) {
  html { scroll-snap-type: y proximity; }
  /* The top stop sits on the header: the hero clips its photo, which makes
     it a scroll container of its own, so it can't hold the stop itself. */
  .site-header { scroll-snap-align: start; }
  .work { scroll-snap-align: start; scroll-margin-top: var(--stop-work); }
  .quests { scroll-margin-top: 0; }
  .quests .section-title { scroll-snap-align: start; scroll-margin-top: var(--stop-quests); }
  .contact { scroll-margin-top: 0; }
  .site-footer { scroll-snap-align: end; }
}
@media (min-width: 1024px) and (min-height: 780px) {
  html { scroll-snap-type: y mandatory; }
}

@media (max-width: 1280px) {
  .work-body { padding-right: 112px; }
  .quest-title { font-size: 48px; line-height: 50px; }
}

/* Tablet: project imagery stacks above its details. */
@media (max-width: 1023px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .work-tabs { grid-column: 1; }
  .work-panel { grid-template-columns: minmax(0, 1fr); min-height: 0; }

  .work-visual {
    margin-top: 0;
    height: 460px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    --u: calc(100cqh / 664);
  }
  .stage { left: calc(50% - 239.5 * var(--u)); top: 0; }
  /* The panel is wider than the stage here, so the grain covers all of it. */
  .stage .grain {
    left: calc(239.5 * var(--u));
    top: calc(332 * var(--u));
    width: 100cqh;
    height: 100cqw;
    object-fit: cover;
    transform: translate(-50%, -50%) rotate(-90deg);
  }

  .work-body { padding: 80px 96px 40px 32px; }

  .section-title { padding-left: 32px; }
  .quests-layout {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 56px;
    padding: 0 32px;
  }
  .collage { margin-top: 0; margin-bottom: 300px; }
  .quests-lettering {
    position: static;
    display: flex;
    flex-direction: column;
    margin-bottom: -24px;
  }
  .quests-lettering img { position: static; }
  .lettering-side { width: 62%; }
  .lettering-quests { width: 100%; margin-top: -8%; }
  .quest {
    left: auto;
    right: 0;
    top: calc(100% + 48px);
    width: min(480px, 100%);
  }
}

/* Tablet, lore: a frame of 1100 units around the folder, so the papers stay
   readable (the lettering runs off the sides), and below the menu bar. */
@media (min-width: 720px) and (max-width: 1023px) {
  .lore {
    aspect-ratio: 1100 / 797;
    margin-top: max(0px, 118px - 139 * 100vw / 1100);
  }
  /* Moved along with left/right, not translate, which would cut the stipple
     off from the page it multiplies into. */
  .lore > * { --u: calc(100cqw / 1100); }
  .lore-backdrop { left: calc(-170 * var(--u)); right: calc(170 * var(--u)); }
  .lore-folder { left: calc(76 * var(--u)); }
}

/* Phone */
@media (max-width: 719px) {

  /* Header: a menu button over the photo. The links open as a full-screen
     menu, frosted like the stipple dialog, under a bar with the pansy. */
  .menu-toggle {
    position: fixed;
    z-index: 1;
    top: 10px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--bg);
    cursor: pointer;
    transition: color 0.25s ease;
  }
  .menu-toggle.is-on-light,
  .menu-open .menu-toggle { color: var(--body); }
  .menu-icon { grid-area: 1 / 1; }
  .menu-icon--close,
  .menu-open .menu-icon--open { display: none; }
  .menu-open .menu-icon--close { display: block; }
  .menu-open .menu-toggle { right: 20px; }
  .menu-open { overflow: hidden; }

  .nav {
    inset: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: auto;
    height: auto;
    padding: 88px 20px 24px;
    border: 0;
    border-radius: 0;
    background: hsla(45, 40%, 98%, 0.7);
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, -webkit-backdrop-filter 0.3s ease, backdrop-filter 0.3s ease, visibility 0s linear 0.3s;
  }
  .menu-open .nav {
    opacity: 1;
    visibility: visible;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    transition-delay: 0s;
  }
  .intro-play .nav { animation: none; }
  .nav::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 64px;
  }
  .nav-brand {
    position: absolute;
    top: 10px;
    left: 20px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
  }
  .nav-brand img { width: 36px; height: 39px; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 8px; }
  .nav-links li { display: block; }
  .nav-links li + li::before { content: none; }
  .nav-rule { display: none; }
  .nav-links a,
  .nav-cta {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 20px;
    border-bottom: 1px solid var(--body);
    background: none;
  }
  /* The links drop in one after another. */
  .nav-links li,
  .nav-cta {
    opacity: 0;
    translate: 0 -8px;
    transition: opacity 0.3s ease, translate 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .menu-open .nav-links li,
  .menu-open .nav-cta { opacity: 1; translate: none; }
  .menu-open .nav-links li:nth-child(2) { transition-delay: 0.04s; }
  .menu-open .nav-links li:nth-child(3) { transition-delay: 0.08s; }
  .menu-open .nav-cta { transition-delay: 0.12s; }

  /* Sections stop below the pinned menu button; side quests at the very
     top, so the whole carousel is in view. */
  .work,
  .contact { scroll-margin-top: 64px; }
  .quests { scroll-margin-top: 0; }

  /* Hero: fills the screen except for the first project row, which peeks in
     at the bottom. From the photo's bottom edge down it follows the Figma
     frame (390 wide, scaled with the width); the photo takes the rest. */
  .hero {
    aspect-ratio: auto;
    height: max(calc(100vh - 52px), calc(482 * 100vw / 390));
    height: max(calc(100svh - 52px), calc(482 * 100vw / 390));
  }
  .hero > * { --u: calc(100cqw / 390); }
  .hero-photo { top: 0; bottom: calc(302 * var(--u)); width: 100%; height: auto; }
  .stipple--hero {
    left: calc(-139 * var(--u));
    top: auto;
    bottom: calc(-23 * var(--u));
    width: calc(668 * var(--u));
    height: calc(325 * var(--u));
  }
  .hero-name-anna { left: calc(19 * var(--u)); top: auto; bottom: calc(319 * var(--u)); width: calc(335 * var(--u)); }
  .hero-name-volkova { left: calc(3 * var(--u)); top: auto; bottom: calc(227 * var(--u)); width: calc(401 * var(--u)); }
  .hero-intro {
    left: calc(20 * var(--u));
    top: calc(100% - 205.5 * var(--u));
    max-width: calc(350 * var(--u));
    line-height: 1.5;
  }

  /* Work: a feed. Every project shows under its name bar. */
  .work {
    display: flex;
    flex-direction: column;
    border-bottom: 0;
    overflow-x: clip;
  }
  .work-tabs { display: contents; }
  #tab-files { order: 1; }
  #panel-files { order: 2; }
  #tab-pears { order: 3; }
  #panel-pears { order: 4; }
  #tab-node { order: 5; }
  #panel-node { order: 6; }
  #tab-smm { order: 7; }
  #panel-smm { order: 8; }

  .work-tab {
    flex: none;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    text-align: left;
    pointer-events: none;
  }

  .work-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    padding: 16px 16px 0;
  }
  .work-info,
  .work-body { display: contents; }

  .work-title { order: 1; font-size: 48px; line-height: 1.15; text-box: none; }

  /* Pictures, centred, their shadows left uncut, without the grain;
     projects with no picture go without. The social post sits in a box
     cropped to it, without its paper. */
  .work-visual { order: 2; border-bottom: 0; overflow: visible; }
  .work-visual:not(:has(.shot)),
  .work-visual .grain,
  #panel-smm .work-paper { display: none; }
  #panel-smm .work-visual { --u: calc(440px / 714); height: 361px; }
  #panel-smm .stage { left: calc(12 * var(--u)); top: calc(-45px + 24 * var(--u)); }
  /* On My Disk's and PeARS' screens on their paper, as in Figma's frame
     (480 by 664), from edge to edge of the screen: the paper fills the box
     and the screen runs off its right and bottom. */
  :is(#panel-files, #panel-pears) .work-visual { --u: calc(100cqw / 480); height: auto; margin-inline: -16px; aspect-ratio: 480 / 664; overflow: hidden; }
  :is(#panel-files, #panel-pears) .stage { left: 0; top: 0; }
  #panel-files .shot--screen { left: calc(74 * var(--u)); top: calc(36 * var(--u)); }

  .work-meta-wrap { order: 3; }
  .work-meta { display: flex; flex-direction: column; }
  .meta-row,
  .meta-row--half {
    align-items: center;
    min-height: 40px;
    padding: 8px;
    border-bottom: 1px solid var(--line);
  }
  .meta-row:last-child { border-bottom: 0; }
  .meta-row--half:nth-last-child(2) { border-right: 0; }
  .meta-row dt { width: 62px; }
  .meta-row dd { flex: 1; min-width: 0; line-height: 1.5; }
  .work-desc { order: 4; margin-top: 8px; line-height: 1.5; }
  .work-desc p + p { margin-top: 1.5em; }
  /* Keeps the first line clear of the second sticker. */
  .work-desc::before { content: ""; float: right; width: 88px; height: 24px; }

  .work-footer {
    order: 5;
    justify-content: center;
    margin: 0 -16px;
    padding: 0;
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }

  .section-title { padding-left: 16px; font-size: 48px; line-height: 64px; }
  /* Side quests: the section is one screen tall plus the distance the row
     of cards travels and a pause at each end (--pin, set by js/main.js).
     The screen-high panel stays pinned while that scrolls by: first a
     pause, then the cards move along, then another pause on the last one.
     --screen-h is the screen with the browser's bars showing, --panel-h with
     them tucked away: the panel reaches that far down so nothing after it
     peeks in when the bars go. */
  .quests {
    --screen-h: 100vh;
    --panel-h: 100vh;
    height: calc(var(--panel-h) + var(--pin, 0px));
    padding: 0;
  }
  @supports (height: 100svh) { .quests { --screen-h: 100svh; --panel-h: 100lvh; } }

  /* The panel: lettering and cards centred on the screen with the bars
     showing, room for the counter below them. */
  .quests-layout {
    position: sticky;
    top: 0;
    height: var(--panel-h);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    padding: 16px 16px calc(56px + var(--panel-h) - var(--screen-h));
  }
  .quests-lettering { margin-bottom: 0; }

  /* The carousel: one side quest per card, full width, its picture centred
     in a box above its note. The pictures overlap the bottom of the
     lettering a little, and their box gets the height the screen has left
     once the lettering, notes and counter are in (--notes-h, the tallest
     note, is measured by js/main.js). --card is a card's width, --img-h the
     pictures' height. */
  .collage {
    --card: 100cqw;
    --img-h: clamp(140px, calc(var(--screen-h) - 88px - 40.5cqw - var(--notes-h, 248px)), calc(var(--card) * 0.85));
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    grid-template-rows: var(--img-h) auto;
    gap: 16px;
    aspect-ratio: auto;
    margin: -10cqw -16px 0;
    padding: 0 16px;
    overflow-x: hidden;
  }
  .piece {
    position: relative;
    left: auto;
    top: auto;
    grid-row: 1;
    place-self: center;
  }
  .quest { grid-row: 2; }
  /* Each picture as large as fits its box, by width or by height. */
  .piece--lastfm { grid-column: 1; --r: -3deg; --u: min(calc(var(--card) * 0.95 / 435.43), calc(var(--img-h) * 0.9 / 209.49)); }
  #quest-lastfm { grid-column: 1; }
  .piece--albums { grid-column: 2; --r: 6deg; --u: min(calc(var(--card) * 0.8 / 266.08), calc(var(--img-h) * 0.88 / 332.59)); }
  #quest-books { grid-column: 2; }
  .piece--phone { grid-column: 3; --u: min(calc(var(--card) * 0.6 / 171), calc(var(--img-h) * 0.92 / 350)); }
  #quest-llm { grid-column: 3; }
  .piece--health { grid-column: 4; --r: 3deg; --u: min(calc(var(--card) * 0.92 / 356.68), calc(var(--img-h) * 0.88 / 220.03)); }
  #quest-health { grid-column: 4; }
  .piece--coffee { grid-column: 5; --u: min(calc(var(--card) * 0.72 / 226.2), calc(var(--img-h) * 0.95 / 223.47)); }
  #quest-allergy { grid-column: 5; }

  /* On the contact section's stipple, along the bottom of the screen. */
  .contact .quests-counter {
    display: block;
    position: absolute;
    left: 16px;
    top: calc(7px + var(--reach));
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: -0.05em;
    color: var(--body);
  }

  .quest,
  .quest.is-active {
    position: static;
    width: auto;
    align-items: flex-start;
    text-align: left;
    opacity: 1;
    visibility: visible;
    translate: none;
  }
  .quest .cta { padding-left: 0; }

  .quest-title { font-size: 40px; line-height: 42px; margin-bottom: 20px; }
  .quest-title--caps { max-width: 240px; }

  /* Contact rides tucked 48px under side quests while the panel is pinned:
     its stipple and the counter show along the bottom of the screen, its
     title stays just out of view, and it scrolls on from there once the
     cards are done. It's sticky to the bottom of the screen (--contact-h,
     its height, is set by js/main.js), and its wrapper reaches back up side
     quests by --pin, to where the panel's bottom is as it pins, so it can't
     ride any higher than that. Its box starts --reach above its content, so
     the stipple, which reaches up above the title, stays inside it: being
     sticky puts the section on a layer of its own, and the stipple blends
     with the section's own background. */
  .contact-tuck { --reach: 100px; display: block; margin-top: calc(-48px - var(--reach) - var(--pin, 0px)); }
  .contact-tuck::before { content: ""; display: block; height: var(--pin, 0px); }
  .contact { gap: 24px; }
  .contact-tuck .contact {
    position: sticky;
    bottom: calc(48px + var(--reach) - var(--contact-h));
    padding-top: calc(56px + var(--reach));
    scroll-margin-top: calc(64px - var(--reach));
  }
  /* Let go for a jump to it from a link (js/main.js). */
  .contact-tuck.is-jumping .contact { bottom: auto; }

  .stipple--contact {
    --u: calc(100cqw / 900);
    left: calc(-200 * var(--u));
    top: calc(var(--reach) - 120 * var(--u));
  }
  .contact-title { font-size: 40px; line-height: 1.05; text-box: none; }
  .booking,
  .booking-embed { min-height: 560px; }

  .site-footer { flex-direction: column; align-items: stretch; gap: 16px; padding: 24px 20px; }
  .footer-credit { display: block; text-align: center; line-height: 1.3; }
  .footer-credit img { display: inline; vertical-align: -1px; }
  .footer-links li {
    position: relative;
    flex: 1 1 0;
    justify-content: center;
    height: 44px;
  }
  .footer-links li + li::before { position: absolute; left: -5.5px; top: calc(50% - 1.5px); }

  /* Lore: one screen. The "About me" lettering over the stipple, in a frame
     390 wide, and over them the folder, close up on its right-hand side (530
     of its units across the screen, fewer if the screen is short): all of it
     and the hint under it in view, clear of the menu button. Papers turned
     over go off past the left edge. */
  .lore {
    aspect-ratio: auto;
    height: 100vh;
    height: 100svh;
    margin-top: 0;
  }
  .lore > * { --u: calc(100cqw / 390); }
  .stipple--lore {
    left: calc(-150 * var(--u));
    top: calc(30 * var(--u));
    width: calc(690 * var(--u));
    height: calc(335 * var(--u));
  }
  .lore-lettering--about { left: calc(12 * var(--u)); top: calc(48 * var(--u)); width: calc(326 * var(--u)); }
  .lore-lettering--me { left: calc(165.5 * var(--u)); top: calc(123.3 * var(--u)); width: calc(230 * var(--u)); }
  /* 662 units from the top of the photo to the folder's bottom edge. */
  .lore-folder {
    --u: min(100cqw / 530, (100svh - 108px) / 662);
    left: calc(100cqw - 954 * var(--u));
    top: calc(100% - 48px - 622 * var(--u));
  }
  .lore-hint {
    display: block;
    left: 0;
    right: 0;
    bottom: 16px;
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: -0.05em;
    text-align: center;
    color: #513f49;
  }
}

/* ---------- 7. Case study (on-my-disk.html) ---------- */

/* A redesign in progress (Figma: Portfolio, "Desktop - 3"). The opening:
   halftone trees with paper burnt over them, the On My Disk screen laid on
   top, then the title, the details and the overview, and the research
   question on a sheet of paper. Figma's shaders are flattened into the
   pictures. */

/* A long page: no scroll stops (they hold the homepage's sections). */
html:has(.page-study) { scroll-snap-type: none; }

/* The opening, laid out in units of Figma's 1440px frame (--u), up to that
   width. The screen drifts up as the page scrolls (--drift; js/study.js),
   so it moves faster than the page. */
.cs-banner {
  --u: calc(min(100vw, 1440px) / 1440);
  --drop: 0px;   /* phones: room above the screen for the ← */
  position: relative;
  height: calc(552 * var(--u) + var(--drop));
  overflow: hidden;
  border-bottom: 1px solid rgba(199, 192, 195, 0.6);
  background: rgba(233, 226, 229, 0.5);
  isolation: isolate;
}
.cs-banner-trees {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Paper, turned on its side and darkened a quarter, burnt into the trees. */
.cs-banner-paper {
  position: absolute;
  inset: 0 0 auto;
  height: calc(571 * var(--u));
  container-type: size;
  mix-blend-mode: color-burn;
}
.cs-banner-paper img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100cqh;
  height: 100cqw;
  translate: -50% -50%;
  rotate: -90deg;
}
.cs-banner-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
}

.cs-mockup {
  position: absolute;
  left: 50%;
  top: calc(93.7 * var(--u) + var(--drop));
  width: calc(976 * var(--u));
  height: calc(583 * var(--u));
  overflow: hidden;
  border-radius: 4px;
  background: var(--white);
  box-shadow:
    0 0 0 max(2px, calc(4 * var(--u))) rgba(245, 242, 244, 0.8),   /* Figma's stroke, outside the screen */
    0 191px 54px rgba(67, 4, 23, 0),
    0 122px 49px rgba(67, 4, 23, 0.01),
    0 69px 41px rgba(67, 4, 23, 0.05),
    0 31px 31px rgba(67, 4, 23, 0.09),
    0 8px 17px rgba(67, 4, 23, 0.1);
  translate: -50% var(--drift, 0px);
  will-change: translate;
}
/* Figma's render of the whole screen (Main 1), filling the box. As the
   screen drifts up, its foot comes into the opening. */
.cs-mockup img { width: 100%; height: auto; }

/* Back to the work, staying in the top left corner: a circle of darkened
   glass with a rim and the site's arrow in the page's colour over the
   opening; past it, the page's colour with the rim and the arrow in brown,
   as the phone menu's button turns (is-on-light; js/study.js). */
.cs-back {
  --u: calc(min(100vw, 1440px) / 1440);   /* the opening's */
  position: fixed;
  z-index: 2;
  left: calc(max(16px, calc(45 * var(--u))) + 1px);
  top: calc(max(16px, calc(33 * var(--u))) + 1px);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--bg);
  background: rgba(39, 26, 33, 0.3);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  box-shadow:
    0 23px 4.5px rgba(152, 129, 129, 0.01),
    0 13px 4px rgba(152, 129, 129, 0.04),
    0 6px 3px rgba(152, 129, 129, 0.07),
    0 1px 1.5px rgba(152, 129, 129, 0.08);
  transition: color 0.25s ease, background-color 0.25s ease;
}
.cs-back:hover { background: rgba(39, 26, 33, 0.42); }
.cs-back.is-on-light { color: var(--body); background: rgba(246, 244, 245, 0.94); }
.cs-back.is-on-light:hover { background: rgba(255, 255, 255, 0.96); }
.cs-back:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }
.cs-back-arrow {
  position: relative;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("../assets/img/icons/arrow-left.svg") center / 20px 20px no-repeat;
  mask: url("../assets/img/icons/arrow-left.svg") center / 20px 20px no-repeat;
  transition: translate 0.2s ease;
}
.cs-back:hover .cs-back-arrow { translate: -2px 0; }

/* Page-load intro (html.intro / html.intro-play, as on the homepage): the
   trees dissolve in as the homepage's do, the screen comes up from a little
   below, and the ← drops in as the homepage's menu does. Then the read
   arrives block by block as it comes into view, out of a blur as a
   project's text does in the work tabs, blocks arriving together 60ms
   apart (.is-revealed, --reveal-delay; js/study.js; html.reveals once it's
   running, else they show with the intro). */
.intro:not(.intro-play) :is(.cs-banner-trees, .cs-banner-paper, .cs-mockup, .cs-back),
.intro:not(.intro-play) .cs-block,
.reveals .cs-block:not(.is-revealed) { opacity: 0; }
.intro-play :is(.cs-banner-trees, .cs-banner-paper) { animation: intro-fade 1.6s ease backwards; }
.intro-play .cs-mockup { animation: intro-slide 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.4s backwards; }
.intro-play .cs-back { animation: intro-drop 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1.5s backwards; }
.cs-block.is-revealed { animation: panel-rise 0.7s cubic-bezier(0.2, 0.6, 0.2, 1) var(--reveal-delay, 0s) backwards; }
/* Pictures come up without the blur, as on the reference. */
.cs-block--media.is-revealed { animation-name: media-rise; }
@keyframes media-rise { from { opacity: 0; transform: translateY(6px); } }

/* The read: 180px in from each side of the 1440px frame (less on narrower
   windows), its parts 136px apart: the title, the details and the overview,
   the impact, screens, the problem and the challenge, the question, my role,
   the solutions, the outcome, the next steps and the other case studies.
   All but the title sit a further 56px in (--cs-inset). Then the contact
   section and the footer. */
.cs {
  --cs-pad: clamp(24px, 12.5vw, 180px);
  --cs-inset: clamp(0px, 3.9vw, 56px);
  display: flex;
  flex-direction: column;
  gap: clamp(72px, 9.44vw, 136px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 72px var(--cs-pad);
  color: var(--body);
}
.cs-title {
  font-family: var(--font-serif);
  font-size: clamp(44px, 5.56vw, 80px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.09em;
  color: var(--ink);
  font-feature-settings: "rvrn" 1, "case" 1, "cpsp" 1, "ordn" 1;
  text-box: trim-both cap alphabetic;
}

.cs-intro {
  display: flex;
  align-items: flex-start;
  gap: clamp(48px, 7.2vw, 104px);
  padding: 0 var(--cs-inset);
}
.cs-details,
.cs-overview { flex: 1 0 0; min-width: 0; }
.cs-details {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.cs-details div {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cs-details dt,
.cs-label {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: -0.05em;
  color: var(--body);
  font-feature-settings: "dlig" 1;
  text-box: trim-both cap alphabetic;
}
.cs-details dd {
  font-size: 18px;
  line-height: normal;
  letter-spacing: -0.04em;
  text-box: trim-both cap alphabetic;
}
.cs-overview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cs-overview-text,
.cs-text {
  font-size: 20px;
  font-weight: 300;
  line-height: 1.21;
  color: var(--ink);
}
.cs-overview-text p + p,
.cs-text p + p { margin-top: 1.21em; }   /* a line between them */

/* The question, on a sheet of paper: the paper's grain over the page's
   colour, the botanical drawing darkening it. Under the mouse it rises a
   little, on the lore papers' spring (--rise; js/rise.js). */
.cs-question {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 231px;
  margin: 0 clamp(0px, 3.9vw, 56px);
  padding: 64px clamp(24px, 11.67vw, 168px);
  border: 1px solid rgba(194, 175, 184, 0.26);
  background: rgb(230 226 228);   /* under the paper grain: Figma's 233 229 231 with it */
  box-shadow:
    0 53px 15px rgba(194, 179, 179, 0),
    0 34px 14px rgba(194, 179, 179, 0.02),
    0 19px 11px rgba(194, 179, 179, 0.07),
    0 9px 9px rgba(194, 179, 179, 0.12),
    0 2px 5px rgba(194, 179, 179, 0.14);
  translate: 0 var(--rise, 0px);
}
.cs-question-paper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: luminosity;
  opacity: 0.58;
}
.cs-question-botanical {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76.9%;   /* 745 of the sheet's 968px */
  height: auto;
  min-height: 100%;   /* a taller sheet: it covers it, cropped at the sides */
  object-fit: cover;
  translate: -50% -50%;
  mix-blend-mode: darken;
}
.cs-question-text {
  position: relative;
  flex: 1;
  font-family: var(--font-serif);
  font-size: clamp(34px, 3.9vw, 56px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.09em;
  text-align: center;
  color: var(--ink);
  font-feature-settings: "rvrn" 1, "case" 1, "cpsp" 1, "ordn" 1;
  text-box: trim-both cap alphabetic;
}

/* A section's name between two lines, and a plain line between parts. */
.cs-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: -0.05em;
  color: var(--body);
  font-feature-settings: "dlig" 1;
}
.cs-divider::before,
.cs-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(194, 175, 184, 0.46);
}
.cs-divider span { text-box: trim-both cap alphabetic; }
.cs-rule {
  height: 1px;
  margin: 0;
  border: 0;
  background: rgba(194, 175, 184, 0.46);
}

/* A sheet of paper, as the question's: the paper's grain over the page's
   colour, with a softer shadow. */
.cs-paper {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(194, 175, 184, 0.26);
  background: rgb(230 226 228);
  box-shadow:
    0 9px 9px rgba(194, 179, 179, 0.12),
    0 2px 5px rgba(194, 179, 179, 0.14);
}
.cs-paper-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: luminosity;
  opacity: 0.58;
  pointer-events: none;
}

/* Impact: two figures side by side, the botanical drawing darkening each
   sheet from its outer side. Under the mouse a sheet rises a little, as
   the question does (--rise; js/rise.js). */
.cs-impact {
  display: flex;
  gap: 16px;
  padding: 0 var(--cs-inset);
}
.cs-stat {
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  min-width: 0;
  padding: 64px 48px;
  translate: 0 var(--rise, 0px);
}
.cs-stat-botanical {
  position: absolute;
  top: 0;
  width: auto;
  height: 100%;
  mix-blend-mode: darken;
  pointer-events: none;
}
.cs-stat-botanical--right { right: 0; }
.cs-stat-botanical--left { left: 0; }
.cs-stat-figure,
.cs-stat-text { position: relative; }
.cs-stat-figure {
  font-family: var(--font-serif);
  font-size: clamp(48px, 4.44vw, 64px);
  font-weight: 400;
  line-height: 1.125;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-feature-settings: "rvrn" 1, "case" 1, "cpsp" 1, "ordn" 1;
  text-box: trim-both cap alphabetic;
}
.cs-stat-figure--tight { letter-spacing: -0.03em; }   /* "100%", set closer in Figma */
.cs-stat-text {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: normal;
  letter-spacing: -0.05em;
  color: var(--body);
  font-feature-settings: "dlig" 1;
  text-box: trim-both cap alphabetic;
}

/* Screens on paper: a sheet the width of the read (968 by 627 in the
   frame), the screen in the middle of it (841 by 502). Under the mouse the
   screen rises a little, on the lore papers' spring, while the sheet stays
   put (--rise; js/study.js). Below, two sheets side by side, as tall. */
.cs-gallery {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 var(--cs-inset);
}
.cs-frame {
  display: grid;
  place-items: center;
  aspect-ratio: 968 / 627;
}
.cs-gallery-row {
  display: flex;
  gap: 16px;
  aspect-ratio: 968 / 627;
}
.cs-gallery-row .cs-frame { aspect-ratio: auto; }
.cs-gallery-row .cs-frame:first-child { flex: 614 1 0; }
.cs-gallery-row .cs-frame:last-child { flex: 338 1 0; }
.cs-shot {
  position: relative;
  width: 86.88%;   /* 841 of 968 */
  aspect-ratio: 841 / 502;
  overflow: hidden;
  border-radius: 4px;
  box-shadow:
    0 53px 15px rgba(194, 179, 179, 0),
    0 34px 14px rgba(194, 179, 179, 0.02),
    0 19px 11px rgba(194, 179, 179, 0.07),
    0 9px 9px rgba(194, 179, 179, 0.12),
    0 2px 5px rgba(194, 179, 179, 0.14);
  translate: 0 var(--rise, 0px);
}
.cs-shot img { width: 100%; height: 100%; object-fit: cover; }

/* The problem and the challenge side by side, as the details and the
   overview; my role across the read. */
.cs-pair {
  display: flex;
  align-items: flex-start;
  gap: clamp(48px, 7.2vw, 104px);
  padding: 0 var(--cs-inset);
}
.cs-pair > section,
.cs-role {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cs-pair > section { flex: 1 0 0; min-width: 0; }
.cs-role { padding: 0 var(--cs-inset); }
.cs-role .cs-text { line-height: 1.2; }

/* Solutions: what and why, half the read wide on the right or the left,
   edged on the left in the paper's rim colour, then the screen on paper.
   The edge comes in with the title (the read's reveal). */
.cs-solutions {
  display: flex;
  flex-direction: column;
  gap: clamp(88px, 10.56vw, 152px);
  padding: 0 var(--cs-inset);
}
.cs-solution {
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 3.9vw, 56px);
}
.cs-solution-text {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: max(50%, min(100%, 420px));
  padding-left: 32px;
  border-left: 1px solid rgba(194, 175, 184, 0.26);
  color: var(--ink);
  transition: border-color 0.7s ease;
}
.reveals .cs-solution-text:not(:has(.is-revealed)) { border-color: transparent; }
.cs-solution--right .cs-solution-text { align-self: flex-end; }
.cs-solution-title {
  font-family: var(--font-serif);
  font-size: clamp(34px, 3.33vw, 48px);
  font-weight: 400;
  line-height: 0.896;   /* 43px at 48 */
  letter-spacing: -0.05em;
  font-feature-settings: "dlig" 1;
  text-box: trim-both cap alphabetic;
}
.cs-solution-desc {
  font-size: 18px;
  font-weight: 300;
  line-height: 1.2;
}

/* Outcome: three figures side by side, as the impact's, with 56px more
   room above and below; the botanical drawing runs on from one sheet to the
   next (the first's from its right, the last's from its left). */
.cs-outcome {
  display: flex;
  gap: 16px;
  padding: var(--cs-inset);
}
.cs-outcome .cs-stat {
  justify-content: flex-start;
  padding: 64px 40px;
}
.cs-stat-botanical--full { left: 0; width: 100%; object-fit: cover; }

/* Next steps: two side by side, each edged as the solutions are. */
.cs-next {
  display: flex;
  gap: 56px;
  padding: var(--cs-inset);
}
.cs-next .cs-solution-text { flex: 1 0 0; width: auto; min-width: 0; }
/* Three, as a list (PeARS' outcome): one above the other below 1024px. */
.cs-next--three { margin: 0; list-style: none; }

/* The other studies' parts, in the same hand as On My Disk's: what's under
   a section's name (.cs-stack), a heading there set as a solution's title
   (.cs-heading), a list (.cs-list), a picture on paper at its own
   proportions (.cs-frame--fit; a screen there is --w of it wide), or a
   bare sheet (.cs-frame--blank), pictures side by side at one height
   (.cs-row, each --r wide for every unit high), a caption, always on the
   paper at its foot (.cs-caption), phones cut out of their old backgrounds,
   in groups (.cs-iterations, .cs-phone), a live page on paper (.cs-live),
   a quote (.cs-quote), a picture with its notes beside it (.cs-aside,
   .cs-notes), texts side by side, edged as the solutions are (.cs-cols),
   and three sheets side by side (.cs-trio). */
.cs-stack {
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 3.9vw, 56px);
  padding: 0 var(--cs-inset);
}
.cs-stack > * { min-width: 0; }
.cs :is(h4, h5, blockquote) { margin: 0; }
.cs-heading { max-width: 22em; color: var(--ink); }
:is(.cs-text, .cs-list, .cs-solution-desc) a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}
:is(.cs-text, .cs-list, .cs-solution-desc) a:hover { color: var(--accent); }
.cs-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-left: 1.1em;
  list-style: disc;
}
.cs-list li::marker { color: var(--body); }
.cs-frame--fit {
  aspect-ratio: auto;
  row-gap: 16px;        /* a screen and its caption */
  padding: 6.4% 6.6%;   /* 62 and 64 of 968, as the screens sit */
}
.cs-frame--blank { aspect-ratio: 968 / 627; align-content: end; }
.cs-frame--fit .cs-shot { width: var(--w, 100%); aspect-ratio: auto; }
.cs-frame--fit .cs-shot img { height: auto; }
.cs-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(16px, 2.8vw, 40px);
  width: 100%;
}
.cs-row > * { flex: var(--r) 1 0; min-width: 0; }
/* Before and after, each at its own height, their captions level. */
.cs-row--top { align-items: stretch; }
.cs-row--top .cs-caption { margin-top: auto; }
.cs-figure {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cs-caption {
  position: relative;   /* over the paper's grain */
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: -0.05em;
  text-align: center;
  color: var(--body);
  font-feature-settings: "dlig" 1;
}
/* Phones in a row, all the same height, in groups, each group (a figure)
   with its caption under it: Iteration 3's one phone, Iteration 4's two.
   The empty track doubles the gap between the groups. */
.cs-iterations {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0 repeat(2, minmax(0, 1fr));
  column-gap: clamp(8px, 1.4vw, 20px);
  row-gap: 16px;
  align-items: end;
  width: 100%;
}
.cs-iterations :is(figure, .cs-phones) { display: contents; }
.cs-iterations .cs-phone { grid-row: 1; aspect-ratio: 1 / 2; object-fit: contain; }
.cs-iterations .cs-caption { grid-row: 2; justify-self: center; white-space: nowrap; }
.cs-iterations figure:first-child :is(.cs-phone, .cs-caption) { grid-column: 1; }
.cs-iterations figure:last-child .cs-phone:first-child { grid-column: 3; }
.cs-iterations figure:last-child .cs-phone:last-child { grid-column: 4; }
.cs-iterations figure:last-child .cs-caption { grid-column: 3 / 5; }
.cs-phone {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 9px 9px rgba(194, 179, 179, 0.24)) drop-shadow(0 2px 5px rgba(194, 179, 179, 0.28));
  translate: 0 var(--rise, 0px);
}
.cs-live {
  display: block;
  width: 100%;
  height: clamp(360px, 36vw, 502px);
  border: 0;
  background: var(--white);
}
.cs-quote {
  padding-left: 32px;
  border-left: 1px solid rgba(194, 175, 184, 0.46);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.05em;
  color: var(--ink);
  font-feature-settings: "dlig" 1;
}
.cs-quote p + p { margin-top: 12px; }
.cs-aside {
  display: grid;
  grid-template-columns: minmax(0, 68.75fr) minmax(0, 31.25fr);
  align-items: start;
  gap: 32px;
}
.cs-notes {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.cs-notes .cs-solution-text { width: auto; }
.cs-cols {
  display: flex;
  gap: 56px;
}
.cs-cols > * { flex: 1 0 0; min-width: 0; }
.cs-cols > .cs-solution-text { width: auto; }
.cs-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cs-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* The other case studies: lore's folder (.lore-folder), 948 of the read's
   1080 units wide, in the middle, its shadow reaching down over the contact
   section, above the stipple there. A paper's screenshot is placed on it
   (--pin-x, --pin-y, --pin-w), so it moves with it. */
.cs-more {
  position: relative;
  z-index: 1;
  container-type: inline-size;
}
.cs-more > * { --u: calc(100cqw / 1080); }
.cs-more .cs-folder {
  position: relative;
  left: auto;
  top: auto;
  margin-left: calc(66 * var(--u));
}
.cs-folder .folder-label {
  left: calc(241 * var(--u));
  translate: -50% 0;
  white-space: nowrap;
}
.cs-folder .folder-arrow {
  left: calc(149 * var(--u));
  top: calc(304 * var(--u));
  width: calc(171 * var(--u));
}
.sheet-pin {
  position: absolute;
  left: calc(var(--pin-x) * var(--u));
  top: calc(var(--pin-y) * var(--u));
  width: calc(var(--pin-w) * var(--u));
  height: auto;
  -webkit-user-drag: none;
}

/* The contact section's stipple starts 480 units above it, at the left
   edge (Figma), behind the folder. */
.contact--study .stipple--contact {
  left: 0;
  top: calc(-480 * var(--u));
}

/* Going to a section from the contents: its heading stops clear of the ←. */
.cs :is(h2, h3)[id] { scroll-margin-top: 120px; }

/* The contents (CaseToc.astro), at the right edge, halfway down: a short
   line for each section, pale, the one you're in in the page's brown (as
   Notion marks it). Over them, or with the keyboard in them, they open
   into frosted glass edged in brown, as the message is, with the sections'
   names; the one you're in is underlined, as the menu marks its page.
   It comes in once the opening has gone by (is-shown; js/study.js). */
.toc {
  position: fixed;
  z-index: 2;
  top: 50%;
  right: clamp(24px, 2.78vw, 40px);
  translate: 0 -50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.toc.is-shown,
.toc:focus-within {
  opacity: 1;
  pointer-events: auto;
}
.toc-marks,
.toc-list { margin: 0; list-style: none; }
.toc-marks {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 0 12px 16px;   /* room to aim for */
  transition: opacity 0.2s ease;
}
.toc-mark {
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: rgba(81, 63, 73, 0.24);
  transition: background-color 0.25s ease;
}
.toc-mark.is-current { background: var(--body); }
.toc-panel {
  position: absolute;
  top: 50%;
  right: -16px;
  width: max-content;
  padding: 20px 24px;
  border: 1px solid var(--body);
  border-radius: 12px;
  background: rgba(246, 244, 245, 0.7);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  translate: 8px -50%;
  pointer-events: none;
  transition: opacity 0.2s ease 0.12s, translate 0.25s ease 0.12s;
}
.toc:is(:hover, :focus-within) .toc-panel {
  opacity: 1;
  translate: 0 -50%;
  pointer-events: auto;
  transition-delay: 0s;
}
.toc:is(:hover, :focus-within) .toc-marks { opacity: 0; }
.toc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: -0.05em;
  color: var(--body);
  font-feature-settings: "dlig" 1;
}
.toc-link {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size 0.25s ease, color 0.25s ease;
}
.toc-link:hover,
.toc-link[aria-current] { background-size: 100% 1px; }
.toc-link[aria-current] { color: var(--ink); }
.toc-link:focus-visible { outline: 1px solid var(--body); outline-offset: 3px; }

@media (max-width: 1023px) {
  .toc { display: none; }
  .cs-outcome { flex-direction: column; }
  .cs-outcome .cs-stat { flex: none; }
  .cs-next--three { flex-direction: column; gap: 48px; }
  .cs-trio { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 719px) {
  .cs-banner { --u: calc(100vw / 1100); --drop: 56px; }
  .cs { --cs-pad: 20px; gap: 56px; padding-top: 40px; padding-bottom: 56px; }
  .cs-intro { flex-direction: column; gap: 48px; }
  .cs-details,
  .cs-overview { flex: none; width: 100%; }
  .cs-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .cs-overview-text { font-size: 18px; }
  .cs-question { min-height: 0; padding: 40px 24px; }
  .cs-question-botanical { width: 140%; }
  .cs-impact,
  .cs-pair { flex-direction: column; }
  .cs-impact { gap: 16px; }
  .cs-pair { gap: 48px; }
  .cs-stat { flex: none; padding: 40px 24px; }
  .cs-pair > section { flex: none; width: 100%; }
  .cs-text { font-size: 18px; }
  .cs-outcome .cs-stat { padding: 40px 24px; }
  .cs-next { flex-direction: column; gap: 48px; }
  .cs-aside { grid-template-columns: minmax(0, 1fr); }
  .cs-cols { flex-direction: column; gap: 32px; }
  .cs-cols > * { flex: none; }

  /* The folder close up on its right-hand side, across the whole screen
     (530 of its units, as on the lore page); papers turned over go off past
     the left edge. */
  .cs-more { margin-inline: calc(-1 * var(--cs-pad)); overflow-x: clip; }
  .cs-more > * { --u: calc(100cqw / 530); }
  .cs-more .cs-folder { margin-left: calc(100cqw - 954 * var(--u)); }
  .cs-more .lore-hint { position: static; margin-top: 16px; }
  .contact--study { --reach: 0px; }
}

/* Inside the homepage's panel (js/panel.js): its scrolling stays in the
   panel. Where the panel has its × (in its top left corner, 560px and
   wider) that closes it, so there's no ←, and the read keeps clear of the
   ×; on phones the ← closes it (js/study.js). */
.in-panel { overscroll-behavior: contain; }
@media (min-width: 560px) {
  .in-panel .cs-back { display: none; }
  .in-panel .cs { --cs-pad: 96px; }
}

/* ---------- 8. Not found (404.html) ---------- */

/* A line in the case study's title type, and the way home. */
.not-found {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 32px;
  min-height: 100vh;
  padding: 0 clamp(24px, 12.5vw, 180px);
}
.not-found-title {
  font-family: var(--font-serif);
  font-size: clamp(44px, 5.56vw, 80px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.09em;
  color: var(--ink);
  font-feature-settings: "rvrn" 1, "case" 1, "cpsp" 1, "ordn" 1;
  text-box: trim-both cap alphabetic;
}
.not-found .cta { height: auto; padding: 0; }

/* ---------- Test: work first (preview.html) ---------- */

/* On tablets and wider, a strip with the name takes the hero's place, the
   halftone trees behind it, and the work comes straight after it (Figma:
   "Desktop - 4"). Phones keep the hero. */
.banner { display: none; }

@media (min-width: 720px) {
  .page-work-first .hero { display: none; }

  .banner {
    position: relative;
    display: flex;
    align-items: center;
    height: 136px;
    padding: 0 32px;
    border-bottom: 1px solid var(--body);
    overflow: hidden;
    color: var(--bg);
  }
  .banner-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(32, 22, 25, 0.35);
  }
  .banner-text {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .banner-name {
    font-family: var(--font-serif);
    font-size: 64px;
    font-weight: 400;
    line-height: 56px;
    letter-spacing: -0.08em;
    white-space: nowrap;
    text-box: trim-both cap alphabetic;
  }
  .banner-intro {
    font-size: 16px;
    font-weight: 500;
    line-height: 16px;
    letter-spacing: -0.05em;
    text-transform: lowercase;
  }

  /* The strip's line is the work's top edge. */
  .page-work-first .work { border-top: 0; }

  /* The menu comes in with the page rather than after the hero's intro. */
  .intro-play .page-work-first :is(.nav, .menu-toggle) { animation-delay: 0.2s; }
}

/* Tablets: the menu spans the top, so the name sits under it. */
@media (min-width: 720px) and (max-width: 1023px) {
  .banner { height: auto; padding: 114px 32px 28px; }
}

/* Desktop: the menu sits in the strip, centred in it, and the work's scroll
   stop is the top of the page, right under the strip. The work fills the
   window from there down (never shorter than 600px), so its foot, "Full
   study", sits on the window's bottom edge. Its picture grows with it
   where the showcase gets taller than wide, cropped at the sides. */
@media (min-width: 1024px) {
  .page-work-first {
    --stop-work: 136px;
  }
  .page-work-first .work-panel {
    min-height: max(calc(600px - var(--tab-h)), calc(100vh - var(--stop-work) - var(--tab-h) - 1px));
  }
  .page-work-first .work-visual { --u: max(calc(100cqw / 479), calc(100cqh / 664)); }
  .page-work-first .stage { left: calc(50% - 239.5 * var(--u)); }
  .page-work-first .nav {
    top: 35px;
    right: 32px;
    width: clamp(560px, 50vw, 720px);
  }
}

/* The On My Disk case study in a panel from the right, over the page, from
   the project's "Full study" (js/panel.js). The page dims and blurs as for
   the message; the panel slides in, and out the same way back. Phones: the
   whole screen. */
.study-panel {
  inset: 0 0 0 auto;
  width: clamp(600px, 54vw, 820px);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--bg);
  box-shadow: -24px 0 64px rgba(39, 26, 33, 0.16);
}
.study-panel::backdrop {
  background: rgba(39, 26, 33, 0.25);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.study-panel[open] { animation: study-panel-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
.study-panel[open]::backdrop { animation: nudge-backdrop-in 0.5s ease both; }
.study-panel.is-closing { animation: study-panel-out 0.5s cubic-bezier(0.64, 0, 0.78, 0) both; }
.study-panel.is-closing::backdrop { animation: nudge-backdrop-out 0.5s cubic-bezier(0.75, 0, 0.75, 0.9) both; }
@keyframes study-panel-in { from { translate: 100% 0; } }
@keyframes study-panel-out { to { translate: 100% 0; } }

.study-panel-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}
/* The ×: a pill like the study's own, at the panel's top corner, in the
   study's wide left margin there, so it never covers the writing. Phones,
   where there's no room for that margin, close it with the study's ← (or
   going back). */
.study-panel-close {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--panel);
  border-radius: 50%;
  background: rgba(246, 244, 245, 0.94);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  box-shadow:
    0 1px 1.5px rgba(152, 129, 129, 0.08),
    0 6px 3px rgba(152, 129, 129, 0.07),
    0 13px 4px rgba(152, 129, 129, 0.04),
    0 23px 4.5px rgba(152, 129, 129, 0.01);
  color: var(--body);
  cursor: pointer;
  transition: background-color 0.25s ease;
}
.study-panel-close:hover { background: rgba(255, 255, 255, 0.96); }
.study-panel-close:focus-visible { outline: 1px solid var(--body); outline-offset: 3px; }

@media (max-width: 1023px) {
  .study-panel { width: min(100%, 80vw); }
}
@media (max-width: 719px) {
  .study-panel { width: 100%; box-shadow: none; }
}
@media (max-width: 559px) {
  .study-panel-close { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
