/* Petrichor Bio — "lab notebook" edition
   The site is written as one entry in a lab notebook. Paintings are plates:
   landscapes for the name, dark-field cells for the work. */

@font-face { font-family: "Newsreader"; src: url("fonts/newsreader.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #f1eee7;
  --ink: #15140f;
  --body: #55524a;
  --muted: #8f897c;
  --line: #d9d4c8;
  --tick: #bdb6a7;
  --night: #1b1a16;
  --night-ink: #f1eee7;
  --night-body: #a9a396;
  --rust: #b8673a;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", "Helvetica Neue", Arial, system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --r: 6px;
  --gutter: clamp(20px, 5vw, 76px);
  --max: 1360px;
  --label: 500 11.5px/1.3 var(--sans);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 18px/1.58 var(--sans); letter-spacing: -0.006em;
  font-feature-settings: "cv11", "ss01";
}
/* paper grain over the whole page */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .33 0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .22; mix-blend-mode: multiply;
}

a { color: inherit; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--ink); color: var(--paper); }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; font-optical-sizing: auto; letter-spacing: -0.03em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(50px, 8.4vw, 136px); line-height: .94; letter-spacing: -0.04em; }
h2 { font-size: clamp(32px, 3.6vw, 54px); line-height: 1.06; }
h3 { font-size: clamp(24px, 2.2vw, 32px); line-height: 1.12; }
em, .it { font-style: italic; font-family: var(--serif); letter-spacing: -0.02em; }
p { margin: 0 0 1.05em; text-wrap: pretty; }
.lead { font-size: clamp(18px, 1.45vw, 22px); line-height: 1.5; color: var(--body); max-width: 31em; }
.label { font: var(--label); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Section rule */
.ruler { height: 1px; background: var(--line); }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .55em; height: 54px; padding: 0 28px;
  border-radius: 999px; background: var(--ink); color: var(--paper);
  font: 500 16.5px/1 var(--sans); letter-spacing: -0.01em; text-decoration: none;
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.pill:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -14px rgba(20, 20, 15, .45); }
.pill .arr { display: inline-block; transition: transform .6s var(--ease); }
.pill:hover .arr { transform: translateX(4px); }
.pill.light { background: var(--paper); color: var(--ink); }
.textlink { font-size: 16px; text-decoration: none; border-bottom: 1px solid var(--tick); padding-bottom: 2px; transition: border-color .3s; }
.textlink:hover { border-color: var(--ink); }

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; transition: background-color .4s var(--ease), box-shadow .4s var(--ease); }
.nav.scrolled { background: rgba(241, 238, 231, .84); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3); box-shadow: 0 1px 0 var(--line); }
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font: 400 26px/1 var(--serif); letter-spacing: -0.03em; text-decoration: none; color: var(--ink); }
.wordmark .drop { width: 14px; height: 19px; flex: none; }
.nav-links { display: flex; align-items: center; gap: clamp(18px, 3vw, 38px); }
.nav-links a {
  font-size: 15px; color: var(--body); text-decoration: none; padding-bottom: 2px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: color .3s, background-size .6s var(--ease);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); background-size: 100% 1px; }

/* ---------- Entry header ---------- */
.entry-meta { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 26px 0 10px; }
.entry-meta .right { display: flex; gap: 22px; align-items: center; }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rust); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.hero h1 { margin: clamp(30px, 6vh, 70px) 0 clamp(26px, 4vh, 44px); max-width: 11em; }
.hero h1 em { font-weight: 400; letter-spacing: -0.035em; }
.hero-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 30px 60px; align-items: end; margin-bottom: clamp(40px, 7vh, 72px); }

/* ---------- Plates: paintings as specimens ---------- */
figure { margin: 0; }
.plate {
  position: relative; overflow: hidden; isolation: isolate; border-radius: var(--r);
  background: #1a1a18;
}
.plate .art { position: absolute; inset: 0; background: center / cover no-repeat; z-index: -2; }
.plate-wide { width: 100%; aspect-ratio: 2520 / 1080; max-height: min(45vh, 440px); }
.plate-tall { aspect-ratio: 4 / 5; width: min(100%, calc(min(45vh, 440px) * 0.8)); max-height: min(45vh, 440px); margin-left: auto; }
@supports (height: 1svh) {
  .plate-wide { max-height: min(45svh, 440px); }
  .plate-tall { width: min(100%, calc(min(45svh, 440px) * 0.8)); max-height: min(45svh, 440px); }
}
.plate .rain { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.caption { display: flex; justify-content: space-between; gap: 20px; align-items: baseline; padding: 14px 0 0; color: var(--muted); font-size: 14.5px; }
.caption .it { font-size: 17px; color: var(--body); }

/* Annotation pins */
.pin { position: absolute; width: 0; height: 0; z-index: 2; pointer-events: none; }
.pin .dot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .18); }
.pin .stem { position: absolute; left: 0; bottom: 6px; width: 1px; height: var(--h, 70px); background: rgba(255, 255, 255, .85); transform-origin: bottom; }
.pin .tag {
  position: absolute; left: 10px; bottom: calc(var(--h, 70px) + 2px); width: max-content; max-width: 290px;
  color: #fff; text-shadow: 0 1px 10px rgba(20, 15, 10, .45);
}
.pin.left .tag { left: auto; right: 10px; text-align: right; }
.pin .tag .label { color: rgba(255, 255, 255, .82); display: block; margin-bottom: 3px; }
.pin .tag .it { display: block; font-size: 17px; line-height: 1.25; }


