/* ============================================================
   KAAN ÜMIT İŞMEN — PORTFOLIO
   Hand-crafted CSS. No frameworks.
   ============================================================ */

:root {
  --bg0: #05070d;
  --bg1: #0a0e1a;
  --bg2: #111729;
  --bg3: #18203a;
  --border: #1f2940;
  --border-hover: #34415f;
  --ink: #e8edf7;
  --muted: #93a0b8;
  --dim: #7b89a3; /* ≥4.5:1 on all surfaces (WCAG AA for body text) */
  --cyan: #38e1ff;
  --violet: #8b7cff;
  --magenta: #ff5ca8;
  --lime: #a3f561;
  --cyan-soft: rgba(56, 225, 255, 0.10);
  --violet-soft: rgba(139, 124, 255, 0.10);
  --magenta-soft: rgba(255, 92, 168, 0.10);
  --lime-soft: rgba(163, 245, 97, 0.10);
  --grad: linear-gradient(120deg, var(--cyan), var(--violet));
  --grad-3: linear-gradient(120deg, var(--cyan), var(--violet), var(--magenta));
  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1160px;
  --nav-h: 72px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg0);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

html.locked, html.locked body { overflow: hidden; }

::selection { background: rgba(139, 124, 255, 0.4); color: #fff; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg0); }
::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 99px;
  border: 2px solid var(--bg0);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  color: var(--ink);
}

p { margin: 0 0 1em; }

a { color: var(--cyan); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--ink); }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 300;
  background: var(--bg2);
  color: var(--ink);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: top 0.2s ease;
}
.skip-link:focus { top: 14px; }

/* ============ BACKGROUND LAYERS ============ */

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.6;
  pointer-events: none;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 124, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 124, 255, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 80%);
}

.bg-glow {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
}
.bg-glow-1 {
  width: 560px; height: 560px;
  top: -180px; right: -120px;
  background: var(--violet);
}
.bg-glow-2 {
  width: 480px; height: 480px;
  bottom: -200px; left: -160px;
  background: var(--cyan);
  opacity: 0.10;
}

.nav, .hero, main, footer, .marquee-wrap { position: relative; z-index: 1; }

/* ============ CUSTOM CURSOR ============ */

.cursor-dot, .cursor-ring {
  display: none;
  position: fixed;
  top: 0; left: 0;
  z-index: 250;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.cursor-ring {
  width: 36px; height: 36px;
  border: 1.5px solid rgba(139, 124, 255, 0.55);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out),
              border-color 0.25s ease, background 0.25s ease;
}
html.cursor-on .cursor-dot, html.cursor-on .cursor-ring { display: block; }
html.cursor-on, html.cursor-on a, html.cursor-on button,
html.cursor-on input, html.cursor-on label { cursor: none; }
html.cursor-on .cursor-ring.is-hover {
  width: 56px; height: 56px;
  border-color: var(--cyan);
  background: rgba(56, 225, 255, 0.07);
}

/* ============ PRELOADER ============ */

#preloader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg0);
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
html.js #preloader { display: flex; }
#preloader.done { opacity: 0; visibility: hidden; }

.pre-terminal {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--cyan);
  width: min(420px, 84vw);
}
.pre-line { min-height: 1.6em; white-space: nowrap; overflow: hidden; }
.pre-line::after {
  content: '▋';
  animation: blink 0.8s steps(1) infinite;
  color: var(--violet);
}
.pre-bar {
  margin-top: 1rem;
  height: 3px;
  background: var(--bg2);
  border-radius: 99px;
  overflow: hidden;
}
#pre-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--grad);
  border-radius: 99px;
  transition: width 0.25s ease;
}

@keyframes blink { 50% { opacity: 0; } }

/* ============ SCROLL PROGRESS ============ */

.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 120;
  background: var(--grad-3);
  box-shadow: 0 0 12px rgba(56, 225, 255, 0.5);
}

