/* ==========================================================================
   FAHADULLAH DAHRI — "From line to light"
   Blueprint (cyan) = drafting state · Render (vermilion) = finished state
   ========================================================================== */

:root {
  --bg: #0c0c0b;
  --bg-2: #141412;
  --bg-3: #1c1c19;
  --ink: #ecebe5;
  --ink-2: #a9a8a0;
  --ink-3: #6d6c66;
  --line: rgba(236, 235, 229, 0.1);
  --line-2: rgba(236, 235, 229, 0.2);
  --render: #ff4d1f;
  --render-soft: rgba(255, 77, 31, 0.14);
  --draft: #6fd3ff;
  --draft-soft: rgba(111, 211, 255, 0.12);
  --grid: rgba(111, 211, 255, 0.05);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1440px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f1efe8;
  --bg-2: #e8e5dc;
  --bg-3: #dedad0;
  --ink: #151513;
  --ink-2: #54534d;
  --ink-3: #8a887f;
  --line: rgba(21, 21, 19, 0.12);
  --line-2: rgba(21, 21, 19, 0.24);
  --render: #e5380d;
  --render-soft: rgba(229, 56, 13, 0.1);
  --draft: #0a6fa8;
  --draft-soft: rgba(10, 111, 168, 0.1);
  --grid: rgba(10, 111, 168, 0.07);
  --shadow: 0 30px 70px -35px rgba(40, 30, 10, 0.35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
::selection { background: var(--render); color: #fff; }
:focus-visible { outline: 2px solid var(--draft); outline-offset: 3px; border-radius: 4px; }

/* Drafting grid across the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 85%);
}

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.accent { color: var(--render); }
.draft { color: var(--draft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- CAD cursor (fine pointers only) ---------- */
.cad { display: none; }
@media (pointer: fine) {
  .cad { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 9000; }
  .cad-h, .cad-v { position: absolute; background: var(--draft); opacity: 0.18; will-change: transform; }
  .cad-h { left: 0; top: 0; width: 100%; height: 1px; }
  .cad-v { left: 0; top: 0; width: 1px; height: 100%; }
  .cad-box {
    position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px;
    border: 1px solid var(--draft); will-change: transform;
    transition: width 0.25s var(--ease), height 0.25s var(--ease), margin 0.25s var(--ease), border-color 0.25s;
  }
  .cad-tag {
    position: absolute; left: 0; top: 0; padding: 2px 6px; font: 10px/1.4 var(--mono);
    color: var(--draft); background: var(--bg); border: 1px solid var(--line-2); white-space: nowrap; will-change: transform;
  }
  .cad.is-link .cad-box { width: 44px; height: 44px; margin: -22px 0 0 -22px; border-color: var(--render); }
  .cad.is-link .cad-h, .cad.is-link .cad-v { background: var(--render); }
  .cad.is-hidden { opacity: 0; }
  body.has-cad, body.has-cad a, body.has-cad button { cursor: none; }
  body.has-cad input, body.has-cad textarea { cursor: text; }
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  transition: transform 0.45s var(--ease), background-color 0.3s;
}
.nav.is-scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.nav.is-hidden { transform: translateY(-100%); }
.nav-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line-2);
  font: 600 12px var(--mono); position: relative;
}
.brand-mark::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 6px; height: 6px; background: var(--render); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { padding: 8px 12px; font-size: 14px; color: var(--ink-2); border-radius: 999px; transition: color 0.2s, background-color 0.2s; }
.nav-links a:hover, .nav-links a.is-active { color: var(--ink); background: var(--bg-3); }
.nav-tools { display: flex; align-items: center; gap: 8px; }
.kbd-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; color: var(--ink-2); transition: border-color 0.2s, color 0.2s;
}
.kbd-btn:hover { border-color: var(--ink-2); color: var(--ink); }
kbd { font: 11px var(--mono); padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 5px; color: var(--ink-2); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; transition: border-color 0.2s, transform 0.4s var(--ease); }
.icon-btn:hover { border-color: var(--ink-2); }
.icon-btn svg { width: 16px; height: 16px; }
.btn-fuse {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--render); color: #fff; font-size: 13px; font-weight: 600; transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.btn-fuse:hover { transform: translateY(-1px); box-shadow: 0 8px 24px -8px var(--render); }
.btn-fuse .spark { width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #ffd27a; animation: flicker 1.1s infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 40% { opacity: 0.4; } 60% { opacity: 0.9; } }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .nav-links, .kbd-btn .kbd-label, .nav-tools .btn-fuse { display: none; }
  .menu-btn { display: grid; }
  .nav-links.is-open {
    display: flex; flex-direction: column; align-items: stretch; position: fixed; top: 68px; left: 0; right: 0;
    padding: 16px var(--gutter) 24px; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav-links.is-open a { font-size: 22px; padding: 12px 0; border-radius: 0; background: none; border-bottom: 1px solid var(--line); }
}

/* ---------- Layers panel (desktop section index) ---------- */
.layers {
  position: fixed; right: 12px; top: 50%; transform: translateY(-50%); z-index: 400;
  width: 34px; padding: 6px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font: 11px var(--mono); overflow: hidden; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.4s, width 0.35s var(--ease);
}
.layers.is-visible { opacity: 1; pointer-events: auto; }
.layers:hover, .layers:focus-within { width: 168px; }
.layers-head { display: flex; justify-content: space-between; padding: 4px 2px 8px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; opacity: 0; transition: opacity 0.2s; }
.layers:hover .layers-head, .layers:focus-within .layers-head { opacity: 1; }
.layers a { display: flex; align-items: center; gap: 10px; padding: 6px 4px; color: var(--ink-3); transition: background-color 0.2s, color 0.2s; }
.layers a:hover { color: var(--ink); background: var(--bg-3); }
.layers a .eye { width: 12px; height: 12px; border: 1px solid currentColor; border-radius: 50%; position: relative; flex: none; }
.layers a.is-active { color: var(--ink); background: var(--bg-3); }
.layers a.is-active .eye::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--render); }
@media (max-width: 1280px) { .layers { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 24px; border-radius: 999px;
  font-weight: 500; font-size: 15px; border: 1px solid var(--line-2); transition: background-color 0.25s, color 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}
.btn:hover { border-color: var(--ink); }
.btn-solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-solid:hover { background: var(--render); border-color: var(--render); color: #fff; }
.btn svg { width: 16px; height: 16px; transition: transform 0.3s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 120px 0 56px; min-height: 100svh; display: flex; align-items: center; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.status { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 10px; border: 1px solid var(--line-2); border-radius: 999px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }
.hero-title { font-size: clamp(52px, 9.4vw, 148px); line-height: 0.88; letter-spacing: -0.055em; font-weight: 600; margin: 28px 0 0; }
.hero-title .ln { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-title .ln > span { display: inline-block; transform: translateY(105%); animation: rise 1s var(--ease) forwards; }
.hero-title .ln:nth-child(2) > span { animation-delay: 0.08s; }
.hero-title .serif { font-weight: 400; letter-spacing: -0.03em; color: var(--ink-2); }
@keyframes rise { to { transform: translateY(0); } }
.dimension { display: flex; align-items: center; gap: 10px; margin: 22px 0 0; color: var(--draft); font: 11px var(--mono); max-width: 560px; }
.dimension::before, .dimension::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: 0.6; }
.dimension::before { border-left: 1px solid; height: 9px; background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat; }
.dimension::after { border-right: 1px solid; height: 9px; background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat; }
.hero-lede { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; color: var(--ink-2); max-width: 34ch; margin: 24px 0 36px; }
.hero-lede strong { color: var(--ink); font-weight: 500; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.fade-up { opacity: 0; transform: translateY(16px); animation: fadeUp 0.9s var(--ease) forwards; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

/* Render view window */
.viewport-win { position: relative; border: 1px solid var(--line-2); background: var(--bg-2); box-shadow: var(--shadow); }
.win-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line); font: 10.5px var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
.win-bar .dots { display: flex; gap: 6px; }
.win-bar .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--bg-3); border: 1px solid var(--line-2); }
.win-bar .rec { color: var(--render); }
.render-stage { position: relative; aspect-ratio: 1; overflow: hidden; background: #0a0a0a; }
.render-stage img { width: 100%; height: 100%; object-fit: cover; }
.buckets { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.bucket { position: relative; background: #0d0d0d; transition: opacity 0.35s ease; }
.bucket.is-active { background: rgba(13, 13, 13, 0.55); }
.bucket.is-active::before, .bucket.is-active::after {
  content: ""; position: absolute; inset: 2px; border: 1.5px solid #ffd76a;
  clip-path: polygon(0 0, 30% 0, 30% 2px, 2px 2px, 2px 30%, 0 30%, 0 70%, 2px 70%, 2px calc(100% - 2px), 30% calc(100% - 2px), 30% 100%, 70% 100%, 70% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 70%, 100% 70%, 100% 30%, calc(100% - 2px) 30%, calc(100% - 2px) 2px, 70% 2px, 70% 0, 100% 0, 100% 100%, 0 100%);
}
.bucket.is-done { opacity: 0; }
.win-foot { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.win-foot > div { padding: 10px 12px; font: 10.5px/1.5 var(--mono); color: var(--ink-3); text-transform: uppercase; }
.win-foot > div + div { border-left: 1px solid var(--line); }
.win-foot b { display: block; font-weight: 500; color: var(--ink); font-size: 12px; }
.render-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--render); width: 0; transition: width 0.2s linear; }
.annot { position: absolute; font: 10px var(--mono); color: var(--draft); white-space: nowrap; }
.annot-top { top: -26px; left: 0; right: 0; display: flex; align-items: center; gap: 8px; }
.annot-top::before, .annot-top::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: 0.5; }
.annot-side { right: -30px; top: 0; bottom: 0; writing-mode: vertical-rl; display: flex; align-items: center; gap: 8px; }
.annot-side::before, .annot-side::after { content: ""; flex: 1; width: 1px; background: currentColor; opacity: 0.5; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 72px; border-top: 1px solid var(--line); }
.stat { padding: 20px 20px 0 0; }
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--line); }
.stat-num { font-size: clamp(32px, 4vw, 52px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.stat-num sup { font-size: 0.45em; color: var(--render); vertical-align: top; margin-left: 2px; }
.stat-label { margin-top: 8px; }

@media (max-width: 960px) {
  .hero { padding-top: 104px; min-height: 0; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { max-width: 520px; width: 100%; margin: 24px auto 0; }
  .annot-side { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); margin-top: 48px; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); margin-top: 20px; }
}

/* ---------- Marquee ---------- */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding: 22px 0; background: var(--bg-2); }
.marquee-track { display: flex; width: max-content; animation: marquee 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item { display: flex; align-items: center; gap: 32px; padding-right: 32px; font-size: clamp(28px, 4vw, 56px); font-weight: 500; letter-spacing: -0.04em; white-space: nowrap; }
.marquee-item:nth-child(even) { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--ink-2); }
.marquee-item::after { content: ""; width: 14px; height: 14px; border: 1.5px solid var(--render); transform: rotate(45deg); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 12vw, 160px) 0; position: relative; }
.sec-head { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: end; margin-bottom: clamp(40px, 6vw, 72px); }
.sec-tag { display: flex; align-items: center; gap: 10px; color: var(--ink-3); padding-bottom: 12px; }
.sec-tag b { color: var(--render); font-weight: 500; }
.sec-title { font-size: clamp(40px, 6.4vw, 96px); line-height: 0.95; letter-spacing: -0.05em; font-weight: 600; margin: 0; }
.sec-title .serif { color: var(--ink-2); }
.sec-head-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
@media (max-width: 760px) { .sec-head { grid-template-columns: 1fr; gap: 8px; } .sec-tag { padding-bottom: 0; } }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 0.08s; } .reveal-d2 { transition-delay: 0.16s; } .reveal-d3 { transition-delay: 0.24s; }

