/* ==========================================================================
   Faham Fasihi — Portfolio
   ========================================================================== */

:root {
  --bg: #f4f2ee;
  --bg-2: #ebe8e2;
  --surface: #ffffff;
  --ink: #141414;
  --ink-2: #3b3a37;
  --muted: #75726b;
  --line: rgba(20, 20, 20, 0.12);
  --line-strong: rgba(20, 20, 20, 0.22);
  --accent: #ff5b2e;
  --accent-ink: #ffffff;
  --ok: #1fa45a;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.06), 0 12px 32px -12px rgba(20, 20, 20, 0.22);
  --shadow-lg: 0 2px 4px rgba(20, 20, 20, 0.06), 0 30px 60px -24px rgba(20, 20, 20, 0.35);

  --font-sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;

  --max: 1320px;
  --gutter: clamp(16px, 4vw, 48px);
  --radius: 18px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f10;
    --bg-2: #171719;
    --surface: #1c1c1f;
    --ink: #f3f1ec;
    --ink-2: #d2cfc8;
    --muted: #8f8b84;
    --line: rgba(243, 241, 236, 0.12);
    --line-strong: rgba(243, 241, 236, 0.24);
    --accent: #ff6a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 30px 60px -24px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f0f10;
  --bg-2: #171719;
  --surface: #1c1c1f;
  --ink: #f3f1ec;
  --ink-2: #d2cfc8;
  --muted: #8f8b84;
  --line: rgba(243, 241, 236, 0.12);
  --line-strong: rgba(243, 241, 236, 0.24);
  --accent: #ff6a3d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 30px 60px -24px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::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(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s 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; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  padding-block: 14px;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), padding 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom-color: var(--line);
  padding-block: 10px;
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
/* Wordmark: wide geometric caps, tracked out. */
.brand {
  display: inline-flex; align-items: center; min-height: 40px;
  font-family: "Syncopate", var(--font-sans); font-weight: 700; text-transform: uppercase;
  font-size: 13px; letter-spacing: 0.16em; line-height: 1; white-space: nowrap;
  transition: color 0.2s, letter-spacing 0.5s var(--ease);
}
.brand:hover { color: var(--accent); letter-spacing: 0.2em; }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a:not(.btn) {
  padding: 8px 14px; border-radius: 999px; font-size: 15px; color: var(--ink-2);
  transition: background-color 0.2s, color 0.2s;
}
.nav__links a:not(.btn):hover { background: var(--bg-2); color: var(--ink); }
.nav__right { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); transition: background-color 0.2s, border-color 0.2s;
}
.theme-toggle:hover { background: var(--bg-2); border-color: var(--line-strong); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

@media (max-width: 760px) {
  .nav__links a:not(.btn) { display: none; }
  .brand { font-size: 12px; letter-spacing: 0.12em; }
}

/* ---------- Buttons & pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px; border-radius: 999px;
  font-weight: 500; font-size: 15px; letter-spacing: -0.005em; white-space: nowrap;
  transition: transform 0.3s var(--ease), background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.3s;
}
.btn svg { width: 16px; height: 16px; transition: transform 0.3s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn--sm { height: 40px; padding: 0 16px; font-size: 14px; }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { border: 1px solid var(--line-strong); }
.btn--ghost:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -12px var(--accent); }

.status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 60%, transparent);
  font-size: 14px; color: var(--ink-2);
}
.dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--ok); opacity: 0; animation: ping 2.2s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(0.5); opacity: 0.8; } 80%, 100% { transform: scale(1.4); opacity: 0; } }

.tag {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--ink-2);
  white-space: nowrap;
}

.eyebrow {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 500;
}
.eyebrow::before { content: ""; width: 24px; height: 1px; background: currentColor; }

/* ---------- Hero ---------- */
/* Reeded "curtain" glass behind the hero (WebGL in assets/js/glass.js). */
.hero-shell { position: relative; isolation: isolate; }
.hero-glass {
  position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  /* Fallback when WebGL is unavailable: soft glow seen through CSS strips. */
  background:
    repeating-linear-gradient(90deg, transparent 0 60px, color-mix(in srgb, var(--ink) 5%, transparent) 72px, transparent 78px),
    radial-gradient(40% 55% at 78% 40%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    radial-gradient(35% 45% at 95% 85%, color-mix(in srgb, #4f6bff 26%, transparent), transparent 70%),
    var(--bg);
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.hero-glass canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s var(--ease); }
.hero-glass.is-live { background: var(--bg); }
.hero-glass.is-live canvas { opacity: 1; }
.hero { padding-top: clamp(120px, 18vh, 180px); padding-bottom: clamp(40px, 6vw, 72px); }
.hero__top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: clamp(28px, 4vw, 44px); }
.hero__title {
  font-size: clamp(44px, 7.4vw, 116px);
  line-height: 0.98; letter-spacing: -0.045em; font-weight: 500;
}
.hero__title .serif { letter-spacing: -0.02em; }
.hero__bottom {
  margin-top: clamp(32px, 5vw, 56px);
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px 64px; align-items: end;
}
.hero__lede { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.55; color: var(--ink-2); max-width: 36em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
@media (max-width: 860px) {
  .hero__bottom { grid-template-columns: 1fr; }
  .hero__actions { justify-content: flex-start; }
}

/* Reel: curved (concave) carousel of work, driven by assets/js/carousel.js. */
.reel {
  --w: clamp(190px, 21vw, 310px);
  --h: calc(var(--w) * 0.9);
  position: relative; overflow: hidden;
  height: calc(var(--h) * 1.55 + 16px);
  perspective: 1500px; perspective-origin: 50% 50%;
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none;
  /* Soft fade on both sides */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 22%, #000 78%, transparent 100%);
}
.reel.is-dragging { cursor: grabbing; }
/* Without JS: a simple centred row. */
.reel__stage { position: absolute; inset: 0; display: flex; gap: 20px; align-items: center; justify-content: center; }
.js .reel__stage { display: block; transform-style: preserve-3d; }
.reel__item {
  position: relative; width: var(--w); height: var(--h); flex: none;
  border-radius: 14px; overflow: hidden; background: var(--bg-2);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.js .reel__item {
  position: absolute; left: 50%; top: 50%;
  margin: calc(var(--h) / -2) 0 0 calc(var(--w) / -2);
  backface-visibility: hidden; will-change: transform;
}
.reel__item img { width: 100%; height: 100%; object-fit: cover; object-position: center; pointer-events: none; -webkit-user-drag: none; }
.reel__item.is-art { border-color: transparent; }
/* Screens sit on the project tint like a mockup, bleeding off the bottom-right corner. */
.reel__item.is-shot { --tint: var(--tint-l); background: var(--tint); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .reel__item.is-shot { --tint: var(--tint-d); } }
:root[data-theme="dark"] .reel__item.is-shot { --tint: var(--tint-d); }
.reel__shot {
  position: absolute; left: 11%; top: 13%; width: 112%; height: 100%;
  border-radius: 8px 0 0 0; overflow: hidden; background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.08), 0 18px 36px -18px rgba(20, 20, 20, 0.45);
}
.reel__shot img { object-position: top left; }

/* Logos / sectors strip */
.strip { border-block: 1px solid var(--line); margin-top: clamp(24px, 4vw, 40px); }
.strip__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px;
  padding-block: 22px; font-size: 15px; color: var(--muted);
}
.strip__inner strong { color: var(--ink); font-weight: 500; }
.strip__list { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.strip__list li { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.strip__list li::before { content: "✦"; color: var(--accent); font-size: 11px; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(72px, 10vw, 140px); }
.section__head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 24px;
  margin-bottom: clamp(36px, 5vw, 64px);
}
.section__title {
  font-size: clamp(36px, 5vw, 72px); line-height: 1.02; letter-spacing: -0.04em; font-weight: 500;
  margin-top: 14px; max-width: 16ch;
}
.section__intro { max-width: 30em; color: var(--ink-2); font-size: 18px; }

/* ---------- Work: filterable project grid (mirrors the Figma "Featured projects" board) ---------- */
.work-head { display: grid; justify-items: center; text-align: center; gap: 0; margin-bottom: clamp(32px, 4vw, 52px); }
.work-head .section__title { max-width: none; }
.work-head .section__intro { margin-top: 16px; font-size: 17px; }
.filters { display: none; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 28px; }
.js .filters { display: flex; }
.filter {
  display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 16px 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  font: 500 13px/1 var(--font-sans); text-transform: uppercase; letter-spacing: 0.08em; cursor: pointer;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.filter:hover { border-color: var(--line-strong); color: var(--ink); }
.filter sup { font-size: 10px; letter-spacing: 0; color: var(--muted); transform: translateY(-3px); }
/* Radio-style dot, as in the Figma filter */
.filter__dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; opacity: 0.7; }
.filter__dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; transform: scale(0); transition: transform 0.3s var(--ease); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter[aria-pressed="true"] sup { color: inherit; opacity: 0.6; }
.filter[aria-pressed="true"] .filter__dot { opacity: 1; }
.filter[aria-pressed="true"] .filter__dot::after { transform: scale(1); }

/* Masonry that still reads left-to-right: main.js sets each card's row span from its height. */
.pgrid { --gap: clamp(16px, 1.8vw, 24px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.js .pgrid { grid-auto-rows: 2px; row-gap: 0; }
@media (max-width: 1080px) { .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .pgrid { grid-template-columns: minmax(0, 1fr); } }
.pcard {
  --tint: var(--tint-l);
  display: block;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pcard { --tint: var(--tint-d); } }
:root[data-theme="dark"] .pcard { --tint: var(--tint-d); }
.js .pgrid .pcard { margin-bottom: var(--gap); }
.pcard[hidden] { display: none; }
.pgrid.is-switching .pcard { opacity: 0; transform: translateY(10px) scale(0.985); }

.pcard__media { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--tint); isolation: isolate; }
.pcard__art img { width: 100%; transition: transform 1s var(--ease); }
.pcard:hover .pcard__art img { transform: scale(1.04); }
.pcard__art.is-dark { background: #111; }

/* Projects without a Figma mockup: framed screenshot (+ phone) on the tint */
.pcard__art--comp { aspect-ratio: 593 / 530; position: relative; }
.pcard__shot {
  position: absolute; left: 9%; top: 24%; width: 110%;
  border-radius: 10px 0 0 0; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-lg);
  transition: transform 0.9s var(--ease);
}
.pcard__shot::before {
  content: ""; display: block; height: 18px; background: var(--surface); border-bottom: 1px solid var(--line);
  background-image: radial-gradient(circle at 12px 9px, #ff5f57 3.5px, transparent 4px),
                    radial-gradient(circle at 24px 9px, #febc2e 3.5px, transparent 4px),
                    radial-gradient(circle at 36px 9px, #28c840 3.5px, transparent 4px);
}
.pcard__art--comp .pcard__shot img, .pcard:hover .pcard__art--comp img { transform: none; }
.pcard:hover .pcard__shot { transform: translate(-10px, -10px); }
.pcard__phone {
  position: absolute; left: 6%; bottom: -14%; width: 22%; z-index: 2;
  border-radius: 18px; overflow: hidden; border: 4px solid #121212; background: #121212; box-shadow: var(--shadow-lg);
  transition: transform 0.9s var(--ease);
}
.pcard__phone img { width: 100%; }
.pcard:hover .pcard__phone { transform: translateY(-16px) rotate(-2deg); }

.pcard__label { position: absolute; left: 0; right: 0; top: 0; z-index: 3; padding: clamp(18px, 1.8vw, 24px); color: var(--ink); pointer-events: none; }
.pcard__label.on-light { color: #141414; }
.pcard__label.on-dark { color: #fff; }
.pcard__kind { display: block; font-size: 14px; opacity: 0.78; letter-spacing: -0.005em; }
.pcard__headline { margin-top: 2px; font-size: clamp(19px, 1.6vw, 23px); line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; max-width: 22ch; }

.pcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 4px 2px; }
.pcard__foot div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.pcard__foot strong { font-weight: 500; font-size: 16px; }
.pcard__foot span { color: var(--muted); font-size: 14px; }
.pcard__arrow {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong);
  display: grid; place-items: center; transition: background-color 0.3s, color 0.3s, transform 0.5s var(--ease), border-color 0.3s;
}
.pcard__arrow svg { width: 16px; height: 16px; }
.pcard:hover .pcard__arrow { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: rotate(-45deg); }
.pcard:focus-visible { outline: none; }
.pcard:focus-visible .pcard__media { outline: 2px solid var(--accent); outline-offset: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Work grid (legacy cards) ---------- */
.work { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 32px); }
.work .card:first-child { grid-column: 1 / -1; }
@media (max-width: 820px) { .work { grid-template-columns: 1fr; } }

.card { --tint: var(--tint-l); display: block; position: relative; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { --tint: var(--tint-d); } }
:root[data-theme="dark"] .card { --tint: var(--tint-d); }

.card__media {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--tint); aspect-ratio: 4 / 3;
  isolation: isolate;
}
.work .card:first-child .card__media { aspect-ratio: 21 / 10; }
@media (max-width: 820px) { .work .card:first-child .card__media { aspect-ratio: 4 / 3; } }

.card__shot {
  position: absolute; left: 9%; right: 9%; top: 10%;
  border-radius: 12px 12px 0 0; overflow: hidden;
  box-shadow: var(--shadow-lg); background: var(--surface);
  transition: transform 0.9s var(--ease);
}
.work .card:first-child .card__shot { left: 14%; right: 14%; top: 9%; }
.card__shot::before {
  content: ""; display: block; height: 22px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  background-image: radial-gradient(circle at 14px 11px, #ff5f57 4px, transparent 4.5px),
                    radial-gradient(circle at 28px 11px, #febc2e 4px, transparent 4.5px),
                    radial-gradient(circle at 42px 11px, #28c840 4px, transparent 4.5px);
}
.card__shot img { width: 100%; }
.card:hover .card__shot { transform: translateY(-14px) scale(1.015); }

.card__phone {
  position: absolute; right: 5%; bottom: -18%; width: 19%; z-index: 2;
  border-radius: 22px; overflow: hidden; border: 5px solid #121212; background: #121212;
  box-shadow: var(--shadow-lg);
  transition: transform 0.9s var(--ease);
}
.card__phone img { width: 100%; }
.card:hover .card__phone { transform: translateY(-24px) rotate(-2deg); }
@media (max-width: 820px) { .card__phone { width: 26%; } }

.card__badge {
  position: absolute; top: 16px; left: 16px; z-index: 3;
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 13px; font-weight: 500; color: var(--ink);
}
.card__body { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; padding: 20px 4px 0; align-items: start; }
.card__title { font-size: clamp(22px, 2vw, 28px); letter-spacing: -0.03em; font-weight: 500; line-height: 1.2; }
.card__title .serif { color: var(--muted); }
.card__desc { grid-column: 1 / -1; color: var(--ink-2); max-width: 44em; }
.card__tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.card__arrow {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong);
  display: grid; place-items: center; transition: background-color 0.3s, color 0.3s, transform 0.5s var(--ease), border-color 0.3s;
}
.card__arrow svg { width: 18px; height: 18px; }
.card:hover .card__arrow { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: rotate(-45deg); }

/* Cursor bubble */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none;
  width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 500; line-height: 1.2;
  transform: translate3d(var(--x, -200px), var(--y, -200px), 0) scale(0);
  transition: transform 0.35s var(--ease);
}
.cursor.is-on { transform: translate3d(var(--x), var(--y), 0) scale(1); }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------- Services ---------- */
.services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.service { padding: 32px 28px 36px 0; border-bottom: 1px solid var(--line); }
.service + .service { padding-left: 28px; border-left: 1px solid var(--line); }
.service__num { font-family: var(--font-serif); font-style: italic; font-size: 22px; color: var(--accent); }
.service__title { font-size: 26px; letter-spacing: -0.03em; font-weight: 500; margin: 18px 0 12px; line-height: 1.15; }
.service p { color: var(--ink-2); }
.service ul { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 900px) {
  .services { grid-template-columns: 1fr; }
  .service, .service + .service { padding: 28px 0; border-left: 0; }
}

/* ---------- Process ---------- */
.process { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; counter-reset: step; }
.step {
  position: relative; padding: 28px 24px 32px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.step:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.step__k { font-size: 13px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.step h3 { font-size: 24px; font-weight: 500; letter-spacing: -0.03em; margin: 40px 0 10px; }
.step p { color: var(--ink-2); font-size: 16px; }
@media (max-width: 1000px) { .process { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .process { grid-template-columns: 1fr; } .step h3 { margin-top: 24px; } }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.portrait {
  position: sticky; top: 110px;
  aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-2);
  display: grid; place-items: center;
  border: 1px solid var(--line);
}
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }
.portrait__mono { font-family: var(--font-serif); font-style: italic; font-size: clamp(120px, 16vw, 220px); line-height: 1; color: var(--ink); opacity: 0.9; letter-spacing: -0.04em; }
.portrait__cap {
  position: absolute; left: 16px; right: 16px; bottom: 16px;
  display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-2);
  padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.about__text h2 { font-size: clamp(30px, 3.6vw, 52px); line-height: 1.1; letter-spacing: -0.035em; font-weight: 500; }
.about__text p { margin-top: 22px; color: var(--ink-2); font-size: 18px; max-width: 36em; }
.facts { margin-top: 40px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.fact { padding: 20px 0; border-bottom: 1px solid var(--line); }
.fact:nth-child(odd) { padding-right: 20px; }
.fact:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
.fact dt { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.fact dd { margin: 6px 0 0; font-size: 17px; }
.tools { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .portrait { position: relative; top: 0; max-width: 420px; }
}
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; }
  .fact:nth-child(even) { padding-left: 0; border-left: 0; }
}

/* ---------- Contact ---------- */
.contact { padding-block: clamp(80px, 12vw, 160px); text-align: center; position: relative; overflow: hidden; }
.contact::before {
  content: ""; position: absolute; inset: auto -20% -60% -20%; height: 120%; z-index: -1;
  background: radial-gradient(50% 50% at 50% 50%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
}
.contact__title { font-size: clamp(48px, 9vw, 150px); line-height: 0.95; letter-spacing: -0.05em; font-weight: 500; margin-top: 22px; }
.contact__lede { margin: 28px auto 0; max-width: 34em; color: var(--ink-2); font-size: 19px; }
.contact__actions { margin-top: 40px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.email {
  display: inline-flex; align-items: center; gap: 12px; margin-top: 32px;
  font-size: clamp(20px, 2.6vw, 32px); letter-spacing: -0.02em;
  border-bottom: 1px solid var(--line-strong); padding-bottom: 4px;
  transition: color 0.2s, border-color 0.2s;
}
.email:hover { color: var(--accent); border-color: var(--accent); }
.copy { font-size: 13px; color: var(--muted); margin-left: 4px; }
.copy.is-done { color: var(--ok); }
.contact .eyebrow { justify-content: center; }
.contact .eyebrow::after { content: ""; width: 24px; height: 1px; background: currentColor; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 28px; font-size: 14px; color: var(--muted); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.footer a:hover { color: var(--ink); }
.footer__links { display: flex; flex-wrap: wrap; gap: 20px; }

/* ==========================================================================
   Case study
   ========================================================================== */
.cs-hero { padding-top: clamp(116px, 16vh, 160px); }
.back { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); transition: color 0.2s; }
.back:hover { color: var(--ink); }
.back svg { width: 16px; height: 16px; transform: rotate(180deg); transition: transform 0.3s var(--ease); }
.back:hover svg { transform: rotate(180deg) translateX(3px); }
.cs-hero__eyebrow { margin-top: 40px; }
.cs-title { font-size: clamp(44px, 7vw, 108px); line-height: 0.98; letter-spacing: -0.045em; font-weight: 500; margin-top: 18px; }
.cs-title .serif { color: var(--muted); display: block; font-size: 0.62em; margin-top: 0.12em; letter-spacing: -0.02em; line-height: 1.05; }
.cs-lede { margin-top: 28px; max-width: 40em; font-size: clamp(18px, 1.6vw, 22px); color: var(--ink-2); line-height: 1.55; }
.cs-note {
  margin-top: 20px; display: inline-flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; border-radius: 12px; background: var(--bg-2); color: var(--ink-2); font-size: 14px;
}
.cs-note svg { width: 16px; height: 16px; margin-top: 3px; flex: none; color: var(--accent); }

.meta {
  margin-top: clamp(40px, 5vw, 64px);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line);
}
.meta div { padding: 20px 20px 20px 0; }
.meta div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.meta dt { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.meta dd { margin: 8px 0 0; font-size: 16px; line-height: 1.45; }
.meta a { display: inline-flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line-strong); }
.meta a:hover { color: var(--accent); border-color: var(--accent); }
.meta a svg { width: 13px; height: 13px; transform: rotate(-45deg); }
@media (max-width: 1000px) {
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta div, .meta div + div { padding: 18px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .meta div:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .meta { grid-template-columns: 1fr; }
  .meta div:nth-child(even) { padding-left: 0; border-left: 0; }
}

.cs-cover {
  --tint: var(--tint-l);
  margin-top: clamp(32px, 4vw, 48px); border-radius: var(--radius); background: var(--tint);
  padding: clamp(20px, 6vw, 88px) clamp(16px, 7vw, 120px) 0; overflow: hidden;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cs-cover { --tint: var(--tint-d); } }
:root[data-theme="dark"] .cs-cover { --tint: var(--tint-d); }
.cs-cover .frame { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.frame {
  border-radius: 12px; overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.frame::before {
  content: ""; display: block; height: 26px; background: var(--surface); border-bottom: 1px solid var(--line);
  background-image: radial-gradient(circle at 16px 13px, #ff5f57 4.5px, transparent 5px),
                    radial-gradient(circle at 32px 13px, #febc2e 4.5px, transparent 5px),
                    radial-gradient(circle at 48px 13px, #28c840 4.5px, transparent 5px);
}
.frame img { width: 100%; }

.cs-section { padding-block: clamp(56px, 8vw, 112px) 0; }
.cs-grid { display: grid; grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr); gap: 24px clamp(32px, 6vw, 96px); }
.cs-grid h2 { font-size: clamp(28px, 3vw, 40px); letter-spacing: -0.035em; font-weight: 500; line-height: 1.1; }
.cs-grid h2 .num { display: block; font-family: var(--font-serif); font-style: italic; color: var(--accent); font-size: 0.6em; margin-bottom: 12px; letter-spacing: 0; }
.prose p { font-size: 19px; color: var(--ink-2); max-width: 38em; }
.prose p + p { margin-top: 18px; }
@media (max-width: 860px) { .cs-grid { grid-template-columns: 1fr; } }

.points { counter-reset: pt; display: grid; gap: 0; border-top: 1px solid var(--line); }
.points li {
  counter-increment: pt; display: grid; grid-template-columns: 52px 1fr; gap: 12px;
  padding: 22px 0; border-bottom: 1px solid var(--line); font-size: 18px; color: var(--ink-2);
}
.points li::before { content: counter(pt, decimal-leading-zero); font-size: 14px; color: var(--muted); padding-top: 4px; font-variant-numeric: tabular-nums; }
.points li strong { color: var(--ink); font-weight: 500; }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); margin-top: clamp(32px, 4vw, 56px); }
.gallery figure { margin: 0; }
.gallery .wide { grid-column: 1 / -1; }
.gallery figcaption { margin-top: 14px; font-size: 15px; color: var(--muted); max-width: 46em; }
.gallery figcaption strong { color: var(--ink); font-weight: 500; }
.gallery button { display: block; width: 100%; text-align: left; cursor: zoom-in; border-radius: 12px; }
@media (max-width: 760px) { .gallery { grid-template-columns: 1fr; } }

.phones {
  --tint: var(--tint-l);
  margin-top: clamp(32px, 4vw, 56px); border-radius: var(--radius); background: var(--tint);
  padding: clamp(32px, 6vw, 80px) 16px; display: flex; justify-content: center; gap: clamp(14px, 4vw, 56px); flex-wrap: wrap;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .phones { --tint: var(--tint-d); } }
:root[data-theme="dark"] .phones { --tint: var(--tint-d); }
.phone { width: clamp(150px, 22vw, 280px); text-align: center; }
.phone__frame {
  border-radius: 30px; overflow: hidden; border: 7px solid #111; background: #111; box-shadow: var(--shadow-lg);
}
.phone__frame img { width: 100%; }
.phone figcaption { margin-top: 14px; font-size: 14px; color: var(--ink-2); }
.phone:nth-child(2) { transform: translateY(clamp(12px, 3vw, 40px)); }
@media (max-width: 600px) {
  .phones { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scroll-snap-type: x mandatory; padding-inline: 24px; scrollbar-width: none; }
  .phones::-webkit-scrollbar { display: none; }
  .phone { flex: none; width: 60vw; scroll-snap-align: center; }
  .phone:first-child { margin-left: auto; }
  .phone:last-child { margin-right: auto; }
  .phone:nth-child(2) { transform: none; }
}

.outcomes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.outcome { padding: 28px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.outcome__k { font-size: clamp(30px, 3vw, 44px); letter-spacing: -0.04em; font-weight: 500; line-height: 1; }
.outcome p { margin-top: 14px; color: var(--ink-2); font-size: 16px; }
@media (max-width: 860px) { .outcomes { grid-template-columns: 1fr; } }

.next {
  display: block; margin-top: clamp(80px, 10vw, 140px); border-top: 1px solid var(--line);
  padding-block: clamp(48px, 7vw, 96px);
}
.next__label { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.next__title {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 14px;
  font-size: clamp(40px, 7vw, 104px); letter-spacing: -0.045em; line-height: 1; font-weight: 500;
  transition: color 0.3s;
}
.next__title svg { width: clamp(36px, 5vw, 72px); height: clamp(36px, 5vw, 72px); flex: none; transition: transform 0.5s var(--ease); }
.next:hover .next__title { color: var(--accent); }
.next:hover .next__title svg { transform: translateX(10px); }

/* Lightbox */
.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(1600px, 96vw); max-height: 94vh; width: 100%;
}
.lightbox::backdrop { background: rgba(10, 10, 10, 0.86); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lightbox img { width: 100%; max-height: 88vh; object-fit: contain; border-radius: 12px; }
.lightbox__close {
  position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
  background: #fff; color: #111; display: grid; place-items: center; font-size: 22px; line-height: 1;
}
.lightbox__cap { color: #ddd; text-align: center; margin-top: 12px; font-size: 15px; }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal[data-delay="1"] { transition-delay: 0.08s; }
.js .reveal[data-delay="2"] { transition-delay: 0.16s; }
.js .reveal[data-delay="3"] { transition-delay: 0.24s; }

.js .hero__title .line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.js .hero__title .line > span { display: inline-block; transform: translateY(105%); transition: transform 1.1s var(--ease); }
.js .hero.in .hero__title .line > span { transform: none; }
.js .hero.in .hero__title .line:nth-child(2) > span { transition-delay: 0.08s; }
.js .hero.in .hero__title .line:nth-child(3) > span { transition-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .js .hero__title .line > span { transform: none; }
}
/* After the first filter change, cards switch quickly instead of using the slow scroll-reveal timing. */
.js .pgrid.is-filtered .pcard { transition: opacity 0.35s var(--ease), transform 0.35s var(--ease); transition-delay: 0s; }
/* Phones: filter chips become one swipeable row instead of wrapping. */
@media (max-width: 680px) {
  .filters { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; width: calc(100% + 2 * var(--gutter)); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .filters::-webkit-scrollbar { display: none; }
  .filter { flex: none; }
}
.cs-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
