@font-face { font-family: "Inter"; src: url("../fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JB Mono"; src: url("../fonts/jbmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JB Mono"; src: url("../fonts/jbmono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
/* metric-matched fallback to avoid layout shift while Inter loads */
@font-face { font-family: "Inter Fallback"; src: local("Arial"); size-adjust: 107%; ascent-override: 90%; descent-override: 22%; line-gap-override: 0%; }

:root {
  --black: #000;
  --ink: #111113;
  --white: #fff;
  --g50: #f5f5f7;
  --g100: #ececef;
  --g200: #dcdce0;
  --g500: #6e6e73;   /* 5.0:1 on white */
  --g700: #3a3a3c;
  --stage: #0b0b0c;  /* must match STAGE in tools/recolor.mjs */
  --line: rgba(0, 0, 0, .1);
  --sans: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JB Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-ios: cubic-bezier(.32, .72, 0, 1);
  --header: 56px;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1200px;
  --r-card: 22px;
  --r-ctl: 12px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; scroll-behavior: smooth; }
html.locked { overflow: hidden; }
body {
  margin: 0; background: var(--white); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.55; letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, picture { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--black); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--black); color: var(--white); }
section[id], [id^="work"] { scroll-margin-top: calc(var(--header) + 8px); }

.wrap { width: 100%; max-width: calc(var(--max) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.muted { color: var(--g500); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--black); color: var(--white); padding: 10px 14px; border-radius: var(--r-ctl); transition: top .2s var(--ease); }
.skip:focus { top: 12px; }

/* ---------- header ---------- */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 40; height: var(--header);
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid transparent; transition: border-color .3s var(--ease);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .header { background: rgba(255, 255, 255, .72); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
}
.header.scrolled { border-bottom-color: var(--line); }
.header .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.wordmark { font-weight: 650; font-size: 19px; letter-spacing: -.03em; display: inline-flex; align-items: center; gap: 9px; }
.wordmark-mark { width: 18px; height: 18px; }
.nav { position: relative; display: flex; gap: 4px; }
.nav a { position: relative; padding: 8px 12px; font-size: 14px; color: var(--g700); border-radius: 999px; transition: color .25s var(--ease); }
.nav a:hover, .nav a[aria-current="true"] { color: var(--black); }
.nav-ind { position: absolute; left: 0; bottom: 2px; height: 1.5px; width: 1px; background: var(--black); transform-origin: 0 50%; opacity: 0; transition: transform .45s var(--ease), opacity .3s; pointer-events: none; }
.menu-btn { display: none; font-size: 14px; padding: 8px 12px; margin-right: -12px; }

@media (max-width: 760px) {
  .nav { display: none; }
  .menu-btn { display: block; }
}

/* mobile menu sheet */
.menu {
  position: fixed; inset: 0; z-index: 60; background: var(--white);
  display: flex; flex-direction: column; padding: calc(var(--header) + 24px) var(--gutter) 40px;
  transform: translateY(100%); visibility: hidden;
  transition: transform .5s var(--ease-ios), visibility 0s linear .5s;
}
.menu.open { transform: none; visibility: visible; transition: transform .5s var(--ease-ios); }
.menu-close { position: absolute; top: 10px; right: calc(var(--gutter) - 12px); padding: 8px 12px; font-size: 14px; }
.menu a { font-size: 40px; font-weight: 600; letter-spacing: -.035em; line-height: 1.25; padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.menu a span { font-family: var(--mono); font-size: 12px; color: var(--g500); font-weight: 400; letter-spacing: .04em; }
.menu-foot { margin-top: auto; display: grid; gap: 6px; font-size: 15px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 999px; font-size: 15px; font-weight: 500;
  transition: transform .35s var(--ease), background-color .25s, color .25s, border-color .25s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-dark { background: var(--black); color: var(--white); }
.btn-dark:hover { background: var(--g700); }
.btn-line { border: 1px solid var(--g200); }
.btn-line:hover { border-color: var(--black); }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- section scaffolding ---------- */
.section { padding-block: clamp(88px, 12vw, 160px); }
.section + .section { border-top: 1px solid var(--line); }
.sec-head { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: end; margin-bottom: clamp(40px, 6vw, 72px); }
.sec-mark { grid-column: 1 / -1; display: flex; gap: 14px; align-items: center; margin-bottom: 20px; color: var(--g500); }
.sec-mark::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sec-title { grid-column: 1 / span 8; font-size: clamp(36px, 5.4vw, 64px); line-height: 1.04; letter-spacing: -.035em; font-weight: 650; }
.sec-lead { grid-column: 9 / -1; color: var(--g500); font-size: 17px; }
@media (max-width: 900px) { .sec-title, .sec-lead { grid-column: 1 / -1; } .sec-lead { margin-top: 16px; } }

/* ---------- hero ---------- */
.hero { padding-top: calc(var(--header) + clamp(48px, 9vw, 120px)); padding-bottom: clamp(56px, 8vw, 96px); }
.hero-top { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 28px; align-items: end; }
.hero-eyebrow { grid-column: 1 / -1; color: var(--g500); display: flex; gap: 18px; flex-wrap: wrap; }
.hero h1 { grid-column: 1 / span 9; font-size: clamp(48px, 9.2vw, 128px); line-height: .96; letter-spacing: -.05em; font-weight: 680; }
.hero h1 .thin { color: var(--g500); font-weight: 500; }
.hero-side { grid-column: 10 / -1; display: grid; gap: 22px; padding-bottom: 10px; }
.hero-side p { color: var(--g700); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 900px) { .hero h1, .hero-side { grid-column: 1 / -1; } }

.dim { position: relative; margin-top: clamp(40px, 6vw, 72px); height: 18px; color: var(--g500); }
.dim::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--g200); }
.dim::after { content: ""; position: absolute; inset: 3px 0; border-inline: 1px solid var(--g200); }
.dim span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--white); padding: 0 12px; }

.hero-stage {
  position: relative; margin-top: 14px; border-radius: 28px; overflow: hidden; background: var(--stage);
  aspect-ratio: 16 / 9; isolation: isolate; display: block; color: var(--white);
}
.hero-stage picture, .hero-stage img { width: 100%; height: 100%; }
.hero-stage img { object-fit: contain; padding: 3% 6%; will-change: auto; }
.hero-stage .tb { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 12px; padding: 18px 22px; color: rgba(255,255,255,.62); }
.hero-stage .tb b { color: var(--white); font-weight: 500; }
.hero-stage .open-hint { transition: color .3s; }
.hero-stage:hover .open-hint { color: var(--white); }
@media (max-width: 700px) {
  .hero-stage { aspect-ratio: 4 / 3; border-radius: 22px; }
  .hero-stage .tb { flex-direction: column; gap: 2px; padding: 14px 16px; }
}

/* ---------- work grid ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.chip { min-height: 36px; padding: 0 16px; border-radius: 999px; font-size: 14px; border: 1px solid var(--g200); color: var(--g700); transition: background-color .25s, color .25s, border-color .25s; }
.chip:hover { border-color: var(--black); color: var(--black); }
.chip[aria-pressed="true"] { background: var(--black); border-color: var(--black); color: var(--white); }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 28px); }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }
.card[hidden] { display: none; }
.card-link { display: block; border-radius: var(--r-card); -webkit-tap-highlight-color: transparent; }
.card-lift {
  position: relative; border-radius: var(--r-card);
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--s, 1));
  transition: transform .45s var(--ease);
}
.card-lift::after { /* shadow layer: only opacity animates */
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; opacity: 0;
  box-shadow: 0 24px 48px -16px rgba(0,0,0,.35), 0 8px 16px -8px rgba(0,0,0,.18);
  transition: opacity .45s var(--ease);
}
.tile { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-card); background: var(--stage); overflow: hidden; }
.tile picture, .tile img { width: 100%; height: 100%; }
.tile img { object-fit: contain; padding: 7%; transform: scale(var(--is, 1)); transition: transform .6s var(--ease); }
.tile .desig { position: absolute; top: 14px; left: 16px; color: rgba(255,255,255,.55); }
.tile .tool { position: absolute; top: 14px; right: 16px; color: rgba(255,255,255,.55); }
.card-text { padding: 16px 4px 4px; }
.card-title { font-size: 19px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.card-sum { color: var(--g500); font-size: 15px; margin-top: 4px; }
.card-meta { margin-top: 10px; color: var(--g500); }
@media (hover: hover) and (pointer: fine) {
  .card-link:hover .card-lift, .card-link:focus-visible .card-lift { --s: 1.035; }
  .card-link:hover .card-lift::after, .card-link:focus-visible .card-lift::after { opacity: 1; }
  .card-link:hover .tile img { --is: 1.06; }
}
.card-link:focus-visible { outline: none; }
.card-link:focus-visible .tile { outline: 2px solid var(--black); outline-offset: 3px; }

/* ---------- capabilities ---------- */
.cap { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 48px; }
.spec { grid-column: 1 / span 7; border-top: 1px solid var(--black); }
.spec li { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.spec h3 { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.spec p { color: var(--g500); margin-top: 4px; font-size: 16px; }
.spec .mono { padding-top: 5px; color: var(--g500); }
.stackups { grid-column: 9 / -1; display: grid; gap: 32px; align-content: start; }
.stack figcaption { display: flex; justify-content: space-between; margin-bottom: 12px; }
.stack figcaption b { font-weight: 600; font-family: var(--sans); text-transform: none; letter-spacing: -.01em; font-size: 15px; }
.layer { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.layer.cu { height: 22px; background: var(--black); color: var(--white); border-radius: 4px; }
.layer.di { height: 30px; color: var(--g500); background: repeating-linear-gradient(135deg, var(--g50) 0 6px, var(--g100) 6px 7px); }
.layer + .layer { margin-top: 3px; }
@media (max-width: 900px) { .spec, .stackups { grid-column: 1 / -1; } .stackups { grid-template-columns: 1fr 1fr; gap: 20px; } }
@media (max-width: 560px) { .stackups { grid-template-columns: 1fr; } }

/* ---------- process ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; counter-reset: s; }
.step { border-top: 1px solid var(--black); padding-top: 20px; }
.step .mono { color: var(--g500); }
.step h3 { font-size: 22px; letter-spacing: -.025em; font-weight: 600; margin-top: 28px; }
.step p { color: var(--g500); margin-top: 8px; font-size: 16px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; row-gap: 40px; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.contact { background: var(--black); color: var(--white); }
.contact .sec-mark { color: rgba(255,255,255,.55); }
.contact .sec-mark::after { background: rgba(255,255,255,.16); }
.contact .sec-lead { color: rgba(255,255,255,.62); }
.contact-grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 40px; align-items: stretch; }
.c-card { border: 1px solid rgba(255,255,255,.16); border-radius: var(--r-card); padding: clamp(22px, 3vw, 32px); display: flex; flex-direction: column; gap: 18px; }
.c-card .mono { color: rgba(255,255,255,.55); }
.c-mail { grid-column: 1 / span 7; }
.c-wa { grid-column: 8 / -1; }
.c-big { font-size: clamp(24px, 3.6vw, 44px); letter-spacing: -.035em; font-weight: 600; line-height: 1.1; word-break: break-all; }
.c-big:hover { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.c-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.contact .btn-light { background: var(--white); color: var(--black); }
.contact .btn-light:hover { background: var(--g100); }
.contact .btn-ghost { border: 1px solid rgba(255,255,255,.28); color: var(--white); }
.contact .btn-ghost:hover { border-color: var(--white); }
.wa-body { display: flex; gap: 22px; align-items: center; }
.qr { width: 148px; flex: none; background: var(--white); border-radius: 16px; padding: 8px; }
.qr img { width: 100%; height: auto; image-rendering: pixelated; }
.wa-body p { color: rgba(255,255,255,.62); font-size: 15px; }
.copied { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.62); align-self: center; opacity: 0; transform: translateY(4px); transition: opacity .3s var(--ease), transform .3s var(--ease); }
.copied.show { opacity: 1; transform: none; }
@media (max-width: 900px) { .c-mail, .c-wa { grid-column: 1 / -1; } }
@media (max-width: 620px) { .wa-body { flex-direction: column-reverse; align-items: flex-start; order: 3; } .c-wa .c-row { order: 2; margin-top: 0; } .qr { width: 132px; } }

/* ---------- footer ---------- */
.footer { background: var(--black); color: rgba(255,255,255,.62); border-top: 1px solid rgba(255,255,255,.12); font-size: 14px; }
.footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-block: 28px; flex-wrap: wrap; }
.footer .wordmark { color: var(--white); font-size: 16px; }
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer a:hover { color: var(--white); }

.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 30; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.9); border: 1px solid var(--g200); display: grid; place-items: center;
  opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none;
  transition: opacity .35s var(--ease), transform .45s var(--ease);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 18px; height: 18px; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- project detail sheet ---------- */
.detail { position: fixed; inset: 0; z-index: 80; display: none; }
.detail.open { display: block; }
.detail-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.42); }
.detail-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet {
  position: relative; max-width: 1120px; margin: clamp(12px, 4vh, 40px) auto 0; min-height: calc(100% - clamp(12px, 4vh, 40px));
  background: var(--white); border-radius: 28px 28px 0 0; padding: clamp(12px, 1.6vw, 18px);
  touch-action: pan-y;
}
.sheet-bar { position: sticky; top: 0; z-index: 3; display: flex; justify-content: flex-end; pointer-events: none; height: 0; }
.close-btn {
  pointer-events: auto; margin: 14px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.88); color: var(--black); box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.18);
  transition: transform .3s var(--ease);
}
@supports (backdrop-filter: blur(1px)) { .close-btn { background: rgba(255,255,255,.7); backdrop-filter: blur(14px) saturate(180%); } }
.close-btn:active { transform: scale(.92); }
.close-btn svg { width: 16px; height: 16px; }
.grabber { display: none; width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.5); position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 2; }
@media (pointer: coarse) { .grabber { display: block; } }
.d-stage { position: relative; background: var(--stage); border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 10; cursor: zoom-in; }
.d-stage > div { position: absolute; inset: 0; }
.d-stage picture, .d-stage img { width: 100%; height: 100%; }
.d-stage img { object-fit: contain; padding: 4% 6%; transition: transform .55s var(--ease); transform-origin: var(--zx, 50%) var(--zy, 50%); }
.d-stage.zoomed { cursor: zoom-out; }
.d-stage.zoomed img { transform: scale(2.2); }
.d-stage .desig { position: absolute; z-index: 1; left: 18px; top: 16px; color: rgba(255,255,255,.55); pointer-events: none; }
@media (max-width: 700px) { .d-stage { aspect-ratio: 4 / 3; } }
.d-body { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 32px; padding: clamp(28px, 5vw, 64px) clamp(8px, 3vw, 40px) 24px; }
.d-head { grid-column: 1 / span 5; }
.d-title { font-size: clamp(32px, 4.4vw, 52px); line-height: 1.04; letter-spacing: -.04em; font-weight: 650; }
.d-meta { margin-top: 18px; color: var(--g500); display: flex; gap: 14px; flex-wrap: wrap; }
.d-tool { margin-top: 26px; display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--g200); border-radius: var(--r-ctl); font-size: 14px; }
.d-tool svg { width: 16px; height: 16px; }
.d-text { grid-column: 7 / -1; }
.d-text p { color: var(--g700); }
.d-text p + p { margin-top: 14px; }
.d-hl { margin-top: 28px; border-top: 1px solid var(--black); }
.d-hl li { padding: 13px 0; border-bottom: 1px solid var(--line); display: flex; gap: 14px; font-size: 16px; }
.d-hl li::before { content: ""; flex: none; width: 7px; height: 7px; margin-top: 9px; border-radius: 50%; border: 1.5px solid var(--black); }
@media (max-width: 860px) { .d-head, .d-text { grid-column: 1 / -1; } }
.d-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 24px clamp(8px, 3vw, 40px) clamp(28px, 4vw, 48px); border-top: 1px solid var(--line); margin-top: 16px; }
.d-nav { display: flex; gap: 8px; }
.d-fade { opacity: 0; transform: translateY(16px); }
.detail.ready .d-fade { opacity: 1; transform: none; transition: opacity .6s var(--ease) .12s, transform .7s var(--ease) .12s; }

/* view transitions: iOS-style card expand */
::view-transition-group(*) { animation-duration: .52s; animation-timing-function: var(--ease-ios); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .4s; }
::view-transition-old(p-stage), ::view-transition-new(p-stage) { height: 100%; width: 100%; object-fit: cover; }
::view-transition-old(p-title), ::view-transition-new(p-title) { height: 100%; object-fit: none; object-position: left top; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .15s !important; transition-delay: 0s !important; animation-duration: .15s !important; }
  .reveal { transform: none; }
  .card-lift { transform: none !important; }
  .tile img { transform: none !important; }
  .d-fade { transform: none; }
  ::view-transition-group(*) { animation-duration: .15s; }
}
