/* ------------------------------------------------------------------
   Manvi — portfolio
   The design is a 1512 × 982 Figma canvas. Each page renders that
   canvas 1:1 inside .stage, which main.js scales to fit the viewport.
   ------------------------------------------------------------------ */

:root {
  --bg: #f3f3f1;
  --ink: #212121;
  --ink-2: #343434;
  --muted: #939393;
  --grey: #5f5f5e;
  --light: #ededed;

  --yellow: #f8d71c;
  --orange: #e24000;
  --green: #457247;
  --pink: #f57cc3;
  --blue: #2d4a9d;
  --red: #d83b1a;
  --amber: #fba738;
  --wire: #c8011d;

  --s: 1;   /* stage scale, set by main.js */
  --ox: 0px; /* stage horizontal offset, set by main.js */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  overflow: clip; /* the oversized overlays must never make the page scroll */
  -webkit-font-smoothing: antialiased;
}
body { position: fixed; inset: 0; }

body { font-family: 'Poppins', sans-serif; color: var(--ink); }

a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
img { display: block; max-width: none; user-select: none; -webkit-user-drag: none; }

.stage {
  position: absolute;
  top: 0;
  left: var(--ox);
  width: 1512px;
  height: 982px;
  transform: scale(var(--s));
  transform-origin: 0 0;
}

.a { position: absolute; }

/* ---------- edge-to-edge frame (Home / About / Projects) ----------
   main.js lifts the header and footer out of the stage into these two
   full-width strips; the stage keeps only the content and is centred
   between them. */
html:not(.long) .stage { top: var(--oy, 0px); z-index: 1; pointer-events: none; }
:where(html:not(.long) .stage) > * { pointer-events: auto; } /* zero specificity: .night / .loader keep pointer-events:none */
.layer {
  position: fixed; left: 0; z-index: 0;
  width: calc(100vw / var(--s));
  transform: scale(var(--s));
  transition: opacity .3s ease;
}
.layer-top { top: 0; height: 74px; transform-origin: 0 0; }
.layer-bottom { bottom: 0; height: 66px; transform-origin: 0 100%; }
.layer-top .header-line { left: 0; width: 100%; }
.layer-top .nav { left: auto; right: 55px; }
.layer-bottom .foot-line { top: 28px; left: 196px; width: calc(100% - 401px); }
.layer-bottom .coord { top: 16px; }
.layer-bottom .coord-e { left: auto; right: 55px; }
html.leaving .layer { opacity: 0; }

/* ---------- type ---------- */
.poppins { font-family: 'Poppins', sans-serif; font-weight: 400; line-height: normal; }
.poppins-light { font-family: 'Poppins', sans-serif; font-weight: 300; line-height: normal; }
.raleway { font-family: 'Raleway', sans-serif; font-weight: 400; line-height: normal; }
.raleway-light { font-family: 'Raleway', sans-serif; font-weight: 300; line-height: normal; }
.questrial { font-family: 'Questrial', sans-serif; font-weight: 400; line-height: normal; }
.nowrap { white-space: nowrap; }

/* ---------- header ---------- */
.header-line {
  left: -6000px; width: 13512px; top: 73px; height: 0;
  border-top: var(--hair, 1.001px) solid #000;
}
.brand { left: 46px; top: 20px; width: 43.629px; height: 34.061px; }
.brand img { width: 43.629px; height: 34.061px; }

.nav {
  left: 1162px; top: 24px;
  display: flex; gap: 21px; align-items: center;
  font-size: 16.775px; white-space: nowrap;
}
.nav a, .nav span { color: var(--muted); transition: color .25s ease; position: relative; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav span { cursor: default; }
.nav a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px;
  background: var(--ink); transform: scaleX(0); transform-origin: left;
  transition: transform .3s ease;
}
.nav a:hover::after { transform: scaleX(1); }

