/* ==========================================================================
   Santiago Batnoska — Portfolio
   Handmade: no frameworks. Ember palette, Syne + Manrope + JetBrains Mono.
   ========================================================================== */

:root {
  --bg: #09090b;
  --bg-2: #101013;
  --surface: #141418;
  --line: rgba(236, 235, 230, 0.1);
  --line-strong: rgba(236, 235, 230, 0.22);
  --text: #ecebe6;
  --muted: #8b8a92;
  --ember: #ff4d1c;
  --ember-2: #ffb03b;
  --unity: #d8dbe2;
  --unreal: #8fb4ff;
  --radius: 18px;
  --gutter: clamp(20px, 4vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
html.lenis-off { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(15px, 1.05vw, 17px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip; /* mobile browsers widen the page for overflowing content even under hidden */
}

body.is-loading { overflow: hidden; }

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; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure { margin: 0; }
::selection { background: var(--ember); color: #0b0b0d; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 200;
  padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg);
  transition: top 0.3s var(--ease);
}
.skip-link:focus { top: 16px; }

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

/* ---------- Dots ---------- */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); flex: none; }
.dot--live { box-shadow: 0 0 0 0 rgba(255, 77, 28, 0.6); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 28, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(255, 77, 28, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 28, 0); }
}

/* ==========================================================================
   Preloader
   ========================================================================== */
.preloader {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: flex;
  transition: clip-path 1.1s var(--ease-in-out), visibility 0s linear 1.1s;
  clip-path: inset(0 0 0 0);
}
body.is-loaded .preloader { clip-path: inset(0 0 100% 0); visibility: hidden; }

.preloader__inner {
  flex: 1; display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--gutter);
}
.preloader__top { display: flex; justify-content: space-between; color: var(--muted); }
.preloader__log { color: var(--muted); display: grid; gap: 6px; align-self: flex-start; }
.preloader__log li { opacity: 0; transform: translateY(6px); transition: opacity 0.4s, transform 0.4s var(--ease), color 0.4s; }
.preloader__log li.is-on { opacity: 1; transform: none; }
.preloader__log li.is-done { color: var(--text); }
.preloader__log li.is-done::after { content: " OK"; color: var(--ember); }
.preloader__bottom { display: grid; gap: 18px; }
.preloader__count {
  font-family: var(--font-display); font-weight: 500; line-height: 0.85;
  font-size: clamp(88px, 18vw, 260px); letter-spacing: -0.04em;
  display: flex; align-items: flex-start;
}
.preloader__pct { font-size: 0.35em; color: var(--ember); margin-left: 0.08em; margin-top: 0.15em; }
.preloader__bar { height: 1px; background: var(--line); position: relative; overflow: hidden; }
.preloader__bar span { position: absolute; inset: 0; background: linear-gradient(90deg, var(--ember), var(--ember-2)); transform-origin: left; transform: scaleX(0); }

/* ==========================================================================
   Ambient layers: grain, progress, cursor, toast
   ========================================================================== */
.grain {
  position: fixed; inset: -50%; z-index: 150; pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.8s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-2%, -1%); }
  100% { transform: translate(0, 0); }
}

.progress { position: fixed; left: 0; top: 0; right: 0; height: 2px; z-index: 120; pointer-events: none; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--ember), var(--ember-2)); transform-origin: left; transform: scaleX(0); }

