/* =========================================================
   AIBANGBEE JERRY — Portfolio
   Design system: red + black, engineered, premium
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* surfaces */
  --bg:        #08080a;
  --bg-2:      #0c0c0e;
  --surface:   #121214;
  --surface-2: #17171a;
  --surface-3: #1d1d21;
  --line:      #232327;
  --line-2:    #313137;

  /* ink */
  --text:  #f4f4f5;
  --muted: #a3a3a9;
  --faint: #6a6a70;

  /* brand red */
  --red:        #e60012;
  --red-bright: #ff2b1c;
  --red-deep:   #a8000d;
  --red-ink:    #ff5347;
  --red-glow:   rgba(230, 0, 18, 0.45);
  --red-haze:   rgba(230, 0, 18, 0.12);

  /* type */
  --display: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --maxw: 1280px;
  --gutter: clamp(24px, 5vw, 64px);
  --radius: 4px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-2: cubic-bezier(0.65, 0, 0.35, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: auto;
}

/* a subtle film-grain / vignette over everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(230,0,18,0.07), transparent 60%),
    radial-gradient(100% 100% at 100% 100%, rgba(230,0,18,0.04), transparent 55%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--red); color: #fff; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
/* NOTE: use padding-block (not `padding: v 0`) so these never zero out the
   horizontal gutter when the element also carries .wrap — that was the
   "text stuck to the edge" bug on every content section. */
.section { position: relative; padding-block: clamp(80px, 12vh, 160px); }
.section--tight { padding-block: clamp(56px, 8vh, 96px); }
main { position: relative; z-index: 2; }

/* ---------- type ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--red-ink);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--red);
  display: inline-block;
}
.eyebrow--plain::before { display: none; }

h1, h2, h3 { font-weight: 600; line-height: 1.02; letter-spacing: -0.03em; }

.display {
  font-size: clamp(3rem, 11vw, 9.5rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.045em;
}
.h1 { font-size: clamp(2.4rem, 6vw, 5rem); }
.h2 { font-size: clamp(1.9rem, 4vw, 3.4rem); }
.h3 { font-size: clamp(1.3rem, 2.4vw, 1.9rem); }

.lead { font-size: clamp(1.05rem, 1.6vw, 1.4rem); color: var(--muted); font-weight: 400; line-height: 1.5; max-width: 60ch; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.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;
}
.mono { font-family: var(--mono); }
.red { color: var(--red-ink); }
.outline-text { color: transparent; -webkit-text-stroke: 1.4px var(--line-2); }

/* ---------- buttons ---------- */
.btn {
  --pad: 16px 30px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: var(--pad);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius);
  overflow: hidden;
  transition: color .4s var(--ease), border-color .4s var(--ease), transform .3s var(--ease);
  z-index: 0;
  isolation: isolate;
}
.btn::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: var(--red);
  transform: translateY(101%);
  transition: transform .45s var(--ease);
}
.btn:hover { color: #fff; border-color: var(--red); }
.btn:hover::after { transform: translateY(0); }
.btn--solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn--solid::after { background: #fff; }
.btn--solid:hover { color: var(--red-deep); border-color: #fff; }
.btn--ghost { border-color: var(--line); color: var(--muted); }
.btn .arr { transition: transform .35s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }

/* ---------- scroll progress + cursor ---------- */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--red-deep), var(--red), var(--red-bright));
  z-index: 200; box-shadow: 0 0 12px var(--red-glow);
}
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 300; pointer-events: none;
  border-radius: 50%; transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; }
.cursor-ring {
  width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.6);
  transition: width .25s var(--ease), height .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease);
}
.cursor-ring.is-hover { width: 56px; height: 56px; border-color: var(--red-bright); background: var(--red-haze); }
@media (hover: none), (max-width: 860px) { .cursor-dot, .cursor-ring { display: none !important; } }