/* ============ NAV ============ */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(5, 7, 13, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav-logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  white-space: nowrap;
}
.nav-logo:hover { color: var(--ink); }
.logo-bracket { color: var(--dim); transition: color 0.25s ease; }
.nav-logo:hover .logo-bracket { color: var(--cyan); }
.logo-accent { color: var(--cyan); }

.nav-links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  position: relative;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0;
}
.nav-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--dim);
  margin-right: 0.35rem;
  transition: color 0.2s ease;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%;
  height: 2px;
  background: var(--grad);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links a:hover .nav-num, .nav-links a.active .nav-num { color: var(--cyan); }
.nav-links a.active::after, .nav-links a:hover::after { transform: scaleX(1); }

.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-gh {
  display: inline-flex;
  color: var(--muted);
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, transform 0.2s ease;
}
.nav-gh:hover { color: var(--ink); transform: translateY(-2px); }
.nav-gh svg { width: 20px; height: 20px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px; height: 42px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.2s ease;
}
html.menu-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
html.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
html.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ MOBILE MENU ============ */

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 7, 13, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
html.menu-open .mobile-menu { opacity: 1; visibility: visible; }
.mobile-menu ul { list-style: none; margin: 0; padding: 0; }
.mobile-menu li {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
  transition-delay: 0s;
}
html.menu-open .mobile-menu li {
  opacity: 1;
  transform: none;
  transition-delay: calc(0.06s + var(--i, 0) * 0.06s);
}
.mobile-menu a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 600;
  color: var(--ink);
  padding: 0.55rem 0;
}
.mobile-menu a span {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--cyan);
}
.mobile-menu a:hover { color: var(--cyan); }
.mobile-menu-foot {
  margin-top: 3rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--dim);
}

/* ============ HERO ============ */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 3rem) 1.5rem 4rem;
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  align-items: center;
  gap: 3.5rem;
}

/* entrance choreography (triggered by body.loaded) —
   hidden state is gated on html.js so the page is fully
   visible when JavaScript is off or fails to boot */
html.js body:not(.loaded) .hero-eyebrow,
html.js body:not(.loaded) .hero-name .hero-line,
html.js body:not(.loaded) .hero-title,
html.js body:not(.loaded) .hero-tagline,
html.js body:not(.loaded) .hero-actions,
html.js body:not(.loaded) .hero-visual {
  opacity: 0;
}
body.loaded .hero-eyebrow, body.loaded .hero-name .hero-line, body.loaded .hero-title,
body.loaded .hero-tagline, body.loaded .hero-actions, body.loaded .hero-visual {
  animation: rise 0.9s var(--ease-out) backwards;
}
body.loaded .hero-eyebrow { animation-delay: 0.05s; }
body.loaded .hero-name .hero-line:nth-child(1) { animation-delay: 0.15s; }
body.loaded .hero-name .hero-line:nth-child(2) { animation-delay: 0.25s; }
body.loaded .hero-title { animation-delay: 0.45s; }
body.loaded .hero-tagline { animation-delay: 0.58s; }
body.loaded .hero-actions { animation-delay: 0.7s; }
body.loaded .hero-visual { animation-delay: 0.55s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--cyan-soft);
  color: var(--cyan);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 1.6rem;
  border: 1px solid rgba(56, 225, 255, 0.25);
}
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lime);
  position: relative;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--lime);
  animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(3.2); opacity: 0; }
}

