/* ============ Tokens ============ */
:root {
  --paper: #e9e9ea;          /* silver-gray, not white */
  --ink: #111113;
  --muted: #4e5056;
  --faint: #8a8c92;
  --line: #c8cace;
  --accent: #a13d2a;         /* terracotta: the banner's sunset orange, leaning a little towards red */
  --accent-soft: rgba(161, 61, 42, .12);
  --night: #110f11;

  --display: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --hand: "Caveat Variable", "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --sans: "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar) + 20px); }
body { margin: 0; background: var(--night); color: var(--ink); font: 16px/1.7 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
.hand { font-family: var(--hand); font-weight: 500; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
mark { background: linear-gradient(100deg, transparent 2%, var(--accent-soft) 4%, var(--accent-soft) 96%, transparent 98%) 0 65% / 100% 50% no-repeat; color: inherit; font-weight: 600; padding: 0 2px; }
::selection { background: rgba(161, 61, 42, .2); }

/* ============ Top navigation ============ */
/* Pinned to the top. Over the open banner it floats on the photo; once the
   banner has folded up, the strip it leaves behind (.hero-bar) is its background. */
:root { --bar: 48px; }
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: var(--bar);
  display: flex; align-items: center; gap: 28px; padding: 0 36px;
  color: rgba(240, 236, 230, .86);
}
.topnav a { color: inherit; }
.topnav a:hover { text-decoration: none; color: #fff; }
.brand { font: italic 1.45rem/1 var(--display); white-space: nowrap; }
.topnav-links { display: flex; gap: 6px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a { font-size: .84rem; font-weight: 500; padding: 6px 12px; border-radius: 999px; white-space: nowrap; transition: background .2s; }
.nav-cv { border: 1px solid currentColor; }

/* ============ Hero ============ */
@property --reveal { syntax: "<percentage>"; inherits: false; initial-value: 130%; }
/* How far the banner has folded: 0 = open, 1 = folded into the bar. */
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }
@keyframes fold { from { --p: 0; } to { --p: 1; } }

.hero {
  --hh: clamp(260px, 17.2vw, 760px);       /* visible banner height: ~5.8 : 1 strip of the photo */
  --ph: calc(var(--hh) * 1.648);           /* full photo frame height (the "stage") */
  --pw: calc(var(--ph) * .7512);           /* photo width (1087 × 1447) */
  /* Sticky with a negative top: it scrolls up with the page until only its
     bottom --bar pixels are left, then stays. --p follows the scroll position
     over that same distance; the browser computes it in the same frame as the
     scroll itself, so the fades and the sliding horizon never trail the
     fold, however fast the wheel. (Browsers without scroll-driven animations
     get --p from main.js instead.) */
  position: sticky; top: calc(var(--bar) - var(--hh)); z-index: 10;
  height: var(--hh); overflow: hidden; color: #f2ede6;
  background: linear-gradient(#141414, #121014 50%, #0e0b0e);
}
@supports (animation-timeline: scroll()) {
  .hero {
    animation: fold linear both;
    animation-timeline: scroll(root block);
    animation-range: 0 calc(var(--hh) - var(--bar));
  }
}
/* crop: hide the top ~15% and bottom ~25% of the frame; horizon lands at ~59% of the banner */
.hero-stage { position: absolute; left: 0; right: 0; top: calc(var(--hh) * -.242); height: var(--ph); }
.hero-photo { position: absolute; left: 0; top: 0; height: 100%; width: var(--pw); margin: 0; }
.hero-photo img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent 100%); mask-image: linear-gradient(90deg, #000 90%, transparent 100%);
}

/* The sky outside the window, continued across the page.
   Colour stops are sampled from the photo (window column, by height). */
.hero-sky {
  position: absolute; top: 0; bottom: 0; left: calc(var(--pw) * .84); right: 0;
  background: linear-gradient(180deg,
    rgba(20, 20, 30, 0) 31%, #14141e 37%, #1e223a 41%, #34405a 43%, #5e6a7c 45%, #768089 46%, #93938f 47%,
    #b09e85 48%, #bd9d78 48.5%, #c79766 49%, #c58852 49.5%, #ba6a34 50%, #994722 50.5%,
    #3d2624 51%, #271e20 51.5%, #1f1b1e 52%, rgba(25, 23, 26, .6) 54%, rgba(20, 18, 20, 0) 58%);
  /* layer 1: blend in over the window frame, then fade with distance; layer 2: animated reveal */
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0, #000 calc(var(--pw) * .1), #000 calc(var(--pw) * .1 + 6%), rgba(0, 0, 0, .62) 40%, rgba(0, 0, 0, .26) 72%, transparent 100%),
    linear-gradient(90deg, #000 calc(var(--reveal) - 30%), transparent var(--reveal));
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent 0, #000 calc(var(--pw) * .1), #000 calc(var(--pw) * .1 + 6%), rgba(0, 0, 0, .62) 40%, rgba(0, 0, 0, .26) 72%, transparent 100%),
    linear-gradient(90deg, #000 calc(var(--reveal) - 30%), transparent var(--reveal));
  mask-composite: intersect;
}
/* soft bloom where the light leaves the window */
.hero-bloom {
  position: absolute; left: calc(var(--pw) * .55); width: calc(var(--pw) * .9); top: 36%; height: 26%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(214, 142, 84, .32), rgba(190, 120, 80, .1) 55%, transparent 75%);
  mix-blend-mode: screen; pointer-events: none;
}
.hero-stars {
  position: absolute; top: 0; height: 36%; left: calc(var(--pw) * .95); right: 0; opacity: .55;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 27% 61%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 41% 14%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 55% 45%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 68% 28%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 79% 70%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 10%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 95% 52%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 84%, #fff 50%, transparent 51%), radial-gradient(1.2px 1.2px at 62% 78%, #fff 50%, transparent 51%);
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent); mask-image: linear-gradient(180deg, #000 30%, transparent);
}
/* crisp edge where bright sky meets the dark ground */
.horizon { position: absolute; top: 50.5%; left: calc(var(--pw) * .9); right: 0; height: 0; }
.horizon-line {
  position: absolute; left: 0; right: 0; top: 0; height: 1px; transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(214, 128, 70, .7), rgba(200, 112, 60, .45) 35%, rgba(190, 100, 55, .12) 75%, transparent);
}
.hero-text { position: absolute; top: 0; bottom: 0; left: calc(var(--pw) + 4vw); right: 6vw; }
.hero-text h1 {
  position: absolute; left: 0; right: 0; bottom: 57%;
  /* one line, sized to the space right of the photo */
  font: italic clamp(1.7rem, calc((100vw - var(--pw) - 10vw) / 18.5), 3.9rem)/1.04 var(--display);
  letter-spacing: -.01em; color: #f4efe8; white-space: nowrap;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .4);
}
.glow-word {
  background: linear-gradient(180deg, #e9c08c 10%, #d8925a 55%, #bb6a37); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(214, 140, 80, .3));
}
.hero-note {
  position: absolute; left: 4px; right: 0; top: calc(50.5% + 30px); margin: 0;
  font-size: clamp(1.15rem, 1.55vw, 1.5rem); line-height: 1.2; color: #d9a374; transform: rotate(-1.5deg); transform-origin: left;
}

/* Folding up. The photo dims away and the night-sky bar comes up in its place.
   There is only ever one horizon: as the banner folds, the photo sinks so that
   its horizon slides down to the bar's bottom edge, landing there exactly as
   the fold completes; .hero-band, a copy of that horizon at the same height,
   takes over from the photo's as the photo fades, so the light never splits
   into two lines. Then the window's last light gathers on the horizon behind
   the name and spreads to the right.
   Two versions of the progress: --p is exact (anything that moves the horizon
   uses it, so the line stays on the fold however fast the wheel), --pe is the
   same value eased over about 0.1 s by main.js (the fades and the zoom use
   it, so a wheel's steps blend into one motion). */
.hero {
  --pe: var(--p);                                                /* until main.js takes over */
  --hz: .59;                                                     /* horizon, as a fraction of the open banner's height */
  --sink: calc(var(--hh) * (1 - var(--hz)));                     /* how far it has to travel to reach the bottom edge */
  --hy: calc(var(--hh) * var(--hz) + var(--p) * var(--sink));    /* where it is now */
  --face: calc(var(--pw) * .86);                                 /* the face and window frame: no horizon in front of them */
  --late: clamp(0, calc((var(--pe) - .7) / .3), 1);               /* 0 until the face has mostly faded, then up to 1 */
}
.hero-stage {
  z-index: 1;
  /* the slight zoom is centred on the horizon, so the horizon stays on its line */
  transform: translateY(calc(var(--p) * var(--sink))) scale(calc(1 + var(--pe) * .035));
  transform-origin: 30% 50.5%; opacity: calc(1 - var(--pe) * 1.1); will-change: transform, opacity;
}
.hero-text { opacity: calc(1 - var(--pe) * 2.4); transform: translateY(calc(var(--pe) * -28px)); }
.hero-bar {
  position: absolute; z-index: 0; left: 0; right: 0; bottom: 0; height: var(--bar); pointer-events: none;
  opacity: clamp(0, calc(var(--pe) * 1.8 - .3), 1);
  background: linear-gradient(180deg, #121219, #191c2b 55%, #222840);   /* night sky, where the links sit */
}
/* The horizon as the bar keeps it: the banner's colour stops just above the
   line, ending on the line itself (nothing dark below it), bright on the left
   and fading to the right as the banner's sky does. Its opacity rises as the
   photo's falls — but in front of the face (where the real photo has no
   horizon) it waits until the face has all but gone, so the line never cuts
   across it. */
.hero-band {
  --bh: 20px;
  position: absolute; z-index: 1; left: 0; right: 0; top: calc(var(--hy) - var(--bh)); height: var(--bh); pointer-events: none;
  background: linear-gradient(180deg,
    rgba(52, 64, 90, 0), rgba(52, 64, 90, .7) 22%, #5e6a7c 40%, #93938f 54%, #b09e85 64%, #c79766 74%, #c58852 84%, #ba6a34 94%, #d27a3c);
  -webkit-mask-image:
    linear-gradient(90deg, rgb(0 0 0 / var(--late)) var(--face), #000 calc(var(--face) + 80px)),
    linear-gradient(90deg, #000, #000 14%, rgba(0, 0, 0, .62) 44%, rgba(0, 0, 0, .26) 76%, rgba(0, 0, 0, .12));
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, rgb(0 0 0 / var(--late)) var(--face), #000 calc(var(--face) + 80px)),
    linear-gradient(90deg, #000, #000 14%, rgba(0, 0, 0, .62) 44%, rgba(0, 0, 0, .26) 76%, rgba(0, 0, 0, .12));
  mask-composite: intersect;
  opacity: clamp(0, calc(var(--pe) * 1.1), 1);
}
/* The glow behind the name: a small warm spot on the horizon at the left edge
   (where the window ends up) that opens out to the right as the fold finishes. */
.hero-glow {
  --g: var(--late);   /* it sits in front of the face too, so it waits for the face to go */
  --gh: calc(var(--bar) * 1.5);
  position: absolute; z-index: 2; left: 0; top: calc(var(--hy) - var(--gh) * .72); width: min(46vw, 620px); height: var(--gh);
  pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(100% 70% at 0% 72%, rgba(236, 156, 88, .5), rgba(214, 128, 70, .2) 36%, rgba(190, 100, 55, .06) 60%, transparent 74%);
  transform-origin: 0% 72%; transform: scale(calc(.14 + var(--g) * .86), calc(.55 + var(--g) * .45));
  opacity: calc(var(--g) * 1.4);
}

@media (prefers-reduced-motion: no-preference) {
  .hero-sky { animation: dawn 3.4s cubic-bezier(.3, .6, .25, 1) .2s both; }
  .horizon { animation: spread 3s cubic-bezier(.3, .6, .25, 1) .6s both; }
  .hero-bloom { animation: bloom 2.4s ease-out .1s both, breathe 7s ease-in-out 2.5s infinite alternate; }
  .hero-stars { animation: twinkle 4s ease-in-out infinite alternate; }
  .hero-text h1 { animation: rise 1.4s cubic-bezier(.2, .7, .2, 1) 1.1s both; }
  .hero-note { animation: write 1.6s steps(28, end) 2.2s both; }
}
@keyframes dawn { from { --reveal: 0%; } to { --reveal: 130%; } }
@keyframes spread { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes bloom { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes breathe { from { opacity: .8; } to { opacity: 1; } }
@keyframes twinkle { from { opacity: .35; } to { opacity: .65; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes write { from { clip-path: inset(-20% 100% -20% 0); } to { clip-path: inset(-20% 0 -20% 0); } }

/* ============ Paper (silver-gray) ============ */
.paper {
  position: relative; background-color: var(--paper);
  background-image:
    linear-gradient(180deg, #dcdde0, rgba(233, 233, 234, 0) 280px),
    radial-gradient(900px 500px at 80% 10%, rgba(255, 255, 255, .5), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .31 0 0 0 0 .33 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Two page columns — profile | content. The content column is capped at a
   comfortable reading width and the pair is centred on wide screens. */
.layout {
  --g: clamp(48px, 6vw, 112px);
  max-width: 1440px; margin: 0 auto; padding: 96px 48px 0;
  display: grid; grid-template-columns: minmax(0, 290px) minmax(0, 860px); justify-content: center; column-gap: var(--g);
}

/* ============ Profile (left) ============ */
.profile { position: sticky; top: calc(var(--bar) + 28px); align-self: start; width: 100%; }
/* transparent-background portrait, shown as is */
.portrait { width: 250px; }
.portrait img { display: block; width: 100%; height: auto; }
.pname { font: 2.7rem/1.05 var(--display); margin: 22px 0 6px; letter-spacing: -.01em; }
.ploc { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--faint); font-size: .88rem; }
.plinks { display: flex; flex-direction: column; gap: 2px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.plink { display: flex; align-items: center; gap: 10px; padding: 4px 0; color: var(--ink); font-size: .9rem; overflow-wrap: anywhere; }
.plink .icon { color: var(--accent); }
.plink:hover { color: var(--accent); }
.pinterests { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.pinterests span { font-size: .75rem; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255, 255, 255, .35); }

/* ============ Sections ============ */
.section { padding-bottom: 72px; }
.section-title { margin: 0 0 26px; font: clamp(2rem, 3.2vw, 2.5rem)/1.1 var(--display); letter-spacing: -.01em; }

.block { margin-bottom: 40px; }
.block:last-child { margin-bottom: 0; }
.block-title { margin: 0 0 16px; font: 600 .74rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.eyebrow { margin: 0; font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

.prose p { margin: 0 0 14px; max-width: 68ch; font-size: 1.02rem; line-height: 1.75; color: #2c2d31; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 600; color: var(--ink); }

ul.dash { list-style: none; margin: 0; padding: 0; }
ul.dash li { position: relative; padding-left: 22px; margin: 6px 0; font-size: .95rem; color: #2c2d31; }
ul.dash li::before { content: ""; position: absolute; left: 2px; top: .8em; width: 10px; height: 1.5px; background: var(--accent); }

.years { list-style: none; margin: 0; padding: 0; }
.years li { display: grid; grid-template-columns: 54px 1fr; gap: 12px; padding: 8px 0; font-size: .94rem; border-bottom: 1px solid var(--line); }
.years li:last-child { border-bottom: 0; }
.years .year { font: italic 1.08rem/1.5 var(--display); color: var(--faint); }
.rank { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 3px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; color: var(--accent); background: var(--accent-soft); vertical-align: 1px; }

.projects { display: grid; gap: 22px; }
.project { padding-left: 20px; border-left: 1.5px solid var(--line); transition: border-color .25s; }
.project:hover { border-left-color: var(--accent); }
.project h4 { font: 600 1.02rem/1.4 var(--sans); }
.project .eyebrow { margin: 4px 0 6px; font-size: .68rem; }
.project p:last-child { margin: 0; font-size: .93rem; color: #2c2d31; }

.pubs { list-style: none; counter-reset: pub; margin: 0; padding: 0; }
.pub { position: relative; counter-increment: pub; padding: 0 0 22px 46px; }
.pub:last-child { padding-bottom: 0; }
.pub::before { content: counter(pub, decimal-leading-zero); position: absolute; left: 0; top: -4px; font: italic 1.6rem/1 var(--display); color: var(--accent); }
.pub h4 { font: 1.3rem/1.28 var(--display); }
.pub-authors { margin: 6px 0 2px; font-size: .9rem; color: var(--muted); }
.pub-authors sup { font-size: .7em; }
.me { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.pub-venue { margin: 4px 0 0; font-size: .92rem; color: var(--muted); }
.pub-venue-link { text-decoration: underline; text-decoration-color: var(--accent-soft); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.pub-venue-link:hover { text-decoration-color: currentColor; }
.pub-links { display: flex; gap: 12px; margin: 6px 0 0; font-size: .78rem; font-weight: 600; letter-spacing: .06em; }

/* ============ Desk ============ */
/* A raised plane with one card per story. The plane is the page's own paper,
   pushed up: same colour, lit from the top-left (a white glow on that side, a
   soft shadow on the other). Everything is sized in --u (1% of the desk's
   width), so the whole arrangement scales as one piece. A card that is picked
   up (.on — hover, focus or tap) straightens and grows from the corner set in
   --o; its photos cross-fade. */
.desk { container-type: inline-size; margin: 24px 0 96px; }
.desk-mat {
  --u: 1cqw;
  position: relative; width: calc(var(--u) * 94); margin-inline: auto; height: calc(var(--u) * 64); border-radius: clamp(16px, calc(var(--u) * 3.2), 36px);
  background: linear-gradient(145deg, #f8f8f9, #e5e6e9 55%, #dcdde1);
  box-shadow:
    /* contact shadow right under the edge, then the long soft fall-off */
    calc(var(--u) * .5) calc(var(--u) * .6) calc(var(--u) * 1) rgba(108, 112, 126, .3),
    calc(var(--u) * 2.6) calc(var(--u) * 2.8) calc(var(--u) * 5.8) rgba(126, 130, 144, .62),
    /* light from the top-left */
    calc(var(--u) * -2.4) calc(var(--u) * -2.4) calc(var(--u) * 5) rgba(255, 255, 255, 1),
    /* bevel: a lit top-left rim and a shaded bottom-right rim */
    inset 2px 2px 1px rgba(255, 255, 255, .95), inset -2px -2px 2px rgba(110, 114, 128, .2);
}
/* Apple-style "continuous" corners: the curve eases in from the straight edge
   instead of starting abruptly like a circular arc. A squircle bends more
   tightly than a circle of the same radius, so the radius is larger here to
   keep the corner looking about as soft. Browsers without corner-shape keep
   the plain rounded corner above. */
@supports (corner-shape: squircle) {
  .desk-mat { border-radius: clamp(26px, calc(var(--u) * 5.6), 64px); corner-shape: squircle; }
}
.desk-scribble {
  position: absolute; left: calc(var(--u) * 3); bottom: calc(var(--u) * 3.6); margin: 0;
  font-size: max(15px, calc(var(--u) * 2.7)); line-height: 1.1; color: var(--accent); transform: rotate(-2deg); transform-origin: left; pointer-events: none;
}

/* card shadows fall to the bottom-right, like the plane's own */
.dcard {
  --s: 1.5; --shadow: drop-shadow(calc(var(--u) * .45) calc(var(--u) * .55) calc(var(--u) * .9) rgba(76, 78, 90, .34));
  position: absolute; z-index: 1; width: var(--w); cursor: pointer; outline: none;
  transform: rotate(var(--r)); transform-origin: var(--o); filter: var(--shadow);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), filter .35s;
}
.dcard.on { z-index: 5; transform: rotate(0deg) scale(var(--s)); --shadow: drop-shadow(calc(var(--u) * 1) calc(var(--u) * 1.3) calc(var(--u) * 2.2) rgba(60, 62, 74, .42)); }
.desk-mat:has(.dcard.on) .dcard:not(.on) { filter: var(--shadow) saturate(.55) opacity(.5); }
.dcard:focus-visible .dcard-paper { outline: 2px solid var(--accent); outline-offset: 3px; }
.dcard-paper { background: #fdfcf9; padding: calc(var(--u) * 1) calc(var(--u) * 1) 0; }

.dcard-photo { position: relative; aspect-ratio: var(--ar); overflow: hidden; background: #d9dadd; }
.dcard-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s ease; }
.dcard-photo img.on { opacity: 1; }
.dcard-dots { position: absolute; left: 50%; bottom: calc(var(--u) * .8); display: flex; gap: calc(var(--u) * .5); transform: translateX(-50%); opacity: 0; transition: opacity .3s; }
.dcard-dots i { width: calc(var(--u) * .65); height: calc(var(--u) * .65); border-radius: 50%; background: rgba(255, 255, 255, .45); box-shadow: 0 0 2px rgba(0, 0, 0, .5); transition: background .3s; }
.dcard-dots i.on { background: #fff; }
.dcard-hint { position: absolute; top: calc(var(--u) * .5); right: calc(var(--u) * .9); font-size: calc(var(--u) * 1.5); line-height: 1; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); opacity: 0; transition: opacity .3s; }
.dcard-hint::after { content: "scroll to flip"; }
@media (hover: none) { .dcard-hint::after { content: "tap to flip"; } }
.dcard.on .dcard-dots, .dcard.on .dcard-hint { opacity: 1; }

.dcard-body { padding: calc(var(--u) * .9) calc(var(--u) * .2) calc(var(--u) * 1.2); }
.dcard-caption { margin: 0 0 calc(var(--u) * .5); min-height: 1.1em; font-size: max(11.5px, calc(var(--u) * 1.8)); line-height: 1.1; color: var(--accent); transform: rotate(-1deg); transform-origin: left; }
.dcard-caption:empty { display: none; }
.dcard-label { margin: 0; font-size: max(6.5px, calc(var(--u) * .78)); font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--accent); }
.dcard-title { margin: calc(var(--u) * .25) 0; font: max(12.5px, calc(var(--u) * 2))/1.1 var(--display); color: var(--ink); }
.dcard-text { margin: 0; font-size: max(8px, calc(var(--u) * .98)); line-height: 1.4; color: var(--muted); }

/* plant: a photo print, with the startup paper-clipped to its corner */
.dcard-plant { --w: calc(var(--u) * 35); --ar: 4 / 3; --r: -3deg; --o: 0% 0%; --s: 1.42; left: calc(var(--u) * 2); top: calc(var(--u) * 7.5); }
.dclip {
  position: absolute; right: calc(var(--u) * -3); top: calc(100% - var(--u) * 1.1); width: calc(var(--u) * 19);
  padding: calc(var(--u) * 1.5) calc(var(--u) * 1.3) calc(var(--u) * 1.2); background: #e2d3b4; transform: rotate(5deg);
}
.dclip-pin { position: absolute; left: calc(var(--u) * 1.6); top: calc(var(--u) * -2.2); width: calc(var(--u) * 1.6); height: calc(var(--u) * 3.6); fill: none; stroke: #9aa0aa; stroke-width: 1.6; stroke-linecap: round; }
.dclip-label { margin: 0 0 calc(var(--u) * .4); font-size: max(10px, calc(var(--u) * 1.55)); line-height: 1.1; color: #7e2c1d; }
.dclip-title { margin: 0; font: max(11.5px, calc(var(--u) * 1.8))/1.1 var(--display); color: var(--ink); }
.dclip-text { margin: calc(var(--u) * .2) 0 0; font-size: max(8px, calc(var(--u) * .95)); color: #5b5340; }

/* film: a strip of film, dark, with sprocket holes */
.dcard-film { --w: calc(var(--u) * 27); --ar: 2 / 1; --r: 2deg; --o: 50% 0%; left: calc(var(--u) * 40); top: calc(var(--u) * 4.5); }
.dcard-film .dcard-paper { background: #211d1f; padding-top: calc(var(--u) * .7); }
.dfilm-holes { display: block; height: calc(var(--u) * 1.1); margin: 0 0 calc(var(--u) * .7); background: repeating-linear-gradient(90deg, transparent 0 calc(var(--u) * .6), rgba(246, 243, 236, .8) calc(var(--u) * .6) calc(var(--u) * 1.5), transparent calc(var(--u) * 1.5) calc(var(--u) * 2.1)); border-radius: 1px; }
.dcard-photo + .dfilm-holes { margin: calc(var(--u) * .7) 0 0; }
.dcard-film .dcard-label { color: #e08a52; }
.dcard-film .dcard-title { color: #f4efe8; }
.dcard-film .dcard-text { color: rgba(244, 239, 232, .65); }

/* ticket: photo above a perforated stub (the notches are cut out with a mask) */
.dcard-ticket { --w: calc(var(--u) * 22); --ar: 3 / 4; --r: 4deg; --o: 100% 0%; left: calc(var(--u) * 70); top: calc(var(--u) * 5); }
.dcard-ticket .dcard-paper {
  --tear: calc(var(--w) * 4 / 3); padding: 0;
  -webkit-mask-image: radial-gradient(circle at 0 var(--tear), transparent calc(var(--u) * .8), #000 calc(var(--u) * .85)), radial-gradient(circle at 100% var(--tear), transparent calc(var(--u) * .8), #000 calc(var(--u) * .85));
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(circle at 0 var(--tear), transparent calc(var(--u) * .8), #000 calc(var(--u) * .85)), radial-gradient(circle at 100% var(--tear), transparent calc(var(--u) * .8), #000 calc(var(--u) * .85));
  mask-composite: intersect;
}
.dcard-ticket .dcard-body { padding: calc(var(--u) * 1.1) calc(var(--u) * 1.6) calc(var(--u) * 1.4); border-top: 1.5px dashed rgba(17, 17, 19, .28); }

/* polaroid: wide white border, the handwriting does the talking */
.dcard-polaroid { --w: calc(var(--u) * 29); --ar: 3 / 2; --r: -2deg; --o: 50% 100%; left: calc(var(--u) * 41); top: calc(var(--u) * 30.5); }
.dcard-polaroid .dcard-paper { background: #fff; padding: calc(var(--u) * 1.2) calc(var(--u) * 1.2) 0; }
.dcard-polaroid .dcard-caption { font-size: max(12px, calc(var(--u) * 2.1)); }

/* narrow desk (phones): the cards line up in a row you swipe through */
@container (max-width: 520px) {
  .desk-mat { --u: 2.7cqw; width: auto; margin-inline: 0; height: auto; display: flex; align-items: flex-start; gap: calc(var(--u) * 2.4); overflow-x: auto; scroll-snap-type: x mandatory; padding: calc(var(--u) * 8) calc(var(--u) * 3) calc(var(--u) * 3.4); scrollbar-width: none; }
  .desk-mat::-webkit-scrollbar { display: none; }
  .dcard { position: relative; left: auto; top: auto; flex: none; scroll-snap-align: center; --s: 1; }
  .dcard-plant { --w: calc(var(--u) * 27); --r: -1.5deg; margin-bottom: calc(var(--u) * 9); }
  .dcard-film { --w: calc(var(--u) * 27); --r: 1.5deg; }
  .dcard-ticket { --w: calc(var(--u) * 21); --r: 1.5deg; }
  .dcard-polaroid { --w: calc(var(--u) * 27); --r: -1.5deg; }
  .dclip { right: calc(var(--u) * -1.5); }
  .desk-scribble { left: calc(var(--u) * 3.4); top: calc(var(--u) * 2.4); bottom: auto; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .dcard, .dcard-photo img { transition: none; }
}

/* ============ Ending ============ */
/* A thin sunset strip answers the opening banner: the photo centred, its
   sky continued to both edges (colour stops sampled from the photo's
   left/right edges, cloud streaks smoothed out); the question floats in
   the sky, the handwritten answer sits on the dark ground. */
.ending { margin-top: 56px; text-align: center; }
.ending-question {
  position: absolute; left: 0; right: 0; top: calc(var(--eh) * .13); margin: 0;
  font: italic clamp(1.6rem, 2.4vw, 2.7rem)/1.1 var(--display); color: #fbf6ef;
  text-shadow: 0 1px 3px rgba(10, 14, 30, .5), 0 2px 26px rgba(10, 14, 30, .7);
}
.ending-band {
  --eh: clamp(220px, 15.5vw, 400px);       /* visible strip height (~6.5 : 1 on wide screens) */
  position: relative; min-height: var(--eh); overflow: hidden;
  display: flex; flex-direction: column;
  background: #2a1a10; color: #f3ede4;     /* ground colour, in case the answer makes the strip taller */
}
/* stage = full photo frame; the strip shows rows 47%–80% of it (horizon at ~61% of the strip) */
.ending-stage {
  position: absolute; left: 0; right: 0; top: calc(var(--eh) * -1.4242); height: calc(var(--eh) * 3.0303);
  background: linear-gradient(180deg,
    #13192b 0%, #192239 10%, #202e47 20%, #22385f 28%, #284573 34%, #314d73 40%, #4a6276 46%, #687f86 50%,
    #9a9c88 54%, #ddb276 58%, #fdaa33 62%, #f48506 64.5%, #e05d02 66%, #c4470a 67%, #5a2a12 67.6%,
    #472614 68.5%, #432716 70%, #301f14 75%, #2a1a10 80%, #24170e 85%, #150f09 97%, #120d08 100%);
}
.ending-stage::after {   /* let the extended sky dim gently towards the far edges */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg,
    rgba(10, 8, 12, .5) 0%, rgba(10, 8, 12, .32) 8%, rgba(10, 8, 12, .16) 16%, rgba(10, 8, 12, .05) 24%, rgba(10, 8, 12, 0) 32%,
    rgba(10, 8, 12, 0) 68%, rgba(10, 8, 12, .05) 76%, rgba(10, 8, 12, .16) 84%, rgba(10, 8, 12, .32) 92%, rgba(10, 8, 12, .5) 100%);
}
@media (max-width: 1100px) { .ending-stage::after { display: none; } }   /* photo already spans the width */
.ending-photo {
  position: absolute; top: 0; left: 50%; height: 100%; width: auto; transform: translateX(-50%); display: block;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%);
}
.ending-bloom {
  position: absolute; left: 0; right: 0; top: 55%; height: 24%; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(calc(var(--eh) * 2.4) calc(var(--eh) * .32) at 50% 50%, rgba(255, 170, 70, .3), rgba(240, 120, 40, .08) 60%, transparent);
}
.ending-horizon {
  position: absolute; left: 0; right: 0; top: 67.2%; height: 1.5px; transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(232, 104, 30, .45) 18%, rgba(255, 176, 90, .95) 50%, rgba(232, 104, 30, .45) 82%, transparent);
  box-shadow: 0 0 14px rgba(255, 140, 50, .45);
}
.ending-text { position: relative; width: min(92%, 960px); margin: 0 auto; padding: calc(var(--eh) * .612 + 18px) 0 22px; }
.ending-answer {
  margin: 0 auto; max-width: 52ch;
  font-size: clamp(1.15rem, 1.6vw, 1.7rem); line-height: 1.25; color: #f2b878; transform: rotate(-1deg);
}
.ending-foot { padding-top: 26px; background: linear-gradient(#2a1a10, #120d08 70%); }
.ending-contact { margin: 0; padding: 0 16px 24px; font-size: .92rem; color: rgba(243, 237, 228, .7); }
.ending-contact a { color: #f2b878; }


@media (prefers-reduced-motion: no-preference) {
  .ending-horizon { clip-path: inset(0 50% 0 50%); transition: clip-path 2.6s cubic-bezier(.3, .6, .25, 1) .3s; }
  .ending-band.lit .ending-horizon { clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* the banner still folds (its horizon still has to meet the bar), but the question and glow just fade */
  .hero-text, .hero-glow { transform: none; }
}

/* ============ Responsive ============ */
@media (max-width: 1279px) {
  .layout { padding: 96px 40px 0; grid-template-columns: 250px minmax(0, 1fr); column-gap: 56px; }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; gap: 56px; padding-top: 72px; }
  .profile { position: static; display: grid; grid-template-columns: auto 1fr; column-gap: 32px; align-items: end; }
  .portrait { width: 200px; grid-row: span 5; }
}
@media (max-width: 1100px) {
  .hero { --hh: 400px; }   /* the question wraps to two lines here, so give it room */
  .hero-text h1 { white-space: normal; font-size: clamp(1.9rem, 3.8vw, 2.5rem); max-width: 13em; text-wrap: balance; }
}
@media (max-width: 820px) {
  .hero { --hh: clamp(520px, 80svh, 760px); --hz: .5; --face: 52%; }   /* full-height photo: horizon at its middle, face on the left half */
  .hero-stage { top: 0; height: 100%; }
  .hero-photo { width: 100%; }
  .hero-photo img { object-position: 74% 50%; -webkit-mask-image: none; mask-image: none; }
  .hero-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 6, 8, .55) 0%, transparent 22%, transparent 52%, rgba(8, 6, 8, .65) 66%, rgba(8, 6, 8, .92) 100%); }
  .hero-sky, .hero-stars, .hero-bloom, .horizon { display: none; }
  .hero-text { left: 20px; right: 20px; }
  .hero-text h1 { bottom: 110px; font-size: clamp(1.9rem, 7.6vw, 2.7rem); }
  .hero-note { top: auto; bottom: 46px; left: 2px; font-size: 1.1rem; }
  .topnav { padding: 0 16px; gap: 14px; }
  .brand { display: none; }
  .topnav-links { margin-left: 0; }
  .topnav-links a { padding: 6px 10px; font-size: .8rem; }
}
@media (max-width: 640px) {
  .layout { padding: 56px 16px 0; gap: 44px; }
  .profile { grid-template-columns: 1fr; }
  .portrait { width: 190px; grid-row: auto; }
  .pname { font-size: 2.3rem; }
  .section { padding-bottom: 56px; }
  .pub { padding-left: 38px; }
  .ending-band { --eh: 320px; }
}
