/* =====================================================================
   Portfolio stylesheet
   Two themes (light / dark) share one layout. Each theme is one surface,
   one ink and ONE accent. Change the variables, not the rules.
   ===================================================================== */

:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2eee8;
  --surface: #faf8f4;
  --surface-2: #ebe6df;
  --ink: #32292f;
  --muted: #7b7276;
  --line: rgba(50, 41, 47, 0.12);
  --line-strong: rgba(50, 41, 47, 0.35);
  --accent: #656839;
  --accent-ink: #f2eee8;
  --star: 50, 41, 47;
  --constellation: 101, 104, 57;
  --star-alpha: 0.8;
  --logo-filter: brightness(0) opacity(0.8);
  --patch-logo-filter: brightness(0) invert(1);
  --shadow: 0 1px 2px rgba(50, 41, 47, 0.06), 0 18px 40px -24px rgba(50, 41, 47, 0.35);
  --hero-scrim: rgba(20, 14, 18, 0.72);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b191c;
  --surface: #242125;
  --surface-2: #2b282c;
  --ink: #ece7e2;
  --muted: #9a938f;
  --line: rgba(236, 231, 226, 0.12);
  --line-strong: rgba(236, 231, 226, 0.32);
  --accent: #a7cb98;
  --accent-ink: #1b191c;
  --star: 236, 231, 226;
  --constellation: 167, 203, 152;
  --star-alpha: 1;
  --logo-filter: brightness(0) invert(1) opacity(0.85);
  --patch-logo-filter: brightness(0);
  --shadow: 0 0 0 1px rgba(236, 231, 226, 0.08), 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --hero-scrim: rgba(10, 8, 10, 0.78);
}

:root {
  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;
  --max: 1120px;
  --read: 680px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --header-h: 64px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; transition: background 0.3s, color 0.3s;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.005em; line-height: 1.05; margin: 0; color: var(--ink); }
h1 { font-size: clamp(2.5rem, 5.6vw, 4.4rem); max-width: 18ch; }
h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
h3 { font-size: 1.45rem; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
kbd { font-family: var(--font-mono); font-size: 0.7rem; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 0.35em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.num { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--accent); }

.eyebrow, .meta { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.eyebrow { margin: 0 0 1.3rem; }
.lede { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--muted); max-width: 58ch; margin-top: 1.4rem; line-height: 1.6; }

/* ---------- star field ---------- */
#sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.site-header, main, .site-footer { position: relative; z-index: 1; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); position: relative; }
.header-right { display: flex; align-items: center; gap: 1.4rem; }
.brand { font-family: var(--font-display); font-size: 1.25rem; }
.site-nav { display: flex; gap: 2rem; font-size: 0.92rem; }
.site-nav a { position: relative; padding: 0.25rem 0; }
.site-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.3s var(--ease); }
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }

