/* ==========================================================================
   Théo Naciri — personal site
   Plain CSS, no build step. Light/dark follow the visitor's OS preference.
   ========================================================================== */

/* ---------- Fonts (self-hosted, latin subset, SIL OFL — see assets/fonts) ---------- */
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-italic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
/* Metric-matched fallbacks: no layout shift while the web fonts load */
@font-face {
  font-family: "Geist Fallback";
  src: local("Arial"), local("Liberation Sans"), local("Helvetica");
  size-adjust: 105.42%;
  ascent-override: 95.33%;
  descent-override: 27.98%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Instrument Serif Fallback";
  src: local("Times New Roman"), local("Liberation Serif"), local("Times");
  size-adjust: 83.65%;
  ascent-override: 118.35%;
  descent-override: 37.06%;
  line-gap-override: 0%;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #f6f4ef;
  --bg-2: #eeebe3;
  --surface: #fffdf9;
  --ink: #0f1d33;
  --ink-2: #4c5566;
  --ink-3: #626978;
  --line: rgb(15 29 51 / 0.11);
  --line-2: rgb(15 29 51 / 0.2);
  --accent: #1f4fd8;
  --accent-ink: #ffffff;
  --accent-soft: rgb(31 79 216 / 0.09);
  --topo: rgb(31 79 216 / 0.26);
  --ok: #0f7d40;
  --invert-bg: #0f1d33;
  --invert-ink: #f6f4ef;
  --invert-ink-2: #b9c2d3;

  --shadow-1: 0 1px 2px rgb(15 29 51 / 0.06), 0 10px 28px -14px rgb(15 29 51 / 0.22);
  --shadow-2: 0 2px 6px rgb(15 29 51 / 0.06), 0 34px 64px -28px rgb(15 29 51 / 0.4);

  --font-serif: "Instrument Serif", "Instrument Serif Fallback", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "Geist", "Geist Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 68px;
  --radius: 14px;
  --radius-sm: 9px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a111e;
    --bg-2: #0f1828;
    --surface: #111b2d;
    --ink: #eef2f8;
    --ink-2: #a9b3c4;
    --ink-3: #7d889c;
    --line: rgb(238 242 248 / 0.09);
    --line-2: rgb(238 242 248 / 0.17);
    --accent: #8aa8ff;
    --accent-ink: #0a111e;
    --accent-soft: rgb(138 168 255 / 0.12);
    --topo: rgb(138 168 255 / 0.2);
    --ok: #3ccf7f;
    --invert-bg: #eef2f8;
    --invert-ink: #0a111e;
    --invert-ink-2: #4c5566;

    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.35), 0 10px 28px -14px rgb(0 0 0 / 0.7);
    --shadow-2: 0 2px 6px rgb(0 0 0 / 0.35), 0 34px 64px -28px rgb(0 0 0 / 0.85);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