/* ---------- Render lens (blueprint → render) ---------- */
.lens { position: relative; overflow: hidden; background: var(--bg-3); isolation: isolate; --x: 50%; --y: 50%; --r: 0px; }
.lens img { width: 100%; height: 100%; object-fit: cover; }
.lens .l-draft { filter: grayscale(1) contrast(1.25) brightness(0.75); transition: transform 1.2s var(--ease); }
.lens::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: color;
  background: #0b5d8a;
}
:root[data-theme="light"] .lens::before { background: #1677b3; }
.lens::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0.55;
  background-image: linear-gradient(rgba(111, 211, 255, 0.18) 1px, transparent 1px), linear-gradient(90deg, rgba(111, 211, 255, 0.18) 1px, transparent 1px);
  background-size: 24px 24px;
}
.lens .l-render {
  position: absolute; inset: 0; z-index: 3;
  -webkit-mask-image: radial-gradient(circle at var(--x) var(--y), #000 calc(var(--r) - 1px), transparent var(--r));
  mask-image: radial-gradient(circle at var(--x) var(--y), #000 calc(var(--r) - 1px), transparent var(--r));
}
.lens .l-ring {
  position: absolute; z-index: 4; left: var(--x); top: var(--y); width: calc(var(--r) * 2); height: calc(var(--r) * 2);
  transform: translate(-50%, -50%); border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 50%; pointer-events: none;
  opacity: 0; transition: opacity 0.3s;
}
.lens .l-ring::after { content: attr(data-label); position: absolute; left: 50%; top: 100%; transform: translate(-50%, 8px); font: 10px var(--mono); color: #fff; letter-spacing: 0.08em; white-space: nowrap; text-shadow: 0 1px 4px #000; }
.lens.is-lensing .l-ring { opacity: 1; }
.lens.is-rendered .l-render { -webkit-mask-image: none; mask-image: none; }
.lens-hint { position: absolute; z-index: 5; left: 14px; top: 14px; padding: 5px 9px; background: rgba(0, 0, 0, 0.55); color: #fff; backdrop-filter: blur(6px); border-radius: 999px; font: 10px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; transition: opacity 0.3s; }
.lens.is-lensing .lens-hint, .lens.is-rendered .lens-hint { opacity: 0; }

/* ---------- Work cards ---------- */
.work-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(16px, 2vw, 28px); }
.card { grid-column: span 6; display: block; }
.card.is-wide { grid-column: span 12; }
.card .lens { aspect-ratio: 4 / 3; }
.card.is-wide .lens { aspect-ratio: 21 / 9; }
.card-meta { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: baseline; padding: 18px 2px 0; }
.card-num { color: var(--render); }
.card-title { font-size: clamp(22px, 2.3vw, 32px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; margin: 0; }
.card-sub { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-3); }
.card:hover .card-title { color: var(--render); }
.card-title { transition: color 0.25s; }
.card .arrow { width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; transition: background-color 0.25s, border-color 0.25s, transform 0.4s var(--ease); }
.card:hover .arrow { background: var(--render); border-color: var(--render); color: #fff; transform: rotate(-45deg); }
.card .arrow svg { width: 16px; height: 16px; }
@media (max-width: 760px) { .card, .card.is-wide { grid-column: span 12; } .card.is-wide .lens { aspect-ratio: 16 / 10; } }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: clamp(32px, 6vw, 96px); }
.about-photo { position: sticky; top: 100px; align-self: start; }
.about-photo .lens { aspect-ratio: 4 / 5; }
.about-text p { font-size: clamp(20px, 2vw, 28px); line-height: 1.4; letter-spacing: -0.02em; margin: 0 0 24px; color: var(--ink-2); }
.about-text p strong { color: var(--ink); font-weight: 500; }
.about-text p:first-child::first-letter { color: var(--render); }
.edu { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); margin-top: 40px; }
.edu > div { padding: 20px 20px 20px 0; }
.edu > div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.edu h4 { margin: 8px 0 0; font-size: 18px; font-weight: 500; letter-spacing: -0.02em; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } .about-photo { position: relative; top: 0; max-width: 420px; } }

/* Capabilities (accordion rows) */
.caps { margin-top: clamp(64px, 9vw, 120px); border-top: 1px solid var(--line); }
.cap { border-bottom: 1px solid var(--line); }
.cap-head { width: 100%; display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center; padding: 26px 0; text-align: left; }
.cap-head h3 { margin: 0; font-size: clamp(24px, 3.4vw, 48px); font-weight: 500; letter-spacing: -0.04em; transition: color 0.25s, transform 0.4s var(--ease); }
.cap-head:hover h3 { color: var(--render); transform: translateX(8px); }
.cap-plus { width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 50%; position: relative; transition: transform 0.4s var(--ease), background-color 0.25s; }
.cap-plus::before, .cap-plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 1.5px; background: currentColor; transform: translate(-50%, -50%); }
.cap-plus::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform 0.4s var(--ease); }
.cap.is-open .cap-plus { background: var(--ink); color: var(--bg); }
.cap.is-open .cap-plus::after { transform: translate(-50%, -50%) rotate(0deg); }
.cap-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s var(--ease); }
.cap.is-open .cap-body { grid-template-rows: 1fr; }
.cap-body > div { overflow: hidden; }
.cap-inner { display: grid; grid-template-columns: 64px 1fr 1fr; gap: 16px; padding-bottom: 28px; }
.cap-inner p { margin: 0; color: var(--ink-2); font-size: 17px; max-width: 46ch; grid-column: 2; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-content: start; }
.chip { padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; color: var(--ink-2); }
@media (max-width: 760px) { .cap-head { grid-template-columns: 40px 1fr auto; } .cap-inner { grid-template-columns: 1fr; } .cap-inner p { grid-column: 1; } }