.theme-toggle { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; transition: border-color 0.2s; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle span { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 1.5px solid var(--ink); }
.nav-toggle { display: none; width: 40px; height: 40px; margin-right: -8px; background: none; border: 0; cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.nav-toggle span { display: block; width: 20px; height: 1.5px; background: var(--ink); transition: transform 0.25s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .header-right { gap: 0.6rem; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: var(--header-h); flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 0.4rem var(--gutter) 0.8rem; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.7rem 0; }
  .site-nav a::after { display: none; }
}

/* ---------- reading progress (project pages) ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }

/* ---------- home hero ---------- */
.hero { padding: clamp(2.5rem, 7vh, 4.5rem) 0 clamp(2rem, 5vh, 3.5rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.hero-visual { position: relative; justify-self: end; width: min(420px, 100%); aspect-ratio: 1; display: grid; place-items: center; }
.hero-photo { margin: 0; width: 76%; position: relative; z-index: 1; }
.hero-photo img { aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-crease { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-8deg); }
.kresling line { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; fill: none; }
.kresling line.valley { stroke-dasharray: 4 5; }
.js .kresling line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 22ms + 200ms); }
.js .kresling line.valley { animation-name: draw-dashed; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes draw-dashed { to { stroke-dashoffset: 0; stroke-dasharray: 0.04 0.05; } }
.hero-masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 2rem; border-bottom: 1px solid var(--line-strong); padding-bottom: 1rem; margin-bottom: clamp(1.5rem, 4vh, 2.5rem); }
.hero-masthead h1 { font-size: clamp(3.2rem, 9vw, 7.2rem); letter-spacing: -0.02em; line-height: 0.95; max-width: none; }
.hero-masthead .eyebrow { margin: 0 0 0.4rem; text-align: right; max-width: 30ch; }
@media (max-width: 640px) { .hero-masthead { flex-direction: column; align-items: flex-start; gap: 0.6rem; } .hero-masthead .eyebrow { text-align: left; white-space: normal; } }
.tagline { font-family: var(--font-display); font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.15; margin: 0; max-width: 20ch; }
.tagline em { font-style: italic; color: var(--accent); }
.hero .lede { margin-top: 1.5rem; max-width: 54ch; }
.hero-status { margin: 2.2rem 0 0; }
.hero-status .dot { color: var(--accent); margin-right: 0.3rem; }
@media (max-width: 760px) { .hero-grid { grid-template-columns: 1fr; } .hero-visual { justify-self: start; width: min(300px, 80%); order: -1; } }

.page-head { padding: clamp(3rem, 8vh, 5rem) 0 2rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.button { display: inline-block; padding: 0.72rem 1.3rem; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 500; font-size: 0.93rem; border: 1px solid var(--ink); transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.3s var(--ease); }
.button:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.button.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.js .hero .hero-text > *, .js .hero-masthead > *, .js .hero-visual, .js .about-hero-text > * { animation: rise 0.9s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s ease, transform 0.8s var(--ease); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- sections & grid ---------- */
.section { padding: clamp(2rem, 5vh, 3.5rem) 0 clamp(3rem, 8vh, 5rem); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.more { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.more::after { content: " \2192"; display: inline-block; transition: transform 0.3s var(--ease); }
.more:hover::after { transform: translateX(4px); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 3.5vw, 2.75rem) clamp(1.25rem, 3vw, 2.25rem); }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

/* ---------- project card ---------- */
.card { display: flex; flex-direction: column; color: inherit; }
.card[hidden] { display: none; }
.card-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); transition: transform 0.5s var(--ease); }
.card:hover .card-media { transform: translateY(-4px); }
.card-media img, .card-placeholder { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.card:hover .card-media img { transform: scale(1.035); }
.card-placeholder { background: var(--surface); }
.card-body { padding: 1.1rem 0.1rem 0; }
.card-line { display: flex; align-items: baseline; gap: 0.8rem; }
.card-index { font-family: var(--font-mono); font-size: 0.74rem; color: var(--accent); letter-spacing: 0.02em; }
.card-body h3 { margin: 0.4rem 0 0.4rem; transition: color 0.2s; }
.card:hover h3 { color: var(--accent); }
.card-body p { color: var(--muted); font-size: 0.95rem; margin: 0 0 0.7rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0.4rem 0 0; }
.tags li { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.24rem 0.65rem; }

/* ---------- tag filter ---------- */
.filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.6rem; }
.chip { cursor: pointer; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.86rem; transition: all 0.2s; }
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* =====================================================================
   PROJECT PAGE
   ===================================================================== */

/* cover with the title set into it */
.project-hero { padding: clamp(1.25rem, 3vh, 2rem) 0 0; }
.cover-bleed .project-hero { padding: 0; }
.cover-bleed .hero-frame { border-radius: 0; box-shadow: none; height: clamp(380px, 62vh, 640px); }
.cover-bleed .cover-text { width: 100%; max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.hero-frame {
  position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2);
  min-height: 320px; height: clamp(360px, 52vh, 560px); box-shadow: var(--shadow); display: flex; align-items: flex-end;
}
.hero-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--hero-scrim) 0%, rgba(0, 0, 0, 0.18) 45%, rgba(0, 0, 0, 0) 75%); }
.cover-text { position: relative; z-index: 1; padding: clamp(1.5rem, 4vw, 3rem); color: #fff; }
.cover-text .eyebrow { color: rgba(255, 255, 255, 0.72); margin-bottom: 0.9rem; }
.cover-text h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 4rem); max-width: 16ch; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35); }
.cover-text .tags { margin-top: 1rem; }
.cover-text .tags li { color: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.35); }
.project-hero.no-cover .hero-frame { height: auto; min-height: 0; background: transparent; box-shadow: none; }
.project-hero.no-cover .hero-frame::after { display: none; }
.project-hero.no-cover .cover-text { color: var(--ink); padding: clamp(3rem, 8vh, 5rem) 0 1rem; }
.project-hero.no-cover .cover-text h1 { color: var(--ink); text-shadow: none; }
.project-hero.no-cover .cover-text .eyebrow { color: var(--muted); }
.project-hero.no-cover .cover-text .tags li { color: var(--muted); border-color: var(--line); }

.split-head { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; padding: clamp(2.5rem, 7vh, 4.5rem) 0 1rem; }
.cover-text.plain { color: var(--ink); padding: 0; }
.cover-text.plain h1 { color: var(--ink); text-shadow: none; }
.cover-text.plain .eyebrow { color: var(--muted); }
.cover-text.plain .tags li { color: var(--muted); border-color: var(--line); }
.split-cover { margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow); }
.split-cover img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
@media (max-width: 760px) { .split-head { grid-template-columns: 1fr; } .split-cover { order: -1; } }
.blk-gallery .trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1.6rem; }
.blk-wide .duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1.6rem; }
@media (max-width: 760px) { .blk-gallery .trio { grid-template-columns: 1fr; } .blk-wide .duo { grid-template-columns: 1fr; } }

