/* ═══════════════════════════════════════════════════════════════
   ANDIE FACHREZI — HOME (v2)
   White, orange, black. One idea everywhere: "I design it, then I build it."
   Hold W (or press and hold the name) to see the whole page as a wireframe.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #FFFFFF;
  --orange: #FF5400;  /* primary — the logo orange */
  --ink: #111111;     /* secondary — black */
  --paper: #FFFFFF;
  --tint: #FFF4EC;    /* light orange for alternating sections */
  --muted: #5E5E5E;
  --line: rgba(17, 17, 17, .14);
  --mono: 'JetBrains Mono', monospace;
  --flex: 'Roboto Flex', sans-serif;
  --pad: 28px;
  /* wireframe placeholders (overridden on dark sections) */
  --wf-bg: var(--bg);
  --wf-ln: var(--ink);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font-family: 'Space Grotesk', sans-serif; line-height: 1.5; overflow-x: clip; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--orange); color: var(--ink); }

.skip { position: absolute; left: -9999px; top: 12px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 16px; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

/* ═══════════════════════ HERO ═══════════════════════ */
.poster {
  position: relative; height: 100vh; height: 100svh;
  display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr);
  padding: 22px var(--pad);
  overflow-x: clip; overflow-y: visible; /* clip sideways (guide lines run edge to edge), but let the polaroid shadow fall past the bottom */
}

/* 8px grid: visible in wireframe mode, and flashes when the polaroid snaps */
.grid8 {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s;
  background-image:
    linear-gradient(rgba(255,84,0,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,84,0,.14) 1px, transparent 1px);
  background-size: 8px 8px;
}
.grid8.flash { opacity: 1; transition: none; }

.meta {
  display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 16px 40px; align-items: center;
  font-size: 13px; line-height: 1.35; position: relative; z-index: 3;
}
.meta .end { justify-self: end; text-align: right; }
.meta b { display: block; font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .1em; margin-bottom: 4px; }

.type { align-self: start; position: relative; z-index: 2; cursor: crosshair; font-weight: inherit; }
.word {
  position: relative; display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--flex); line-height: .8; text-transform: uppercase; white-space: nowrap; user-select: none;
}
.w1 { color: var(--orange); }
.w2 { color: var(--ink); margin-top: .02em; }

.ch { position: relative; display: inline-block; font-variation-settings: 'wght' 1000, 'wdth' 112, 'opsz' 144; }
.ch .f { display: block; transition: opacity .25s; }
.ch .o { position: absolute; inset: 0; color: transparent; -webkit-text-stroke: 1.5px var(--ink); opacity: 0; transition: opacity .25s; }
.w1 .ch .o { -webkit-text-stroke-color: var(--orange); }

/* selection box + handles (letters, preview card) */
.ch::after {
  content: ''; position: absolute; inset: .026em -.03em .06em; pointer-events: none;
  border: 1.5px solid var(--orange); opacity: 0; transition: opacity .2s;
}
.hd { position: absolute; width: 9px; height: 9px; background: var(--bg); border: 1.5px solid var(--orange); pointer-events: none; }
.ch .hd { opacity: 0; transition: opacity .2s; }
.ch .hd.a { left: calc(-.03em - 4px); top: calc(.026em - 4px); }
.ch .hd.b { right: calc(-.03em - 4px); top: calc(.026em - 4px); }
.ch .hd.c { left: calc(-.03em - 4px); bottom: calc(.06em - 4px); }
.ch .hd.d { right: calc(-.03em - 4px); bottom: calc(.06em - 4px); }
.ch.focus::after, .ch.focus .hd { opacity: 1; }

/* guide lines: cap height + baseline */
.word::before, .word::after {
  content: ''; position: absolute; left: calc(-1 * var(--pad)); right: calc(-1 * var(--pad)); height: 0;
  border-top: 1px dashed rgba(255,84,0,.7); opacity: 0; transition: opacity .3s; pointer-events: none;
}
.word::before { top: .026em; }
.word::after { bottom: .06em; }
.type.inspect .word::before, .type.inspect .word::after { opacity: 1; }