.hero-name {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 1.04;
  margin-bottom: 1.1rem;
  letter-spacing: -0.03em;
}
.hero-line { display: block; }
.hero-line-grad {
  background: var(--grad-3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-name:hover .hero-line-grad {
  animation: glitch-shift 0.45s steps(2) 2;
}
@keyframes glitch-shift {
  0%   { text-shadow: 2px 0 var(--magenta), -2px 0 var(--cyan); transform: translateX(0); }
  25%  { text-shadow: -3px 0 var(--magenta), 3px 0 var(--cyan); transform: translateX(1px); }
  50%  { text-shadow: 2px 0 var(--cyan), -2px 0 var(--violet); transform: translateX(-1px); }
  100% { text-shadow: none; transform: none; }
}

.hero-title {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.1vw, 1.3rem);
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 1.4rem;
  min-height: 1.7em;
}
.hero-prompt { color: var(--magenta); margin-right: 0.6rem; }
#typed { color: var(--ink); }
.caret {
  display: inline-block;
  width: 10px;
  height: 1.15em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--cyan);
  animation: blink 0.9s steps(1) infinite;
}

.hero-tagline {
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  color: var(--muted);
  max-width: 580px;
  margin-bottom: 2.2rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }

/* ============ BUTTONS ============ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.78rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  background: rgba(17, 23, 41, 0.6);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.25s ease, color 0.2s ease;
  will-change: transform;
}
.btn:hover {
  border-color: var(--border-hover);
  background: var(--bg2);
  color: var(--ink);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn-primary {
  background: var(--grad);
  border: none;
  color: #05070d;
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
.btn-primary:hover::before { left: 130%; }
.btn-primary:hover {
  color: #05070d;
  box-shadow: 0 10px 36px rgba(56, 225, 255, 0.35);
}
.btn-icon { padding: 0.78rem 0.9rem; }

/* ============ HERO TERMINAL ============ */

.hero-visual { position: relative; }
.hero-visual-glow {
  position: absolute;
  inset: 8%;
  z-index: -1;
  background: var(--grad);
  filter: blur(70px);
  opacity: 0.22;
  border-radius: 50%;
}
.terminal {
  background: rgba(10, 14, 26, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  transform: rotate(1.2deg);
  transition: transform 0.4s var(--ease-out);
}
.terminal:hover { transform: rotate(0deg) scale(1.012); }
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.7rem 1rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.t-dot { width: 11px; height: 11px; border-radius: 50%; }
.t-red { background: #ff5f57; }
.t-yellow { background: #febc2e; }
.t-green { background: #28c840; }
.terminal-title {
  margin-left: auto;
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--dim);
}
.terminal-body { padding: 1.1rem 1.2rem 1.3rem; }
.t-line {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.9;
  white-space: nowrap;
  overflow: hidden;
}
.t-cmd { color: var(--lime); }
.t-progress { color: var(--cyan); letter-spacing: 0.5px; }
.t-status { color: var(--violet); }

.gan-frame {
  margin: 0.9rem auto;
  width: fit-content;
  padding: 8px;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
#gan-canvas {
  display: block;
  width: 220px;
  height: 160px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ============ SCROLL CUE ============ */

.scroll-cue {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--dim);
}
html.js body:not(.loaded) .scroll-cue { opacity: 0; }
body.loaded .scroll-cue { animation: rise-cue 1s var(--ease-out) 1.4s backwards; }
@keyframes rise-cue {
  from { opacity: 0; transform: translate(-50%, 26px); }
  to { opacity: 1; transform: translateX(-50%); }
}
.scroll-cue:hover { color: var(--cyan); }
.scroll-cue-line {
  width: 1px;
  height: 44px;
  background: linear-gradient(to bottom, transparent, var(--cyan));
  position: relative;
  overflow: hidden;
}
.scroll-cue-line::after {
  content: '';
  position: absolute;
  top: -50%;
  left: 0;
  width: 100%;
  height: 50%;
  background: var(--ink);
  animation: cue-drop 1.8s ease-in-out infinite;
}
@keyframes cue-drop {
  0% { top: -50%; }
  100% { top: 110%; }
}
.scroll-cue-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

/* ============ MARQUEE ============ */

.marquee-wrap {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 26, 0.5);
  padding: 1.1rem 0;
  overflow: hidden;
}
.marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: marquee 30s linear infinite;
}
/* spacing via margins (not gap) so the two copies measure exactly
   50% of the track each and the loop point is seamless */
.marquee-track > * { margin-right: 2.2rem; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.2s ease;
}
.marquee-track span:hover { color: var(--cyan); }
.marquee-track i {
  font-style: normal;
  font-size: 0.6rem;
  color: var(--violet);
}
@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ============ SECTIONS (common) ============ */

.section {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 7.5rem 1.5rem;
}
.section::before {
  content: attr(data-watermark);
  content: attr(data-watermark) / ''; /* empty alt text: decorative, hidden from AT */
  position: absolute;
  top: 3.2rem;
  right: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4rem, 12vw, 9rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(139, 124, 255, 0.07);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.section > * { position: relative; z-index: 1; }

.section-head { margin-bottom: 3rem; }
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.9rem;
}
.section-num {
  color: var(--dim);
}
.section-label::after {
  content: '';
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}
.section-title {
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  margin-bottom: 0;
  max-width: 700px;
}
.section-title em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============ REVEAL SYSTEM ============
   Keyframe-based (not transitions) so component hover/tilt
   transforms and transitions are untouched once revealed. */

html.js [data-reveal]:not(.in) { opacity: 0; }
html.js [data-reveal].in {
  opacity: 1;
  animation: reveal-up 0.85s var(--ease-out) backwards;
}
html.js [data-reveal="right"].in { animation-name: reveal-right; }
html.js [data-reveal="left"].in { animation-name: reveal-left; }
html.js [data-reveal="zoom"].in { animation-name: reveal-zoom; }

html.js [data-stagger]:not(.in) > * { opacity: 0; }
html.js [data-stagger].in > * {
  animation: reveal-up 0.7s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 90ms);
}