p,
h1,
h2,
h3 {
  margin: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-weight: 500;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 12px;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.i {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Buttons & links ---------- */
.btn {
  --h: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: var(--h);
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 500 0.95rem/1 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out), background-color 0.3s,
    border-color 0.3s, color 0.3s;
}
.btn .i {
  transition: transform 0.4s var(--ease-out);
}
.btn:hover .i--move {
  transform: translateX(3px);
}
.btn:hover .i--down {
  transform: translateY(2px);
}
.btn--primary {
  background: var(--ink);
  color: var(--bg);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -14px rgb(15 29 51 / 0.55);
}
.btn--ghost {
  border-color: var(--line-2);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--ink);
  backdrop-filter: blur(6px);
}
.btn--ghost:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.btn--sm {
  --h: 38px;
  padding: 0 16px;
  font-size: 0.875rem;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size 0.45s var(--ease-out), color 0.3s;
}
.link:hover {
  color: var(--accent);
  background-size: 0 1px;
  background-position: 100% 100%;
}
.link .i {
  width: 0.85em;
  height: 0.85em;
  transition: transform 0.4s var(--ease-out);
}
.link:hover .i--ext {
  transform: translate(2px, -2px);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background-color 0.35s, border-color 0.35s, backdrop-filter 0.35s;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  margin-right: auto;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--bg);
  font: 400 1.05rem/1 var(--font-serif);
  letter-spacing: 0.02em;
  transition: transform 0.5s var(--ease-out), border-radius 0.5s var(--ease-out);
}
.brand:hover .brand__mark {
  transform: rotate(-8deg);
  border-radius: 50%;
}
.brand__name {
  font-weight: 500;
  font-size: 0.95rem;
}
.nav {
  display: flex;
  gap: 28px;
}
.nav a {
  position: relative;
  font-size: 0.9rem;
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.3s;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}
.nav a:hover,
.nav a[aria-current] {
  color: var(--ink);
}
.nav a:hover::after,
.nav a[aria-current]::after {
  transform: scaleX(1);
  transform-origin: left;
}
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lang {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font: 500 0.75rem/1 var(--font-mono);
}
.lang a {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: background-color 0.3s, color 0.3s;
}
.lang a:hover {
  color: var(--ink);
}
.lang a[aria-current] {
  background: var(--ink);
  color: var(--bg);
}
.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(var(--scroll, 0));
  transform-origin: left;
  pointer-events: none;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: min(100svh, 1000px);
  padding: calc(var(--header-h) + 36px) 0 100px;
  overflow: hidden;
}
.hero__topo {
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--topo);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 120px, #000 62%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 120px, #000 62%, transparent);
}
.hero__topo svg {
  position: absolute;
  inset: -3%;
  width: 106%;
  height: 106%;
  max-width: none;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0);
  transition: transform 1.2s var(--ease-out);
}
.topo path:not(.topo__pulse) {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: topo-draw 3.2s var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 60ms + 120ms);
}
.topo .topo__pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 0.045 0.955;
  stroke-dashoffset: 1;
  opacity: 0;
  animation: topo-pulse 11s linear infinite;
  animation-delay: calc(2.6s + var(--p) * 2.6s);
}
.topo__summit {
  fill: var(--accent);
}
.topo__ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  transform-box: fill-box;
  transform-origin: center;
  animation: summit 3.2s var(--ease-out) infinite;
  animation-delay: 2.4s;
  opacity: 0;
}
@keyframes topo-draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes topo-pulse {
  0% {
    stroke-dashoffset: 1;
    opacity: 0;
  }
  6%,
  88% {
    opacity: 0.85;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
}
@keyframes summit {
  0% {
    transform: scale(0.4);
    opacity: 0.9;
  }
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

.hero__inner {
  position: relative;
}
.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 0.875rem;
  color: var(--ink-2);
}
.pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ok);
  animation: ping 2.2s var(--ease-out) infinite;
}
@keyframes ping {
  from {
    transform: scale(1);
    opacity: 0.6;
  }
  to {
    transform: scale(3.2);
    opacity: 0;
  }
}