/* overview: summary beside details */
.overview { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr); gap: clamp(2rem, 5vw, 4.5rem); padding-top: clamp(2.5rem, 6vh, 4rem); align-items: start; }
.summary { font-family: var(--font-display); font-size: clamp(1.25rem, 2vw, 1.6rem); line-height: 1.4; margin: 0; max-width: 36ch; }
.details { margin: 0; border-top: 1px solid var(--line-strong); }
.details > div { display: grid; grid-template-columns: 90px 1fr; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.details dt { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 0.3rem; }
.details dd { margin: 0; font-size: 0.92rem; line-height: 1.5; }
.details-links dd { display: flex; flex-direction: column; gap: 0.25rem; }
.details-links a { color: var(--accent); }
.details-links a::after { content: " \2197"; font-size: 0.8em; }
@media (max-width: 760px) { .overview { grid-template-columns: 1fr; } }

.highlights { list-style: none; padding: 0; margin: clamp(2rem, 5vh, 3rem) 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.2rem 2rem; }
.highlights li { display: flex; flex-direction: column; gap: 0.25rem; padding-left: 1rem; border-left: 1px solid var(--line-strong); }
.hl-value { font-family: var(--font-display); font-size: clamp(1.9rem, 3vw, 2.6rem); line-height: 1; color: var(--accent); }
.hl-label { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }

/* sticky section bar */
.section-nav {
  position: sticky; top: var(--header-h); z-index: 15; margin-top: clamp(2.5rem, 6vh, 4rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.section-nav ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.section-nav ol::-webkit-scrollbar { display: none; }
.section-nav a { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.8rem 0.9rem; font-size: 0.84rem; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.2s, border-color 0.2s; }
.section-nav a:hover, .section-nav a.active { color: var(--ink); border-bottom-color: var(--accent); }
.section-nav a .num { font-size: 0.66rem; }

/* sections: each one picks a layout from its own content */
.case { padding-top: clamp(2rem, 5vh, 3.5rem); }
.case-section { padding: clamp(2.5rem, 6vh, 4rem) 0; }
.case-section.band { background: color-mix(in srgb, var(--surface) 70%, transparent); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.case-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.6rem; }
.case-head h2 { font-size: clamp(1.9rem, 3vw, 2.6rem); }
.blk .prose { max-width: none; }
.blk-wide .prose { max-width: 72ch; font-size: 1.04rem; }
.blk-wide .prose.cols, .blk-duo .prose.cols, .blk-strip .prose.cols { max-width: none; columns: 2; column-gap: 3rem; }
.prose.cols > :first-child { margin-top: 0; }
.prose.cols h3 { column-span: all; }
.prose.cols p, .prose.cols li { break-inside: avoid; }
.blk-side { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.blk-side.flip .media { order: -1; }
.blk-side .media { position: sticky; top: calc(var(--header-h) + 64px); }
.blk-duo .duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1.6rem; }
.blk-strip .carousel { margin-top: 1.6rem; }
.carousel.strip .slide { flex: 0 0 min(46%, 520px); }
@media (max-width: 760px) {
  .blk-side { grid-template-columns: 1fr; }
  .blk-side.flip .media { order: 0; }
  .blk-side .media { position: static; }
  .blk-wide .prose.cols, .blk-duo .prose.cols, .blk-strip .prose.cols { columns: 1; }
  .blk-duo .duo { grid-template-columns: 1fr; }
  .carousel.strip .slide { flex-basis: 85%; }
}

.case-section.note .prose { font-family: var(--font-display); font-size: clamp(1.3rem, 2.2vw, 1.8rem); line-height: 1.35; max-width: 34ch; }

/* pull quotes */
.prose blockquote { margin: 2rem auto; padding: 0; border: 0; max-width: 30ch; text-align: center; font-family: var(--font-display); font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1.25; color: var(--ink); }
.prose blockquote::before { content: "\2726"; display: block; color: var(--accent); font-size: 0.9rem; margin-bottom: 0.8rem; }
.prose blockquote p { margin: 0; }

/* timeline steps */
.steps { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.step { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 1.25rem; padding: 1.8rem 0; border-top: 1px solid var(--line); }
.step-index { font-family: var(--font-display); font-size: 2.2rem; line-height: 1; color: var(--accent); }
.step .prose h3 { font-size: 1.5rem; margin: 0.15rem 0 0.7rem; }
@media (max-width: 760px) { .step { grid-template-columns: 1fr; gap: 0.5rem; } }

/* =====================================================================
   EXPERIENCE: MISSION PATCHES ON AN ORBIT
   ===================================================================== */
.orbit { position: relative; height: 190px; margin: 1.5rem 0 0; }
.orbit-arc { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.orbit-arc path { fill: none; stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 3 6; }
.patch {
  position: absolute; width: 150px; height: 150px; transform: translate(-50%, -50%);
  background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%;
  transition: transform 0.5s var(--ease), filter 0.3s;
}
.patch svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 10px 18px rgba(20, 14, 18, 0.18)); }
.patch-stitch { fill: none; stroke: var(--ink); stroke-opacity: 0.45; stroke-width: 1.4; stroke-dasharray: 2.5 3.5; }
.patch-ring { fill: var(--ink); stroke: var(--ink); stroke-width: 1.6; }
.patch-band { fill: color-mix(in srgb, var(--accent) 30%, var(--surface)); stroke: none; }
.patch-core { fill: var(--accent); stroke: var(--ink); stroke-opacity: 0.35; stroke-width: 1; }
.patch-rim { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.22em; fill: var(--bg); }
.patch-stars circle { fill: var(--accent-ink); opacity: 0.9; }
.patch-no { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.15em; fill: var(--bg); fill-opacity: 0.7; }
.patch-logo { position: absolute; left: 50%; top: 50%; width: 42%; height: 27%; object-fit: contain; transform: translate(-50%, -50%); filter: var(--patch-logo-filter); }
.patch-mark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); font-family: var(--font-display); font-size: 2.2rem; line-height: 1; color: var(--accent-ink); }
.patch:hover { transform: translate(-50%, -50%) scale(1.06); }
.patch.active { transform: translate(-50%, -50%) scale(1.12); }
.patch.active .patch-ring { stroke: var(--accent); stroke-width: 2.4; }
.patch.active .patch-band { fill: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.patch.active .patch-rim { fill: var(--accent); }
.patch:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.mission-log { position: relative; margin-top: 2.5rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mission { display: none; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0; }
.mission.active { display: grid; animation: fade 0.5s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.mission-media { background: var(--surface-2); min-height: 260px; display: grid; place-items: center; }
.mission-media img { width: 100%; height: 100%; object-fit: cover; }
.mission-tile { display: grid; place-items: center; width: 100%; height: 100%; }
.mission-tile img { width: 44%; height: auto; max-height: 40%; object-fit: contain; filter: var(--logo-filter); }
.mission-tile span { font-family: var(--font-display); font-size: 2rem; opacity: 0.85; }
.mission-body { padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.5rem, 3vw, 2.5rem) 4.2rem; display: flex; flex-direction: column; gap: 0.4rem; }
.mission-line { display: flex; gap: 1rem; align-items: baseline; margin-bottom: 0.4rem; }
.mission-body h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.1; }
.mission-org { color: var(--muted); font-size: 0.92rem; margin: 0 0 0.6rem; }
.mission-note { margin: 0; max-width: 52ch; }
.mission-link { color: var(--accent); font-size: 0.9rem; margin-top: 0.6rem; }
.mission-ui { position: absolute; right: clamp(1.5rem, 3vw, 2.5rem); bottom: 1.4rem; display: flex; align-items: center; gap: 0.6rem; }
@media (max-width: 760px) {
  .orbit-arc { display: none; }
  .orbit { height: auto; display: flex; gap: 0.5rem; overflow-x: auto; scroll-snap-type: x proximity; padding: 0.5rem 0 0.75rem; scrollbar-width: none; }
  .orbit::-webkit-scrollbar { display: none; }
  .patch { position: static; transform: none; flex: 0 0 128px; width: 128px; height: 128px; scroll-snap-align: center; }
  .patch:hover, .patch.active { transform: scale(1.04); }
  .mission { grid-template-columns: 1fr; }
  .mission-media { min-height: 0; aspect-ratio: 16 / 9; }
}

/* =====================================================================
   ABOUT
   ===================================================================== */
.about-hero { padding: clamp(3rem, 9vh, 6rem) 0 clamp(1rem, 3vh, 2rem); }
.about-hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.about-hero-text h1 { font-size: clamp(2.6rem, 6vw, 4.8rem); }
@media (max-width: 760px) { .about-hero-grid { grid-template-columns: 1fr; } }
.about-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.about-prose { max-width: 62ch; font-size: 1.08rem; }
.about-aside { display: flex; flex-direction: column; gap: 1.6rem; position: sticky; top: calc(var(--header-h) + 32px); }
.now, .edu-block { border-top: 1px solid var(--line-strong); padding-top: 0.9rem; }
.now ul { list-style: none; padding: 0; margin: 0.6rem 0 0; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.93rem; }
.now li { padding-left: 1.1rem; position: relative; }
.now li::before { content: "\2726"; position: absolute; left: 0; top: 0.1em; color: var(--accent); font-size: 0.7rem; }
.edu-line { font-size: 0.93rem; margin: 0.6rem 0 0; line-height: 1.5; }
@media (max-width: 860px) { .about-body { grid-template-columns: 1fr; } .about-aside { position: static; } }

.photo-strip { columns: 3; column-gap: 1.2rem; }
.photo-strip figure { margin: 0 0 1.2rem; break-inside: avoid; }
.photo-strip img { border-radius: var(--radius); box-shadow: var(--shadow); }
.photo-strip figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; }
@media (max-width: 760px) { .photo-strip { columns: 2; } }
@media (max-width: 420px) { .photo-strip { columns: 1; } }

/* skills as a planisphere */
.skymap { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.skymap svg { width: 100%; height: auto; display: block; }
.graticule ellipse, .graticule line { fill: none; stroke: rgba(236, 231, 226, 0.08); stroke-width: 1; vector-effect: non-scaling-stroke; }
.dust circle { fill: #ece7e2; }
.constellation { transition: opacity 0.35s; cursor: default; outline: none; }
.skymap:hover .constellation:not(:hover), .skymap:focus-within .constellation:not(:focus) { opacity: 0.35; }
.constellation line { stroke: rgba(236, 231, 226, 0.35); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; transition: stroke 0.3s; }
.constellation:hover line, .constellation:focus line { stroke: #a7cb98; stroke-dasharray: none; }
.constellation .star .core { fill: #fff; animation: twinkle 3.2s ease-in-out infinite; animation-delay: var(--tw, 0s); }
@keyframes twinkle { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
.constellation .star .halo { fill: #a7cb98; opacity: 0; transition: opacity 0.3s; }
.constellation:hover .star .halo, .constellation:focus .star .halo { opacity: 0.25; }
.constellation .star text { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; fill: rgba(236, 231, 226, 0.75); paint-order: stroke; stroke: rgba(11, 15, 26, 0.85); stroke-width: 3px; stroke-linejoin: round; }
.constellation:hover .star text, .constellation:focus .star text { fill: #fff; }
.const-title { font-family: var(--font-display); font-style: italic; font-size: 22px; fill: #f5d3c8; opacity: 0.55; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: rgba(11, 15, 26, 0.8); stroke-width: 4px; }
.constellation:hover .const-title, .constellation:focus .const-title { opacity: 1; fill: #a7cb98; }
@media (prefers-reduced-motion: reduce) { .constellation .star .core { animation: none; } }
.skills-list { display: block; margin-top: 1.5rem; }
@media (max-width: 700px) { .skymap { display: none; } }
.skills { margin: 1.5rem 0 0; }
.skills > div { display: grid; grid-template-columns: 130px 1fr; gap: 1rem; padding: 0.75rem 0; border-top: 1px solid var(--line); }
.skills > div:last-child { border-bottom: 1px solid var(--line); }
.skills dt { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 0.3rem; }
.skills dd { margin: 0; }

.about-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); border-top: 1px solid var(--line); padding-top: 2.5rem; }
.interests { font-family: var(--font-display); font-size: clamp(1.3rem, 2vw, 1.7rem); line-height: 1.35; margin: 0.6rem 0 0; max-width: 28ch; }
.contact-email { display: inline-block; font-family: var(--font-display); font-size: clamp(1.4rem, 2.4vw, 2rem); margin: 0.4rem 0 0.4rem; color: var(--ink); text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--accent); text-decoration-thickness: 1px; }
.contact-email:hover { color: var(--accent); }
.contact-block .actions { margin-top: 1rem; }
@media (max-width: 760px) { .about-foot { grid-template-columns: 1fr; } }

/* keyboard shortcuts card */
.shortcuts { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); }
.shortcuts[hidden] { display: none; }
.shortcuts-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.6rem; min-width: 300px; }
.shortcuts-card dl { margin: 0.8rem 0 0; display: grid; gap: 0.5rem; }
.shortcuts-card dl div { display: grid; grid-template-columns: 70px 1fr; gap: 1rem; align-items: baseline; font-size: 0.9rem; }
.shortcuts-card dd { margin: 0; color: var(--muted); }

/* cross-fade between pages (browsers that support it) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }

/* media: a single figure, or a carousel */
.media-one figure { margin: 0; }
.media-one img, .media-one video, .slide img, .slide video {
  width: 100%; aspect-ratio: 4 / 3; object-fit: contain; display: block;
  background: var(--surface-2); border-radius: var(--radius); box-shadow: var(--shadow);
}
.media-one figcaption, .slide figcaption, .gallery figcaption, .prose figcaption { font-size: 0.82rem; color: var(--muted); margin-top: 0.6rem; line-height: 1.45; }
.carousel { position: relative; }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 1rem; -webkit-overflow-scrolling: touch; }
.carousel-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; }
.slide figure { margin: 0; }
.carousel-ui { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.7rem; }
.carousel-counter { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.02em; color: var(--muted); min-width: 3.5em; text-align: center; }
.carousel-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; display: grid; place-items: center; font-size: 0.9rem; transition: border-color 0.2s, color 0.2s; }
.carousel-btn:hover { border-color: var(--accent); color: var(--accent); }
.carousel-btn[disabled] { opacity: 0.35; cursor: default; }

/* ---------- long-form text (Markdown output) ---------- */
.prose { max-width: var(--read); }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.8rem; margin: 2.4rem 0 0.9rem; }
.prose h3 { font-size: 1.3rem; margin: 1.9rem 0 0.6rem; }
.prose p, .prose ul, .prose ol { margin-bottom: 1.1em; }
.prose li { margin-bottom: 0.3em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.prose blockquote { margin: 1.6rem 0; padding: 0.2rem 0 0.2rem 1.2rem; border-left: 2px solid var(--accent); color: var(--muted); font-family: var(--font-display); font-size: 1.25rem; line-height: 1.4; }
.prose figure { margin: 0.3rem 0 1.4rem; }
.prose figure img, .prose figure video { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.prose code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface); padding: 0.12em 0.38em; border-radius: 4px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; font-size: 0.85rem; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; margin: 1.2rem 0; }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.01em; color: var(--muted); font-weight: 500; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.prose .draft { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 0.8rem 1rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); margin-bottom: 1.5rem; }
.figure-row { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 1rem; margin: 1.6rem 0 1.8rem; }
.figure-row figure { margin: 0; }
.figure-row img, .figure-row video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
@media (max-width: 560px) { .figure-row { grid-template-columns: 1fr; } }