.cursor { position: fixed; left: 0; top: 0; z-index: 250; pointer-events: none; mix-blend-mode: difference; display: none; }
.has-cursor .cursor { display: block; }
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor input { cursor: none; }
.cursor__dot, .cursor__ring { position: fixed; left: 0; top: 0; border-radius: 50%; will-change: transform; }
.cursor__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; }
.cursor__ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1px solid rgba(255, 255, 255, 0.7);
  display: grid; place-items: center;
  transition: width 0.35s var(--ease), height 0.35s var(--ease), margin 0.35s var(--ease), background 0.35s, border-color 0.35s;
}
.cursor__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #000; opacity: 0; transition: opacity 0.2s; }
.cursor.is-hover .cursor__ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: transparent; background: rgba(255, 255, 255, 0.95); }
.cursor.is-label .cursor__ring { width: 92px; height: 92px; margin: -46px 0 0 -46px; border-color: transparent; background: #fff; }
.cursor.is-label .cursor__label { opacity: 1; }
.cursor.is-down .cursor__ring { transform: scale(0.85); }
.cursor.is-hidden { opacity: 0; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 260; transform: translate(-50%, 180%);
  padding: 12px 18px; border-radius: 999px; background: var(--text); color: var(--bg);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform 0.5s var(--ease), opacity 0.3s, visibility 0s linear 0.5s;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform 0.5s var(--ease), opacity 0.3s, visibility 0s; }

/* ==========================================================================
   Header
   ========================================================================== */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px var(--gutter);
  transition: transform 0.6s var(--ease), background 0.4s, padding 0.4s;
}
.header.is-scrolled { background: rgba(9, 9, 11, 0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding-block: 14px; border-bottom: 1px solid var(--line); }
.header.is-hidden { transform: translateY(-110%); }

.logo { display: flex; align-items: center; gap: 12px; }
.logo__mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: -0.02em;
  background: var(--text); color: var(--bg);
  transition: transform 0.5s var(--ease), background 0.3s;
}
.logo:hover .logo__mark { transform: rotate(-8deg) scale(1.05); background: var(--ember); }
.logo__name { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; }

.nav { display: flex; gap: clamp(16px, 2.4vw, 40px); }
.nav__link { display: inline-flex; gap: 8px; align-items: baseline; font-size: 0.92rem; color: var(--muted); transition: color 0.3s; position: relative; }
.nav__link .mono { font-size: 0.62rem; color: var(--ember); }
.nav__link::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px; background: var(--text); transform: scaleX(0); transform-origin: right; transition: transform 0.5s var(--ease); }
.nav__link:hover, .nav__link.is-active { color: var(--text); }
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); transform-origin: left; }

.header__actions { display: flex; align-items: center; gap: 14px; }
.lang {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em;
  transition: border-color 0.3s, background 0.3s;
}
.lang:hover { border-color: var(--text); }
.lang__opt { color: var(--muted); transition: color 0.3s; }
.lang__opt.is-active { color: var(--text); }
.lang__sep { color: var(--line-strong); }

.menu-btn { display: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); position: relative; }
.menu-btn span { position: absolute; left: 12px; right: 12px; height: 1.5px; background: var(--text); transition: transform 0.5s var(--ease), top 0.5s var(--ease); }
.menu-btn span:first-child { top: 16px; }
.menu-btn span:last-child { top: 24px; }
.menu-open .menu-btn span:first-child { top: 20px; transform: rotate(45deg); }
.menu-open .menu-btn span:last-child { top: 20px; transform: rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: var(--gutter);
  clip-path: circle(0% at calc(100% - 44px) 44px); transition: clip-path 0.8s var(--ease-in-out);
  visibility: hidden;
}
.menu-open .mobile-menu { clip-path: circle(150% at calc(100% - 44px) 44px); visibility: visible; }
.mobile-menu a { font-family: var(--font-display); font-size: clamp(40px, 11vw, 72px); font-weight: 700; letter-spacing: -0.03em; display: flex; gap: 14px; align-items: baseline; }
.mobile-menu a .mono { font-size: 0.8rem; color: var(--ember); }

/* ==========================================================================
   Buttons & links
   ========================================================================== */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 26px; border-radius: 999px; font-weight: 600; font-size: 0.95rem; overflow: hidden; isolation: isolate;
  transition: color 0.4s var(--ease), border-color 0.4s;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  transform: translateY(101%); transition: transform 0.5s var(--ease);
}
.btn:hover::before { transform: translateY(0); }
.btn--solid { background: var(--text); color: var(--bg); }
.btn--solid::before { background: var(--ember); }
.btn--solid:hover { color: #0b0b0d; }
.btn--ghost { border: 1px solid var(--line-strong); }
.btn--ghost::before { background: var(--text); }
.btn--ghost:hover { color: var(--bg); border-color: var(--text); }
.btn__arrow { transition: transform 0.4s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(4px); }

.link-arrow { display: inline-flex; align-items: center; gap: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line-strong); font-weight: 600; transition: border-color 0.3s, color 0.3s; }
.link-arrow span:last-child { transition: transform 0.4s var(--ease); color: var(--ember); }
.link-arrow:hover { border-color: var(--ember); }
.link-arrow:hover span:last-child { transform: translate(3px, -3px); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative; min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 140px var(--gutter) clamp(40px, 7vh, 80px); overflow: hidden;
}
.hero__embers { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(255, 77, 28, 0.18), transparent 70%),
    radial-gradient(ellipse at center, transparent 40%, rgba(9, 9, 11, 0.85) 100%);
}

