:root {
  --fg: #000;
  --bg: #fff;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --accent: #0a7a99;
  --gutter: 24px;
  --col: 35vw;
  --display: "Anton", Impact, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.77, 0, .18, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
}

/* registered so they do NOT inherit: moving the cursor only restyles #frame, not every element inside it */
@property --px { syntax: "<number>"; inherits: false; initial-value: 0; }
@property --py { syntax: "<number>"; inherits: false; initial-value: 0; }
@property --tx { syntax: "<length-percentage>"; inherits: false; initial-value: -58%; }
@property --ty { syntax: "<length-percentage>"; inherits: false; initial-value: 8%; }
@property --rot { syntax: "<angle>"; inherits: false; initial-value: 11deg; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #000; }
body {
  font-family: var(--mono); font-size: 0.875rem; line-height: 1.6; letter-spacing: -0.01em;
  text-transform: uppercase; color: var(--fg); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---------- menu (sits behind the page) ---------- */
#menu {
  position: fixed; inset: 0; color: #fff; background: #000;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  padding: 0 var(--gutter); text-align: right;
}
#menu .menu-btn { position: absolute; top: 22px; right: var(--gutter); }
#menu { transform: scale(1.08); transition: transform .9s var(--ease); }
body.menu-open #menu { transform: none; }

#menu nav a {
  display: flex; align-items: flex-start; justify-content: flex-end; gap: 14px;
  font-family: var(--display); font-size: clamp(56px, 9vw, 130px); line-height: .95; letter-spacing: -0.02em;
  transition: opacity .3s, transform .5s var(--out), color .25s;
}
/* small index number that appears on hover */
#menu nav a::before {
  content: attr(data-n); font-family: var(--mono); font-size: .875rem; letter-spacing: 0; line-height: 1.6;
  margin-top: .5em; opacity: .55; transition: opacity .3s;
}
#menu nav a:hover::before { opacity: 1; }
#menu nav a:hover { color: #4cc3e3; transform: translateX(-10px); }
#menu nav:hover a:not(:hover) { opacity: .3; }
#menu nav a:active { transform: translateX(-10px) scale(.98); }

/* letters rise one by one when the menu opens, and drop when it closes */
#menu .lbl { display: inline-block; overflow: hidden; padding: .06em 0 .02em; }
#menu .ch { display: inline-block; transform: translateY(110%); transition: transform .45s var(--ease); }
body.menu-open #menu .ch {
  transform: none; transition: transform .8s var(--out);
  transition-delay: calc(.3s + var(--i) * 90ms + var(--c) * 28ms);
}

.menu-meta, .menu-foot { opacity: 0; transform: translateY(14px); transition: opacity .3s, transform .3s; }
body.menu-open .menu-meta, body.menu-open .menu-foot {
  opacity: 1; transform: none; transition: opacity .7s .8s, transform .8s .8s var(--out);
}
.menu-meta { margin-top: 8vh; display: flex; gap: 28px; }
.menu-meta a, .menu-foot a { text-decoration: underline; text-underline-offset: 3px; }
.menu-foot { position: absolute; bottom: 24px; right: var(--gutter); color: #9a9a9a; }

/* ---------- the page frame (tilts away when menu opens) ---------- */
#frame {
  position: fixed; inset: 0; background: var(--bg); overflow: hidden;
  transform-origin: 0 0; transition: transform .9s var(--ease), opacity .35s; will-change: transform;
}
#frame { --tx: -58%; --ty: 8%; --rot: 11deg; }
/* the tilted page holds still while the menu is open: re-tilting this huge layer on every mouse move was what made it lag */
body.menu-open #frame {
  transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
  cursor: pointer;
}
/* the cursor effect lives on the light menu links instead: they drift slightly toward the pointer */
#menu nav { transform: translate(calc(var(--mx, 0) * -14px), calc(var(--my, 0) * -10px)); transition: transform .35s var(--out); }
body.menu-open #frame > *, body.menu-open .header > * { pointer-events: none; }
#frame.leave { opacity: 0; }