/* ---------- gallery ---------- */
.gallery-title { margin-bottom: 1.4rem; font-size: 1.6rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.gallery figure { margin: 0; }
.gallery img, .gallery video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); transition: transform 0.5s var(--ease); display: block; }
.gallery figure:hover img { transform: translateY(-3px); }

/* ---------- prev / next ---------- */
.project-nav { display: flex; justify-content: space-between; gap: 2rem; border-top: 1px solid var(--line); padding-top: 1.6rem; margin-top: clamp(2.5rem, 6vh, 4rem); margin-bottom: 4rem; }
.project-nav a { display: flex; flex-direction: column; gap: 0.3rem; font-family: var(--font-display); font-size: 1.3rem; max-width: 45%; }
.project-nav .next { text-align: right; margin-left: auto; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2.75rem 0 3rem; margin-top: 2rem; font-size: 0.92rem; }
.footer-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
.footer-name { font-family: var(--font-display); font-size: 1.3rem; }
.footer-email { color: var(--muted); }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 1.5rem; padding: 0; margin: 0; }
.footer-note { color: var(--muted); font-size: 0.78rem; margin: 2rem 0 0; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; opacity: 0; visibility: hidden; flex-direction: column; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 94%, transparent); padding: 4vh 4vw; cursor: zoom-out; transition: opacity 0.3s ease, visibility 0.3s; }
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img { max-width: 100%; max-height: 80vh; width: auto; height: auto; border-radius: 8px; box-shadow: var(--shadow); transform: scale(0.97); transition: transform 0.4s var(--ease); }
.lightbox.open img { transform: none; }
.lightbox-caption { color: var(--muted); font-size: 0.9rem; margin: 1rem 0 0; text-align: center; max-width: 70ch; }
.lightbox-ui { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.8rem; cursor: default; }
.lightbox-ui .carousel-counter { color: var(--muted); }