/* ---------- Notebook sections ---------- */
.entry { padding: clamp(70px, 12vh, 140px) 0 0; }
.entry .grid { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 3.2fr); gap: clamp(24px, 5vw, 90px); }
.margin { padding-top: 14px; }
.margin .sec { font: 400 15px/1 var(--serif); font-style: italic; color: var(--muted); display: block; margin-bottom: 8px; }
.entry h2 { max-width: 16em; margin-bottom: .62em; }
.entry .body { color: var(--body); font-size: clamp(17px, 1.3vw, 20px); line-height: 1.62; max-width: 37em; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(30px, 5vw, 80px); align-items: start; }
.entry .ruler { margin-bottom: 26px; }

/* Result: the dark band, with the fog painting barely visible behind it */
.band-wrap { padding: clamp(80px, 13vh, 150px) 0 0; }
.band {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--night); color: var(--night-ink); border-radius: var(--r);
  padding: clamp(40px, 6vw, 88px) clamp(26px, 6vw, 96px);
}
.band .fog { position: absolute; inset: 0; background: center / cover no-repeat; opacity: .55; z-index: -1; }
.band .fog::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(27,26,22,.94) 25%, rgba(27,26,22,.35)); }
.band .head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.band .label { color: rgba(241, 238, 231, .55); }
.band .status { color: rgba(241, 238, 231, .8); }
.band h2 { color: var(--night-ink); max-width: 15em; margin-bottom: .7em; }
.band p { color: var(--night-body); max-width: 36em; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.6; }

/* Signature */
.signoff { padding: clamp(80px, 13vh, 150px) 0 clamp(60px, 9vh, 100px); }
.signoff .grid { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 3.2fr); gap: clamp(24px, 5vw, 90px); }
.sigs { display: flex; flex-wrap: wrap; gap: 26px clamp(30px, 5vw, 80px); }
.sig { min-width: 180px; }
.sig .name { font: italic 400 clamp(26px, 2.4vw, 34px)/1 var(--serif); letter-spacing: -0.03em; padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.sig .label { margin-top: 10px; display: block; }
.sig-cofounder .name { font-size: clamp(20px, 1.8vw, 25px); }
.sig-cofounder .label { font-size: 10px; }


/* ---------- Article pages (Why, Goals) ---------- */
.page-head { padding: clamp(10px, 3vh, 30px) 0 clamp(36px, 6vh, 60px); }
.page-head h1 { font-size: clamp(46px, 6.4vw, 100px); max-width: 12em; margin: clamp(26px, 5vh, 56px) 0 .35em; }
.article { padding: clamp(60px, 11vh, 120px) 0 0; counter-reset: sec; }
.article .container { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 3.2fr); gap: clamp(24px, 5vw, 90px); }
.article aside { position: sticky; top: 100px; align-self: start; font-size: 14.5px; color: var(--muted); }
.article aside ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: toc; }
.article aside li { counter-increment: toc; }
.article aside li::before { content: "§" counter(toc) "  "; font-family: var(--serif); font-style: italic; }
.article aside a { text-decoration: none; transition: color .3s; }
.article aside a:hover { color: var(--ink); }
.prose { max-width: 38em; font-size: clamp(17px, 1.3vw, 20px); line-height: 1.66; color: var(--body); }
.prose section { margin-bottom: clamp(48px, 7vh, 80px); scroll-margin-top: 100px; counter-increment: sec; }
.prose h2 { font-size: clamp(30px, 2.8vw, 42px); color: var(--ink); margin-bottom: .55em; }
.prose h2::before { content: "§" counter(sec); display: block; font: italic 400 16px/1 var(--serif); color: var(--muted); letter-spacing: 0; margin-bottom: 14px; }