.hero__name {
  margin: 22px 0 0;
  font: 400 clamp(4.4rem, 13.4vw, 10.6rem) / 1 var(--font-serif);
  letter-spacing: -0.03em;
}
.hero__name .line {
  display: block;
  overflow: hidden;
  padding: 0.04em 0.06em 0.1em 0;
}
.hero__name .line + .line {
  margin-top: -0.2em;
  padding-left: clamp(0px, 9vw, 150px);
}
.hero__name .word {
  display: inline-block;
  animation: rise 1.25s var(--ease-out) both;
}
.hero__name .line + .line .word {
  animation-delay: 0.12s;
}
.hero__name em {
  font-style: italic;
  color: var(--accent);
}
.hero__role {
  margin-top: 18px;
  font: 500 clamp(1.15rem, 2.2vw, 1.5rem) / 1.3 var(--font-sans);
  letter-spacing: -0.01em;
}
.hero__lead {
  margin-top: 14px;
  max-width: 600px;
  font-size: clamp(1.02rem, 1.4vw, 1.15rem);
  color: var(--ink-2);
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  margin-top: 30px;
}
.hero__cta .link {
  margin-left: 8px;
  font-size: 0.95rem;
}
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 34px;
  list-style: none;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.hero__meta li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero__meta .i {
  color: var(--accent);
}
.hero .fade-in {
  animation: fade-up 1s var(--ease-out) both;
  animation-delay: calc(0.35s + var(--d, 0) * 0.1s);
}
.hero__scroll {
  position: absolute;
  left: 50%;
  bottom: 26px;
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: 10px;
  font: 500 0.68rem/1 var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
}
.hero__scroll::after {
  content: "";
  width: 1px;
  height: 44px;
  background: currentColor;
  animation: scroll-cue 2.4s var(--ease-in-out) infinite;
}
@keyframes rise {
  from {
    transform: translateY(105%);
  }
  to {
    transform: none;
  }
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes scroll-cue {
  0% {
    transform: scaleY(0);
    transform-origin: top;
  }
  45% {
    transform: scaleY(1);
    transform-origin: top;
  }
  55% {
    transform: scaleY(1);
    transform-origin: bottom;
  }
  100% {
    transform: scaleY(0);
    transform-origin: bottom;
  }
}

/* ---------- Clients marquee ---------- */
.clients {
  padding: 30px 0 34px;
  border-block: 1px solid var(--line);
}
.clients__label.eyebrow {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 55s linear infinite;
}
.marquee:hover .marquee__track {
  animation-play-state: paused;
}
.marquee ul {
  display: flex;
  align-items: center;
  list-style: none;
}
.marquee li {
  display: flex;
  align-items: center;
  gap: 52px;
  padding-right: 52px;
  font: italic 400 clamp(1.6rem, 3.2vw, 2.4rem) / 1.2 var(--font-serif);
  color: var(--ink-2);
  white-space: nowrap;
}
.marquee li::after {
  content: "";
  width: 7px;
  height: 7px;
  rotate: 45deg;
  background: var(--accent);
  opacity: 0.7;
}
@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(76px, 10vw, 136px);
}
.section-head {
  display: grid;
  gap: 18px;
  margin-bottom: clamp(40px, 6vw, 72px);
}
.section-head--split {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: end;
  gap: 18px 64px;
}
.section-head--split .eyebrow {
  grid-column: 1 / -1;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 500 0.74rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.eyebrow b {
  font-weight: 500;
  color: var(--accent);
}
.eyebrow::after {
  content: "";
  width: 44px;
  height: 1px;
  background: var(--line-2);
}
.clients__label.eyebrow::before {
  content: "";
  width: 44px;
  height: 1px;
  background: var(--line-2);
}
.section-title {
  font: 400 clamp(2.6rem, 6.4vw, 5.4rem) / 1 var(--font-serif);
  letter-spacing: -0.025em;
}
.section-title em {
  font-style: italic;
  color: var(--accent);
}
.section-lead {
  max-width: 560px;
  color: var(--ink-2);
  font-size: 1.08rem;
}
.hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font: 500 0.75rem/1.4 var(--font-mono);
  color: var(--ink-2);
}
.hint .i {
  color: var(--accent);
}
.hint__touch {
  display: none;
}
@media (hover: none) {
  .hint__hover {
    display: none;
  }
  .hint__touch {
    display: inline;
  }
}

/* ---------- About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.about__intro {
  font: 400 clamp(1.45rem, 2.6vw, 2rem) / 1.35 var(--font-serif);
  letter-spacing: -0.005em;
}
.about__intro em {
  font-style: italic;
  color: var(--accent);
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}
.stat {
  padding: 26px 0 26px;
  border-bottom: 1px solid var(--line);
}
.stat:nth-child(odd) {
  padding-right: 24px;
}
.stat:nth-child(even) {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}
.stat dt {
  font: 400 clamp(3.2rem, 6vw, 4.8rem) / 1 var(--font-serif);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat dt small {
  font-size: 0.55em;
  color: var(--accent);
  margin-left: 2px;
}
.stat dd {
  margin: 10px 0 0;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.principles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: clamp(48px, 7vw, 88px);
  list-style: none;
}
.principle {
  position: relative;
  padding: 24px 22px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out), border-color 0.3s;
}
.principle:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-1);
  border-color: var(--line-2);
}
.principle__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
}
.principle h3 {
  margin-top: 18px;
  font: 400 1.45rem/1.15 var(--font-serif);
}
.principle p {
  margin-top: 8px;
  font-size: 0.93rem;
  color: var(--ink-2);
}

/* ---------- Work / book ---------- */
.work {
  background: var(--bg-2);
  border-block: 1px solid var(--line);
}
.project {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 72px);
  padding-block: clamp(48px, 7vw, 96px);
  border-top: 1px solid var(--line);
}
.project:first-of-type {
  border-top: 0;
  padding-top: 8px;
}
.project__info {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  align-self: start;
}
.project__num {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font: italic 400 2.6rem/1 var(--font-serif);
  color: var(--accent);
}
.project__num span {
  font: 500 0.72rem/1 var(--font-mono);
  font-style: normal;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}
