* { box-sizing: border-box; }
:root {
  --paper: #efeee9;
  --ink: #171715;
  --muted: #77766f;
  --line: rgba(23, 23, 21, .22);
  --gutter: clamp(20px, 4.3vw, 72px);
}
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Manrope", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 24px var(--gutter); border-bottom: 1px solid var(--line); gap: 24px; }
.wordmark { font-size: 13px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.wordmark span { font-family: "DM Mono", monospace; font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 10px; }
nav { display: flex; gap: clamp(16px, 3vw, 42px); font-size: 12px; }
nav a, .text-link, .contact-bottom a, .site-footer a { transition: opacity .2s ease; }
nav a:hover, .text-link:hover, .contact-bottom a:hover, .site-footer a:hover { opacity: .55; }
.intro { padding: clamp(64px, 9vw, 130px) var(--gutter) 54px; }
.eyebrow { font: 10px/1.5 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0; }
h1 { font-size: clamp(70px, 13.8vw, 210px); line-height: .83; letter-spacing: -.095em; font-weight: 500; margin: clamp(42px, 7vw, 94px) 0 52px; }
h1 em, h2 em { font-family: Georgia, serif; font-weight: 400; }
.hero-image { position: relative; width: 100%; overflow: hidden; aspect-ratio: 2.55 / 1; background: #242522; }
.hero-image img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 54%; }

.intro-bottom { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-top: 25px; }
.intro-copy { max-width: 350px; font-size: clamp(15px, 1.5vw, 20px); line-height: 1.5; margin: 0; }
.text-link { font-size: 12px; border-bottom: 1px solid var(--ink); padding-bottom: 8px; white-space: nowrap; }
.text-link span { margin-left: 18px; }
.work-section, .about-section, .contact-section { padding: 70px var(--gutter) 100px; border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.section-note { margin: 0; color: var(--muted); font-size: 12px; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; row-gap: 44px; }
.project-card { display: block; border: 0; padding: 0; background: transparent; text-align: left; cursor: pointer; min-width: 0; }
.project-card-wide { grid-column: span 2; }
.project-card-portrait { grid-column: span 1; }
.project-image { display: block; position: relative; width: 100%; aspect-ratio: 1.26; overflow: hidden; background: #d9d7d0; }
.project-card-wide .project-image { aspect-ratio: 2.08; }
.project-card-portrait .project-image { aspect-ratio: 4 / 5; }
.project-image img, .project-image video { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .72s cubic-bezier(.2,.7,.2,1), filter .3s ease; }
.project-image video { background: #141414; }
.project-card:hover .project-image video { transform: scale(1.035); filter: brightness(.9); }
.project-card:hover .project-image img { transform: scale(1.025); filter: brightness(.92); }

.project-meta { display: flex; justify-content: space-between; gap: 16px; padding-top: 13px; font-size: 13px; }
.project-meta strong { display: block; font-weight: 600; }
.project-meta small { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; }
.project-year { font: 10px "DM Mono", monospace; color: var(--muted); white-space: nowrap; }
.image-instruction, .small-note, .dialog-hint { color: var(--muted); font-size: 10px; line-height: 1.6; }
.image-instruction { margin-top: 36px; }
.about-content { display: grid; grid-template-columns: 1fr 1fr; gap: 8vw; }
.about-content h2, .contact-content h2 { font-size: clamp(42px, 7vw, 100px); line-height: .95; letter-spacing: -.07em; font-weight: 500; margin: 0; }
.about-copy { max-width: 520px; }
.about-copy > p:first-child { font-size: clamp(16px, 1.6vw, 21px); line-height: 1.55; margin: 0 0 36px; }
.skills-label { font: 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.skills { font-size: 13px; line-height: 1.8; }
.contact-content { min-height: 320px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 48px; }
.contact-link { font-size: clamp(16px, 2.2vw, 28px); border-bottom: 1px solid var(--ink); padding-bottom: 10px; }
.contact-link span { margin-left: 24px; }
.contact-bottom { display: flex; justify-content: space-between; width: 100%; gap: 20px; color: var(--muted); font-size: 11px; }
.site-footer { display: flex; justify-content: space-between; padding: 20px var(--gutter); border-top: 1px solid var(--line); font: 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.project-dialog { width: min(1100px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 0; border: 0; background: var(--paper); color: var(--ink); overflow-y: auto; }
.project-dialog::backdrop { background: rgba(10,10,9,.75); backdrop-filter: blur(4px); }
.dialog-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; }
.close-dialog { border: 0; background: none; cursor: pointer; font-size: 12px; }
.dialog-body { padding: 26px clamp(22px, 5vw, 60px) 30px; max-width: 820px; }
.dialog-body h2 { font-size: clamp(34px, 6vw, 66px); letter-spacing: -.06em; font-weight: 500; margin: 10px 0 18px; }
.dialog-year { margin: 3px 0 0; }
.dialog-description { font-size: 16px; line-height: 1.6; max-width: 680px; }
.dialog-credits { font: 11px/1.7 "DM Mono", monospace; color: var(--muted); margin-top: 24px; }
/* Project pages use an asymmetrical image sequence with a short entrance animation. */
.dialog-gallery { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(7px, 1.1vw, 14px); padding: 0 clamp(10px, 2vw, 22px) 30px; }
.gallery-item { margin: 0; min-width: 0; overflow: hidden; background: transparent; animation: gallery-rise .78s cubic-bezier(.19,.7,.25,1) both; animation-delay: calc(var(--gallery-index, 0) * 75ms); }
.gallery-item img, .gallery-item video { display: block; width: 100%; height: 100%; min-height: 100%; object-fit: cover; object-position: center; background: transparent; transition: transform .85s cubic-bezier(.2,.7,.2,1), filter .3s ease; }
.gallery-item:hover img, .gallery-item:hover video { transform: scale(1.025); filter: brightness(.94); }
.gallery-item--feature { grid-column: 1 / -1; aspect-ratio: 1.9 / 1; }
.gallery-item--wide { grid-column: span 8; aspect-ratio: 1.4 / 1; }
.gallery-item--half { grid-column: span 6; aspect-ratio: 1.05 / 1; }
.gallery-item--narrow { grid-column: span 4; aspect-ratio: .82 / 1; }
.gallery-item--portrait-wide { grid-column: span 7; aspect-ratio: 4 / 5; }
.gallery-item--portrait-narrow { grid-column: span 5; aspect-ratio: 4 / 5; }
.dialog-gallery[data-project="perfect-child-video"] .gallery-item:not([class*="portrait"]) { aspect-ratio: 4 / 3; }
.dialog-gallery[data-project="touchdesigner-studies"] .gallery-item--feature { aspect-ratio: 1.65 / 1; }
.dialog-hint { padding: 24px clamp(22px, 5vw, 60px) 34px; margin: 0; }
.dialog-scan { padding: 0 clamp(10px, 2vw, 22px) 30px; }
.dialog-scan[hidden] { display: none; }
.scan-panel-heading, .scan-panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 4px; }
.scan-panel-heading p, .scan-panel-footer span, .scan-panel-footer a { margin: 0; color: var(--muted); font: 10px/1.6 "DM Mono", monospace; }
.scan-panel-heading { flex-wrap: wrap; }
.scan-reset-button { margin-left: auto; padding: 9px 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: 10px "DM Mono", monospace; cursor: pointer; }
.scan-reset-button:hover { background: var(--ink); color: var(--paper); }
.scan-panel-footer a { color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 3px; white-space: nowrap; }
.scan-viewer { position: relative; width: 100%; height: clamp(340px, 54vw, 660px); overflow: hidden; background: #1b1c19; }
.scan-viewer canvas { display: block; width: 100%; height: 100%; }
.scan-loading, .scan-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 28px; color: #efeee9; text-align: center; font: 12px/1.6 "DM Mono", monospace; }
.scan-error { display: block; padding-top: 120px; }
.scan-panel-enter { animation: gallery-rise .75s cubic-bezier(.19,.7,.25,1) both; }
.project-dialog[open] { animation: dialog-enter .48s cubic-bezier(.18,.74,.2,1) both; }
.project-dialog::backdrop { animation: backdrop-enter .3s ease both; }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(26px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes backdrop-enter { from { background: rgba(10,10,9,0); } to { background: rgba(10,10,9,.75); } }
@keyframes gallery-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
:focus-visible { outline: 2px solid #5c625d; outline-offset: 4px; }
@media (max-width: 680px) {
  .site-header { align-items: flex-start; flex-direction: column; padding-top: 20px; padding-bottom: 20px; }
  .wordmark span { display: block; margin: 6px 0 0; }
  .intro { padding-top: 68px; }
  h1 { margin: 54px 0 38px; }
  .hero-image { aspect-ratio: 1.2 / 1; }
  .intro-bottom, .section-heading, .about-content, .contact-bottom { display: flex; flex-direction: column; align-items: flex-start; }
  .intro-bottom { gap: 28px; }
  .project-grid { grid-template-columns: 1fr; row-gap: 34px; }
  .project-card-wide { grid-column: span 1; }
  .project-card-portrait { grid-column: span 1; }
  .project-card-wide .project-image, .project-image { aspect-ratio: 1.18; }
  .project-card-portrait .project-image { aspect-ratio: 4 / 5; }
  .about-content { gap: 36px; }
  .contact-bottom { gap: 12px; }
  .site-footer { gap: 12px; flex-wrap: wrap; }
  .dialog-gallery { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .gallery-item--feature, .gallery-item--wide, .gallery-item--half, .gallery-item--narrow,
  .gallery-item--portrait-wide, .gallery-item--portrait-narrow { grid-column: 1 / -1; }
  .gallery-item--feature { aspect-ratio: 1.18 / 1; }
  .gallery-item--portrait-wide, .gallery-item--portrait-narrow { aspect-ratio: 4 / 5; }
  .scan-panel-heading, .scan-panel-footer { align-items: flex-start; flex-direction: column; }
  .scan-viewer { height: 62vh; min-height: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Each gallery tile follows the media's native ratio (unless explicitly portrait-cropped).
   This removes CSS-created letterboxing on TouchDesigner clips and photographs. */
.dialog-gallery[data-project="touchdesigner-studies"] .gallery-item video {
  object-fit: cover;
  background: transparent;
}
.project-card[data-project="touchdesigner-studies"] .project-image video {
  object-fit: cover;
  object-position: center;
}
.scan-error p { max-width: 620px; margin: 12px auto; }
.scan-error code { display: block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; opacity: .8; font-size: 10px; }


/* --- Reactive interface layer (v12) --- */
:root { --motion-ease: cubic-bezier(.18,.72,.2,1); --pointer-x: 50%; --pointer-y: 50%; }
body { overflow-x: clip; }
.scroll-progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 500; pointer-events: none; background: rgba(23,23,21,.07); }
#scroll-progress-fill { display: block; width: 0; height: 100%; background: var(--ink); transform-origin: left center; will-change: width; }
.site-header { position: relative; z-index: 20; }
nav { align-items: center; }
nav a { position: relative; padding: 7px 0; }
nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 1px; height: 1px; background: var(--ink); transition: right .35s var(--motion-ease); }
nav a:hover::after, nav a.is-current::after { right: 0; }
nav a.is-current { opacity: .75; }
.motion-toggle { display: inline-flex; gap: 7px; align-items: center; padding: 7px 0 7px 4px; border: 0; background: transparent; color: var(--muted); font: 10px "DM Mono", monospace; cursor: pointer; white-space: nowrap; }
.motion-toggle-dot { width: 6px; height: 6px; border-radius: 50%; background: #66875c; box-shadow: 0 0 0 3px rgba(102,135,92,.14); transition: background .2s, box-shadow .2s; }
.motion-toggle[aria-pressed="false"] .motion-toggle-dot { background: #9a9a93; box-shadow: none; }
.hero-image { isolation: isolate; position: relative; }
.hero-image .hero-shader-fallback { position: absolute; inset: 0; transition: opacity .4s ease; }
.hero-shader-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .4s ease; pointer-events: none; }
.hero-image.shader-ready .hero-shader-canvas { opacity: 1; }
.hero-image.shader-ready .hero-shader-fallback { opacity: 0; }
.hero-shader-ui { position: absolute; z-index: 2; inset: auto 16px 14px; display: flex; justify-content: space-between; gap: 20px; color: rgba(250,249,244,.9); text-shadow: 0 1px 9px rgba(0,0,0,.35); font: 9px "DM Mono", monospace; letter-spacing: .09em; text-transform: uppercase; pointer-events: none; }
.hero-shader-ui span:last-child { opacity: .76; }
.project-grid { perspective: 1200px; }
.project-card { position: relative; opacity: 1; translate: 0 18px; transform: perspective(1100px) rotateX(var(--tilt-y, 0deg)) rotateY(var(--tilt-x, 0deg)); transform-style: preserve-3d; transition: opacity .6s var(--motion-ease), translate .75s var(--motion-ease), transform .28s ease-out; will-change: transform; }
.js-interactions-ready .project-card { opacity: 0; }
.project-card.is-visible { opacity: 1; translate: 0 0; }
.project-image { isolation: isolate; }
.project-image::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; background: radial-gradient(260px circle at var(--pointer-x, 50%) var(--pointer-y, 50%), rgba(255,255,255,.17), rgba(255,255,255,.035) 38%, transparent 72%); mix-blend-mode: screen; transition: opacity .28s ease; }
.project-card:hover .project-image::after { opacity: 1; }
.project-image::before { content: "OPEN PROJECT ↗"; position: absolute; z-index: 3; right: 12px; bottom: 11px; font: 9px "DM Mono", monospace; letter-spacing: .08em; color: #f3f0e7; opacity: 0; transform: translateY(5px); transition: opacity .22s ease, transform .3s var(--motion-ease); text-shadow: 0 1px 8px rgba(0,0,0,.45); pointer-events: none; }
.project-card:hover .project-image::before, .project-card:focus-visible .project-image::before { opacity: .95; transform: translateY(0); }
.project-image img, .project-image video { transform: translate3d(calc((var(--pointer-xn, 0) * -8px)), calc((var(--pointer-yn, 0) * -6px)), 0) scale(1.035); transition: transform .7s var(--motion-ease), filter .25s ease; }
.project-card:hover .project-image img, .project-card:hover .project-image video { transform: translate3d(calc((var(--pointer-xn, 0) * -10px)), calc((var(--pointer-yn, 0) * -8px)), 0) scale(1.07); }
.project-meta { transition: transform .32s var(--motion-ease); }
.project-card:hover .project-meta { transform: translateX(4px); }
.project-meta strong { transition: letter-spacing .35s var(--motion-ease); }
.project-card:hover .project-meta strong { letter-spacing: -.015em; }
.project-year { transition: transform .3s var(--motion-ease), color .2s; }
.project-card:hover .project-year { transform: translateX(-3px); color: var(--ink); }
.pointer-ui { position: fixed; z-index: 600; top: 0; left: 0; width: 34px; height: 34px; display: grid; place-items: center; pointer-events: none; opacity: 0; transform: translate3d(-100px,-100px,0); mix-blend-mode: difference; color: #fff; transition: opacity .2s ease; }
.pointer-ui.is-active { opacity: 1; }
.pointer-ui-core { position: absolute; inset: 10px; border: 1px solid currentColor; border-radius: 50%; transition: inset .25s var(--motion-ease), border-radius .25s ease, background .2s ease; }
.pointer-ui-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%) scale(.8); opacity: 0; white-space: nowrap; font: 8px "DM Mono", monospace; letter-spacing: .08em; transition: opacity .15s ease, transform .2s var(--motion-ease); }
.pointer-ui.is-interactive { width: 76px; height: 76px; }
.pointer-ui.is-interactive .pointer-ui-core { inset: 0; border-radius: 50%; background: rgba(255,255,255,.12); }
.pointer-ui.is-interactive .pointer-ui-label { opacity: 1; transform: translate(-50%,-50%) scale(1); }
body.pointer-ui-enabled, body.pointer-ui-enabled a, body.pointer-ui-enabled button { cursor: none; }
body.motion-paused .pointer-ui, body.motion-paused .hero-shader-ui .shader-ui-hint { display: none; }
body.motion-paused .hero-shader-canvas { opacity: 0 !important; }
body.motion-paused .hero-shader-fallback { opacity: 1 !important; }
body.motion-paused .project-card { transform: none !important; }
body.motion-paused .project-image img, body.motion-paused .project-image video { transform: none !important; }
body.motion-paused .project-card, body.motion-paused .project-meta, body.motion-paused nav a::after { transition-duration: .01ms !important; }
@media (hover: none), (pointer: coarse) {
  .pointer-ui { display: none !important; }
  body, body a, body button { cursor: auto; }
  .project-card, .js-interactions-ready .project-card { opacity: 1; translate: 0 0; transform: none; }
  .project-card:hover .project-image::before { opacity: 0; }
}
@media (max-width: 680px) {
  .motion-toggle { font-size: 10px; }
  .hero-shader-ui { inset: auto 10px 10px; font-size: 8px; }
  .project-card, .js-interactions-ready .project-card { opacity: 1; translate: 0 0; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pointer-ui, .hero-shader-canvas, .project-image::after { display: none !important; }
  .project-card { opacity: 1; translate: 0 0; transform: none !important; }
}