.hud { position: absolute; inset: 96px calc(var(--gutter) / 2) 24px; pointer-events: none; color: var(--muted); }
.hud__corner { position: absolute; width: 22px; height: 22px; border-color: var(--line-strong); border-style: solid; border-width: 0; }
.hud__corner--tl { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.hud__corner--tr { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.hud__corner--bl { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.hud__corner--br { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }
.hud__readout { position: absolute; top: 14px; right: 34px; }
.hud__fps { position: absolute; top: 14px; left: 34px; }
.hud b { color: var(--text); font-weight: 500; }

.hero__content { position: relative; z-index: 2; padding-right: clamp(0px, 4vw, 64px); }
.hero__kicker { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); margin-bottom: clamp(16px, 3vh, 32px); }
.hero__title {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(34px, 9.6vw, 200px); line-height: 0.88; letter-spacing: -0.045em;
  margin-left: -0.04em;
}
.hero__line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.hero__word { display: inline-block; }
.hero__word--outline { color: transparent; -webkit-text-stroke: 1.5px var(--text); }
.hero__word--outline .char { transition: color 0.4s, -webkit-text-stroke-color 0.4s; }
.hero__word--outline .char:hover { color: var(--ember); -webkit-text-stroke-color: var(--ember); transition: none; }

.hero__bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-top: clamp(24px, 4vh, 48px); flex-wrap: wrap; }
.hero__lead { max-width: 34ch; font-size: clamp(17px, 1.5vw, 22px); color: var(--text); line-height: 1.45; }
.hero__role { display: flex; flex-direction: column; gap: 6px; text-align: right; }
.hero__role-label { color: var(--muted); }
.hero__role-text { font-family: var(--font-display); font-weight: 600; font-size: clamp(18px, 1.8vw, 26px); color: var(--ember); min-height: 1.4em; }
.typer__caret { display: inline-block; width: 2px; height: 1em; margin-left: 4px; vertical-align: -0.12em; background: var(--ember); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero__cta { display: flex; gap: 14px; margin-top: clamp(24px, 4vh, 40px); flex-wrap: wrap; }

.scroll-cue { position: absolute; right: var(--gutter); bottom: clamp(40px, 7vh, 80px); z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); writing-mode: vertical-rl; }
.scroll-cue__line { width: 1px; height: 64px; background: var(--line-strong); position: relative; overflow: hidden; }
.scroll-cue__line::after { content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%; background: var(--ember); animation: drip 2s var(--ease-in-out) infinite; }
@keyframes drip { to { top: 100%; } }

/* Split-text & reveal states (set up by JS) */
.char, .word { display: inline-block; }
.word { white-space: nowrap; }
[data-split] .char { transform: translateY(110%); transition: transform 1s var(--ease); transition-delay: calc(var(--i) * 28ms); }
[data-split].is-in .char { transform: none; }
.hero [data-split] .char { transition-duration: 1.2s; transition-delay: calc(0.15s + var(--i) * 45ms); }
.section__title, .contact__title > span { display: inline-block; overflow: hidden; padding-bottom: 0.06em; }

.reveal-up { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
body.is-ready .reveal-up { opacity: 1; transform: none; }
body.is-ready .hero__kicker { transition-delay: 0.1s; }
body.is-ready .hero__lead { transition-delay: 0.7s; }
body.is-ready .hero__role { transition-delay: 0.85s; }
body.is-ready .hero__cta { transition-delay: 1s; }

[data-reveal] { opacity: 0; transform: translateY(40px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ==========================================================================
   Marquee
   ========================================================================== */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding: 22px 0; background: var(--bg-2); }
.marquee__track { display: flex; width: max-content; gap: 34px; align-items: center; animation: marquee 38s linear infinite; }
.marquee__track span { font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 2.6vw, 38px); text-transform: uppercase; letter-spacing: -0.01em; white-space: nowrap; }
.marquee__track span:nth-child(4n + 1) { color: transparent; -webkit-text-stroke: 1px var(--muted); }
.marquee__track i { color: var(--ember); font-style: normal; font-size: 18px; }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: clamp(80px, 11vh, 150px) var(--gutter); position: relative; }
.section__head { display: grid; grid-template-columns: auto 1fr; column-gap: 24px; row-gap: 18px; align-items: start; margin-bottom: clamp(48px, 8vh, 96px); }
.section__index { color: var(--ember); padding-top: 0.9em; }
.section__title { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 6.6vw, 112px); line-height: 0.95; letter-spacing: -0.04em; text-transform: uppercase; }
.section__sub { grid-column: 2; max-width: 52ch; color: var(--muted); font-size: clamp(16px, 1.2vw, 19px); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: clamp(40px, 6vh, 72px); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted); font-weight: 600; font-size: 0.9rem;
  transition: background 0.35s, color 0.35s, border-color 0.35s;
}
.chip sup { font-size: 0.6rem; color: inherit; opacity: 0.7; }
.chip:hover { color: var(--text); border-color: var(--text); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Projects ---------- */
.projects { display: grid; gap: clamp(72px, 12vh, 140px); }
.project { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(28px, 4vw, 72px); align-items: center; }
.project--flip .project__media { order: 2; }
.project > *, .tool > *, .about__grid > * { min-width: 0; } /* grid items may shrink below their content (code, long tags) */
.project.is-filtered { display: none; }
.project.is-entering { animation: projectIn 0.8s var(--ease) both; }
@keyframes projectIn { from { opacity: 0; transform: translateY(30px) scale(0.98); } }

.project__media {
  position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; background: var(--surface);
  transform-style: preserve-3d; transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.6s var(--ease);
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.8);
}
.project__media.is-tilting { transition: transform 0.1s linear; }
.project__media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform 1.2s var(--ease), filter 0.8s; filter: saturate(0.85) brightness(0.92); }
.project__media:hover img { transform: scale(1.12); filter: saturate(1.05) brightness(1); }
.project__media::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid var(--line); pointer-events: none; }
.project__glare {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.22), transparent 45%);
}
.project__media:hover .project__glare { opacity: 1; }
.project__level { position: absolute; left: 16px; top: 16px; padding: 7px 11px; border-radius: 999px; background: rgba(9, 9, 11, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--line); }