@keyframes reveal-up {
  from { opacity: 0; transform: translateY(30px); }
}
@keyframes reveal-right {
  from { opacity: 0; transform: translateX(44px); }
}
@keyframes reveal-left {
  from { opacity: 0; transform: translateX(-44px); }
}
@keyframes reveal-zoom {
  from { opacity: 0; transform: scale(0.93); }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ============ ABOUT ============ */

.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3.5rem;
  align-items: start;
}
.about-text {
  font-size: 1.06rem;
  color: var(--muted);
}
.about-text strong { color: var(--ink); font-weight: 600; }
.about-text strong:first-of-type {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.stat-card {
  background: rgba(17, 23, 41, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.35rem;
}
.stat-suffix { font-size: 0.7em; }
.stat-label {
  font-size: 0.84rem;
  color: var(--dim);
  line-height: 1.5;
}

/* ============ SKILLS ============ */

.skill-groups {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
}
.skill-group {
  --hue: var(--cyan);
  --hue-soft: var(--cyan-soft);
  position: relative;
  background: rgba(17, 23, 41, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.3s ease;
}
.skill-group[data-hue="violet"] { --hue: var(--violet); --hue-soft: var(--violet-soft); }
.skill-group[data-hue="magenta"] { --hue: var(--magenta); --hue-soft: var(--magenta-soft); }
.skill-group[data-hue="lime"] { --hue: var(--lime); --hue-soft: var(--lime-soft); }
.skill-group::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--hue), transparent 70%);
  opacity: 0.7;
}
.skill-group:hover {
  transform: translateY(-5px);
  border-color: var(--border-hover);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
}
.skill-group h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.98rem;
  color: var(--hue);
  margin-bottom: 1.1rem;
  font-family: var(--font-mono);
  font-weight: 500;
}
.sg-icon {
  display: inline-flex;
  width: 30px; height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--hue-soft);
  color: var(--hue);
}
.sg-icon svg { width: 16px; height: 16px; }
.sg-cursor {
  animation: blink 1.1s steps(1) infinite;
  font-weight: 700;
}
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  display: inline-block;
  padding: 0.38rem 0.85rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.83rem;
  color: var(--ink);
  font-weight: 500;
  transition: transform 0.2s var(--ease-out), border-color 0.2s ease,
              background 0.2s ease, box-shadow 0.2s ease;
}
.pill:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: var(--hue, var(--cyan));
  background: var(--hue-soft, var(--cyan-soft));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* ============ PROJECTS ============ */