/* ---------- Footer ---------- */
footer.site { border-top: 1px solid var(--line); padding: 30px 0 50px; font-size: 14px; color: var(--muted); }
footer.site .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px 40px; }
footer.site p { margin: 0; }
footer.site nav { display: flex; gap: 26px; }
footer.site nav a { text-decoration: none; transition: color .3s; }
footer.site nav a:hover { color: var(--ink); }

/* ======================================================================
   Motion (armed by .js; the page is complete without it)
   ====================================================================== */
.js [data-reveal] { opacity: 0; transform: translateY(24px); }
.js [data-reveal].in { opacity: 1; transform: none; transition: opacity 1s var(--ease) var(--d, 0s), transform 1s var(--ease) var(--d, 0s); }

/* Headline words rise one by one */
.js .hero h1 .w { display: inline-block; opacity: 0; transform: translateY(.35em); }
.js .hero.in h1 .w { opacity: 1; transform: none; transition: opacity 1.1s var(--ease) calc(var(--i) * .07s), transform 1.1s var(--ease) calc(var(--i) * .07s); }

/* Section rules draw in from the left */
.js .ruler { transform: scaleX(0); transform-origin: left; }
.js .ruler.in { transform: scaleX(1); transition: transform 1.2s var(--ease); }

/* Plates develop like a print: from grey and soft to full colour */
.js .plate .pin .dot { transform: scale(0); }
.js .plate .pin .stem { transform: scaleY(0); }
.js .plate .pin .tag { opacity: 0; transform: translateY(6px); }
.js .plate.in .pin .dot { transform: scale(1); transition: transform .7s var(--ease) calc(1.1s + var(--i) * .25s); }
.js .plate.in .pin .stem { transform: scaleY(1); transition: transform .9s var(--ease) calc(1.25s + var(--i) * .25s); }
.js .plate.in .pin .tag { opacity: 1; transform: none; transition: opacity .9s var(--ease) calc(1.6s + var(--i) * .25s), transform .9s var(--ease) calc(1.6s + var(--i) * .25s); }

/* Result band: fades up, then the scale draws to the goal mark */
.js .band { opacity: 0; transform: translateY(30px); }
.js .band.in { opacity: 1; transform: none; transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .js 
/* Signatures write themselves */
.js .sig .name { clip-path: inset(0 100% 0 0); }
.js .sig.in .name { clip-path: inset(0 0 0 0); transition: clip-path 1.6s var(--ease) var(--d, 0s); }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js .hero h1 .w, .js .ruler, .js .plate .art, .js .pin *, .js .band, .js .band *, .js .sig .name {
    opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; transition: none !important;
  }
  .status::before { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .entry .grid, .signoff .grid, .article .container { grid-template-columns: 1fr; gap: 16px; }
  .split { grid-template-columns: 1fr; }
  .hero-row { grid-template-columns: 1fr; }
  .article aside { position: static; }
}
@media (max-width: 700px) {
  body { font-size: 17px; }
  .nav .container { height: 66px; }
  .wordmark { font-size: 23px; }
  .nav-links { gap: 16px; }
  .entry-meta .right .label:not(.status) { display: none; }
  .pin { display: none; }
  .plate-wide { aspect-ratio: 4 / 3; }
  .plate-tall { margin: 0 auto; }
  .plate-wide .art { background-position: 62% center !important; }
  .pin .tag { max-width: 150px; }
  .caption { flex-direction: column; gap: 6px; }
  .band .head { flex-direction: column; gap: 10px; }
}

/* ---------- Living paintings (WebGL, repainted at 15 fps) ---------- */
.plate .live-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: 0; transition: opacity 1.2s var(--ease); }
.plate.live .live-canvas { opacity: 1; }
.plate .rain { z-index: 1; }
.plate-dark::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 85% 80% at 50% 50%, transparent 55%, rgba(8, 8, 10, .5)); }
@media (prefers-reduced-motion: reduce) { .js .plate .live-canvas { filter: none !important; } }