.project__meta { display: flex; align-items: center; gap: 14px; color: var(--muted); margin-bottom: 18px; }
.project__rule { flex: 0 0 48px; height: 1px; background: var(--line-strong); }
.tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text); }
.tag--unity { border-color: rgba(216, 219, 226, 0.35); }
.tag--unreal { border-color: rgba(143, 180, 255, 0.45); color: var(--unreal); }
.tag--soon { border-color: rgba(255, 77, 28, 0.45); color: var(--ember); }
.project__title { font-family: var(--font-display); font-weight: 700; font-size: clamp(34px, 4.2vw, 68px); line-height: 0.98; letter-spacing: -0.035em; margin-bottom: 18px; }
.project__desc { color: var(--muted); max-width: 46ch; margin-bottom: 24px; font-size: clamp(16px, 1.15vw, 18px); }
.project__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.project__tags li { padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 0.82rem; color: var(--text); }
.project__tags li.is-role { border-color: rgba(255, 77, 28, 0.45); color: var(--ember); }
.project__links { display: flex; gap: 24px; flex-wrap: wrap; }

/* ==========================================================================
   Tools
   ========================================================================== */
.tools { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 18%, var(--bg-2) 82%, var(--bg) 100%); }
.tool {
  display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(32px, 5vw, 80px); align-items: center;
  padding: clamp(28px, 4vw, 56px); border-radius: calc(var(--radius) + 8px); border: 1px solid var(--line);
  background: radial-gradient(120% 120% at 0% 0%, rgba(255, 77, 28, 0.08), transparent 50%), var(--surface);
}
.tool__badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.tool__title { font-family: var(--font-display); font-weight: 800; font-size: clamp(36px, 4.4vw, 72px); line-height: 0.95; letter-spacing: -0.04em; margin-bottom: 20px; }
.tool__arrow { color: var(--ember); display: inline-block; animation: nudge 2.4s var(--ease-in-out) infinite; }
@keyframes nudge { 50% { transform: translateX(10px); } }
.tool__lead { color: var(--muted); max-width: 50ch; margin-bottom: 26px; }
.tool__features { display: grid; gap: 12px; margin-bottom: 32px; }
.tool__features li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: baseline; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tool__features .mono { color: var(--ember); }
.tool__stats, .about__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; }
.stat__num, .stat__pre, .stat__unit { font-family: var(--font-display); font-weight: 700; font-size: clamp(34px, 3.6vw, 56px); line-height: 1; letter-spacing: -0.03em; }
.stat__pre, .stat__unit { color: var(--ember); font-size: clamp(22px, 2.2vw, 32px); }
.stat__label { flex-basis: 100%; color: var(--muted); margin-top: 6px; line-height: 1.4; }