.featured-project {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  background: linear-gradient(135deg, rgba(56, 225, 255, 0.05), rgba(139, 124, 255, 0.06) 50%, rgba(255, 92, 168, 0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.4rem;
  margin-bottom: 1.6rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.featured-project:hover {
  border-color: rgba(139, 124, 255, 0.45);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.featured-copy h3 {
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  margin-bottom: 0.8rem;
}

.project-meta {
  font-size: 0.76rem;
  color: var(--cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}
.project-desc {
  color: var(--muted);
  font-size: 0.96rem;
  margin-bottom: 1.3rem;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.3rem;
}
.tag {
  font-size: 0.74rem;
  padding: 0.28rem 0.7rem;
  background: var(--violet-soft);
  color: var(--violet);
  border: 1px solid rgba(139, 124, 255, 0.22);
  border-radius: 5px;
  font-weight: 500;
  font-family: var(--font-mono);
  transition: background 0.2s ease, color 0.2s ease;
}
.tag:hover { background: rgba(139, 124, 255, 0.2); color: var(--ink); }

.project-links { display: flex; gap: 0.75rem; margin-top: auto; }
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  font-weight: 500;
}
.project-link:hover {
  color: var(--ink);
  border-color: var(--cyan);
  background: var(--cyan-soft);
  transform: translateY(-2px);
}
.project-link svg { width: 15px; height: 15px; }
.project-private {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--dim);
  padding: 0.5rem 0.95rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}
.project-private svg { width: 14px; height: 14px; }

/* featured demo */
.featured-demo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9rem;
}
.demo-canvas-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg0);
  line-height: 0;
}
#pixel-canvas {
  width: 100%;
  height: auto;
  display: block;
}
/* crisp blocks only while actually pixelated — the "real image"
   state (1px) should upscale smoothly on HiDPI screens */
#pixel-canvas.is-pixelated { image-rendering: pixelated; }
.demo-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: rgba(5, 7, 13, 0.72);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  backdrop-filter: blur(6px);
  line-height: 1.4;
}
.demo-controls { display: flex; flex-direction: column; gap: 0.4rem; }
.demo-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
.demo-label span { color: var(--cyan); }

/* 28px-tall interactive box (WCAG 2.5.8) with a 4px visual track */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  outline-offset: 6px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--bg3);
  border-radius: 99px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--grad);
  border: 2px solid var(--bg0);
  box-shadow: 0 0 14px rgba(56, 225, 255, 0.6);
  transition: transform 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--bg3);
  border-radius: 99px;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--bg0);
  box-shadow: 0 0 14px rgba(56, 225, 255, 0.6);
}
.demo-note {
  font-size: 0.78rem;
  color: var(--dim);
  font-family: var(--font-mono);
  margin: 0;
}

.projects-grid {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr));
}
.project-card {
  position: relative;
  background: rgba(17, 23, 41, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.3s ease;
}
.project-card:hover {
  border-color: rgba(56, 225, 255, 0.4);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.45);
}
.card-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(139, 124, 255, 0.12), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.project-card:hover .card-shine, .featured-project:hover .card-shine { opacity: 1; }
.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}
.project-card h3 { font-size: 1.12rem; margin: 0; }
.project-icon { color: var(--dim); flex-shrink: 0; transition: color 0.25s ease, transform 0.25s ease; }
.project-card:hover .project-icon { color: var(--cyan); transform: rotate(-8deg) scale(1.1); }
.project-icon svg { width: 22px; height: 22px; }
.project-card .project-desc { flex-grow: 1; }