/* custom scroll indicator on the left edge */
.sbar { position: absolute; top: 0; bottom: 0; left: 12px; width: 5px; background: #e6e6e6; z-index: 5; pointer-events: none; }
.sbar i { position: absolute; left: 0; top: 0; width: 5px; height: 48px; background: #000; will-change: transform; }

/* faint blueprint grid behind the empty left column of the content (not the footer) */
main { position: relative; }
main::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: var(--col); z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0) 55%, #fff 100%),
    linear-gradient(#d2d2d2 1px, transparent 1px),
    linear-gradient(90deg, #d2d2d2 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px; background-position: 0 0, var(--gutter) 0, var(--gutter) 0;
}
@media (max-width: 860px) { main::before { display: none; } }
/* narrow screens: the 3D model becomes a small corner model instead of disappearing */
@media (max-width: 860px) {
  #frame > .hero3d { left: auto; right: 10px; top: auto; bottom: 14px; transform: none !important; width: 150px; z-index: 6; }
}


#scroll {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth; scrollbar-width: none;
}
#scroll::-webkit-scrollbar { display: none; }

.header {
  position: absolute; inset: 0 0 auto 0; z-index: 10; pointer-events: none;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px var(--gutter); color: #000;
  /* translucent: content scrolls underneath, frosted by a blur */
  background: rgba(255,255,255,.72); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.header > * { pointer-events: auto; }
.logo, .menu-btn {
  font-family: var(--display); font-size: 18px; line-height: 1; text-transform: uppercase;
  letter-spacing: 0; background: none; border: 0; cursor: pointer;
}
.menu-btn { font-size: clamp(24px, 2.2vw, 32px); padding: 6px 0; }
.caption {
  position: absolute; left: var(--gutter); bottom: 28px; width: 200px; z-index: 10; font-size: .75rem; letter-spacing: 0;
  background: #fff; padding: 8px 10px; color: #000; pointer-events: none;
  opacity: 0; animation: fade .8s .9s forwards;
}
@keyframes fade { to { opacity: 1; } }

/* ---------- layout ---------- */
.page { padding: 0 var(--gutter) 0 var(--col); }
.hero { padding-top: 21vh; padding-bottom: 8vh; }
.eyebrow { display: flex; flex-direction: column; font-size: .75rem; letter-spacing: 0; margin-bottom: 44px; opacity: 0; animation: fade .7s .2s forwards; }

/* title: letters rise into place */
.title {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(56px, 10vw, 170px); line-height: 1; letter-spacing: -0.02em;
}
.title .w { display: inline-block; overflow: hidden; vertical-align: top; padding: .22em 0 .04em; margin: -.22em 0 -.04em; }
.title .ch { display: inline-block; transform: translateY(110%); }
.title.go .ch { transform: none; transition: transform .9s var(--out); transition-delay: calc(var(--i) * 35ms); }

/* ---------- image cards ---------- */
.card {
  display: block; position: relative; aspect-ratio: 5 / 4; overflow: hidden;
  margin-bottom: 14px; color: #fff;
}
.card canvas, .shot canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card canvas { transition: transform 1.2s var(--out); }
/* darkens the top and bottom edges so the white labels pass contrast on light artwork */
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.4), transparent 35%, transparent 50%, rgba(0,0,0,.45)); pointer-events: none; }
.card .top, .card .name { position: absolute; z-index: 1; }
.card .top {
  inset: 14px 14px auto; display: flex; justify-content: space-between;
  font-family: var(--display); font-size: 18px; letter-spacing: 0; line-height: 1.1;
}
.card .name {
  left: 14px; bottom: 6px; font-family: var(--display); line-height: .95; letter-spacing: -0.02em;
  font-size: clamp(48px, 8vw, 128px); transition: transform .6s var(--out);
}
.card:hover canvas { transform: scale(1.04); }
.card:hover .name { transform: translateX(12px); }
.shot { position: relative; aspect-ratio: 1; }
/* CV: portrait in its own column beside the text, staying in view while the text scrolls */
.cv { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; column-gap: 56px; align-items: start; }
.portrait { position: sticky; top: 90px; aspect-ratio: 4 / 5; width: 100%; }
.cv-text .lead { margin-top: 0; }
@media (max-width: 860px) {
  .cv { grid-template-columns: 1fr; }
  .portrait { position: relative; top: auto; width: min(340px, 100%); margin-bottom: 8vh; }
}
.portrait canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- text sections ---------- */
.lead { font-family: var(--mono); font-size: clamp(18px, 1.9vw, 24px); line-height: 1.5; letter-spacing: 0; text-transform: none; max-width: 30em; margin: 12vh 0; }
.block { margin-bottom: 9vh; max-width: 46em; }
.block p, .cv-item li, .cv-item p { text-transform: none; letter-spacing: 0; line-height: 1.6; }
.block h2 { font-family: var(--display); font-weight: 400; font-size: 16px; letter-spacing: 0; margin-bottom: 16px; }
.block p { margin-bottom: 10px; }
.block b { font-weight: 700; }
.muted { color: var(--muted); }
.cv-item { margin-bottom: 5vh; }
.cv-item ul { margin: 10px 0 0 18px; }
.cv-item li { margin-bottom: 6px; }
.cv { padding-top: 10vh; }