.compare { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--line-strong); user-select: none; touch-action: pan-y; }
.compare > img, .compare__before img { width: 100%; height: 100%; object-fit: cover; }
.compare__before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare__handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--ember); pointer-events: none;
}
.compare__handle span {
  position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: var(--ember); color: #0b0b0d; display: grid; place-items: center; font-size: 18px; box-shadow: 0 0 0 6px rgba(255, 77, 28, 0.2);
}
.compare__label { position: absolute; top: 14px; padding: 6px 10px; border-radius: 999px; background: rgba(9, 9, 11, 0.75); border: 1px solid var(--line); pointer-events: none; }
.compare__label--l { left: 14px; }
.compare__label--r { right: 14px; color: var(--ember); }
.compare__range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare__hint { color: var(--muted); margin: 14px 0 18px; }
.code {
  margin: 0; padding: 18px 20px; border-radius: 12px; background: #0c0c0f; border: 1px solid var(--line);
  font-size: 0.78rem; text-transform: none; letter-spacing: 0; line-height: 1.7; overflow-x: auto; color: var(--text);
}
.c-tag { color: #ff8a5c; } .c-attr { color: #8fb4ff; } .c-str { color: #c3e88d; } .c-com { color: var(--muted); }

.extras { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 20px; }
.extra {
  padding: clamp(24px, 3vw, 40px); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  transition: opacity 1.1s var(--ease), transform 0.6s var(--ease), border-color 0.4s;
}
/* After its reveal, the card's transform is the tilt (declared after the reveal rules, same specificity). */
.extra.is-in { transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.extra.is-tilting { transition: opacity 1.1s var(--ease), transform 0.1s linear, border-color 0.4s; }
.extra:hover { border-color: var(--line-strong); }
.extra__icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); color: var(--ember); margin-bottom: 22px; font-size: 0.8rem; }
.extra h3 { font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 2vw, 30px); letter-spacing: -0.02em; margin-bottom: 10px; }
.extra p { color: var(--muted); }
.extra--soon { border-style: dashed; }

/* ==========================================================================
   About
   ========================================================================== */
.about__grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(32px, 6vw, 110px); align-items: start; }
.about__photo { position: sticky; top: 110px; border-radius: var(--radius); overflow: hidden; background: #000; }
.about__photo img { width: 100%; filter: grayscale(1) contrast(1.05); transition: filter 1s var(--ease), transform 1.4s var(--ease); transform: scale(1.02); }
.about__photo:hover img { filter: grayscale(0) contrast(1); transform: scale(1.05); }
.about__photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(9, 9, 11, 0.85)); pointer-events: none; }
.about__photo figcaption { position: absolute; left: 18px; bottom: 18px; z-index: 1; display: flex; align-items: center; gap: 10px; }
.about__intro { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 2.7vw, 44px); line-height: 1.12; letter-spacing: -0.025em; margin-bottom: 28px; }
.about__text { color: var(--muted); max-width: 60ch; margin-bottom: 44px; font-size: clamp(16px, 1.15vw, 18px); }
.about__stats { padding-block: 32px; border-block: 1px solid var(--line); margin-bottom: 44px; }

.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 32px; margin-bottom: 44px; }
.skills h4 { color: var(--ember); margin-bottom: 12px; font-weight: 500; }
.skills ul { display: flex; flex-wrap: wrap; gap: 8px; }
.skills li { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 0.88rem; transition: background 0.3s, color 0.3s, border-color 0.3s; }
.skills li:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