/* tilt (transform applied by JS) */
.tilt { transform-style: preserve-3d; will-change: transform; }

/* ============ TIMELINE ============ */

.timeline {
  position: relative;
  padding: 1.5rem 0 0.5rem;
}
.tl-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--border);
  border-radius: 99px;
}
.tl-fill {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 0;
  background: linear-gradient(to bottom, var(--cyan), var(--violet));
  border-radius: 99px;
  box-shadow: 0 0 16px rgba(56, 225, 255, 0.45);
}
.tl-comet {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 18px 5px rgba(56, 225, 255, 0.65);
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  margin-bottom: 2.6rem;
}
.tl-item:last-child { margin-bottom: 0; }

.tl-node {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: start;
  margin-top: 1.6rem;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg2);
  border: 2px solid var(--border);
  position: relative;
  z-index: 2;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
.tl-item.active .tl-node {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 0 5px rgba(56, 225, 255, 0.15), 0 0 20px rgba(56, 225, 255, 0.6);
}
.tl-item.active .tl-node::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  animation: node-ping 1.6s var(--ease-out) 1;
}
@keyframes node-ping {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.6); opacity: 0; }
}

.tl-card {
  grid-row: 1;
  background: rgba(17, 23, 41, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.7rem;
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out),
              border-color 0.3s ease, box-shadow 0.3s ease;
}
.tl-item:nth-child(even) .tl-card {
  grid-column: 1;
  text-align: right;
}
.tl-item:nth-child(odd) .tl-card {
  grid-column: 3;
}
/* hidden states only when the JS that reveals them is running */
html.js .tl-card { opacity: 0; }
html.js .tl-item:nth-child(even) .tl-card { transform: translateX(-40px); }
html.js .tl-item:nth-child(odd) .tl-card { transform: translateX(40px); }
html.js .tl-item.active .tl-card { opacity: 1; transform: none; }
.tl-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.4);
}
.tl-item:nth-child(even) .tl-bullets {
  direction: rtl;
  padding-right: 1.1rem;
  padding-left: 0;
}
.tl-item:nth-child(even) .tl-bullets li { direction: ltr; }

.tl-period {
  display: inline-block;
  font-size: 0.74rem;
  color: var(--cyan);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  background: var(--cyan-soft);
  border: 1px solid rgba(56, 225, 255, 0.2);
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.7rem;
}
.tl-role {
  font-size: 1.12rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.tl-company {
  color: var(--violet);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 0.8rem;
}
.tl-bullets {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.93rem;
}
.tl-bullets li { margin-bottom: 0.4rem; }
.tl-bullets li::marker { color: var(--violet); }

/* ============ EDUCATION ============ */

.edu-card {
  position: relative;
  background: var(--bg1);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  align-items: flex-start;
  gap: 1.4rem;
  overflow: hidden;
}
.edu-border {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(var(--angle, 120deg), var(--cyan), var(--violet), var(--magenta), var(--cyan));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: border-flow 7s linear infinite;
  opacity: 0.65;
  pointer-events: none;
}
@keyframes border-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.edu-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  background: var(--violet-soft);
  color: var(--violet);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.edu-icon svg { width: 26px; height: 26px; }
.edu-content h3 { font-size: 1.18rem; margin-bottom: 0.3rem; }
.edu-degree {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 0.96rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.edu-period {
  color: var(--dim);
  font-size: 0.86rem;
  font-family: var(--font-mono);
}

/* ============ CONTACT ============ */

.contact { text-align: center; }
.contact .section-label { justify-content: center; }
.contact .section-label::after { display: none; }
.contact-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.2rem;
}
.contact-title em {
  font-style: normal;
  background: var(--grad-3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.contact-text {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 2.4rem;
}
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
}

/* ============ FOOTER ============ */

footer {
  text-align: center;
  padding: 2.6rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.86rem;
  font-family: var(--font-mono);
}
footer p { margin: 0; }

/* ============ TO-TOP & TOAST ============ */

#to-top {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 80;
  width: 46px; height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s var(--ease-out),
              border-color 0.2s ease, box-shadow 0.25s ease;
}
#to-top.show { opacity: 1; visibility: visible; transform: none; }
#to-top:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(56, 225, 255, 0.35);
}
#to-top svg { width: 20px; height: 20px; }