.project__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 22px;
  font: 500 0.72rem/1.5 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.project__meta span + span::before {
  content: "·";
  margin-right: 10px;
  color: var(--ink-3);
}
.project__title {
  margin-top: 10px;
  font: 400 clamp(2.1rem, 3.6vw, 3rem) / 1.02 var(--font-serif);
  letter-spacing: -0.02em;
}
.project__title em {
  font-style: italic;
  color: var(--accent);
}
.project__role {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.project__desc {
  margin-top: 18px;
  color: var(--ink-2);
}
.result {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  font-weight: 500;
  color: var(--ink);
}
.result .i {
  margin-top: 0.3em;
  color: var(--accent);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
  list-style: none;
}
.tags li {
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font: 500 0.72rem/1 var(--font-mono);
  color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}
.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 22px;
  list-style: none;
  font-size: 0.95rem;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 22px);
  align-items: start;
}
.shot {
  margin: 0;
  min-width: 0;
}
.shot--wide {
  grid-column: 1 / -1;
}
.shot__frame {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line);
  text-decoration: none;
  cursor: zoom-in;
  transition: transform 0.6s var(--ease-out), box-shadow 0.6s var(--ease-out);
}
.shot__frame:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-2), 0 0 0 1px var(--line-2);
}
.shot__frame:focus-visible {
  outline-offset: 5px;
  border-radius: var(--radius);
}
.shot__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.shot__bar i {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--line-2);
}
.shot__bar i:first-child {
  background: #ff5f57;
}
.shot__bar i:nth-child(2) {
  background: #febc2e;
}
.shot__bar i:nth-child(3) {
  background: #28c840;
}
.shot__url {
  flex: 1;
  min-width: 0;
  margin: 0 8px 0 10px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--bg-2);
  font: 500 0.66rem/1 var(--font-mono);
  color: var(--ink-3);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shot__view {
  position: relative;
  display: block;
  aspect-ratio: var(--ar, 1.6);
  overflow: hidden;
  container-type: inline-size;
  background: var(--bg-2);
}
.shot__view img {
  width: 100%;
  height: auto;
  transform: translateY(0);
  transition: transform 1s var(--ease-out);
}
.shot--crop .shot__view img {
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
}
/* Tall screenshots scroll inside their browser frame on hover / keyboard focus */
.shot--tall .shot__frame:hover img,
.shot--tall .shot__frame:focus-visible img {
  transform: translateY(calc(-100% + 100cqw / var(--ar)));
  transition: transform calc(var(--r, 2) * 1.9s) cubic-bezier(0.45, 0.05, 0.4, 1);
}
.shot__hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgb(10 17 30 / 0.72);
  color: #fff;
  font: 500 0.66rem/1 var(--font-mono);
  letter-spacing: 0.04em;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s var(--ease-out);
}
.shot__frame:hover .shot__hint,
.shot__frame:focus-visible .shot__hint {
  opacity: 0;
  transform: translateY(6px);
}
.shot figcaption {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.shot figcaption::before {
  content: "";
  flex: none;
  width: 14px;
  height: 1px;
  margin-top: 0.75em;
  background: var(--ink-3);
}

/* Highlight card that sits next to single portrait screenshots */
.shot-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  align-self: stretch;
  padding: clamp(20px, 2.6vw, 30px);
  border-radius: var(--radius);
  background: var(--invert-bg);
  color: var(--invert-ink);
  overflow: hidden;
  position: relative;
}
.shot-card__label {
  font: 500 0.7rem/1.4 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--invert-ink-2);
}
.shot-card__big {
  font: 400 clamp(3rem, 6vw, 4.6rem) / 0.95 var(--font-serif);
  letter-spacing: -0.02em;
}
.shot-card__big em {
  font-style: italic;
}
.shot-card__text {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--invert-ink-2);
}
.shot-card svg {
  position: absolute;
  right: -48px;
  top: -40px;
  width: 280px;
  height: 280px;
  fill: none;
  stroke: currentColor;
  color: var(--invert-ink-2);
  opacity: 0.4;
  animation: drift 60s linear infinite;
}
@keyframes drift {
  to {
    rotate: 360deg;
  }
}