.link-arrow {
  font-family: var(--display); font-size: 18px; letter-spacing: 0; display: inline-flex; gap: 10px;
  border-bottom: 2px solid currentColor; padding-bottom: 2px; transition: gap .3s var(--out);
}
.link-arrow:hover { gap: 20px; }

.quote { margin: 16vh 0 12vh; font-family: var(--display); font-size: clamp(26px, 3.2vw, 46px); line-height: 1.1; letter-spacing: -0.01em; max-width: 18em; }
.quote small { display: block; margin-top: 20px; font: .75rem/1.6 var(--mono); letter-spacing: 0; }

.next { border-top: 1px solid var(--line); padding: 8vh 0 12vh; margin-top: 10vh; }
.next .title { font-size: clamp(56px, 8vw, 140px); transition: color .25s; }
.next .title .ch { transform: none; }
.next a:hover .title { color: var(--accent); }
.next p { max-width: 30em; margin: 18px 0 26px; }
.next .all { display: block; margin-top: 28px; }

/* ---------- dark skills section ---------- */
.skills {
  position: relative; background: #fff; color: #000; margin: 10vh 0 0 var(--col);
  display: grid; grid-template-columns: 1fr; min-height: 80vh; border-top: 1px solid #000;
}
.skills-graph { position: relative; height: 640px; border-bottom: 1px solid var(--line); }
.skills-graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.skills-list { padding: 48px 32px 64px; }
.skills-eyebrow { font-size: .75rem; letter-spacing: 0; margin-bottom: 28px; }
.skill-row { display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.skill-row:last-child { border-bottom: 1px solid var(--line); }
.skill-group { font-size: .75rem; letter-spacing: 0; color: var(--muted); padding-top: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  border: 1px solid #000; padding: 8px 12px; font-size: .8125rem; letter-spacing: 0;
  text-transform: none; transition: background .2s, color .2s;
}
.tag:hover { background: #000; color: #fff; }
@media (max-width: 860px) {
  .skills { margin-left: 0; grid-template-columns: 1fr; }
  .skills-graph { height: 460px; }
  .skills-list { padding: 40px var(--gutter) 56px; }
  .skill-row { grid-template-columns: 1fr; gap: 10px; }
  .skill-group { padding-top: 0; }
}

/* ---------- project index under the name ---------- */
.index { margin-top: 6vh; border-top: 1px solid #000; }
.index-row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 16px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px solid var(--line); transition: padding .3s var(--out);
}
.index-row .n { color: var(--muted); font-size: .75rem; letter-spacing: 0; }
.index-row .t { font-family: var(--display); font-size: clamp(26px, 3vw, 46px); line-height: 1.05; letter-spacing: -0.01em; text-transform: uppercase; transition: color .25s; }
.index-row .m { color: var(--muted); font-size: .75rem; letter-spacing: 0; }
.index-row:hover { padding-left: 12px; }
.index-row:hover .t { color: var(--accent); }
.peek { position: fixed; width: 220px; aspect-ratio: 4 / 5; pointer-events: none; z-index: 20; opacity: 0; transform: scale(.92); transition: opacity .2s, transform .3s var(--out); }
.peek.on { opacity: 1; transform: none; }
.peek canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; }
.peek canvas.on { opacity: 1; }
@media (max-width: 860px), (hover: none) { .peek { display: none; } .index-row .m { display: none; } .index-row { grid-template-columns: 32px 1fr; } }

/* the project cards now follow the skills section */
#work { margin-top: 10vh; }

/* ---------- footer ---------- */
.footer {
  position: relative; margin-top: 4vh; padding: 56px var(--gutter) 28px var(--col);
  display: grid; grid-template-columns: 1fr 1fr; gap: 36px;
}
.footer::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--fg); }
.footer h3 { font-family: var(--display); font-weight: 400; font-size: 16px; letter-spacing: 0; margin-bottom: 10px; }
.footer .big { grid-column: 1 / -1; font-family: var(--display); font-size: clamp(30px, 5.4vw, 88px); line-height: 1; letter-spacing: -0.01em; word-break: break-all; }
.footer .big a { transition: color .25s; }
.footer .big a:hover { color: var(--accent); }
.footer ul { list-style: none; }
.footer a:hover, .copy:hover { text-decoration: underline; }
.copy { background: none; border: 0; cursor: pointer; text-transform: inherit; text-decoration: underline; }
.legal { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; letter-spacing: 0; }

/* ---------- scroll reveal ---------- */
.rv { opacity: 0; transform: translateY(20px); transition: opacity .8s, transform .9s var(--out); }
.rv.in { opacity: 1; transform: none; }