#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 80px);
  z-index: 150;
  background: var(--bg2);
  border: 1px solid rgba(56, 225, 255, 0.4);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  padding: 0.75rem 1.3rem;
  border-radius: 99px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: transform 0.4s var(--ease-out), opacity 0.4s ease;
  pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ============ RESPONSIVE ============ */

@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 2.6rem; }
  .hero-visual { max-width: 460px; }
  .about-grid { grid-template-columns: 1fr; gap: 2.4rem; }
  .featured-project { grid-template-columns: 1fr; }
}

@media (min-width: 821px) {
  /* never strand the overlay if the viewport grows past the breakpoint */
  .mobile-menu { display: none; }
}

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

  /* timeline collapses to left rail */
  .tl-track { left: 8px; transform: none; }
  .tl-item { grid-template-columns: 40px 1fr; margin-bottom: 1.8rem; }
  .tl-node {
    grid-column: 1;
    justify-self: start;
    margin-left: 1px;
    margin-top: 1.5rem;
  }
  .tl-item:nth-child(odd) .tl-card,
  .tl-item:nth-child(even) .tl-card {
    grid-column: 2;
    text-align: left;
  }
  .tl-item:nth-child(even) .tl-bullets {
    direction: ltr;
    padding-left: 1.1rem;
    padding-right: 0;
  }
  html.js .tl-item:nth-child(odd) .tl-card,
  html.js .tl-item:nth-child(even) .tl-card { transform: translateX(30px); }
  html.js .tl-item.active .tl-card { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .section { padding: 4.5rem 1.25rem; }
  .hero { padding-top: calc(var(--nav-h) + 1.5rem); }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.8rem; }
  .featured-project { padding: 1.5rem; }
  .scroll-cue { display: none; }
  .section::before { font-size: 4rem; top: 2rem; }
  #to-top { bottom: 18px; right: 18px; }
}

/* ============ TOUCH / MOBILE PERFORMANCE ============
   backdrop-filter blur is re-evaluated every scrolled frame and is the
   single biggest source of scroll jank on phones. On coarse pointers we
   swap it for a near-opaque solid background — visually almost identical,
   far cheaper. Desktop keeps the blur. */
@media (pointer: coarse) {
  .nav.scrolled {
    background: rgba(5, 7, 13, 0.94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .mobile-menu {
    background: rgba(5, 7, 13, 0.985);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  /* the demo badge sits over a static canvas — no live content to blur */
  .demo-badge {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  /* filter: blur() forces a large offscreen raster that stalls the very first
     paint on phones (the moment the preloader clears) — which is what was
     freezing the hero animation. Swap the glows for equivalent radial-gradient
     fills: visually near-identical, essentially free. */
  .bg-glow { filter: none; opacity: 1; }
  .bg-glow-1 {
    background: radial-gradient(circle, rgba(139, 124, 255, 0.16), transparent 70%);
  }
  .bg-glow-2 {
    background: radial-gradient(circle, rgba(56, 225, 255, 0.10), transparent 70%);
  }
}

/* ============ REDUCED MOTION ============ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html.js [data-reveal], html.js [data-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero-eyebrow, .hero-name .hero-line, .hero-title, .hero-tagline,
  .hero-actions, .hero-visual, .scroll-cue {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .tl-card { opacity: 1 !important; transform: none !important; }
  .marquee-track { animation: none !important; }
  #bg-canvas { display: none; }
  .cursor-dot, .cursor-ring { display: none !important; }
}