/* =====================================================================
   PATCH COLOURS (each patch brings its own two colours)
   ===================================================================== */
.patch-core { fill: var(--p1, var(--accent)); }
.patch-band { fill: var(--p2, var(--accent)); fill-opacity: 0.45; }
.patch-stars circle { fill: var(--p2, var(--accent-ink)); opacity: 1; }
.patch-logo { filter: brightness(0) invert(1); }
.patch-mark { color: #fff; }
.patch.active .patch-ring { stroke: var(--p2, var(--accent)); }
.patch.active .patch-band { fill-opacity: 0.8; }
.patch.active .patch-rim { fill: var(--bg); }

/* =====================================================================
   EXPERIMENTS (each one is on only when its class is on <body>)
   ===================================================================== */

/* --- fold: the portrait as an accordion ------------------------------ */
@property --fold { syntax: "<number>"; inherits: true; initial-value: 0; }
.fold { perspective: 1100px; }
.fold-strips { display: none; }
.x-fold .fold > img { visibility: hidden; }
.x-fold .fold.flat > img { visibility: visible; }
.x-fold .fold.flat .fold-strips { visibility: hidden; }
.x-fold .fold-strips { display: block; position: absolute; inset: 0; transform-style: preserve-3d; --fold: 1; transition: --fold 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.35s; }
.x-fold .fold-strips.open { --fold: 0; }
.x-fold .fold-strips.live { transition: none; }
.x-fold .fold-strip {
  position: absolute; left: 0; width: 100%; height: calc(100% / 8); top: 0;
  background-image: var(--img); background-size: 100% 800%; background-position: 0 calc(var(--i) * 100% / 7);
  transform-origin: 50% 0; transform-style: preserve-3d; backface-visibility: hidden;
  transform: rotateX(calc(var(--fold) * var(--dir) * 72deg));
  filter: brightness(calc(1 - var(--fold) * 0.22 * (0.5 - var(--dir) * 0.5)));
}
.x-fold .fold-strip .fold-strip { top: 100%; height: 100%; }
.x-fold .fold-strip:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.x-fold .fold-strips > .fold-strip { box-shadow: var(--shadow); }

/* --- crane: the portrait folds into a paper crane -------------------- */
.crane-clip { position: absolute; inset: 0; clip-path: polygon(var(--poly, 0 0, 100% 0, 100% 100%, 0 100%)); background: #e9e2d6; display: none; }
.crane-lines { position: absolute; inset: 0; width: 100%; height: 100%; opacity: var(--t, 0); pointer-events: none; display: none; }
.x-crane .hero-photo { --t: 0; }
.x-crane .hero-photo > img { visibility: hidden; }
.x-crane .hero-photo.flat > img { visibility: visible; }
.x-crane .hero-photo.flat .crane-clip, .x-crane .hero-photo.flat .crane-lines { visibility: hidden; }
.x-crane .crane-clip { display: block; border-radius: calc(var(--radius) * (1 - var(--t))); box-shadow: var(--shadow); }
.x-crane .crane-clip img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: calc(1 - var(--t) * 0.85); filter: grayscale(var(--t)); }
.x-crane .crane-lines { display: block; }
.x-crane .crane-lines line { stroke: var(--ink); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.x-crane .crane-lines line.v { stroke: var(--accent); stroke-dasharray: 4 4; }

/* --- letters: the name rises letter by letter ------------------------ */
.x-letters.js .letters { animation: none; }
.x-letters.js .letters span.sp { display: inline; animation: none; }
.x-letters.js .letters span { display: inline-block; animation: rise-letter 0.8s var(--ease) both; animation-delay: calc(var(--l, 0) * 38ms + 120ms); }
@keyframes rise-letter { from { opacity: 0; transform: translateY(0.35em) rotate(2deg); } to { opacity: 1; transform: none; } }

/* --- starmap: projects as a constellation ---------------------------- */
.view-toggle { display: none; gap: 0.5rem; margin-top: 1.6rem; }
.x-starmap .view-toggle { display: flex; }
@media (max-width: 760px) { .x-starmap .view-toggle { display: none; } }
.starmap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 55%, transparent); overflow: visible; }
.starmap svg { width: 100%; height: auto; display: block; }
.sm-path { fill: none; stroke: var(--accent); stroke-opacity: 0.6; stroke-width: 1; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.sm-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sm-row { stroke: var(--line); stroke-width: 1; stroke-dasharray: 1 6; vector-effect: non-scaling-stroke; }
.sm-rowlabel { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; fill: var(--muted); }
.sm-help { position: absolute; left: 1.2rem; top: 0.9rem; margin: 0; z-index: 2; }
.starmap svg { padding-top: 1.6rem; }
.sm-halo { fill: var(--accent); opacity: 0.08; }
.sm-node { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; color: inherit; }
.sm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--bg); transition: transform 0.3s var(--ease), background 0.2s; }
.sm-node:hover .sm-dot { transform: scale(1.5); background: var(--accent); }
.sm-label { position: absolute; bottom: calc(100% + 6px); white-space: nowrap; font-family: var(--font-display); font-size: 1rem; color: var(--ink); background: color-mix(in srgb, var(--bg) 80%, transparent); padding: 0 0.3em; border-radius: 4px; }
.sm-label.below { bottom: auto; top: calc(100% + 6px); }
.sm-label.left { bottom: auto; right: calc(100% + 8px); }
.sm-label.right { bottom: auto; left: calc(100% + 8px); }
.sm-node:hover .sm-label { color: var(--accent); }
.sm-years { position: absolute; left: 0; right: 0; bottom: 0.6rem; height: 1rem; pointer-events: none; }
.sm-years span { position: absolute; transform: translateX(-50%); font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--muted); }
.sm-card { position: absolute; z-index: 5; width: 300px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; pointer-events: none; display: grid; grid-template-columns: 110px 1fr; }
.sm-card[hidden] { display: none; }
.sm-card img { width: 100%; height: 100%; object-fit: cover; }
.sm-card > div { padding: 0.7rem 0.85rem; }
.sm-card h3 { font-size: 1.05rem; margin: 0.15rem 0 0.3rem; }
.sm-summary { font-size: 0.78rem; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* --- flip: the chosen patch spins ----------------------------------- */
.x-flip .patch.spin { animation: patch-spin 0.9s var(--ease); }
@keyframes patch-spin { from { transform: translate(-50%, -50%) rotateY(0) scale(1.12); } to { transform: translate(-50%, -50%) rotateY(360deg) scale(1.12); } }
@media (max-width: 760px) { @keyframes patch-spin { from { transform: rotateY(0) scale(1.04); } to { transform: rotateY(360deg) scale(1.04); } } }

/* --- parallax: cover photos drift ------------------------------------ */
.x-parallax .hero-frame img.parallax { height: 130%; top: -15%; will-change: transform; }

/* --- hover-swap: cards crossfade to a second photo ------------------- */
.card-media img.alt { display: none; }
.x-hover-swap .card-media { position: relative; }
.x-hover-swap .card-media img.alt { display: block; position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; }
.x-hover-swap .card:hover .card-media img.alt { opacity: 1; }

/* =====================================================================
   PAPER HOME
   ===================================================================== */
.sheet { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.sheet svg { width: 100%; height: 100%; }
.sheet line { stroke: var(--ink); stroke-opacity: 0.11; stroke-width: 1; vector-effect: non-scaling-stroke; }
.sheet line.v { stroke: var(--accent); stroke-opacity: 0.35; stroke-dasharray: 5 6; }
.legend { position: fixed; right: 20px; top: calc(var(--header-h) + 14px); z-index: 2; display: grid; gap: 0.2rem; }
.legend i { display: inline-block; width: 26px; border-top: 1px solid var(--ink); vertical-align: middle; margin-right: 8px; }
.legend i.v { border-top-style: dashed; border-color: var(--accent); }
@media (max-width: 760px) { .legend { display: none; } }
main { perspective: 1400px; }
.crease { height: 1px; border: 0; background: var(--ink); opacity: 0.35; margin: 0; }

.hinge { transform-origin: 50% 0; will-change: transform, opacity; }
.js .hinge { transform: rotateX(-62deg); opacity: 0; }
@media (prefers-reduced-motion: reduce) { .js .hinge { transform: none !important; opacity: 1 !important; } }

.pp-hero { padding: clamp(3rem, 9vh, 6rem) 0 clamp(2.5rem, 6vh, 4rem); }
.pp-hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.pp-name { font-size: clamp(3.6rem, 10.5vw, 8.4rem); line-height: 0.9; letter-spacing: -0.03em; max-width: none; margin-bottom: 1.4rem; }
.pp-name em { font-style: italic; color: var(--accent); }
.pp-text .tagline { max-width: 22ch; }
.pp-text .lede { margin-top: 1.2rem; }
.pp-visual { justify-self: end; width: min(440px, 100%); }
.crane-figure { position: relative; margin: 0; aspect-ratio: 4 / 5; cursor: pointer; outline: none; }
.crane-figure > img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.crane-figure:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.crane-figure .crane-clip { display: block; border-radius: calc(var(--radius) * (1 - var(--t, 0))); box-shadow: var(--shadow); background: var(--surface-2); }
.crane-figure .crane-clip img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: calc(1 - var(--t, 0) * 0.85); filter: grayscale(var(--t, 0)); }
.crane-figure .crane-lines { display: block; }
.crane-figure .crane-lines line { stroke: var(--ink); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.crane-figure .crane-lines line.v { stroke: var(--accent); stroke-dasharray: 4 4; }
.crane-figure > img { visibility: hidden; }
.crane-figure.flat > img { visibility: visible; }
.crane-figure.flat .crane-clip, .crane-figure.flat .crane-lines { visibility: hidden; }
.pp-hint { text-align: center; margin: 0.9rem 0 0; }
@media (max-width: 760px) { .pp-hero-grid { grid-template-columns: 1fr; } .pp-visual { justify-self: start; width: min(320px, 85%); } }

.facets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 3.5vw, 2.75rem) clamp(1.25rem, 3vw, 2.25rem); }
.facet { display: block; color: inherit; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: box-shadow 0.4s; }
.facet:hover { box-shadow: 0 0 0 1px var(--line-strong), 0 30px 60px -28px rgba(0, 0, 0, 0.5); }
.facet-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.facet-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.9s var(--ease); }
.facet-media img.alt { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s; }
.facet:hover .facet-media img.alt { opacity: 1; }
.facet:hover .facet-media img { transform: scale(1.03); }
.facet-body { padding: 1rem 1.2rem 1.3rem; border-top: 1px dashed var(--line-strong); }
.facet-body h3 { margin: 0.35rem 0 0.35rem; transition: color 0.2s; }
.facet:hover h3 { color: var(--accent); }
.facet-body p { margin: 0; color: var(--muted); font-size: 0.93rem; }
@media (max-width: 720px) { .facets { grid-template-columns: 1fr; } }