.tag {
  position: absolute; z-index: 4; pointer-events: none; white-space: pre;
  font: 500 11px var(--mono); background: var(--ink); color: var(--paper);
  padding: 3px 7px; transform: translateY(-100%); opacity: 0; transition: opacity .2s;
}
.tag.on { opacity: 1; }

.foot { position: relative; z-index: 3; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.foot p { max-width: min(520px, calc(50vw - 60px)); font-size: 16px; } /* stays clear of the polaroid at 50vw */
.foot p b, .hl { background: var(--orange); color: var(--ink); font-weight: 600; padding: 0 5px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns a {
  font-weight: 600; font-size: 15px; padding: 15px 24px; border-radius: 999px; text-decoration: none;
  background: var(--orange); color: var(--ink); transition: transform .2s;
}
.btns a.g { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.btns a:hover { transform: translateY(-2px); }

.polaroid {
  position: absolute; left: 50vw; bottom: 4vh; width: clamp(140px, min(15vw, 26vh), 240px); z-index: 5;
  background: var(--paper); padding: 10px 10px 42px; transform: rotate(5deg);
  box-shadow: 0 0 0 1px rgba(17,17,17,.08), 0 18px 40px rgba(17,17,17,.18); cursor: grab; touch-action: none;
}
.polaroid:active { cursor: grabbing; }
.polaroid .ph { aspect-ratio: 1; background: #ccc url('../assets/photo-andie-720.jpg?v=2') center / cover; }
.polaroid figcaption { position: absolute; left: 0; right: 0; bottom: 11px; text-align: center; color: #222; font-size: 13px; font-weight: 500; }
.tape { position: absolute; top: -12px; left: 50%; width: 84px; height: 22px; transform: translateX(-50%) rotate(-4deg); background: var(--orange); opacity: .85; }

.toast {
  position: absolute; z-index: 6; pointer-events: none; font: 500 11px var(--mono);
  background: var(--ink); color: var(--paper); padding: 4px 8px; opacity: 0; transition: opacity .3s;
}
.toast.on { opacity: 1; }

/* ═══════════════════════ TOOLBAR ═══════════════════════ */
.toolbar {
  position: fixed; left: 50%; bottom: 18px; z-index: 50;
  display: flex; gap: 2px; padding: 5px; border-radius: 999px; background: var(--ink);
  box-shadow: 0 10px 30px rgba(17,17,17,.25);
  transform: translate(-50%, 160%); transition: transform .5s cubic-bezier(.2,.9,.2,1);
  max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.toolbar.show { transform: translate(-50%, 0); }
body.lb-open .toolbar { visibility: hidden; }
.toolbar a {
  color: var(--paper); text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap;
  padding: 9px 15px; border-radius: 999px; transition: background .2s, color .2s;
}
.toolbar a:hover { background: rgba(255,255,255,.12); }
.toolbar a.on { background: var(--orange); color: var(--ink); }

/* phones only: current section + Menu, and the sheet it opens */
.tb-menu, .sheet { display: none; }
.tb-menu { align-items: center; gap: 4px; color: var(--paper); font-size: 14px; font-weight: 600; }
.tb-cur { padding: 10px 14px 10px 18px; white-space: nowrap; } /* "Side projects" stays on one line */
.tb-open { white-space: nowrap; }
.tb-open { background: var(--orange); color: var(--ink); padding: 10px 18px; border-radius: 999px; }

.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(17,17,17,.35); opacity: 0; transition: opacity .3s; }
.sheet-panel {
  position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 18px 20px 22px;
  background: var(--ink); color: var(--paper); border-radius: 24px;
  transform: translateY(calc(100% + 16px)); transition: transform .45s cubic-bezier(.2,.9,.2,1);
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet:not(.open) { pointer-events: none; }
.sheet:not(.open) .sheet-panel { visibility: hidden; transition: transform .45s cubic-bezier(.2,.9,.2,1), visibility 0s .45s; }
.sheet-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sheet-close { font: 500 12px var(--mono); text-transform: uppercase; color: var(--paper); padding: 8px 12px; border: 1.5px solid rgba(255,255,255,.3); border-radius: 999px; }
.sheet-links { display: flex; flex-direction: column; }
.sheet-links a {
  font-family: var(--flex); text-transform: uppercase; text-decoration: none; color: var(--paper);
  font-size: clamp(34px, 11vw, 48px); line-height: 1; padding: 8px 0;
  font-variation-settings: 'wght' 950, 'wdth' 100, 'opsz' 144; border-bottom: 1px solid rgba(255,255,255,.12);
  transition: font-variation-settings .35s cubic-bezier(.2,.9,.2,1), color .2s;
}
.sheet-links a.on { color: var(--orange); }
.sheet-links a:active { font-variation-settings: 'wght' 250, 'wdth' 40, 'opsz' 144; }
.sheet-mail { display: inline-block; margin-top: 16px; font: 500 13px var(--mono); color: rgba(255,255,255,.7); }
body.sheet-open { overflow: hidden; }
body.wire .sheet-panel, body.wire .tb-open, body.wire .sheet-close { border-radius: 0; }

/* ═══════════════════════ SECTIONS ═══════════════════════ */
.sec { position: relative; padding: 120px var(--pad); }
.sec-tint { background: var(--tint); }
.sec-dark { background: var(--ink); color: var(--paper); --wf-bg: var(--ink); --wf-ln: var(--paper); }

.sec-head { display: grid; grid-template-columns: 1fr minmax(240px, 380px); align-items: end; gap: 12px 48px; margin-bottom: 64px; }
.frame-label { display: block; font: 500 12px var(--mono); color: var(--orange); text-transform: uppercase; letter-spacing: .08em; }
.sec-head .frame-label { grid-column: 1 / -1; }
.sec-note { font-size: 16px; color: var(--muted); padding-bottom: .6em; }
.sec-dark .sec-note { color: rgba(255,255,255,.65); }

/* section headings: built letter by letter (same mechanic as the name) */
.build {
  font-family: var(--flex); font-size: clamp(48px, 8.4vw, 150px); line-height: .84; text-transform: uppercase;
  font-weight: 900; font-variation-settings: 'wght' 1000, 'wdth' 100, 'opsz' 144; white-space: nowrap;
}
.build .lc { display: inline-block; font-variation-settings: 'wght' 1000, 'wdth' 100, 'opsz' 144; -webkit-text-stroke: 1.5px transparent; transition: font-variation-settings .25s ease-out, color .2s, -webkit-text-stroke-color .2s; }
.build .lc.sp { width: .22em; }
.wd { display: inline-block; white-space: nowrap; }
.build .lc.thin { color: transparent; -webkit-text-stroke-color: var(--orange); }
/* before it scrolls into view: a thin outline, like the start of the hero intro */
.js .build .lc.pre { font-variation-settings: 'wght' 120, 'wdth' 25, 'opsz' 144; color: transparent; -webkit-text-stroke-color: currentColor; }
.js .build .lc.pre.go { transition: font-variation-settings .9s cubic-bezier(.2,.9,.2,1), color .3s .45s, -webkit-text-stroke-color .3s .45s; }

/* ═══════════════════════ SELECTED WORK ═══════════════════════ */
.work-list { list-style: none; border-top: 1.5px solid var(--ink); }
.work-row {
  position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) 260px 64px; gap: 24px; align-items: center;
  padding: 26px 0; border-bottom: 1.5px solid var(--ink); text-decoration: none; color: var(--ink);
}
.w-num { font: 500 13px var(--mono); color: var(--orange); align-self: start; padding-top: .9em; }
.w-name {
  display: block; font-family: var(--flex); text-transform: uppercase; line-height: .9;
  font-size: clamp(34px, 5.2vw, 84px); font-variation-settings: 'wght' 950, 'wdth' 100, 'opsz' 144;
  -webkit-text-stroke: 1.5px transparent;
  transition: font-variation-settings .45s cubic-bezier(.2,.9,.2,1), color .25s, -webkit-text-stroke-color .25s;
}
.w-desc { display: block; margin-top: 10px; font-size: 15px; color: var(--muted); max-width: 520px; }
.w-tags { font: 500 12px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.w-year { font: 500 13px var(--mono); text-align: right; }
.w-thumb { display: none; }
.work-row:hover .w-name, .work-row:focus-visible .w-name {
  font-variation-settings: 'wght' 260, 'wdth' 40, 'opsz' 144; color: transparent; -webkit-text-stroke-color: var(--orange);
}
.work-row:hover .w-year { color: var(--orange); }
/* self-initiated concept, labelled so it never reads as client work */
.work-row.is-concept .w-name::after {
  content: 'Concept'; display: inline-block; vertical-align: .9em; margin-left: .45em;
  font: 500 12px var(--mono); letter-spacing: .06em; padding: 4px 9px; border: 1.5px solid var(--ink); border-radius: 999px;
  -webkit-text-stroke: 0; color: var(--ink);
}

.preview {
  position: fixed; left: 0; top: 0; z-index: 40; width: 380px; pointer-events: none;
  opacity: 0; transform: translate(-50%, -50%) scale(.85); transition: opacity .2s, transform .25s;
  border: 1.5px solid var(--orange); background: var(--bg);
}
.preview.on { opacity: 1; }
.preview-img { aspect-ratio: 4 / 3; overflow: hidden; }
.preview-img img { width: 100%; height: 100%; object-fit: cover; }
.preview .hd.a { left: -5px; top: -5px; } .preview .hd.b { right: -5px; top: -5px; }
.preview .hd.c { left: -5px; bottom: -5px; } .preview .hd.d { right: -5px; bottom: -5px; }
.preview-tag {
  position: absolute; left: -1.5px; top: -1.5px; transform: translateY(-100%); white-space: nowrap;
  font: 500 11px var(--mono); background: var(--orange); color: var(--ink); padding: 3px 7px;
}

/* ═══════════════════════ PROCESS (flow) ═══════════════════════ */
.flow { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 56px; counter-reset: n; }
.node {
  position: relative; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 16px; padding: 24px 22px 26px;
  display: flex; flex-direction: column; gap: 12px; transition: transform .3s, box-shadow .3s;
}
.node:hover { transform: translateY(-4px); box-shadow: 6px 6px 0 var(--ink); }
.node-type { font: 500 12px var(--mono); color: var(--orange); text-transform: uppercase; letter-spacing: .06em; }
.node h3 { font-size: 21px; line-height: 1.2; font-weight: 600; }
.node p { font-size: 15px; color: #333; }
.node a { margin-top: auto; padding-top: 6px; font-weight: 600; font-size: 14px; text-decoration: none; border-bottom: 1.5px solid var(--orange); align-self: start; }
.node a:hover { color: var(--orange); }
.port { position: absolute; top: 34px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--orange); z-index: 2; }
.port.in { left: -7px; } .port.out { right: -7px; }
.node:first-child .port.in, .node:last-child .port.out { display: none; }
/* connector to the next node, drawn when the flow scrolls into view */
.node:not(:last-child)::after {
  content: ''; position: absolute; top: 39px; left: calc(100% + 6px); width: calc(56px - 12px); height: 1.5px;
  background: var(--orange); transform-origin: left; transform: scaleX(var(--draw, 1)); transition: transform .5s ease-out;
}
.js .flow:not(.in) .node::after { --draw: 0; }
.js .flow.in .node:nth-child(1)::after { transition-delay: .2s; }
.js .flow.in .node:nth-child(2)::after { transition-delay: .5s; }
.js .flow.in .node:nth-child(3)::after { transition-delay: .8s; }

/* ═══════════════════════ 3D TILES ═══════════════════════ */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; perspective: 1400px; }
.tile { text-align: left; display: block; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.9,.2,1); will-change: transform; }
.tile-img { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 16px; background: #f2f2f2; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; }
/* light catching the tile, follows the tilt */
.tile-img::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255,255,255,.45), transparent 55%);
}
.tile:hover .tile-img::before { opacity: 1; }
.tile-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 2px 0; }
.tile-cap b { font-size: 16px; font-weight: 600; }
.tile-cap i { font: 500 11px var(--mono); font-style: normal; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ═══════════════════════ SIDE PROJECTS (rail) ═══════════════════════ */
.sec-dark .build { color: var(--paper); }
.rail {
  display: flex; gap: 28px; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 8px var(--pad) 28px;
  scrollbar-width: none; cursor: grab; user-select: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail.dragging { cursor: grabbing; }
.rail.dragging .browser { pointer-events: none; }
.browser {
  flex: 0 0 clamp(260px, 44vw, 660px); text-decoration: none; color: var(--paper);
  border-radius: 14px; overflow: hidden; background: #1E1E1E; border: 1.5px solid #2E2E2E; transition: transform .3s, border-color .3s;
}
.browser:hover { transform: translateY(-6px); border-color: var(--orange); }
.chrome { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1.5px solid #2E2E2E; }
.chrome i { width: 10px; height: 10px; border-radius: 50%; background: #444; }
.chrome i:first-child { background: var(--orange); }
.url { margin-left: 10px; flex: 1; font: 500 12px var(--mono); color: rgba(255,255,255,.55); background: #151515; border-radius: 6px; padding: 4px 10px; }
.browser:hover .url { color: var(--orange); }
.shot { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.browser:hover .shot img { transform: scale(1.03); }
.b-cap { display: block; padding: 16px 18px 20px; font-size: 14px; color: rgba(255,255,255,.65); }
.b-cap b { display: block; color: var(--paper); font-family: var(--flex); font-size: 22px; font-variation-settings: 'wght' 900, 'wdth' 110, 'opsz' 144; margin-bottom: 4px; }
.rail-bar { height: 2px; background: rgba(255,255,255,.15); margin-top: 6px; }
.rail-bar span { display: block; height: 100%; background: var(--orange); transform-origin: left; transform: scaleX(.2); }

/* ═══════════════════════ ABOUT ═══════════════════════ */
.about { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 72px; }
.about-text p { font-size: 18px; color: #333; margin-bottom: 18px; max-width: 600px; }
.about-text .lead { font-family: var(--flex); font-size: clamp(30px, 3.6vw, 52px); line-height: 1.02; color: var(--ink); font-variation-settings: 'wght' 850, 'wdth' 100, 'opsz' 144; margin-bottom: 28px; }
.about-side { display: grid; gap: 44px; }
.log ol { list-style: none; margin-top: 14px; border-top: 1.5px solid var(--ink); }
.log li { display: grid; grid-template-columns: 120px 1fr; gap: 2px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.log .v { grid-row: span 2; font: 500 12px var(--mono); color: var(--orange); padding-top: 3px; }
.log b { font-weight: 600; }
.log i { font-style: normal; color: var(--muted); font-size: 14px; }
.kit ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 24px; }
.kit li { padding: 6px 13px; border: 1.5px solid var(--ink); border-radius: 999px; font-size: 14px; transition: background .2s; }
.kit li:hover { background: var(--orange); }

/* ═══════════════════════ CONTACT ═══════════════════════ */
.contact { padding: 120px var(--pad) 80px; border-top: 1.5px solid var(--ink); }
.contact-lead { font-size: clamp(18px, 1.6vw, 22px); max-width: 560px; margin-top: 16px; }
.say {
  display: flex; justify-content: space-between; align-items: baseline; margin: 40px 0 28px; text-decoration: none;
  font-family: var(--flex); line-height: .8; text-transform: uppercase; color: var(--orange); white-space: nowrap; user-select: none;
}
.say .lc { display: inline-block; font-variation-settings: 'wght' 1000, 'wdth' 112, 'opsz' 144; -webkit-text-stroke: 2px transparent; transition: font-variation-settings .25s ease-out, color .2s, -webkit-text-stroke-color .2s; }
.say .lc.sp { width: .38em; flex: none; }
.say .lc.thin { color: transparent; -webkit-text-stroke-color: var(--orange); }
.mail-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mail { font-size: clamp(20px, 2.4vw, 34px); font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--ink); }
.mail:hover { color: var(--orange); border-color: var(--orange); }
.copy { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 8px 14px; border: 1.5px solid var(--ink); border-radius: 999px; }
.copy:hover { background: var(--ink); color: var(--paper); }
.copy.done { background: var(--orange); border-color: var(--orange); color: var(--ink); }

/* ═══════════════════════ FOOTER ═══════════════════════ */
/* logo left, copyright centred on the page, back-to-top right */
.site-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 22px var(--pad) 90px; border-top: 1px solid var(--line); font-size: 13px; }
.foot-logo { justify-self: start; }
.foot-logo img { width: 44px; height: auto; }
.foot-note { justify-self: end; font: 500 12px var(--mono); color: var(--muted); text-decoration: none; text-transform: uppercase; letter-spacing: .06em; }
.foot-note:hover { color: var(--orange); }

/* ═══════════════════════ LIGHTBOX ═══════════════════════ */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(255,255,255,.96); display: grid; place-items: center; padding: 72px 24px 24px; }
.lightbox[hidden] { display: none; }
.lightbox figure { display: flex; flex-direction: column; align-items: center; min-height: 0; }
/* the image takes whatever height is left after the close button (72px), the caption and the bottom padding,
   so it never runs off the screen, on any window size */
.lightbox img {
  width: auto; height: auto; max-width: 100%;
  max-height: calc(100vh - 72px - 24px - 44px); max-height: calc(100dvh - 72px - 24px - 44px);
  border-radius: 16px; box-shadow: 0 20px 60px rgba(17,17,17,.2);
}
.lightbox figcaption { margin-top: 14px; font: 500 12px var(--mono); text-transform: uppercase; text-align: center; }
.lb-close { position: absolute; top: 18px; right: 22px; font: 500 12px var(--mono); text-transform: uppercase; padding: 9px 14px; border: 1.5px solid var(--ink); border-radius: 999px; }
.lb-close:hover { background: var(--ink); color: var(--paper); }

/* ═══════════════════════ REVEAL ═══════════════════════ */
.js .rise { opacity: 0; transform: translateY(28px); transition: opacity .7s, transform .7s cubic-bezier(.2,.9,.2,1); }
.js .rise.in { opacity: 1; transform: none; }

/* ═══════════════════════ WIREFRAME MODE ═══════════════════════
   Every image becomes a crossed placeholder, every letter its outline,
   every rounded shape a plain box: the page as it looked before it was designed. */
body.wire { background-image: linear-gradient(rgba(255,84,0,.10) 1px, transparent 1px), linear-gradient(90deg, rgba(255,84,0,.10) 1px, transparent 1px); background-size: 8px 8px; }
body.wire .grid8 { opacity: .6; }
body.wire .sec-tint { background: transparent; }

.img { position: relative; }
.img::after {
  content: ''; position: absolute; inset: 0; z-index: 3; display: none; pointer-events: none;
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), var(--wf-ln) 50%, transparent calc(50% + 1px)),
    linear-gradient(to top left, transparent calc(50% - 1px), var(--wf-ln) 50%, transparent calc(50% + 1px)),
    var(--wf-bg);
  box-shadow: inset 0 0 0 1.5px var(--wf-ln);
}
body.wire .img::after { display: block; }

body.wire .ch .f { opacity: 0 !important; }
body.wire .ch .o { opacity: 1 !important; }
body.wire .ch::after { opacity: .45; border-style: dashed; }
body.wire .word::before, body.wire .word::after { opacity: 1; }
body.wire .build .lc, body.wire .say .lc, body.wire .w-name, body.wire .about-text .lead, body.wire .b-cap b {
  color: transparent !important; -webkit-text-stroke: 1.5px var(--wf-ln) !important;
}
body.wire .say .lc { -webkit-text-stroke-color: var(--orange) !important; }
body.wire :is(.meta b, .node h3, .tile-cap b, .log b, .contact-lead, .w-desc, .about-text p, .node p, .foot p) { font-family: var(--mono); font-size: .9em; }
body.wire :is(.btns a, .toolbar, .toolbar a, .node, .tile-img, .browser, .url, .kit li, .copy, .lb-close, .lightbox img) { border-radius: 0 !important; }
body.wire .btns a { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--ink) !important; font-family: var(--mono); font-size: 12px; }
body.wire .node, body.wire .browser { border-style: dashed; box-shadow: none; }
body.wire .polaroid { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }
body.wire .polaroid figcaption { font-family: var(--mono); font-size: 11px; }
body.wire .tape { display: none; }
body.wire .foot p b, body.wire .hl { background: transparent; box-shadow: inset 0 0 0 1.5px var(--orange); }

/* ═══════════════════════ REDUCED MOTION ═══════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ch .f, .ch .o, .ch::after, .grid8, .tile, .toolbar { transition: none; }
  .js .rise { opacity: 1; transform: none; }
}

/* ═══════════════════════ RESPONSIVE ═══════════════════════ */
@media (max-width: 1100px) {
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 56px; }
  .node:nth-child(2)::after { display: none; }
  .work-row { grid-template-columns: 44px minmax(0, 1fr) 64px; }
  .w-tags { display: none; }
}

@media (max-width: 760px) {
  :root { --pad: 16px; }
  .poster { padding: 16px var(--pad); }
  .meta { grid-template-columns: 1fr auto; gap: 14px 16px; font-size: 12px; }
  .meta > div:nth-child(2), .meta > div:nth-child(3) { display: none; }
  /* phones: centred above the name; its top is set by fit() in home.js */
  .polaroid { --pw: clamp(168px, 50vw, 210px); left: calc(50% - var(--pw) / 2); right: auto; top: 0; bottom: auto; width: var(--pw); padding: 9px 9px 34px; }
  .polaroid figcaption { font-size: 12px; bottom: 9px; }
  .foot { flex-direction: column; align-items: start; }
  .foot p { font-size: 14px; max-width: none; }
  /* the two hero buttons share the full width, half each */
  .btns { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .btns a { text-align: center; padding: 15px 12px; white-space: nowrap; }

  .sec { padding: 80px var(--pad); }
  .sec-head { grid-template-columns: 1fr; margin-bottom: 40px; }
  .build { font-size: clamp(36px, 11.5vw, 72px); white-space: normal; }

  .work-row { grid-template-columns: 1fr auto; gap: 8px 16px; padding: 20px 0 24px; }
  .w-thumb { display: block; grid-column: 1 / -1; order: -1; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 12px; margin-bottom: 8px; border: 1px solid var(--line); } /* several covers are white */
  .w-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .w-num { display: none; }
  .w-year { align-self: start; padding-top: .4em; }
  .w-name { font-size: clamp(28px, 9vw, 44px); }
  .preview { display: none; }

  .flow { grid-template-columns: 1fr; gap: 44px; }
  .node:nth-child(2)::after { display: block; }
  .node:not(:last-child)::after { top: calc(100% + 6px); left: 34px; width: 1.5px; height: calc(44px - 12px); transform-origin: top; transform: scaleY(var(--draw, 1)); }
  .port { top: auto; left: 28px !important; right: auto !important; }
  .port.in { top: -7px; } .port.out { bottom: -7px; }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .tile:first-child { grid-column: 1 / -1; } /* 1 featured + 8 = even rows */
  .tile-cap i { display: none; }

  .rail { scroll-snap-type: x mandatory; cursor: auto; }
  .toolbar { padding: 4px; }
  .toolbar a { display: none; }
  .tb-menu, .sheet { display: flex; }
  .sheet { display: block; }
  .rail { gap: 14px; }
  .browser { flex-basis: 76vw; min-width: 0; scroll-snap-align: start; scroll-margin-left: var(--pad); } /* next card peeks in */

  .about { grid-template-columns: 1fr; gap: 48px; }
  .about-text p { font-size: 16px; }

  .contact { padding: 80px var(--pad) 60px; }
  /* phones: one centred column, stacked top to bottom */
  .site-foot { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 14px; padding: 32px var(--pad) 96px; }
  .foot-logo, .foot-note { justify-self: center; }
}