/* ---------- header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120;
  transition: background .4s var(--ease), border-color .4s var(--ease), padding .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(8,8,10,0.72);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom-color: var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 78px; transition: height .4s var(--ease);
}
.scrolled .nav { height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: -0.02em; font-size: 1.05rem; }
.brand .mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--red); color: #fff; font-family: var(--mono); font-weight: 700;
  border-radius: 3px; font-size: 0.95rem; box-shadow: 0 0 22px var(--red-glow);
}
.brand .mark span { transform: translateY(-1px); }
.brand small { display: block; font-family: var(--mono); font-weight: 400; font-size: 0.6rem; letter-spacing: 0.28em; color: var(--faint); text-transform: uppercase; }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 10px 14px; border-radius: 3px; position: relative;
  transition: color .3s var(--ease);
}
.nav-links a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 1px;
  background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--text); }
.nav-cta { margin-left: 10px; }

.nav-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line-2); background: transparent; border-radius: 3px; position: relative; }
.nav-toggle span { position: absolute; left: 12px; right: 12px; height: 1.5px; background: var(--text); transition: transform .3s var(--ease), opacity .3s var(--ease); }
.nav-toggle span:nth-child(1) { top: 16px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 26px; }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 940px) {
  .nav-toggle { display: block; z-index: 130; }
  .nav-links {
    position: fixed; inset: 0;
    flex-direction: column; justify-content: center; align-items: center; gap: 8px;
    background: var(--bg);
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateY(-100%);
    transition: opacity .25s var(--ease), visibility .25s var(--ease), transform .45s var(--ease);
    z-index: 125;
    padding: 90px 24px calc(36px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }
  /* keep the bar (logo + close button) visible above the open overlay */
  .nav-open .brand { position: relative; z-index: 130; }
  /* lock the page behind the menu */
  .nav-open { overflow: hidden; }
  .nav-open .nav-links { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
  /* CRITICAL FIX: the scrolled header uses backdrop-filter, which turns it into
     the containing block for this position:fixed overlay — trapping the menu
     inside the thin header bar (the broken state you saw after scrolling).
     Neutralise the filter while the menu is open so it covers the full screen. */
  .nav-open .site-header,
  .nav-open .site-header.scrolled {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom-color: transparent;
  }
  .nav-links a { font-size: 1.4rem; padding: 14px; }
  .nav-links a::after { display: none; }
  .nav-cta { margin: 16px 0 0; }
}

/* ---------- footer ---------- */
.site-footer { position: relative; z-index: 2; border-top: 1px solid var(--line); background: var(--bg-2); padding: clamp(60px,9vh,110px) 0 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 48px; }
.footer-cta { font-size: clamp(2rem, 5vw, 4rem); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.footer-cta a { color: var(--text); transition: color .3s var(--ease); }
.footer-cta a:hover { color: var(--red-ink); }
.footer-col h4 { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--faint); margin-bottom: 18px; font-weight: 500; }
.footer-col a, .footer-col p { display: block; color: var(--muted); padding: 5px 0; transition: color .3s var(--ease); font-size: 0.95rem; }
.footer-col a:hover { color: var(--red-ink); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 0.72rem; color: var(--faint); letter-spacing: 0.06em; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 36px; } }

/* ---------- reveal animations ---------- */
[data-reveal] { opacity: 0; transform: translateY(34px); transition: opacity .9s var(--ease), transform .9s var(--ease); will-change: opacity, transform; }
[data-reveal="left"] { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="scale"] { transform: scale(.94); }
[data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
/* frozen-timeline / reduced-motion fallback: show everything at end-state */
.anim-frozen [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
.anim-frozen .reveal-lines .line > span { transform: translateY(0) !important; transition: none !important; }
.anim-frozen [data-parallax] { transform: none !important; }

/* line-by-line mask reveal for headings */
.reveal-lines .line { overflow: hidden; display: block; }
.reveal-lines .line > span { display: block; transform: translateY(110%); transition: transform 1s var(--ease); }
.reveal-lines.is-visible .line > span { transform: translateY(0) !important; }
.reveal-lines.is-visible .line:nth-child(2) > span { transition-delay: .08s; }
.reveal-lines.is-visible .line:nth-child(3) > span { transition-delay: .16s; }
.reveal-lines.is-visible .line:nth-child(4) > span { transition-delay: .24s; }

/* ---------- marquee ---------- */
.marquee { overflow: hidden; white-space: nowrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 22px 0; background: var(--bg-2); }
.marquee__track { display: inline-flex; gap: 44px; animation: marquee 32s linear infinite; will-change: transform; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item { font-family: var(--mono); font-size: clamp(1rem,2.4vw,1.7rem); font-weight: 500; letter-spacing: 0.02em; color: var(--muted); display: inline-flex; align-items: center; gap: 44px; text-transform: uppercase; }
.marquee__item::after { content: "✦"; color: var(--red); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- generic cards / chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); padding: 7px 12px; border-radius: 999px; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }

.grid-bg {
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 75%);
}

/* utility */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.wrap-flex { flex-wrap: wrap; }
.center { text-align: center; align-items: center; justify-content: center; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