.pp-about { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); }
.pp-big { font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2.3rem); line-height: 1.2; margin: 0; }
@media (max-width: 760px) { .pp-about { grid-template-columns: 1fr; } }

/* =====================================================================
   ORBITAL (projects page)
   ===================================================================== */
.page-head-tight { padding-bottom: 0.5rem; }
.orbital { position: relative; }
.orbital-wrap { position: relative; height: clamp(520px, 78vh, 760px); user-select: none; cursor: grab; }
.orbital-wrap.drag { cursor: grabbing; }
.orb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.orb-sun { position: absolute; left: 50%; top: 50%; width: 86px; height: 86px; transform: translate(-50%, -50%); border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 50px color-mix(in srgb, var(--accent) 35%, transparent); z-index: 2; }
.orb-sun img { width: 100%; height: 100%; object-fit: cover; }
.orb-planet { position: absolute; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; overflow: visible; z-index: 3; transition: transform 0.35s var(--ease), opacity 0.3s; }
.orb-planet.big { width: 68px; height: 68px; margin: -34px 0 0 -34px; }
.orb-planet img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-strong), 0 12px 28px -12px rgba(0, 0, 0, 0.6); transition: box-shadow 0.3s; }
.orb-planet:hover { transform: scale(1.25); z-index: 5; }
.orb-planet:hover img { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent), 0 12px 28px -12px rgba(0, 0, 0, 0.6); }
.orb-label { position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; font-family: var(--font-display); font-size: 0.95rem; color: var(--ink); background: color-mix(in srgb, var(--bg) 85%, transparent); padding: 0 0.35em; border-radius: 4px; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.orb-planet:hover .orb-label, .orbital-wrap.labels .orb-label { opacity: 1; }
.orb-planet.off { opacity: 0.12; pointer-events: none; }
.orb-card { position: absolute; z-index: 6; width: 320px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; pointer-events: none; display: grid; grid-template-columns: 120px 1fr; }
.orb-card[hidden] { display: none; }
.orb-card img { width: 100%; height: 100%; object-fit: cover; }
.orb-card > div { padding: 0.75rem 0.9rem; }
.orb-card h3 { font-size: 1.1rem; margin: 0.15rem 0 0.3rem; }
.orb-summary { font-size: 0.78rem; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.orb-hint { position: absolute; left: var(--gutter); bottom: 0.4rem; margin: 0; }
@media (max-width: 640px) { .orbital-wrap { height: 70vh; } .orb-planet { width: 40px; height: 40px; margin: -20px 0 0 -20px; } .orb-planet.big { width: 50px; height: 50px; margin: -25px 0 0 -25px; } .orb-sun { width: 64px; height: 64px; } .orb-card { display: none !important; } }

/* origami touches on existing elements */
.mission-log { transform-origin: 50% 0; }
.mission-log.unfolding { animation: unfold-log 0.9s var(--ease); }
@keyframes unfold-log { 0% { transform: perspective(1200px) rotateX(-70deg); opacity: 0.2; } 100% { transform: none; opacity: 1; } }
.crane-facets { position: absolute; inset: 0; width: 100%; height: 100%; opacity: var(--f, 0); pointer-events: none; display: block; }
.crane-facets polygon { stroke: var(--ink); stroke-width: 0.9; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.crane-facets .f1 { fill: color-mix(in srgb, var(--surface) 96%, var(--ink)); }
.crane-facets .f2 { fill: color-mix(in srgb, var(--surface) 74%, var(--ink)); }
.crane-facets .f3 { fill: color-mix(in srgb, var(--surface) 86%, var(--accent)); }
.crane-facets .f4 { fill: color-mix(in srgb, var(--surface) 90%, var(--ink)); }
.crane-facets .f5 { fill: color-mix(in srgb, var(--surface) 80%, var(--ink)); }
.crane-facets line { stroke: var(--ink); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.crane-facets line.v { stroke: var(--accent); stroke-dasharray: 3 3; }
.crane-figure .crane-clip { box-shadow: none; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.18)); }
.crane-figure .crane-clip img { opacity: calc(1 - var(--t, 0) * 0.92); filter: grayscale(var(--t, 0)) contrast(calc(1 - var(--t, 0) * 0.3)); }
.crane-figure.flat .crane-facets { visibility: hidden; }

/* the portrait folds like a letter */
.paper-fold { position: relative; margin: 0; aspect-ratio: 4 / 5; --a1: 0deg; --a2: 0deg; --a3: 0deg; }
.paper-fold > img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); visibility: hidden; }
.paper-fold.flat > img { visibility: visible; }
.paper-fold.flat .pf-stage { visibility: hidden; }
.pf-stage { position: absolute; inset: 0; perspective: 1500px; perspective-origin: 50% 60%; transform-style: preserve-3d; }
.pf-row { position: absolute; left: 0; width: 100%; height: 50%; transform-style: preserve-3d; }
.pf-row.top { top: 0; transform-origin: 50% 100%; transform: rotateX(calc(var(--a3) * -1)) translateZ(6px); }
.pf-row.bottom { top: 50%; }
.pf-panel.mid { position: absolute; left: 33.333%; top: 0; width: 33.334%; height: 100%; transform-style: preserve-3d; }
.pf-flap { position: absolute; top: 0; width: 100%; height: 100%; transform-style: preserve-3d; }
.pf-flap.left { right: 100%; transform-origin: 100% 50%; transform: rotateY(var(--a1)) translateZ(1px); }
.pf-flap.right { left: 100%; transform-origin: 0 50%; transform: rotateY(calc(var(--a2) * -1)) translateZ(3px); }
.pf-face, .pf-back { position: absolute; inset: 0; backface-visibility: hidden; }
.pf-face { background-image: var(--img); background-size: 300% 200%; background-position: var(--px) var(--py); }
.pf-face::after { content: ""; position: absolute; inset: 0; background: rgba(20, 14, 18, var(--sh, 0)); pointer-events: none; }
.pf-back { transform: rotateY(180deg); background: var(--surface-2); background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.05), transparent 60%); }
.pf-row.top .pf-back { transform: rotateY(180deg); }
.pf-stage { filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.18)); }
.paper-fold .pf-row.top .pf-face { border-radius: 0; }
@media (prefers-reduced-motion: reduce) { .paper-fold .pf-stage { display: none; } .paper-fold > img { visibility: visible; } }