/* ---------- Experience timeline ---------- */
.timeline {
  --when: 150px;
  --gap: 64px;
  --x: calc(var(--when) + var(--gap) / 2);
  position: relative;
  list-style: none;
}
.timeline::before,
.timeline::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 40px;
  left: var(--x);
  width: 1px;
  background: var(--line-2);
}
.timeline::after {
  background: var(--accent);
  transform: scaleY(var(--tl, 0));
  transform-origin: top;
}
.job {
  position: relative;
  display: grid;
  grid-template-columns: var(--when) minmax(0, 1fr);
  gap: 0 var(--gap);
  padding-bottom: clamp(40px, 5vw, 60px);
}
.job::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(var(--x) - 5px);
  top: 9px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  background: var(--bg);
  transition: border-color 0.5s, background-color 0.5s, box-shadow 0.5s;
}
.job.is-in::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}
.job__when {
  padding-top: 4px;
  font: 500 0.8rem/1.5 var(--font-mono);
  color: var(--ink-2);
  text-align: right;
}
.job__role {
  font: 400 clamp(1.6rem, 2.6vw, 2rem) / 1.1 var(--font-serif);
  letter-spacing: -0.01em;
}
.job__org {
  margin-top: 6px;
  font-weight: 500;
}
.job__org span {
  font-weight: 400;
  color: var(--ink-2);
}
.job__mode {
  margin-top: 10px;
  font: 500 0.7rem/1.4 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.job__points {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding-left: 18px;
  color: var(--ink-2);
}
.job__points li::marker {
  color: var(--accent);
}
.job .result {
  margin-top: 12px;
}
.job__stack {
  margin-top: 14px;
  font: 0.78rem/1.7 var(--font-mono);
  color: var(--ink-3);
}
.job__link {
  margin-top: 14px;
  font-size: 0.9rem;
}

/* ---------- Skills ---------- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 16px;
}
.skill {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out), border-color 0.3s;
}
.skill:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-1);
  border-color: var(--line-2);
}
.skill h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font: 400 1.6rem/1.1 var(--font-serif);
}
.skill h3 small {
  font: 500 0.7rem/1 var(--font-mono);
  color: var(--ink-3);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  list-style: none;
}
.chips li {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.86rem;
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}
.chips li:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.js .skill .chips li {
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.5s var(--ease-out), transform 0.6s var(--ease-out), border-color 0.3s, color 0.3s,
    background-color 0.3s;
  transition-delay: calc(0.25s + var(--c, 0) * 45ms), calc(0.25s + var(--c, 0) * 45ms), 0s, 0s, 0s;
}
.js .skill.is-in .chips li {
  opacity: 1;
  transform: none;
}

.help {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 32px clamp(32px, 6vw, 96px);
  margin-top: clamp(72px, 10vw, 128px);
}
.help__title {
  font: 400 clamp(2.2rem, 4.4vw, 3.4rem) / 1 var(--font-serif);
  letter-spacing: -0.02em;
}
.help__title em {
  font-style: italic;
  color: var(--accent);
}
.help__list {
  columns: 2;
  column-gap: 40px;
  list-style: none;
  counter-reset: help;
}
.help__list li {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  break-inside: avoid;
  padding: 16px 0 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}
.help__list li::before {
  counter-increment: help;
  content: counter(help, decimal-leading-zero);
  padding-top: 0.3em;
  font: 500 0.72rem/1 var(--font-mono);
  color: var(--accent);
}
.help__list strong {
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}
.edu {
  list-style: none;
}
.edu li {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 20px;
  padding: 22px 0 24px;
  border-top: 1px solid var(--line);
}
.edu time {
  padding-top: 6px;
  font: 500 0.78rem/1.4 var(--font-mono);
  color: var(--ink-2);
}
.edu h3 {
  font: 400 1.6rem/1.15 var(--font-serif);
}
.edu p {
  margin-top: 4px;
  color: var(--ink-2);
}
.edu p strong {
  font-weight: 500;
  color: var(--ink);
}
.hackathons {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 3.2vw, 38px);
  border-radius: calc(var(--radius) + 4px);
  background: var(--invert-bg);
  color: var(--invert-ink);
}
.hackathons h3 {
  font: 400 clamp(2rem, 3.4vw, 2.6rem) / 1 var(--font-serif);
}
.hackathons h3 em {
  font-style: italic;
}
.hackathons > p {
  margin-top: 12px;
  color: var(--invert-ink-2);
}
.hackathons .trophy {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 26px;
  font: 400 4.2rem/1 var(--font-serif);
}
.hackathons .trophy span {
  font: 500 0.95rem/1.3 var(--font-sans);
  color: var(--invert-ink-2);
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  list-style: none;
}
.pills li {
  padding: 8px 13px;
  border: 1px solid color-mix(in srgb, var(--invert-ink) 22%, transparent);
  border-radius: 999px;
  font-size: 0.88rem;
}
.hackathons .jury {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid color-mix(in srgb, var(--invert-ink) 16%, transparent);
  font-size: 0.95rem;
  color: var(--invert-ink-2);
}
.hackathons .jury .i {
  margin-top: 0.25em;
  color: var(--invert-ink);
}

/* ---------- Contact ---------- */
.contact {
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.contact::before {
  content: "";
  position: absolute;
  right: -10%;
  top: -40%;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  pointer-events: none;
}
.contact__inner {
  position: relative;
}
.contact__title {
  margin-top: 22px;
  font: 400 clamp(3.2rem, 10vw, 8.4rem) / 0.95 var(--font-serif);
  letter-spacing: -0.035em;
}
.contact__title em {
  font-style: italic;
  color: var(--accent);
}
.contact__lead {
  margin-top: 22px;
  max-width: 560px;
  font-size: 1.1rem;
  color: var(--ink-2);
}
.contact__mail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 44px;
}
.contact__mail a {
  font: 400 clamp(1.7rem, 4.6vw, 3.4rem) / 1.1 var(--font-serif);
  letter-spacing: -0.01em;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.6s var(--ease-out), color 0.3s;
}
.contact__mail a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}
.copy-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 0.85rem/1 var(--font-sans);
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}
.copy-btn:hover {
  border-color: var(--ink);
}
.copy-btn.is-done {
  border-color: var(--ok);
  color: var(--ok);
}
.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
  list-style: none;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 28px 0 34px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-2);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
}
.site-footer a {
  color: var(--ink);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(6 10 18 / 0.95);
  color: #eef2f8;
  overflow: hidden;
}
.lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  animation: lb-in 0.35s var(--ease-out);
}
.lightbox.is-closing {
  animation: lb-out 0.22s ease-in forwards;
}
.lightbox::backdrop {
  background: transparent;
}
.lightbox__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 12px 22px;
}
.lightbox__count {
  font: 500 0.75rem/1 var(--font-mono);
  letter-spacing: 0.12em;
  color: #a9b3c4;
}
.lb-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.06);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s, transform 0.4s var(--ease-out);
}
.lb-btn:hover {
  background: rgb(255 255 255 / 0.14);
  border-color: rgb(255 255 255 / 0.32);
}
.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 84px;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
}
.lightbox.is-tall .lightbox__stage {
  align-items: flex-start;
  padding-bottom: 24px;
}
.lightbox__img {
  flex: none;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 30px 90px rgb(0 0 0 / 0.55);
  transition: opacity 0.35s, transform 0.5s var(--ease-out);
}
.lightbox.is-tall .lightbox__img {
  max-width: min(100%, 1100px);
  max-height: none;
}
.lightbox__img.is-loading {
  opacity: 0;
  transform: scale(0.985);
}
.lightbox__nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
}
.lightbox__nav--prev {
  left: 18px;
}
.lightbox__nav--next {
  right: 18px;
}
.lightbox__nav--prev:hover {
  transform: translateX(-2px);
}
.lightbox__nav--next:hover {
  transform: translateX(2px);
}
.lightbox__caption {
  padding: 14px 22px 22px;
  text-align: center;
  font-size: 0.95rem;
  color: #c9d1de;
}
.lightbox__caption strong {
  font-weight: 500;
  color: #fff;
}
html.lb-open {
  overflow: hidden;
}
@keyframes lb-in {
  from {
    opacity: 0;
  }
}
@keyframes lb-out {
  to {
    opacity: 0;
  }
}

