:root {
  --page-bg: #ffffff;
  --page-fg: #0b0b0f;
  --page-muted: #5b5b66;
  --line: rgba(11, 11, 15, 0.12);
  --card: #ffffff;
  --card-fg: #0b0b0f;
  --radius: 18px;
  --gutter: clamp(16px, 4vw, 56px);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Space Grotesk', var(--font);
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--page-fg);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

/* ---------- nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  color: var(--page-fg);
  transition: color 0.25s ease;
}
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav__logo { width: 30px; height: 30px; border-radius: 8px; }
.nav__links { display: flex; gap: clamp(14px, 3vw, 32px); }
.nav__links a { text-decoration: none; font-size: 0.92rem; font-weight: 500; }
.nav__links a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 110px var(--gutter) 60px;
  max-width: 1280px;
  margin: 0 auto;
}
.hero__eyebrow {
  margin: 0 0 22px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--page-muted);
}
.hero__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 8.5vw, 7.2rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.hero__title em {
  font-style: normal;
  background: linear-gradient(90deg, #4338CA, #BE185D 50%, #C2410C);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lead {
  max-width: 560px;
  margin: 28px 0 0;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  color: var(--page-muted);
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 620px;
  margin-top: 56px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.hero__stats strong {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  letter-spacing: -0.03em;
}
.hero__stats span { font-size: 0.85rem; color: var(--page-muted); }
.hero__scroll {
  margin: 48px 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--page-muted);
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(6px); } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--solid { background: var(--page-fg); color: var(--page-bg); border-color: var(--page-fg); }

/* ---------- marquee ---------- */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 18px 0;
}
.marquee__track {
  display: flex;
  gap: 48px;
  width: max-content;
  animation: marquee 38s linear infinite;
}
.marquee__track span {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1rem, 2vw, 1.35rem);
  white-space: nowrap;
  color: var(--page-muted);
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- chapter titles ---------- */
.chapter {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(64px, 10vh, 120px) var(--gutter) clamp(24px, 4vh, 48px);
}
.chapter__num {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  color: var(--page-muted);
}
.chapter__title {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: clamp(3rem, 11vw, 9rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
}
.chapter__lead { max-width: 520px; margin: 22px 0 0; color: var(--page-muted); font-size: 1.05rem; }

/* ---------- scroll stages ---------- */
.stage { position: relative; height: 130vh; }
/* Short white breather between projects (about half a screen). */
.stage + .stage { margin-top: 45vh; }
.stage__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  padding: 90px var(--gutter) 40px;
  max-width: 1440px;
  margin: 0 auto;
}
.stage--right .stage__sticky { grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); }
.stage--right .panel { order: 2; }
.stage--right .info { order: 1; }

.panel {
  will-change: transform;
  transform: translate3d(calc(var(--dir) * 120vw), 0, 0);
}
.stage--left { --dir: -1; }
.stage--right { --dir: 1; }

.info { opacity: 0; will-change: opacity, transform; }

.info__index {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.75;
}
.info__kind {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}
.info__title {
  margin: 14px 0 0;
  font-family: var(--display);
  font-size: clamp(2rem, 4.4vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.04em;
}
.info__summary { margin: 18px 0 0; font-size: clamp(0.98rem, 1.25vw, 1.1rem); opacity: 0.88; max-width: 46ch; }
.info__steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
}
.info__steps li {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
}
.info__steps li + li::before { content: '→ '; opacity: 0.7; }
.info__stack { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.info__stack li { font-size: 0.82rem; font-weight: 600; opacity: 0.8; }
.info__stack li + li::before { content: '· '; }
.info .btn { margin-top: 26px; }
.info .btn:hover { background: #fff; color: var(--accent); border-color: #fff; }

/* ---------- frames ---------- */
.frame {
  border-radius: var(--radius);
  background: var(--card);
  color: var(--card-fg);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.frame__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px;
  border-bottom: 1px solid #ececf0;
  background: #f7f7f9;
}
.frame__bar i { width: 11px; height: 11px; border-radius: 50%; background: #d9d9de; }
.frame__bar i:nth-child(1) { background: #ff5f57; }
.frame__bar i:nth-child(2) { background: #febc2e; }
.frame__bar i:nth-child(3) { background: #28c840; }
.frame__url {
  flex: 1;
  min-width: 0;
  margin-left: 10px;
  padding: 5px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ececf0;
  font-size: 0.78rem;
  color: #6b6b76;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.frame__view {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #f2f2f5;
  overflow: hidden;
}
.frame__view img {
  position: relative; /* paint above the absolutely-positioned fallback */
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.frame--flow .frame__view img { object-position: center; }
.frame__view a { position: absolute; inset: 0; z-index: 1; }
.frame__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(120% 90% at 20% 10%, rgba(255, 255, 255, 0.28), transparent 60%),
    linear-gradient(135deg, var(--accent), #0b0b0f);
}
.frame__fallback strong { font-family: var(--display); font-size: clamp(1.8rem, 4vw, 3.4rem); letter-spacing: -0.04em; }
.frame__fallback span { display: block; margin-top: 6px; font-size: 0.9rem; opacity: 0.8; }

/* ---------- contact & footer ---------- */
.contact {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(80px, 12vh, 140px) var(--gutter) clamp(60px, 10vh, 110px);
}
.contact__title {
  margin: 0;
  max-width: 14ch;
  font-family: var(--display);
  font-size: clamp(2.4rem, 7vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.contact__lead { max-width: 520px; margin: 24px 0 0; color: var(--page-muted); font-size: 1.1rem; }
.contact__links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 28px var(--gutter);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--page-muted);
}

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .stage { height: 115vh; }
  .stage + .stage { margin-top: 35vh; }
  .stage__sticky,
  .stage--right .stage__sticky {
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 22px;
    padding: 76px 16px 24px;
  }
  .stage--right .panel, .stage--right .info { order: 0; }
  .info__summary { font-size: 0.95rem; }
  .info__steps { display: none; }
  .info .btn { margin-top: 18px; padding: 10px 18px; }
  .hero__stats { gap: 10px; }
}
@media (max-width: 480px) {
  .nav__links a:first-child { display: none; }
  .nav__links { gap: 16px; }
}

/* ---------- reduced motion: no sliding, panels simply appear ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee__track, .hero__scroll { animation: none; }
  .stage { height: auto; }
  .stage + .stage { margin-top: 0; }
  .stage__sticky { position: relative; height: auto; min-height: 100svh; }
  .panel { transform: none; }
  .info { opacity: 1; }
}
@media (max-width: 350px) {
  .nav__brand { font-size: 1rem; gap: 8px; }
  .nav__logo { width: 26px; height: 26px; }
  .nav__links { gap: 12px; }
  .nav__links a { font-size: 0.85rem; }
}