/* page-peel on home project cards */
.facet-media.peel img.alt { opacity: 1; clip-path: polygon(100% 0, 100% 0, 100% 0); transition: clip-path 0.9s var(--ease); }
.facet:hover .facet-media.peel img.alt { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 0); }
.dogear { position: absolute; right: 0; top: 0; width: 46px; height: 46px; background: linear-gradient(225deg, var(--bg) 0 50%, color-mix(in srgb, var(--surface-2) 70%, var(--ink)) 50% 100%); clip-path: polygon(100% 0, 0 0, 100% 100%); transform-origin: 100% 0; transition: transform 0.9s var(--ease), opacity 0.4s; box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.18); }
.facet:hover .dogear { transform: scale(0); opacity: 0; }

/* (Kresling section removed) */
.kres-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.kres-grid h2 em { font-style: italic; color: var(--accent); }
.kres-hint { margin-top: 1.4rem; }
.kres-stage { position: relative; touch-action: none; cursor: ns-resize; }
.kresling-3d { width: 100%; height: auto; display: block; }
.kresling-3d polygon { stroke: var(--ink); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.kresling-3d polygon.v { stroke-dasharray: 4 3; }
.kresling-3d .rim { fill: none; stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.kres-readout { display: flex; gap: 0.8rem 1.4rem; align-items: baseline; justify-content: center; flex-wrap: wrap; margin-top: 0.4rem; }
.kres-readout b { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; min-width: 3ch; }
@media (max-width: 760px) { .kres-grid { grid-template-columns: 1fr; } }

/* ---------- misc ---------- */
::selection { background: var(--accent); color: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .js .kresling line { stroke-dasharray: none; stroke-dashoffset: 0; }
  .js .kresling line.valley { stroke-dasharray: 4 5; }
  .carousel-track { scroll-behavior: auto; }
}