/* ---------- Scroll reveal (only when JS runs) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s var(--ease-out), transform 1.1s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 110ms);
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}
/* Safety net: if the script never loads, show everything after a moment */
html.js:not(.js-ready) [data-reveal] {
  animation: reveal-failsafe 0s 2.5s forwards;
}
@keyframes reveal-failsafe {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .nav {
    gap: 20px;
  }
  .principles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .about__grid,
  .section-head--split,
  .help,
  .edu-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .project {
    grid-template-columns: minmax(0, 1fr);
  }
  .project__info {
    position: static;
  }
  .help__list {
    columns: 1;
  }
}

@media (max-width: 820px) {
  .nav {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 60px;
  }
  .brand__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .hero {
    padding-bottom: 104px;
  }
  .hero__cta .btn {
    flex: 1 1 auto;
  }
  .hero__cta .link {
    margin-left: 0;
  }
  .hero__meta {
    margin-top: 32px;
  }
  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .stat:nth-child(n) {
    padding: 22px 0;
    border-left: 0;
  }
  .principles {
    grid-template-columns: minmax(0, 1fr);
  }
  .gallery {
    grid-template-columns: minmax(0, 1fr);
  }
  .shot-card {
    min-height: 220px;
  }
  .timeline {
    --when: 0px;
    --gap: 0px;
    --x: 5px;
    padding-left: 30px;
  }
  .timeline::before,
  .timeline::after {
    left: 5px;
  }
  .job {
    grid-template-columns: minmax(0, 1fr);
  }
  .job::before {
    left: -30px;
  }
  .job__when {
    text-align: left;
    padding: 0 0 8px;
  }
  .edu li {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .lightbox__stage {
    padding: 0 10px;
  }
  .lightbox__nav {
    top: auto;
    bottom: 12px;
    translate: none;
  }
  .lightbox__caption {
    padding: 14px 76px 22px;
  }
}

/* Touch screens: tall screenshots drift slowly while in view instead of on hover */
@media (hover: none) {
  .shot--tall.in-view .shot__view img {
    animation: auto-pan calc(var(--r, 2) * 3.4s) var(--ease-in-out) 0.8s infinite alternate;
  }
  .shot__hint {
    display: none;
  }
}
@keyframes auto-pan {
  0%,
  12% {
    transform: translateY(0);
  }
  88%,
  100% {
    transform: translateY(calc(-100% + 100cqw / var(--ar)));
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .topo .topo__pulse,
  .topo__ring,
  .pulse-dot::after {
    display: none;
  }
  .shot--tall .shot__frame:hover img,
  .shot--tall .shot__frame:focus-visible img {
    transform: none;
  }
  .shot__hint {
    display: none;
  }
  .js [data-reveal],
  .js .skill .chips li {
    opacity: 1;
    transform: none;
  }
  .marquee__track {
    flex-wrap: wrap;
    width: auto;
    justify-content: center;
  }
  .marquee ul[aria-hidden="true"] {
    display: none;
  }
  .marquee ul {
    flex-wrap: wrap;
    justify-content: center;
  }
  .marquee {
    -webkit-mask-image: none;
    mask-image: none;
  }
}