/* ---------- footer ---------- */
/* hairlines: never thinner than one screen pixel, whatever the scale (--hair is set by main.js) */
.hl-line, .foot-line, .input-line { background: #000; }
.foot-line { left: 196px; top: 914px; width: 1111px; height: var(--hair, 1px); opacity: .22; }
.coord { top: 902px; font-size: 16.775px; color: #000; opacity: .66; text-align: right; }
.coord-n { left: 46px; width: 138px; }
.coord-e { left: 1320px; width: 137px; }

/* ---------- grid (home / about) ---------- */
.grid-frame {
  left: 105px; top: 287px; width: 1291px; height: 432px;
  border: var(--hair, 1px) solid var(--ink-2); opacity: .13;
}
.grid-h, .grid-v { background: var(--ink-2); opacity: .13; }
.grid-h { left: 106px; width: 1289px; height: var(--hair, 1px); }
.grid-v { top: 288px; height: 430px; width: var(--hair, 1px); }

/* ---------- reveal after loader ---------- */
.reveal { transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
html.loading .reveal,
html.hold .reveal:not(.persist):not(.hi-logo) { opacity: 0; transform: translateY(10px); }

/* ---------- About → Home: ABOUT folds back into the Hey, Hey slides home ---------- */
html.to-home .reveal:not(.persist) { opacity: 0; transform: none; transition: opacity .35s ease; transition-delay: 0s; }
html.to-home .card { opacity: 0; transition: opacity .3s ease; }
html.to-home .about-logo { clip-path: inset(0 100% 0 0); transition: clip-path .6s cubic-bezier(.65, .05, .3, 1) .1s; }
html.to-home .me { opacity: 0; transform: translateX(-14px); transition: opacity .25s ease, transform .3s ease; }
html.from-about .hi-logo { transform: translate(var(--hey-dx, -559px), var(--hey-dy, 1px)); }
html.hey-return .hi-logo { transition: transform .85s cubic-bezier(.65, .05, .3, 1); }

/* ---------- Home → About: "Hey" slides over and becomes "ABOUT" ---------- */
/* 1. on Home: everything but the shared frame and the Hey fades away… */
html.to-about .reveal:not(.persist):not(.hi-logo) {
  opacity: 0; transform: none; transition: opacity .35s ease; transition-delay: 0s;
}
/* …and the Hey glides left onto the ABOUT position (149, 332) */
html.to-about .hi-logo {
  transform: translate(var(--hey-dx, -559px), var(--hey-dy, 1px));
  transition: transform .8s cubic-bezier(.65, .05, .3, 1) .15s;
}
/* 2. on About: Hey sits where ABOUT will be, then ABOUT grows out of it */
.hey-ghost {
  left: 149px; top: 332px; width: 42.001px; height: 86px;
  transition: opacity .35s ease, transform .6s cubic-bezier(.65, .05, .3, 1);
}
.hey-ghost.go { opacity: 0; transform: scaleX(.6); transform-origin: left center; }
html.from-hey .about-logo { clip-path: inset(0 100% 0 0); }
html.from-hey .me { opacity: 0; transform: translateX(-14px); }
.about-logo { transition: clip-path .75s cubic-bezier(.65, .05, .3, 1); }
.me { transition: opacity .5s ease .45s, transform .6s cubic-bezier(.2, .8, .2, 1) .45s; }
html.morph .about-logo { clip-path: inset(0 0 0 0); }
html.morph .me { opacity: .5; transform: none; }
html.logo-pending .brand { opacity: 0; }
.reveal.d1 { transition-delay: .05s; }
.reveal.d2 { transition-delay: .15s; }
.reveal.d3 { transition-delay: .25s; }
.reveal.d4 { transition-delay: .35s; }

/* page-leave fade for nav clicks */
.stage { transition: opacity .3s ease; }
html.leaving .stage { opacity: 0; }

/* =================================================================
   LOADER
   ================================================================= */
.loader { position: absolute; inset: 0; z-index: 200; pointer-events: none; }
html:not(.loading):not(.loader-run) .loader { display: none; }

.loader-bg {
  position: absolute; left: -6000px; top: -6000px; width: 13512px; height: 13000px;
  background: var(--bg);
  transition: opacity .9s ease;
}
.loader.out .loader-bg { opacity: 0; }

/* the square: centred on the Figma rect (634,400 · 233×182) */
.loader-sq {
  position: absolute;
  left: 750.5px; top: 491px;
  width: 12px; height: 12px;
  transform: translate(-50%, -50%) scale(0);
  background: var(--yellow);
  transition:
    width 1.35s cubic-bezier(.7, 0, .25, 1),
    height 1.35s cubic-bezier(.7, 0, .25, 1),
    background-color .12s linear,
    opacity .5s ease,
    transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.loader.in .loader-sq { transform: translate(-50%, -50%) scale(1); }
.loader.grow .loader-sq { width: 233.128px; height: 182.001px; }
.loader.settle .loader-sq { background-color: var(--ink-2); transition-duration: 1.35s, 1.35s, .3s, .5s, .35s; }
.loader.swap .loader-sq { opacity: 0; transition: none; }

/* the cuts: background-coloured bars that drive into the dark box
   along the logo's gaps, breaking it into the M and the B */
.loader-cuts {
  position: absolute; left: 634px; top: 400px;
  width: 233.128px; height: 182.001px;
}
.cut {
  position: absolute; background: var(--bg);
  transition: transform .55s cubic-bezier(.75, 0, .2, 1);
}
.cut.y { transform: scaleY(0); }
.cut.x { transform: scaleX(0); }
.loader.carve .cut { transform: none; }
.loader.swap .loader-cuts { opacity: 0; }

.loader-logo {
  position: absolute;
  left: 634px; top: 400px;
  width: 233.128px; height: 182.001px;
  transform-origin: 0 0;
  opacity: 0;
  transition: transform 1.5s cubic-bezier(.65, .05, .3, 1), opacity .5s ease;
}
.loader.swap .loader-logo { opacity: 1; transition: transform 1.5s cubic-bezier(.65, .05, .3, 1), opacity 0s; }
/* 233.128 → 43.629 wide = 0.18714 ; lands on the header mark at (46,20) */
.loader.fly .loader-logo { transform: translate(var(--fly-x, -588px), var(--fly-y, -380px)) scale(var(--fly-scale, .18714)); }
.loader.land .loader-logo { opacity: 0; transition: opacity .45s ease; transform: translate(var(--fly-x, -588px), var(--fly-y, -380px)) scale(var(--fly-scale, .18714)); }
.loader.out .loader-bg { transition-duration: .8s; }
.brand { transition: opacity .45s ease; }

/* =================================================================
   HOME
   ================================================================= */
.yellow-panel { left: 106px; top: 288px; width: 238px; height: 430px; background: var(--yellow); }
.girl { left: 40px; top: 211px; width: 252px; height: 507px; object-position: bottom; }

.lamp-scene { left: 364px; top: 246px; width: 331.937px; height: 293px; }
.lamp-scene .red { left: 0; top: 41.924px; width: 241.894px; height: 214.906px; background: var(--red); }
.lamp-scene .desk { left: 0; top: 0; width: 331.937px; height: 293px; }

.folder-back { left: 364px; top: 538.72px; width: 497.21px; height: 179.367px; border-radius: 8.062px; background: #233568; }
.folder-tab { left: 364px; top: 521.07px; width: 251.529px; height: 44.61px; }
.folder-mid { left: 364px; top: 579.62px; width: 497.21px; height: 138.475px; border-radius: 8.062px; background: #294186; }
.folder-front { left: 364px; top: 609.36px; width: 497.21px; height: 108.736px; border-radius: 8.062px; background: var(--blue); }
.tag { width: 34.387px; height: 10.223px; border-radius: 1.152px 1.152px 0 0; }
.photog-a { left: 624.22px; top: 443px; width: 365.778px; height: 274.823px; object-position: bottom; transform: scaleX(-1); }
.photog-b { left: 802.95px; top: 443.05px; width: 187.047px; height: 290.114px; object-position: bottom; transform: scaleX(-1); }

.lamp-arm { left: 372.586px; top: 250.027px; width: 94.652px; height: 115.003px; }
.cable { left: 37.056px; top: 363.68px; width: 435.593px; height: 406.454px; pointer-events: none; }
.plug-tip { left: 345.55px; top: 763.49px; width: 8.215px; height: 11.295px; background: var(--wire); }
.plug { left: 337.34px; top: 758.36px; width: 8.215px; height: 22.591px; background: #2c4387; }

/* the switch */
.switch-nub {
  left: 119.31px; top: 735px; width: 8px; height: 8px; background: var(--wire);
  transition: transform .14s cubic-bezier(.3,.7,.4,1);
}
.wwm {
  left: 106.29px; top: 742.96px; width: 231.042px; height: 52.37px;
  background: var(--orange); border-radius: 1.027px;
  color: #fff; font-size: 24.053px; text-align: center;
  padding-top: 15.4px;
  transition: background-color .07s ease;
}
.wwm span { display: block; line-height: normal; }
.wwm:hover { background: #ec4a06; }
.wwm:focus-visible { outline: 2px solid var(--yellow); outline-offset: 4px; }
/* flat 2D switch: the nub on top pushes down into the button, the fill darkens for a beat */
.wwm.pressed { background: #c43800; }
html.lights-out .switch-nub, .switch-nub.pressed { transform: translateY(5px); }

.hi-logo { left: 708px; top: 331px; width: 42.001px; height: 86px; }
.hi-logo img { position: absolute; inset: 0; width: 42.001px; height: 86px; transition: opacity .8s ease; }
.hi-logo .light { opacity: 0; }

.its { left: 757px; top: 397px; width: 145px; font-size: 20px; color: var(--grey); transition: color .8s ease; }
.hi { left: 755px; top: 351px; font-size: 24.131px; color: #000; opacity: .5; transition: color .8s ease; }
.way { left: 1055px; top: 397px; width: 339px; font-size: 20px; color: var(--grey); text-align: right; }
.tagline { left: 923px; top: 259px; width: 473px; font-size: 12px; color: #000; text-align: right; }
.tap { left: 1314px; top: 615px; font-size: 12px; color: #000; }

.dot { transition: transform .3s cubic-bezier(.3,1.5,.5,1); }
.dot-ring { width: 86.374px; height: 86.374px; }

/* ---------- lights out ---------- */
.night {
  left: -6000px; top: -6000px; width: 13512px; height: 13000px;
  background: #000; opacity: 0; pointer-events: none;
  transition: opacity .55s ease;
  z-index: 50;
}
html.lights-out .night { opacity: .87; pointer-events: auto; cursor: pointer; }

/* elements that live above the dark (only while lights are out) */
html.lights-out .lit-1 { z-index: 60; }
html.lights-out .lit-2 { z-index: 61; }
html.lights-out .lit-3 { z-index: 62; }
html.lights-out .lit-4 { z-index: 63; }
html.lights-out .lit-5 { z-index: 64; }

/* only the yellow lamp light flickers; the scene itself stays as it is */

.lamp-light {
  left: 432.11px; top: 281.61px; width: 244.3px; height: 229.8px;
  opacity: 0; pointer-events: none; mix-blend-mode: screen;
  transition: opacity .3s ease;
}
html.lamp-on .lamp-light { opacity: 1; }
html.flicker .lamp-light { animation: light-flicker 1.9s linear forwards; }

/* a natural, irregular tube-style flicker that settles on */
@keyframes light-flicker {
  0%   { opacity: 0; }
  4%   { opacity: .85; }
  6%   { opacity: 0; }
  13%  { opacity: 0; }
  15%  { opacity: .6; }
  16%  { opacity: .1; }
  18%  { opacity: .7; }
  20%  { opacity: 0; }
  34%  { opacity: 0; }
  36%  { opacity: 1; }
  39%  { opacity: .3; }
  41%  { opacity: 1; }
  55%  { opacity: 1; }
  56.5%{ opacity: .45; }
  58%  { opacity: 1; }
  72%  { opacity: .9; }
  73%  { opacity: 1; }
  100% { opacity: 1; }
}

html.lights-out .its { color: var(--light); }
html.lights-out .hi { color: var(--light); }
html.lights-out .hi-logo .light { opacity: 1; }
html.lights-out .hi-logo .dark { opacity: 0; }

/* ---------- the message box ---------- */
#contact { position: absolute; inset: 0; z-index: 65; pointer-events: none; }
#contact .socials, #contact .contact-form { position: absolute; inset: 0; pointer-events: none; }
html.talk #contact a, html.talk #contact input, html.talk #contact button { pointer-events: auto; }
.contact { opacity: 0; pointer-events: none; transform: translateY(14px); transition: opacity .6s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
html.talk .contact { opacity: 1; transform: none; }
.contact.c2 { transition-delay: .08s; }
.contact.c3 { transition-delay: .16s; }

.lets { left: 912px; top: 231px; width: 145px; height: 24px; font-size: 20px; color: var(--light); }
.box { left: 912px; top: 263px; width: 484px; height: 154px; background: var(--orange); border-radius: 4px; }
.socials a { position: absolute; width: 16px; height: 16px; transition: transform .2s ease, opacity .2s; }
.socials a:hover { transform: translateY(-2px); }
.input-line { left: 923px; top: 394.25px; width: 462.001px; height: var(--hair-half, .5px); background: #ededed; opacity: .8; }
.msg {
  left: 923px; top: 396px; width: 440px; height: 18px;
  background: transparent; border: 0; outline: 0;
  font-family: 'Raleway', sans-serif; font-size: 12px; line-height: 18px; color: var(--light);
}
.msg::placeholder { color: var(--light); opacity: 1; }
.msg:focus::placeholder { opacity: .45; }
.send { left: 1369px; top: 395px; width: 20px; height: 20px; display: grid; place-items: center; transition: transform .25s ease; }
.send img { width: 12px; height: 12px; }
.send:hover { transform: translateX(3px); }
.send.sent { transform: translate(40px, -30px) rotate(-20deg); opacity: 0; transition: transform .6s ease-in, opacity .6s ease-in; }

/* =================================================================
   ABOUT
   ================================================================= */
.hl { background: #fde776; height: 17px; }
.about-logo { left: 149px; top: 332px; width: 128px; height: 85.001px; }
.me { left: 282px; top: 394px; font-size: 24.131px; color: #000; opacity: .5; }
.about-tag { left: 149px; top: 447px; width: 473px; font-size: 12px; color: #000; }
.bio { left: 151px; top: 597px; width: 284px; font-size: 12px; color: var(--ink); }
.bio p { line-height: normal; }
.notdesign { left: 713px; top: 651px; font-size: 12px; color: var(--ink); white-space: pre; }
.hobby { top: 688px; width: 100px; font-size: 12px; color: var(--ink); text-align: center; height: 17px; }

.card { transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
/* cards pop into frame when the page opens (after the loader, if it plays) */
html.hold .card { opacity: 0; }
html:not(.loading):not(.hold) .card { animation: card-pop .75s cubic-bezier(.3, 1.45, .45, 1) backwards; }
html:not(.loading):not(.hold) .card.p1 { animation-delay: .2s; }
html:not(.loading):not(.hold) .card.p2 { animation-delay: .38s; }
html:not(.loading):not(.hold) .card.p3 { animation-delay: .56s; }
html.loading .card { opacity: 0; }
@keyframes card-pop {
  0%   { opacity: 0; transform: translateY(60px) scale(.55) rotate(-8deg); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
.card:hover { transform: translateY(-6px) rotate(-1deg); }
.rot { display: flex; align-items: center; justify-content: center; }
.small { font-size: 10.496px; color: var(--ink); white-space: nowrap; }
.small p { line-height: normal; }

.resume {
  left: 106.29px; top: 742.96px; width: 231.042px; height: 52.37px;
  background: var(--orange); border-radius: 1.027px; color: #fff;
  transition: background-color .2s ease, transform .15s ease;
}
.resume:hover { background: #ec4a06; }
.resume:active { transform: translateY(2px); }
.resume .label { position: absolute; left: 59.71px; top: 16.04px; width: 89px; font-size: 24.053px; }
.resume img { position: absolute; left: 153.71px; top: 16.04px; width: 22px; height: 22px; }

/* =================================================================
   PROJECTS
   ================================================================= */
.proj-title { left: 81px; top: 150px; font-size: 24.131px; color: var(--ink); }
.pill {
  top: 151px; width: 209px; height: 27px; border: 1px solid var(--ink-2); border-radius: 17px;
  font-size: 16.775px; color: var(--ink); text-align: center; line-height: 25px;
  transition: background-color .2s ease, color .2s ease;
}
.pill:hover, .pill[aria-pressed="true"] { background: var(--ink-2); color: var(--bg); }

.pill { top: 162px; }
.project {
  width: 443px; height: 315px; border: var(--hair-half, .5px) solid #000; display: block;
  transition: left .6s cubic-bezier(.65,.05,.3,1), top .6s cubic-bezier(.65,.05,.3,1), opacity .35s ease, transform .35s ease;
}
.project.out { opacity: 0; transform: scale(.92); pointer-events: none; }
html:not(.loading) .project { animation: proj-in .6s cubic-bezier(.2,.8,.2,1) backwards; }
.project:nth-of-type(2) { animation-delay: .06s !important; }
.project:nth-of-type(3) { animation-delay: .12s !important; }
.project:nth-of-type(4) { animation-delay: .18s !important; }
.project:nth-of-type(5) { animation-delay: .24s !important; }
.project:nth-of-type(6) { animation-delay: .30s !important; }
html.loading .project { opacity: 0; }
@keyframes proj-in { from { opacity: 0; transform: translateY(16px); } }
.project .swatch { position: absolute; left: 10.5px; top: 8.5px; width: 422px; height: 250px; transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.project .name {
  position: absolute; left: -.5px; bottom: -.5px; width: 443px; height: 46px; border: var(--hair-half, .5px) solid #000;
  font-size: 16.775px; color: #000; text-align: center; padding-top: 9.5px;
}
.project:hover .swatch { transform: scale(.97); }
.project.hidden { opacity: .15; }

/* =================================================================
   CASE STUDIES (long, scrolling pages)
   ================================================================= */
html.long, html.long body { height: auto; overflow-x: hidden; overflow-x: clip; overflow-y: auto; }
html.long body { position: static; }
html.long { scroll-behavior: smooth; }
.cs-spacer { width: 1px; }
/* header + section tabs, pinned to the top (scaled like the stage) */
.cs-bar {
  position: fixed; top: 0; left: 0; z-index: 100;
  width: 1512px; height: 147px;
  transform: scale(var(--s)); transform-origin: 0 0;
}
.cs-bar::before {
  content: ''; position: absolute; left: -6000px; right: -6000px; top: 0; height: 147px;
  background: #fff; opacity: 0; transition: opacity .25s ease, box-shadow .25s ease;
}
.cs-bar { transition: opacity .3s ease; }
html.leaving .cs-bar { opacity: 0; }
.cs-bar.stuck::before { opacity: 1; box-shadow: 0 6px 18px rgba(0, 0, 0, .06); }
.case-study a { color: inherit; text-decoration: none; }
/* Figma/Tailwind default: borders are 0 unless a side is set. Without this, sides
   that only get border-style fall back to 3px and every table row grows. */
.case-study, .case-study *, .case-study *::before, .case-study *::after { border-width: 0; border-style: solid; }
.case-study .cs-nav, .case-study .subnav { transition: color .25s ease; }
.case-study .cs-nav:hover, .case-study .subnav:hover { color: #212121 !important; }
.case-study .subnav.on { color: #000 !important; }

/* placeholder case studies */
.ph-box { position: absolute; border: 1px solid #000; }
.ph-fill { position: absolute; background: #e6e6e3; }
.ph-line { position: absolute; height: 14px; background: #e6e6e3; border-radius: 2px; }

/* =================================================================
   STACKED LAYOUT — phones and portrait tablets (html.stack, see main.js)
   ================================================================= */
html.stack, html.stack body { height: auto; overflow-x: hidden; overflow-y: auto; }
html.stack body { position: static; }
html.stack { --sh: 1; --cz: 1; }

/* header: full width, pinned, scaled for small screens */
html.stack .layer-top {
  position: fixed; z-index: 70; background: var(--bg);
  transform: scale(var(--sh)); width: calc(100vw / var(--sh));
}
html.stack .layer-top .brand { left: 20px; }
html.stack .layer-top .nav { right: 20px; }
html.stack.lights-out .layer-top { z-index: 30; }

.stack-flow {
  position: relative;
  max-width: 760px; margin: 0 auto;
  padding: calc(74px * var(--sh) + 28px) 24px 0;
  display: flex; flex-direction: column; gap: 28px;
}
/* elements moved into the flow drop their canvas coordinates */
html.stack .stack-flow > .a,
html.stack .st-hero .a,
html.stack .st-proj-head .a,
html.stack .st-cards > .a,
html.stack .st-chips > .a,
html.stack .st-grid > .a { position: relative; left: auto !important; top: auto !important; }

/* windows: pixel-exact cropped views of the canvas */
.win { position: relative; width: 100%; overflow: hidden; }
.win-inner, html.stack .win > .stage {
  position: absolute; left: 0 !important; top: 0 !important; width: 1512px; height: 982px;
  transform-origin: 0 0;
}
html.stack .win > .stage { transition: opacity .3s ease; }

/* ---- home ---- */
.st-hero { display: flex; flex-direction: column; gap: 10px; }
.st-hi-row { display: flex; align-items: flex-end; gap: 10px; }
.st-hi-txt { display: flex; flex-direction: column; gap: 2px; padding-bottom: 4px; }
html.stack .st-hero .hi-logo { width: 42px; height: 86px; flex: none; }
html.stack .st-hero .hi { font-size: 28px; width: auto; }
html.stack .st-hero .its { font-size: 22px; width: auto; white-space: nowrap; }
html.stack .st-hero .way { width: auto; text-align: left; font-size: 18px; white-space: normal; }
html.stack .st-hero .tagline { width: auto; text-align: left; font-size: 13px; }
html.stack .win-illus { z-index: 1; background: var(--bg); }
html.stack.lights-out .win-illus { z-index: 50; }
.win-dots { max-width: 420px; }

.night-page {
  position: fixed; inset: 0; z-index: 40; background: #000;
  opacity: 0; pointer-events: none; transition: opacity .55s ease;
}
html.stack.lights-out .night-page { opacity: .87; pointer-events: auto; cursor: pointer; }
/* the message box floats at the bottom of the screen */
.win-contact {
  position: fixed; z-index: 60; left: 12px; right: 12px; bottom: 16px;
  width: auto; max-width: 620px; margin: 0 auto; pointer-events: none;
}

/* ---- about ---- */
.win-title { max-width: 320px; }
html.stack .about-tag { width: auto; font-size: 13px; }
html.stack .bio { width: auto; max-width: 420px; font-size: 14px; line-height: 1.5; }
html.stack .bio p { line-height: 1.5; }
html.stack .bio p:nth-child(2) { background: #fde776; display: inline-block; padding: 0 4px; }
.st-cards { display: flex; flex-direction: column; align-items: center; gap: 12px; }
html.stack .st-cards .card { position: relative; left: auto !important; top: auto !important; zoom: var(--cz); }
html.stack .notdesign { white-space: normal; font-size: 14px; margin-bottom: -14px; }
.st-chips { display: flex; flex-wrap: wrap; gap: 10px; }
html.stack .st-chips .hobby {
  position: relative; left: auto !important; top: auto; width: auto; height: auto;
  background: #fde776; padding: 3px 12px; font-size: 13px;
}
html.stack .resume { align-self: flex-start; flex: none; }
.st-hidden { display: none; }

/* ---- projects ---- */
.st-proj-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
html.stack .proj-title { font-size: 26px; }
html.stack .st-proj-head > div { display: flex; flex-wrap: wrap; gap: 8px; }
html.stack .pill { position: relative; left: auto !important; top: auto; width: auto !important; padding: 0 18px; height: 32px; line-height: 30px; font-size: 15px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
html.stack .project {
  position: relative; left: auto !important; top: auto !important;
  width: auto; height: auto; aspect-ratio: 443 / 315;
}
html.stack .project .swatch { left: 2.4%; top: 2.7%; width: 95.2% !important; height: 79.4% !important; }
html.stack .project .name {
  left: 0; right: 0; bottom: 0; width: auto; height: 14.6%;
  display: flex; align-items: center; justify-content: center; padding: 0; font-size: 15px;
}
html.stack .project.out { display: none; }

/* ---- footer: back in the page flow ---- */
html.stack .layer-bottom {
  position: relative; transform: none; width: auto; height: auto; z-index: auto;
  display: flex; align-items: center; gap: 14px; padding: 18px 0 26px; margin-top: 6px;
}
html.stack .layer-bottom > * { position: relative; left: auto; right: auto; top: auto; }
html.stack .layer-bottom .coord { width: auto; font-size: 12px; white-space: nowrap; }
html.stack .layer-bottom .foot-line { flex: 1; width: auto; min-width: 20px; height: 1px; order: 1; }
html.stack .layer-bottom .coord-e { order: 2; }

/* portrait tablets: more room, bigger type */
@media (min-width: 600px) {
  html.stack .st-hero .hi-logo { zoom: 1.4; }
  html.stack .st-hero .hi { font-size: 38px; }
  html.stack .st-hero .its { font-size: 30px; }
  html.stack .st-hero .way { font-size: 24px; }
  html.stack .st-hero .tagline, html.stack .about-tag { font-size: 16px; }
  html.stack .bio, html.stack .notdesign { font-size: 16px; }
  html.stack .layer-bottom .coord { font-size: 14px; }
  .win-dots { max-width: 520px; }
}

/* ---- loader: its own full-screen layer ---- */
.loader-wrap { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.loader-inner { position: absolute; left: 0; top: 0; width: 1512px; height: 982px; transform-origin: 0 0; }


/* =================================================================
   PHONE — iPhone frames (html.phone, 393 × 852 canvas)
   ================================================================= */
html.phone { --bg: #fff; }

/* header: logo left, hamburger right */
html.phone .layer-top .brand { left: 30px; top: 23px; }
.burger {
  left: auto; right: 36px; top: 26px; width: 32px; height: 28px;
  padding: 0; cursor: pointer; z-index: 2;
}
.burger i {
  position: absolute; left: 0; width: 32px; height: 3px; border-radius: 2px; background: #343434;
  transition: transform .35s cubic-bezier(.65,.05,.3,1), opacity .25s ease, top .35s cubic-bezier(.65,.05,.3,1);
}
.burger i:nth-child(1) { top: 2px; }
.burger i:nth-child(2) { top: 9px; }
.burger i:nth-child(3) { top: 16px; }
.burger i:nth-child(4) { top: 23px; }
html.menu-open .burger i:nth-child(1), html.menu-open .burger i:nth-child(4) { opacity: 0; }
html.menu-open .burger i:nth-child(2) { top: 12.5px; transform: rotate(45deg); }
html.menu-open .burger i:nth-child(3) { top: 12.5px; transform: rotate(-45deg); }
html.menu-open .layer-top { z-index: 170; }

/* the menu: a small dropdown under the hamburger — the page stays visible behind it */
.ph-scrim { position: fixed; inset: 0; z-index: 155; display: none; }
html.menu-open .ph-scrim { display: block; }
.ph-menu {
  position: fixed; z-index: 160;
  top: calc(74px * var(--s, 1) + 8px); right: 14px; width: 188px;
  background: #fff; border: 1px solid #212121;
  display: flex; flex-direction: column; padding: 6px 0;
  clip-path: inset(0 0 100% 0);
  transition: clip-path .32s cubic-bezier(.65,.05,.3,1);
  visibility: hidden;
}
html.menu-open .ph-menu { clip-path: inset(0 0 0 0); visibility: visible; }
.ph-menu a, .ph-menu .soon {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 16px;
  font-family: 'Poppins', sans-serif; font-size: 15px; color: #212121;
  opacity: 0; transform: translateY(-6px);
  transition: opacity .25s ease, transform .3s ease, background-color .15s ease;
  transition-delay: calc(.08s + var(--i) * .04s);
}
html.menu-open .ph-menu a, html.menu-open .ph-menu .soon { opacity: 1; transform: none; }
.ph-menu i { width: 10px; height: 10px; background: var(--c); flex: none; }
.ph-menu em { margin-left: auto; font-style: normal; font-size: 11px; color: #939393; }
.ph-menu a:active { background: #f3f3f1; }
.ph-menu a[aria-current="page"] { background: #f3f3f1; font-weight: 500; }
.ph-menu .soon { color: #b9b9b9; }
.ph-menu .soon i { opacity: .45; }

/* footer strip */
html.phone .layer-bottom { height: 52px; }
html.phone .layer-bottom .coord { top: 15px; font-size: 12px; }
html.phone .layer-bottom .coord-n { left: 20px; text-align: left; }
html.phone .layer-bottom .coord-e { right: 25px; }
html.phone .layer-bottom .foot-line { top: 24px; left: 131px; width: calc(100% - 266px); height: var(--hair, 1px); }

/* home */
.ph-tagline { left: 52px; top: 92px; width: 285px; font-size: 12px; color: #7e7d7d; text-align: center; }
.ph-tag { width: 14.759px; height: 4.388px; border-radius: .494px .494px 0 0; }
.ph-rot { display: flex; align-items: center; justify-content: center; }
html.phone .its, html.phone .hi { white-space: nowrap; }
html.phone.lights-out .switch-nub, html.phone .switch-nub.pressed { transform: translateY(2px); }
html.phone .hey-ghost { left: 49px; top: 229px; width: 36px; height: 73px; }

/* about: only the grid scrolls, one step at a time */
.ph-scroller {
  left: 40px; top: 305px; width: 330px; height: 285px;
  overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.ph-scroller::-webkit-scrollbar { display: none; }
.ph-panel { position: relative; height: 285px; scroll-snap-align: start; scroll-snap-stop: always; }
.ph-hint {
  left: 11px; top: 250px; font-size: 10px; color: #939393;
  animation: hint 1.6s ease-in-out infinite;
}
@keyframes hint { 50% { transform: translateY(4px); } }
html.phone .card {
  animation: none !important;
  opacity: 0; transform: translateY(46px) scale(.7) rotate(-6deg);
  transition: transform .7s cubic-bezier(.3,1.45,.45,1), opacity .4s ease;
}
html.phone .ph-panel.in .card { opacity: 1; transform: none; }
.ph-chip {
  width: 100px; height: 17px; background: #fde776; font-size: 12px; color: #212121;
  text-align: center; line-height: 17px;
}
html.phone .ph-panel .ph-chip:nth-of-type(3) { transition-delay: .06s; }
html.phone .ph-panel .ph-chip:nth-of-type(4) { transition-delay: .12s; }
html.phone .ph-panel .ph-chip:nth-of-type(5) { transition-delay: .18s; }
html.phone .ph-panel .ph-chip:nth-of-type(6) { transition-delay: .24s; }

/* projects: a scrolling list inside the screen */
.pill.ph-pill { top: 136px; height: 24px; line-height: 22px; font-size: 11px; padding: 0; }
.ph-list {
  left: 45.5px; top: 176px; width: 302px; height: 614px;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px;
  scroll-snap-type: y proximity; scrollbar-width: none;
}
.ph-list::-webkit-scrollbar { display: none; }
.ph-list .project {
  position: relative; flex: none; left: auto; top: auto;
  width: 302px; height: 215px; scroll-snap-align: start;
}
.ph-list .project .swatch { left: 7.2px; top: 6.1px; width: 287.6px; height: 170px; }
.ph-list .project .name { width: 302px; height: 32px; font-size: 12.5px; padding-top: 7px; }
.ph-list .project.out { display: none; }

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