/* ---------- Article extras: breadcrumb, steps, record, questions ---------- */
.crumbs { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--muted); padding-top: clamp(18px, 4vh, 40px); }
.crumbs a { text-decoration: none; transition: color .3s; }
.crumbs a:hover { color: var(--ink); }
.page-head h1 { margin-top: clamp(14px, 3vh, 28px); }
.prose a { color: var(--ink); text-decoration-color: var(--tick); text-underline-offset: 3px; transition: text-decoration-color .3s; }
.prose a:hover { text-decoration-color: var(--ink); }
.steps { list-style: none; margin: 1.4em 0 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 18px 0 18px 3.2em; border-top: 1px solid var(--line); }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 14px; font: italic 400 28px/1 var(--serif); color: var(--muted); }
.steps strong { display: block; font-weight: 500; color: var(--ink); margin-bottom: 2px; }
.returns { margin: 1.4em 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(20px, 3vw, 44px); }
.returns div { padding: 16px 0; border-top: 1px solid var(--line); }
.returns dt { font: 400 clamp(20px, 1.7vw, 24px)/1.2 var(--serif); color: var(--ink); margin-bottom: 6px; }
.returns dd { margin: 0; font-size: .92em; }
.faq { margin-top: .6em; border-bottom: 1px solid var(--line); }
.faq details { border-top: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 20px 2.2em 20px 0; position: relative; font: 400 clamp(19px, 1.6vw, 23px)/1.3 var(--serif); color: var(--ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 4px; top: 50%; width: 12px; height: 12px; margin-top: -9px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .5s var(--ease), margin .5s var(--ease); }
.faq details[open] summary::after { transform: rotate(225deg); margin-top: -3px; }
.faq details p { margin: 0 0 22px; max-width: 34em; }
@media (max-width: 700px) { .returns { grid-template-columns: 1fr; } .steps li { padding-left: 2.6em; } }

/* ---------- Homepage sections: two columns, label above the heading ---------- */
.entry { padding: clamp(56px, 9vh, 104px) 0 0; }
.eyebrow { display: flex; align-items: baseline; gap: 12px; margin: 22px 0 18px; }
.eyebrow .sec { font: italic 400 15px/1 var(--serif); color: var(--muted); }
.entry h2 { font-size: clamp(30px, 2.9vw, 44px); line-height: 1.08; max-width: 17em; margin: 0 0 .6em; }
.duo { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 104px); align-items: center; }
.duo-copy .body { max-width: 34em; }
.duo-copy .body p:last-child, .duo-text .body p:last-child { margin-bottom: 0; }
.duo-figure { justify-self: end; }
.duo-flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.duo-flip .duo-figure { order: -1; justify-self: start; }
.duo-figure .plate-tall { margin: 0; }
.duo-text { align-items: start; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.duo-text h2 { margin: 0; }
.wide-figure { margin-top: clamp(36px, 6vh, 64px); }
.signoff { padding: clamp(64px, 10vh, 112px) 0 clamp(56px, 8vh, 90px); }
.signoff .sigs { margin-top: 10px; }
@media (max-width: 960px) {
  .duo, .duo-flip, .duo-text { grid-template-columns: 1fr; gap: 28px; }
  .duo-flip .duo-figure { order: 0; }
  .duo-figure { justify-self: center; }
  .duo-text h2 { margin-bottom: 4px; }
}
.duo-figure { width: min(100%, calc(min(45vh, 440px) * 0.8)); }
@supports (height: 1svh) { .duo-figure { width: min(100%, calc(min(45svh, 440px) * 0.8)); } }
.duo-figure .plate-tall { width: 100%; max-height: none; }

/* ---------- Plates open like a window and come into focus ----------
   The frame (clip-path) opens fast; the painting inside starts zoomed in and settles more
   slowly, so the edge outruns the content. Focus works like a lens: the middle is sharp
   first and the blur retreats outward to the edges. No colour filtering is applied. */
.plate { --zoom: 1; --lens: 0px; --lensr: 60%; }
.plate .art, .plate .live-canvas { transform: scale(var(--zoom)); transform-origin: 50% 55%; }
.plate.moving .art, .plate.moving .live-canvas { will-change: transform; }
.plate::before { display: block !important; content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  -webkit-backdrop-filter: blur(var(--lens)); backdrop-filter: blur(var(--lens));
  -webkit-mask-image: radial-gradient(ellipse 75% 80% at 50% 52%, transparent calc(var(--lensr) - 34%), rgba(0,0,0,.55) var(--lensr), #000 calc(var(--lensr) + 30%));
          mask-image: radial-gradient(ellipse 75% 80% at 50% 52%, transparent calc(var(--lensr) - 34%), rgba(0,0,0,.55) var(--lensr), #000 calc(var(--lensr) + 30%)); }
.plate.settled::before { display: none !important; }

/* slightly larger portrait plates next to the text on desktop */
@media (min-width: 961px) {
  .duo-figure { width: min(100%, calc(min(50vh, 500px) * 0.8)); }
  @supports (height: 1svh) { .duo-figure { width: min(100%, calc(min(50svh, 500px) * 0.8)); } }
}