/* Toolkit: keycaps */
.toolkit { margin-top: clamp(64px, 9vw, 120px); }
.toolkit-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.toolkit-head h3 { margin: 0; font-size: clamp(28px, 3vw, 40px); font-weight: 500; letter-spacing: -0.04em; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.key {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 108px; padding: 14px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; text-align: left;
  box-shadow: 0 4px 0 0 var(--bg-3), 0 4px 0 1px var(--line-2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.2s;
}
.key:hover { border-color: var(--draft); }
.key:active, .key.is-pressed { transform: translateY(4px); box-shadow: 0 0 0 0 var(--bg-3), 0 0 0 1px var(--line-2); }
.key-top { display: flex; justify-content: space-between; color: var(--ink-3); font: 10px var(--mono); text-transform: uppercase; letter-spacing: 0.05em; }
.key-name { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
.key.is-pressed .key-name { color: var(--render); }
.key-out { min-height: 24px; margin-top: 16px; color: var(--ink-2); }

/* ---------- WIP: render queue ---------- */
.queue { border: 1px solid var(--line); background: var(--bg-2); }
.queue-head, .q-row { display: grid; grid-template-columns: 56px 96px 1.4fr 1fr 150px; gap: 20px; align-items: center; padding: 0 20px; }
.queue-head { height: 44px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.q-row { padding-block: 18px; border-bottom: 1px solid var(--line); transition: background-color 0.25s; }
.q-row:last-child { border-bottom: 0; }
.q-row:hover { background: var(--bg-3); }
.q-thumb { width: 96px; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); }
.q-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.q-row:hover .q-thumb img { transform: scale(1.08); }
.q-title { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; margin: 4px 0; }
.q-desc { color: var(--ink-2); font-size: 14px; margin: 0; }
.q-status { display: flex; flex-direction: column; gap: 8px; }
.q-bar { height: 4px; background: var(--bg-3); overflow: hidden; position: relative; }
.q-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--render), transparent); animation: scan 1.8s ease-in-out infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (max-width: 900px) {
  .queue-head { display: none; }
  .q-row { grid-template-columns: 72px 1fr; gap: 6px 16px; }
  .q-row > .q-idx { display: none; }
  .q-thumb { width: 72px; grid-row: span 3; align-self: start; }
  .q-status { grid-column: 2; }
}

/* ---------- LAST FUSE ---------- */
.fuse { position: relative; overflow: hidden; border-block: 1px solid var(--line); background: #070707; color: #ecebe5; }
:root[data-theme="light"] .fuse { background: #11110f; }
.fuse-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; padding-block: clamp(80px, 11vw, 150px); }
.fuse-title { font-size: clamp(64px, 11vw, 168px); line-height: 0.82; letter-spacing: -0.06em; font-weight: 700; margin: 20px 0 24px; }
.fuse-title span { display: block; color: #2a2a27; transition: color 0.6s, text-shadow 0.6s; }
.fuse.is-lit .fuse-title span { color: var(--render); text-shadow: 0 0 60px rgba(255, 77, 31, 0.45); }
.fuse p { color: #a9a8a0; font-size: 18px; max-width: 42ch; }
.fuse-meta { display: flex; gap: 24px; flex-wrap: wrap; margin: 28px 0 36px; color: #6d6c66; }
.fuse-meta b { display: block; color: #ecebe5; font-weight: 500; font-size: 13px; }
.fuse-svg { width: 100%; height: auto; overflow: visible; }
.fuse-svg .rope { fill: none; stroke: #2b2b28; stroke-width: 6; stroke-linecap: round; }
.fuse-svg .rope-dash { fill: none; stroke: #4a4a45; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 2 10; }
.fuse-svg .burnt { fill: none; stroke: #ff4d1f; stroke-width: 2; stroke-linecap: round; opacity: 0.8; }
.fuse-svg .charge { fill: #1a1a18; stroke: #3a3a36; stroke-width: 1.5; }
.fuse.is-lit .fuse-svg .charge { fill: #ff4d1f; stroke: #ffb08f; }
.fuse-svg .charge-label { font: 600 14px var(--mono); fill: #6d6c66; letter-spacing: 0.1em; }
.fuse.is-lit .fuse-svg .charge-label { fill: #fff; }
.fuse-btn { background: #ecebe5; color: #0c0c0b; border-color: #ecebe5; }
.fuse.is-lit .fuse-btn { background: #ff4d1f; color: #fff; border-color: #ff4d1f; box-shadow: 0 0 40px -6px #ff4d1f; }
.fuse-hint { color: #6d6c66; margin-top: 14px; }
@media (max-width: 900px) { .fuse-grid { grid-template-columns: 1fr; } .fuse-art { order: -1; max-width: 520px; } }

/* ---------- Contact ---------- */
.contact-big { display: block; font-size: clamp(36px, 7.4vw, 120px); letter-spacing: -0.055em; line-height: 0.95; font-weight: 600; word-break: break-word; }
.contact-big .serif { color: var(--ink-2); }
.email-link { position: relative; display: inline-flex; align-items: center; gap: 14px; margin-top: 32px; font-size: clamp(18px, 2.2vw, 30px); letter-spacing: -0.02em; padding-bottom: 6px; border-bottom: 1px solid var(--line-2); transition: border-color 0.25s, color 0.25s; }
.email-link:hover { color: var(--render); border-color: var(--render); }
.copy-tip { font: 11px var(--mono); color: var(--ink-3); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 96px); margin-top: clamp(56px, 8vw, 96px); }
.form { display: grid; gap: 2px; }
.field { position: relative; border-bottom: 1px solid var(--line-2); transition: border-color 0.25s; }
.field:focus-within { border-color: var(--render); }
.field label { display: block; padding-top: 16px; color: var(--ink-3); }
.field input, .field textarea, .field select {
  width: 100%; background: transparent; border: 0; outline: 0; color: var(--ink); font: 400 19px/1.4 var(--sans); padding: 8px 0 14px; resize: vertical;
}
.field textarea { min-height: 110px; }
.field .err { position: absolute; right: 0; top: 18px; font: 11px var(--mono); color: var(--render); opacity: 0; transition: opacity 0.2s; }
.field.has-error { border-color: var(--render); }
.field.has-error .err { opacity: 1; }
.type-pills { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 16px; }
.type-pills input { position: absolute; opacity: 0; pointer-events: none; }
.type-pills label { padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 14px; cursor: pointer; color: var(--ink-2); transition: all 0.2s; }
.type-pills input:checked + label { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.type-pills input:focus-visible + label { outline: 2px solid var(--draft); outline-offset: 2px; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 28px; }
.form-note { color: var(--ink-3); font-size: 13px; max-width: 32ch; }
.side-list { display: grid; gap: 0; border-top: 1px solid var(--line); align-content: start; }
.side-list a, .side-list div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--line); font-size: 18px; }
.side-list a { transition: padding 0.3s var(--ease), color 0.25s; }
.side-list a:hover { color: var(--render); padding-left: 10px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0 32px; }
.footer-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--ink-3); }
.footer a:hover { color: var(--ink); }
.big-name { font-size: clamp(56px, 16.5vw, 260px); font-weight: 700; letter-spacing: -0.07em; line-height: 0.8; margin: 0 0 24px; color: var(--bg-3); user-select: none; white-space: nowrap; overflow: hidden; }

/* ---------- Command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 8000; display: none; align-items: flex-start; justify-content: center; padding: 14vh 16px 16px; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.palette.is-open { display: flex; animation: fadeIn 0.18s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.palette-box { width: 100%; max-width: 580px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; animation: pop 0.25s var(--ease); }
@keyframes pop { from { transform: translateY(-8px) scale(0.98); opacity: 0; } }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.palette-input input { flex: 1; height: 56px; border: 0; outline: 0; background: transparent; color: var(--ink); font: 17px var(--sans); }
.palette-list { max-height: 360px; overflow: auto; padding: 8px; margin: 0; list-style: none; }
.palette-group { padding: 10px 10px 6px; color: var(--ink-3); }
.palette-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.palette-item .dim { font: 11px var(--mono); }
.palette-item.is-sel { background: var(--bg-3); }
.palette-item.is-sel .pi-label { color: var(--render); }
.palette-empty { padding: 24px; text-align: center; color: var(--ink-3); }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font: 11px var(--mono); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 8500; transform: translate(-50%, 20px); opacity: 0; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font: 12px var(--mono); pointer-events: none; transition: all 0.35s var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   WORK INDEX PAGE
   ========================================================================== */
.page-head { padding: 140px 0 48px; }
.page-title { font-size: clamp(56px, 12vw, 190px); font-weight: 600; letter-spacing: -0.065em; line-height: 0.85; margin: 16px 0 0; }
.page-title sup { font-size: 0.22em; color: var(--render); vertical-align: top; letter-spacing: 0; font-family: var(--mono); font-weight: 400; margin-left: 8px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 0; border-block: 1px solid var(--line); position: sticky; top: 68px; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 14px; color: var(--ink-2); transition: all 0.2s; }
.filter:hover { color: var(--ink); border-color: var(--ink-2); }
.filter.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter .count { font: 10px var(--mono); margin-left: 4px; opacity: 0.6; vertical-align: super; }
.view-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; }
.view-toggle button { padding: 6px 14px; border-radius: 999px; font: 11px var(--mono); text-transform: uppercase; color: var(--ink-3); }
.view-toggle button.is-active { background: var(--bg-3); color: var(--ink); }

.list { margin-top: 8px; }
.row { position: relative; display: grid; grid-template-columns: 60px 1.6fr 1fr 1fr 70px 40px; gap: 20px; align-items: center; padding: 28px 0; border-bottom: 1px solid var(--line); transition: opacity 0.3s, padding 0.4s var(--ease); }
.row-title { font-size: clamp(24px, 3.4vw, 48px); font-weight: 500; letter-spacing: -0.04em; line-height: 1.05; margin: 0; transition: color 0.25s, transform 0.45s var(--ease); }
.list:hover .row { opacity: 0.35; }
.list .row:hover { opacity: 1; }
.row:hover .row-title { color: var(--render); transform: translateX(10px); }
.row .arrow { width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; transition: all 0.35s var(--ease); }
.row:hover .arrow { background: var(--render); border-color: var(--render); color: #fff; transform: rotate(-45deg); }
.row .arrow svg { width: 16px; height: 16px; }
.row.is-out, .card.is-out { display: none; }
.peek { position: fixed; left: 0; top: 0; z-index: 300; width: 340px; aspect-ratio: 4 / 3; pointer-events: none; overflow: hidden; border: 1px solid var(--line-2); opacity: 0; transform: translate(-50%, -50%) scale(0.85); transition: opacity 0.25s, transform 0.35s var(--ease); will-change: left, top; }
.peek.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.peek img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; transition: opacity 0.3s; }
.peek .tag { position: absolute; left: 10px; bottom: 10px; padding: 4px 8px; background: rgba(0, 0, 0, 0.6); color: #fff; font: 10px var(--mono); text-transform: uppercase; letter-spacing: 0.05em; }
@media (hover: none), (max-width: 900px) { .peek { display: none; } }
@media (max-width: 900px) {
  .row { grid-template-columns: 1fr auto; gap: 8px 16px; }
  .row > .r-num, .row > .r-tools { display: none; }
  .row > .r-cat, .row > .r-year { grid-column: 1; }
  .row .arrow { grid-column: 2; grid-row: 1; }
  .list:hover .row { opacity: 1; }
}
.grid-view { margin-top: 32px; }

/* ==========================================================================
   PROJECT DETAIL PAGE
   ========================================================================== */
.p-head { padding: 128px 0 40px; }
.crumbs { display: flex; gap: 8px; color: var(--ink-3); margin-bottom: 28px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--ink); }
.p-title { font-size: clamp(44px, 8vw, 128px); line-height: 0.9; letter-spacing: -0.06em; font-weight: 600; margin: 0; max-width: 16ch; }
.p-meta { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); margin-top: 48px; }
.p-meta > div { padding: 16px 16px 0 0; }
.p-meta > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.p-meta b, .fuse-meta b { display: block; font: 500 17px/1.3 var(--sans); text-transform: none; margin-top: 6px; letter-spacing: -0.01em; color: var(--ink); }
.fuse-meta b { font-size: 15px; color: #ecebe5; }
@media (max-width: 760px) { .p-meta { grid-template-columns: 1fr 1fr; } .p-meta > div:nth-child(3) { padding-left: 0; border-left: 0; } .p-meta > div:nth-child(n + 3) { margin-top: 16px; border-top: 1px solid var(--line); } }
.p-cover .lens { aspect-ratio: 16 / 9; }
.p-body { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: clamp(56px, 8vw, 110px) 0; }
.p-body p { margin: 0; font-size: clamp(20px, 2.2vw, 30px); line-height: 1.38; letter-spacing: -0.02em; max-width: 40ch; }
@media (max-width: 760px) { .p-body { grid-template-columns: 1fr; } }

/* 3D viewport */
.vp { position: relative; border: 1px solid var(--line-2); background: radial-gradient(ellipse at 50% 40%, #2a2a27, #121211 70%); overflow: hidden; }
:root[data-theme="light"] .vp { background: radial-gradient(ellipse at 50% 40%, #fbfaf6, #d9d5ca 75%); }
.vp-canvas { position: relative; aspect-ratio: 16 / 9; width: 100%; touch-action: none; }
.vp-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
@media (max-width: 700px) { .vp-canvas { aspect-ratio: 4 / 5; } }
.vp-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.vp-modes { display: flex; gap: 4px; flex-wrap: wrap; }
.vp-mode { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px; font-size: 13px; color: var(--ink-2); border: 1px solid transparent; }
.vp-mode kbd { font-size: 10px; padding: 0 5px; }
.vp-mode:hover { color: var(--ink); background: var(--bg-3); }
.vp-mode.is-active { color: var(--ink); background: var(--bg-3); border-color: var(--line-2); }
.vp-mode.is-active kbd { border-color: var(--render); color: var(--render); }
.vp-hud { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 16px; color: var(--ink-3); pointer-events: none; font: 10.5px var(--mono); text-transform: uppercase; }
.vp-axes { position: absolute; right: 14px; bottom: 14px; width: 54px; height: 54px; pointer-events: none; }
.vp-load { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; }
.vp-load .pct { font-size: 48px; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.vp-start { display: grid; place-items: center; gap: 16px; text-align: center; }
.vp-start img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.25; filter: grayscale(1); }
.vp-start > * { position: relative; }

/* Video facade */
.yt { position: relative; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--line-2); overflow: hidden; }
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: 0.75; transition: opacity 0.3s, transform 0.8s var(--ease); }
.yt:hover img { opacity: 0.9; transform: scale(1.02); }
.yt button { position: absolute; inset: 0; display: grid; place-items: center; }
.yt .play { width: 88px; height: 88px; border-radius: 50%; background: var(--render); display: grid; place-items: center; color: #fff; transition: transform 0.3s var(--ease); }
.yt button:hover .play { transform: scale(1.08); }
.yt .play svg { width: 28px; height: 28px; margin-left: 4px; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Contact sheet gallery */
.sheet { columns: 3 280px; column-gap: 16px; }
.frame { break-inside: avoid; margin-bottom: 16px; position: relative; display: block; width: 100%; overflow: hidden; background: var(--bg-3); border: 1px solid var(--line); }
.frame img { width: 100%; transition: transform 0.8s var(--ease); }
.frame:hover img { transform: scale(1.03); }
.frame-no { position: absolute; left: 10px; top: 10px; padding: 3px 7px; background: rgba(0, 0, 0, 0.55); color: #fff; font: 10px var(--mono); letter-spacing: 0.05em; }

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 7000; display: none; background: rgba(5, 5, 5, 0.94); color: #ecebe5; }
.lb.is-open { display: grid; grid-template-rows: auto 1fr auto; animation: fadeIn 0.2s ease; }
.lb-top, .lb-bot { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font: 12px var(--mono); }
.lb-stage { position: relative; display: grid; place-items: center; padding: 0 64px; min-height: 0; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 50%; color: #fff; }
.lb-btn:hover { background: rgba(255, 255, 255, 0.1); }
.lb-btn svg { width: 18px; height: 18px; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
@media (max-width: 700px) { .lb-stage { padding: 0 8px; } .lb-prev, .lb-next { top: auto; bottom: -60px; } }

/* Next project */
.next { display: block; padding: clamp(64px, 10vw, 140px) 0; border-top: 1px solid var(--line); text-align: center; }
.next-title { font-size: clamp(44px, 9vw, 150px); font-weight: 600; letter-spacing: -0.06em; line-height: 0.9; margin: 16px 0 0; transition: color 0.3s; }
.next:hover .next-title { color: var(--render); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .marquee-track { animation: none; }
}
