/* ============================================================
   YASHWANTH — A 3D PORTFOLIO
   Self-contained styles. Black / ink / acid-signal palette.
   ============================================================ */

@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/SpaceGrotesk-normal-variable.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('../fonts/InstrumentSerif-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('../fonts/InstrumentSerif-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- reset / tokens ---------- */
:root {
  --bg: #070708;
  --bg2: #0c0c0e;
  --ink: #f3f1ea;
  --ink-dim: rgba(243, 241, 234, 0.62);
  --ink-faint: rgba(243, 241, 234, 0.3);
  --ink-ghost: rgba(243, 241, 234, 0.14);
  --sig: #c8ff2e;                 /* acid signal green */
  --sig-soft: rgba(200, 255, 46, 0.14);
  --hair: rgba(243, 241, 234, 0.14);
  --hair2: rgba(243, 241, 234, 0.07);
  --font-sans: 'Space Grotesk', 'Arial Black', Arial, system-ui, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  background:
    radial-gradient(1200px 800px at 78% -10%, #101014 0%, transparent 60%),
    radial-gradient(900px 700px at -10% 30%, #0e0f13 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--sig); color: #070708; }
:focus-visible { outline: 2px solid var(--sig); outline-offset: 3px; border-radius: 2px; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
.acc { color: var(--sig); }
.serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---------- fixed FX layers ---------- */
#bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.grain {
  position: fixed; inset: -50%; z-index: 900; pointer-events: none; opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(2%, -1.5%); }
  50% { transform: translate(-1.5%, 2%); }
  75% { transform: translate(1.5%, 1%); }
  100% { transform: translate(0, 0); }
}
main { position: relative; z-index: 1; }

/* ---------- custom cursor ---------- */
body.js-fine, body.js-fine a, body.js-fine button { cursor: none; }
.cursor {
  position: fixed; top: 0; left: 0; z-index: 950; pointer-events: none;
  transform: translate(-50%, -50%); border-radius: 50%;
  mix-blend-mode: difference;
}
#cursorDot { width: 7px; height: 7px; background: #fff; }
#cursorRing {
  width: 38px; height: 38px; border: 1.5px solid rgba(255, 255, 255, 0.8);
  transition: width 0.25s var(--ease), height 0.25s var(--ease), border-color 0.25s;
}
#cursorRing.on { width: 66px; height: 66px; border-color: var(--sig); }
@media (pointer: coarse) { .cursor { display: none; } body.js-fine * { cursor: auto !important; } }

/* ---------- preloader ---------- */
#preloader {
  position: fixed; inset: 0; z-index: 2000; background: #070708;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 2.2rem 4vw 2.6rem;
  transition: clip-path 1s var(--ease) 0.15s, visibility 0s 1.2s;
  clip-path: inset(0 0 0 0);
}
#preloader.done { clip-path: inset(0 0 100% 0); visibility: hidden; }
.pl-top, .pl-bottom { display: flex; justify-content: space-between; }
.pl-top { font-weight: 700; letter-spacing: 0.04em; }
.pl-tag, .pl-note, .pl-bottom { color: var(--ink-faint); }
.pl-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pl-num {
  font-family: var(--font-sans); font-weight: 300; font-size: clamp(5rem, 20vw, 15rem);
  line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.pl-num b { color: var(--sig); font-weight: 300; }
.pl-bar { width: min(340px, 60vw); height: 1px; background: var(--hair); margin: 1.6rem 0 0.9rem; overflow: hidden; }
.pl-bar span { display: block; height: 100%; width: 0; background: var(--sig); transition: width 0.2s linear; }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 800;
  background: linear-gradient(to bottom, rgba(7, 7, 8, 0.85), transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.nav-in {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.15rem 4vw; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; font-weight: 700; letter-spacing: 0.06em; font-size: 1.02rem; }
.brand-mark {
  width: 11px; height: 11px; background: var(--sig);
  box-shadow: 0 0 12px rgba(200, 255, 46, 0.8);
  transform: rotate(45deg);
}
.brand em { font-style: normal; color: var(--sig); }
.nav-links { display: flex; gap: clamp(0.9rem, 2.4vw, 2rem); }
.nav-links a { color: var(--ink-dim); position: relative; padding: 0.3rem 0; transition: color 0.3s; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--sig); transform: scaleX(0); transform-origin: right; transition: transform 0.35s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-links a.on { color: var(--ink); }
.nav-links a.on::after { transform: scaleX(1); }
.nav-cta {
  border: 1px solid var(--hair); padding: 0.55rem 1.05rem; font-size: 0.74rem;
  letter-spacing: 0.16em; text-transform: uppercase; font-family: var(--font-mono);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--sig); border-color: var(--sig); color: #070708; }
.nav-line { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--hair2); }
.nav-line::before {
  content: ""; position: absolute; inset: 0; width: var(--sp, 0%);
  background: linear-gradient(90deg, var(--sig), #7ef0c0);
  transition: width 0.1s linear;
}

/* ---------- hero ---------- */
.hero { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 6rem 4vw 3rem; position: relative; }
.hero-meta { display: flex; align-items: center; gap: 2rem; color: var(--ink-faint); position: absolute; top: 5.4rem; left: 4vw; right: 4vw; justify-content: space-between; }
.live { display: inline-flex; align-items: center; gap: 0.6rem; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--sig); box-shadow: 0 0 10px var(--sig); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.hero-title { margin-top: 1rem; }
.hclip { display: block; overflow: hidden; padding: 0.06em 0; }
.hline {
  display: block; font-size: clamp(48px, 14.8vw, 236px); font-weight: 700;
  line-height: 0.86; letter-spacing: -0.02em;
  transform: translateY(115%); transition: transform 1.15s var(--ease);
  will-change: transform;
}
.hline em.serif { font-size: 1.02em; line-height: 0.8; }
body.loaded .hline { transform: translateY(0); }
body.loaded .hclip:nth-child(2) .hline { transition-delay: 0.09s; }
body.loaded .hclip:nth-child(3) .hline { transition-delay: 0.18s; }

.hero-sub {
  margin-top: clamp(2rem, 5vh, 3.4rem); max-width: 30rem; opacity: 0;
  transform: translateY(24px); transition: opacity 1s var(--ease) 0.55s, transform 1s var(--ease) 0.55s;
}
body.loaded .hero-sub { opacity: 1; transform: translateY(0); }
.hero-sub p { color: var(--ink-dim); font-size: 1.05rem; }
.hero-sub p em { font-style: normal; color: var(--ink); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.9rem; }
.btn {
  font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 1rem 1.5rem; background: var(--sig); color: #070708; border: 1px solid var(--sig);
  transition: transform 0.3s var(--ease), box-shadow 0.3s, background 0.3s;
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -12px rgba(200, 255, 46, 0.55); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--hair); }
.btn.ghost:hover { border-color: var(--ink); background: var(--ink); color: #070708; }

.scrollcue { position: absolute; right: 4vw; bottom: 2.2rem; display: flex; flex-direction: column; align-items: center; gap: 0.8rem; color: var(--ink-faint); opacity: 0; transition: opacity 1s 1.1s; }
body.loaded .scrollcue { opacity: 1; }
.cue-line { width: 1px; height: 56px; background: linear-gradient(var(--sig), transparent); animation: cue 1.6s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
.hero-ghost {
  position: absolute; bottom: -4rem; left: 4vw; font-family: var(--font-sans); font-weight: 700;
  font-size: clamp(140px, 30vw, 420px); line-height: 1; color: transparent;
  -webkit-text-stroke: 1px rgba(243, 241, 234, 0.08); pointer-events: none; user-select: none;
}

/* ---------- marquee ---------- */
.marquee { overflow: hidden; border-block: 1px solid var(--hair2); padding: 1.1rem 0; }
.foot-marq { border: none; border-top: 1px solid var(--hair2); }
.marq-track {
  display: flex; width: max-content; animation: marq 26s linear infinite;
  font-weight: 700; font-size: clamp(1.6rem, 4vw, 3rem); letter-spacing: -0.01em; text-transform: uppercase;
}
.marq-track b { color: var(--sig); font-weight: 700; margin: 0 1.1rem; }
.marq-track span { display: inline-flex; align-items: center; white-space: nowrap; }
@keyframes marq { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marq-track { animation: none; } }

/* ---------- chapters ---------- */
.ch { padding: clamp(6rem, 16vh, 11rem) 4vw; position: relative; }
.ch + .ch { border-top: 1px solid var(--hair2); }
.ch-head { position: relative; margin-bottom: clamp(3rem, 8vh, 6rem); }
.ch-no {
  position: absolute; top: -0.2em; right: 0; font-size: clamp(120px, 24vw, 340px); font-weight: 700;
  line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(243, 241, 234, 0.1);
  user-select: none; pointer-events: none;
}
.chword {
  position: relative; display: inline-block; white-space: nowrap;
  font-weight: 700; line-height: 0.92; letter-spacing: -0.02em;
  font-size: clamp(56px, 12.4vw, 200px);
  max-width: 100%;
}
.chword .dw { display: block; }
.chword .dw .dw-ink { display: block; font: inherit; letter-spacing: inherit; }
.chword .dw:first-child .dw-ink { color: transparent; -webkit-text-stroke: 1.5px var(--ink-ghost); }
.chword .dw:nth-child(2) {
  position: absolute; top: 0; left: 0; height: 100%; width: 0; overflow: hidden;
  will-change: width;
}
.chword .dw:nth-child(2) .dw-ink { color: var(--ink); white-space: nowrap; }
.chword.drawn .dw:nth-child(2) { width: 100%; transition: width 1.25s var(--ease) 0.1s; }
@supports not (-webkit-text-stroke: 1px black) {
  .chword .dw:first-child .dw-ink { color: rgba(243, 241, 234, 0.22); }
}
.ch-lede { max-width: 34rem; color: var(--ink-dim); margin-top: 2rem; font-size: 1.08rem; }

.ch-body.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.lede { font-size: clamp(1.45rem, 2.9vw, 2.5rem); font-weight: 500; line-height: 1.24; letter-spacing: -0.01em; }
.lede em { font-family: var(--font-serif); font-style: italic; }
.col p { color: var(--ink-dim); margin-bottom: 1.2rem; font-size: 1.02rem; }
.col strong { color: var(--ink); font-weight: 600; }
.col .acc, .lede .acc { color: var(--sig); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(3.5rem, 9vh, 7rem); border-top: 1px solid var(--hair); }
.stat { padding: 1.8rem 1.4rem 0.4rem 0; border-left: 1px solid var(--hair); padding-left: 1.4rem; }
.stat:first-child { border-left: none; padding-left: 0; }
.stat .num { display: block; font-size: clamp(2.4rem, 5.6vw, 5rem); font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.stat .num .unit { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: 0.5em; color: var(--sig); margin-left: 0.2em; }
.stat .lbl { display: block; color: var(--ink-faint); margin-top: 0.8rem; }

/* ---------- core (sticky 3D) ---------- */
.core-tall { height: 320vh; }
.core-sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: radial-gradient(60% 60% at 50% 45%, #0b0b0d 0%, #050506 100%);
}
#core-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.core-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(5, 5, 6, 0.7), transparent 22%, transparent 70%, rgba(5, 5, 6, 0.9)),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(5, 5, 6, 0.55) 100%);
}
.core-hud { position: absolute; top: 6.2rem; left: 4vw; right: 4vw; display: flex; justify-content: space-between; color: var(--ink-faint); }
.hud-tag { color: var(--sig); }
.core-stage { position: absolute; bottom: 2.4rem; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.stage-word {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 100%); white-space: nowrap;
  font-family: var(--font-sans); font-weight: 700; font-size: clamp(2rem, 6vw, 4.6rem);
  letter-spacing: 0.02em; color: var(--ink); opacity: 0;
  transition: transform 0.7s var(--ease), opacity 0.6s;
}
.stage-word.active { transform: translate(-50%, 0); opacity: 1; }
.core-pull { position: absolute; bottom: 2.4rem; left: 4vw; color: var(--ink-faint); opacity: 0.7; }

/* ---------- work list ---------- */
.pj-list { display: flex; flex-direction: column; }
.pj { border-top: 1px solid var(--hair); transition: background 0.4s; }
.pj:last-of-type { border-bottom: 1px solid var(--hair); }
.pj-row {
  display: grid; grid-template-columns: 5.5rem 1fr 1fr 0; align-items: center; gap: clamp(1.4rem, 3.5vw, 3.5rem);
  padding: clamp(2rem, 4.5vw, 3.6rem) 0.5rem; position: relative;
}
.pj-num { color: var(--ink-faint); }
.pj-title { font-size: clamp(1.7rem, 3.9vw, 3.4rem); font-weight: 700; line-height: 0.98; letter-spacing: -0.01em; transition: transform 0.5s var(--ease); }
.pj-title em { font-weight: 400; }
.pj-desc { color: var(--ink-dim); font-size: 0.98rem; transition: color 0.3s; }
.pj-tags { grid-column: 1 / -1; color: var(--ink-faint); margin-top: 0.4rem; }
.pj-arrow { position: absolute; right: 0.2rem; top: 1.4rem; font-size: 1.5rem; opacity: 0; transform: translate(-14px, 8px); transition: 0.45s var(--ease); }
.pj:hover .pj-row { }
.pj:hover { background: linear-gradient(90deg, rgba(200, 255, 46, 0.05), transparent 55%); }
.pj:hover .pj-title { transform: translateX(10px); }
.pj:hover .pj-title em, .pj:hover .pj-num { color: var(--sig); }
.pj:hover .pj-arrow { opacity: 1; transform: translate(0, 0); }
.footnote { margin-top: 1.6rem; color: var(--ink-faint); }
.footnote a { color: var(--sig); border-bottom: 1px solid rgba(200, 255, 46, 0.4); }

/* ---------- steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 4vw, 4rem); }
.step { border-top: 1px solid var(--hair); padding-top: 1.4rem; transition: border-color 0.3s; }
.step:hover { border-color: var(--sig); }
.step-n { color: var(--ink-faint); }
.step h3 { font-size: clamp(1.7rem, 3.4vw, 3rem); font-weight: 700; line-height: 1.02; margin: 1.1rem 0 1.1rem; letter-spacing: -0.01em; }
.step h3 em { font-weight: 400; }
.step p { color: var(--ink-dim); font-size: 0.98rem; }

/* ---------- contact ---------- */
.contact .ch-head { margin-bottom: clamp(2rem, 5vh, 4rem); }
.contact-body { max-width: 100%; }
.giant-link {
  display: inline-block; margin: clamp(2.2rem, 6vh, 4.5rem) 0;
  font-size: clamp(1.9rem, 6.2vw, 6.6rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.05;
  word-break: break-word;
  background-image: linear-gradient(var(--sig), var(--sig));
  background-size: 0% 2px; background-repeat: no-repeat; background-position: left calc(100% - 0.12em);
  transition: background-size 0.5s var(--ease);
}
.giant-link:hover { background-size: 100% 2px; }
.giant-link .serif { font-weight: 400; }
.contact-socials { display: flex; flex-wrap: wrap; gap: 2rem; padding-top: 1.6rem; border-top: 1px solid var(--hair); }
.contact-socials a { color: var(--ink-dim); transition: color 0.25s, transform 0.25s; }
.contact-socials a:hover { color: var(--sig); transform: translateY(-2px); }

/* ---------- footer ---------- */
.foot { padding-top: 0; }
.foot-in {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  padding: 2rem 4vw; color: var(--ink-faint); font-size: 0.82rem;
}

/* ---------- reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .nav-links { display: none; }
  .ch-body.split { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; gap: 2.2rem; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: none; padding-left: 0; }
  .core-pull { display: none; }
}
@media (max-width: 700px) {
  .hero { padding-top: 7.5rem; }
  .hero-meta { position: static; margin-bottom: 2rem; }
  .hide-sm { display: none; }
  .scrollcue { display: none; }
  .hero-ghost { display: none; }
  .pj-row { grid-template-columns: 3.4rem 1fr; }
  .pj-desc { grid-column: 2 / -1; }
  .pj-arrow { display: none; }
  .hud-xyz { display: none; }
  .foot-in { flex-direction: column; gap: 0.6rem; }
  .pl-top { flex-direction: column; gap: 0.5rem; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .chword .dw:nth-child(2) { width: 100%; }
  #preloader { display: none; }
}