.timeline { margin-bottom: 40px; }
.timeline__item { display: grid; grid-template-columns: 120px 1fr; gap: 20px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.timeline__when { color: var(--ember); padding-top: 4px; }
.timeline h4 { font-family: var(--font-display); font-weight: 600; font-size: clamp(18px, 1.5vw, 22px); letter-spacing: -0.01em; }
.timeline p { color: var(--muted); }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact { padding-bottom: clamp(80px, 12vh, 140px); }
.contact .section__head { margin-bottom: 24px; }
.contact__title { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: clamp(34px, 8.2vw, 190px); line-height: 0.85; letter-spacing: -0.05em; margin-bottom: clamp(36px, 6vh, 64px); }
.contact__title .word:last-child .char:last-child { color: var(--ember); }
.contact__actions { margin-bottom: clamp(40px, 6vh, 72px); }
.email {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 22px 30px; border-radius: 22px; border: 1px solid var(--line-strong); transition: border-color 0.4s, background 0.4s;
}
.email:hover { border-color: var(--ember); background: rgba(255, 77, 28, 0.06); }
.email__addr { font-family: var(--font-display); font-weight: 600; font-size: clamp(20px, 2.6vw, 40px); letter-spacing: -0.02em; word-break: break-all; }
.email__hint { color: var(--muted); }

.socials { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.socials a {
  display: flex; align-items: center; gap: 14px; padding: 26px 4px; border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-weight: 600; font-size: clamp(18px, 1.6vw, 24px); transition: color 0.3s, padding 0.5s var(--ease);
}
.socials li + li a { border-left: 1px solid var(--line); padding-left: 22px; }
.socials .mono { color: var(--ember); }
.socials__arrow { margin-left: auto; padding-right: 14px; transition: transform 0.4s var(--ease); }
.socials a:hover { color: var(--ember); }
.socials a:hover .socials__arrow { transform: translate(4px, -4px); }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { padding: 0 var(--gutter) 24px; overflow: hidden; }
.footer__row { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; color: var(--muted); padding-block: 26px; border-top: 1px solid var(--line); }
.footer__clock { display: inline-flex; align-items: center; gap: 10px; }
.footer__top { transition: color 0.3s; }
.footer__top:hover { color: var(--ember); }
.footer__giant {
  font-family: var(--font-display); font-weight: 800; font-size: 10.1vw; line-height: 0.8; letter-spacing: -0.06em; text-align: center;
  color: transparent; -webkit-text-stroke: 1px rgba(236, 235, 230, 0.12);
  background: linear-gradient(180deg, rgba(255, 77, 28, 0.35), transparent 75%); -webkit-background-clip: text; background-clip: text;
  user-select: none; margin-bottom: -2vw;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .nav { display: none; }
  .menu-btn { display: block; }
  .project, .project--flip { grid-template-columns: 1fr; }
  .project--flip .project__media { order: 0; }
  .tool { grid-template-columns: 1fr; }
  .about__grid { grid-template-columns: 1fr; }
  .about__photo { position: relative; top: 0; max-width: 460px; }
  .socials { grid-template-columns: repeat(2, 1fr); }
  .socials li:nth-child(3) a { border-left: 0; padding-left: 4px; }
}

@media (max-width: 640px) {
  .hero__title, .contact__title { font-size: 13vw; } /* shrunk to fit by JS (data-fit) */
  .logo__name { display: none; }
  .hud__readout, .hud__fps { display: none; }
  .hero__role { text-align: left; }
  .scroll-cue { display: none; }
  .section__head { grid-template-columns: 1fr; }
  .section__index { padding-top: 0; }
  .section__sub { grid-column: 1; }
  .tool__stats, .about__stats { grid-template-columns: 1fr 1fr; }
  .extras { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; }
  .timeline__item { grid-template-columns: 1fr; gap: 6px; }
  .socials { grid-template-columns: 1fr; }
  .socials li + li a, .socials li:nth-child(3) a { border-left: 0; padding-left: 4px; }
  .footer__row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  html { scroll-behavior: auto; }
  [data-reveal], .reveal-up, [data-split] .char { opacity: 1 !important; transform: none !important; }
  .grain { display: none; }
}