/* ---------- 3D model in the empty left column (home only) ---------- */
.hero3d {
  /* fixed to the viewport, centred vertically in the empty left column */
  position: fixed; left: var(--gutter); top: 50%; transform: translateY(-50%);
  width: min(calc(var(--col) - var(--gutter) * 2), 62vh); aspect-ratio: 1;
  z-index: 0; pointer-events: none;
}
.hero3d canvas { width: 100%; height: 100%; display: block; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  :root { --col: var(--gutter); }
  body { font-size: .8125rem; }
  .caption { display: none; }
  .hero { padding-top: 17vh; }
  .title { font-size: clamp(48px, 15vw, 90px); }
  .footer { grid-template-columns: 1fr; }
  #frame { --tx: -72%; --ty: 6%; --rot: 10deg; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .title .ch, .rv { transform: none; opacity: 1; }
  .eyebrow, .caption { opacity: 1; }
}

/* ---------- press feedback (responds on touch-down, not release) ---------- */
a, button { -webkit-tap-highlight-color: transparent; }
.menu-btn, .logo, .link-arrow, .copy { transition: transform .1s ease-out, opacity .1s; }
.menu-btn:active, .logo:active, .link-arrow:active, .copy:active { transform: scale(.96); }
.card:active .name { transform: translateX(12px) scale(.99); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* reduced motion: no tilt, the page simply fades back to reveal the menu */
@media (prefers-reduced-motion: reduce) {
  body.menu-open #frame { transform: none; opacity: 0; }
  #menu, body.menu-open #menu { transform: none; }
  #menu .ch { transform: none; }
  #menu nav a:hover { transform: none; }
}

/* Apple guidance: touch targets at least 44 x 44 px, without changing their visual size */
.logo, .menu-btn, .copy, .legal a {
  min-width: 44px; min-height: 44px; display: inline-flex; justify-content: center;
}
/* the header controls keep their text at the top, so the enlarged tap area doesn't push the logo down */
.logo, .menu-btn { align-items: flex-start; }
.legal a { padding: 12px 0; }

/* while the menu is open the page moves under the cursor: drop the header blur, which is costly to redraw every frame */
body.menu-open .header { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* reduced transparency: a solid header instead of the frosted one */
@media (prefers-reduced-transparency: reduce) {
  .header { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- project page: numbered sections with bigger type ---------- */
.sec { display: grid; grid-template-columns: 64px 1fr; gap: 16px; margin-bottom: 9vh; max-width: 52em; }
.sec-n { font-family: var(--display); font-size: 18px; color: var(--accent); padding-top: 10px; }
.sec h2 { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 4.2vw, 60px); line-height: 1; letter-spacing: -0.01em; margin-bottom: 20px; }
.sec p { font-family: var(--mono); font-size: clamp(16px, 1.35vw, 19px); line-height: 1.55; letter-spacing: 0; text-transform: none; }
.shot.break { max-width: 46em; }
@media (max-width: 860px) { .sec { grid-template-columns: 1fr; gap: 6px; } .sec-n { padding-top: 0; } }

/* ---------- project text boxes: ONE box style for every project; only the placement differs ---------- */
.sec { border: 1px solid #000; padding: 28px 32px; margin-bottom: 4vh; }

/* 1: stacked, aligned to the left */
.lay-1 .sec { margin-left: 0; }

/* 2: two columns, boxes side by side */
.lay-2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; row-gap: 24px; align-items: stretch; }
.lay-2 .lead, .lay-2 .shot, .lay-2 .quote, .lay-2 .next { grid-column: 1 / -1; }
.lay-2 .sec { margin-bottom: 0; }
.lay-2 .shot.break { display: none; } /* keeps the four boxes in a clean 2 x 2 grid */

/* 3: zig-zag, boxes alternate between the left and the right */
.lay-3 .s1, .lay-3 .s3 { margin-left: 0; margin-right: 22%; }
.lay-3 .s2, .lay-3 .s4 { margin-left: 22%; margin-right: 0; }

/* 4: staircase, each box steps a little further to the right */
.lay-4 .s1 { margin-left: 0; }
.lay-4 .s2 { margin-left: 7%; }
.lay-4 .s3 { margin-left: 14%; }
.lay-4 .s4 { margin-left: 21%; }

@media (max-width: 860px) {
  .lay-2 { display: block; }
  .lay-2 .sec { margin-bottom: 4vh; }
  .lay-3 .sec, .lay-4 .sec { margin-left: 0 !important; margin-right: 0 !important; }
}
