/* ============ Tokens ============ */
:root {
  --bg: #0a0a0b;
  --bg-soft: #121214;
  --surface: rgba(255, 255, 255, 0.032);
  --surface-2: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);
  --text: #f2efe9;          /* warm ivory */
  --text-dim: #a7a49d;
  --text-faint: #6e6c66;
  --red: #e11d2a;           /* the one accent */
  --red-bright: #ff3a3a;
  --red-soft: rgba(225, 29, 42, 0.14);
  --radius: 18px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }
html.preloading { overflow: hidden; }

/* ============ Preloader ============ */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
}
.preloader.done { transform: translateY(-101%); }
.pre-num { font-family: "Sora"; font-weight: 800; font-size: clamp(64px, 16vw, 170px); line-height: 1; letter-spacing: -0.04em; display: flex; align-items: flex-start; }
.pre-pct { font-size: 0.32em; color: var(--red); margin-top: 0.4em; margin-left: 4px; }
.pre-label { font-family: "JetBrains Mono"; font-size: 13px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--text-faint); margin-top: 18px; }
.pre-label .blink-dot { color: var(--red); animation: blink 1s step-end infinite; }
.pre-line { position: absolute; left: 0; bottom: 0; width: 100%; height: 2px; background: rgba(255,255,255,0.08); }
.pre-line i { display: block; height: 100%; width: 0%; background: var(--red); box-shadow: 0 0 12px rgba(225,29,42,0.7); }

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(225, 29, 42, 0.35); color: #fff; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: "Sora", sans-serif; line-height: 1.1; letter-spacing: -0.02em; }

code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85em;
  background: var(--red-soft);
  color: #ff8e8e;
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

/* ============ Background FX ============ */
.bg-grid {
  position: fixed; inset: 0; z-index: -3;
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 40%, transparent 100%);
}
.bg-glow {
  position: fixed; z-index: -2; border-radius: 50%;
  filter: blur(130px); pointer-events: none;
  animation: floatGlow 20s ease-in-out infinite;
}
.glow-1 { width: 520px; height: 520px; background: #c0121e; opacity: 0.34; top: -160px; left: -130px; }
.glow-2 { width: 440px; height: 440px; background: #8e0e18; opacity: 0.30; bottom: -130px; right: -110px; animation-delay: -7s; }
.glow-3 { display: none; }
@keyframes floatGlow {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(55px, 40px) scale(1.1); }
  66% { transform: translate(-35px, 55px) scale(0.96); }
}
#particles { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* ============ Scroll progress ============ */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--red); z-index: 200;
  box-shadow: 0 0 14px rgba(225,29,42,0.7);
}

/* ============ Cursor ============ */
.cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; border-radius: 50%; pointer-events: none; z-index: 300; mix-blend-mode: difference; }
.cursor-dot { width: 7px; height: 7px; background: #fff; transform: translate(-50%,-50%); }
.cursor-ring { width: 34px; height: 34px; border: 1.5px solid rgba(255,255,255,0.6); transform: translate(-50%,-50%); transition: width .25s var(--ease), height .25s var(--ease), background .25s; }
.cursor-ring.hover { width: 56px; height: 56px; background: rgba(255,255,255,0.08); border-color: transparent; }
@media (hover: none) { .cursor-dot, .cursor-ring { display: none; } }

/* ============ Navbar ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 60px);
  transition: padding .35s var(--ease), background .35s, backdrop-filter .35s, border-color .35s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  padding: 12px clamp(20px, 5vw, 60px);
  background: rgba(10, 10, 11, 0.74);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-logo { display: flex; align-items: center; gap: 11px; font-family: "Sora"; font-weight: 700; }
.logo-mark {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 11px; background: var(--red); color: #fff;
  font-size: 15px; font-weight: 800; letter-spacing: -0.04em;
  box-shadow: 0 6px 18px rgba(225,29,42,0.4);
}
.logo-text { font-size: 19px; }
.logo-text .dot { color: var(--red); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link {
  position: relative; padding: 9px 15px; font-size: 14.5px; font-weight: 500;
  color: var(--text-dim); border-radius: 10px; transition: color .25s, background .25s;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); }
.nav-cta {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text); margin-left: 6px;
}
.nav-cta:hover { background: var(--red); color: #fff; border-color: transparent; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: .3s var(--ease); }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Layout ============ */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(80px, 11vw, 150px) clamp(20px, 5vw, 40px) 0; }
.section-head { display: flex; align-items: center; gap: 18px; margin-bottom: 54px; }
.section-index { font-family: "JetBrains Mono"; font-size: 14px; color: var(--red); font-weight: 500; }
.section-index.center { display: block; text-align: center; margin-bottom: 14px; }
.section-title { font-size: clamp(28px, 4.5vw, 44px); font-weight: 700; }
.section-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }

.accent { color: var(--red); }

/* ============ Buttons ============ */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  padding: 14px 26px; border-radius: 13px; font-weight: 600; font-size: 15px;
  font-family: "Sora"; cursor: pointer; transition: transform .3s var(--ease), box-shadow .3s, background .3s;
  border: 1px solid transparent; overflow: hidden;
}
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 10px 28px rgba(225,29,42,0.34); }
.btn-primary:hover { transform: translateY(-3px); background: var(--red-bright); box-shadow: 0 16px 38px rgba(225,29,42,0.46); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { transform: translateY(-3px); background: var(--surface-2); border-color: var(--red); }
.btn-arrow { transition: transform .3s var(--ease); }
.btn-primary:hover .btn-arrow { transform: translateX(5px); }

/* ============ Hero ============ */
.hero { position: relative; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(20px,5vw,40px); min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-top: 120px; }
.hero-inner { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 50px; align-items: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 500;
  color: var(--text-dim); background: var(--surface); border: 1px solid var(--border);
  padding: 7px 15px; border-radius: 100px; margin-bottom: 26px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(225,29,42,0.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(225,29,42,0.6); } 70% { box-shadow: 0 0 0 10px rgba(225,29,42,0); } 100% { box-shadow: 0 0 0 0 rgba(225,29,42,0); } }
.hero-title { font-size: clamp(38px, 7vw, 72px); font-weight: 800; margin-bottom: 12px; }
.hero-role { font-size: clamp(20px, 3.4vw, 32px); font-weight: 600; color: var(--text-dim); min-height: 1.3em; margin-bottom: 24px; }
.typed { color: var(--text); }
.caret { color: var(--red); font-weight: 300; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-desc { font-size: 16.5px; color: var(--text-dim); max-width: 540px; margin-bottom: 34px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }
.hero-socials { display: flex; gap: 22px; }
.social { position: relative; font-size: 14.5px; font-weight: 500; color: var(--text-faint); transition: color .25s; }
.social::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 0; height: 1.5px; background: var(--red); transition: width .3s var(--ease); }
.social:hover { color: var(--text); }
.social:hover::after { width: 100%; }

/* Avatar */
.hero-visual { display: flex; justify-content: center; }
.avatar-wrap { position: relative; width: min(340px, 78vw); aspect-ratio: 1; transform-style: preserve-3d; }
.avatar { position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover; border-radius: 24px; border: 1px solid var(--border-strong); box-shadow: 0 30px 70px rgba(0,0,0,0.55); }
.avatar-frame { position: absolute; inset: -1px; border-radius: 25px; border: 1px solid var(--red); opacity: 0.55; z-index: 1; }
.avatar-glow { position: absolute; inset: 14px; border-radius: 24px; background: var(--red); filter: blur(60px); opacity: 0.22; z-index: -1; }
.floating-chip {
  position: absolute; z-index: 3; padding: 9px 14px 9px 12px; border-radius: 11px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(16,16,18,0.88); backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong); color: var(--text);
  font-family: "JetBrains Mono"; font-size: 13px; font-weight: 500;
  box-shadow: 0 10px 26px rgba(0,0,0,0.45); animation: floatChip 5s ease-in-out infinite;
}
.floating-chip::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--red); }
.chip-1 { top: 6%; left: -16%; }
.chip-2 { top: 32%; right: -22%; animation-delay: -1.4s; }
.chip-3 { bottom: 22%; left: -20%; animation-delay: -2.6s; }
.chip-4 { bottom: 4%; right: -10%; animation-delay: -3.6s; }
@keyframes floatChip { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* Stats */
.hero-stats { display: flex; flex-wrap: wrap; gap: clamp(20px, 5vw, 60px); margin-top: 70px; padding-top: 34px; border-top: 1px solid var(--border); }
.stat { display: flex; flex-direction: column; }
.stat-num, .stat-plus { font-family: "Sora"; font-size: clamp(26px, 4vw, 38px); font-weight: 800; color: var(--red); line-height: 1; display: inline; }
.stat-label { font-size: 13.5px; color: var(--text-faint); margin-top: 8px; }

/* Scroll cue */
.scroll-cue { position: absolute; bottom: 20px; left: 54%; transform: translateX(-50%); }
.mouse { display: block; width: 22px; height: 36px; border: 2px solid var(--text-faint); border-radius: 12px; position: relative; }
.wheel { position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 3px; height: 7px; background: var(--text-dim); border-radius: 3px; animation: wheel 1.6s ease-in-out infinite; }
@keyframes wheel { 0% { opacity: 0; top: 7px; } 40% { opacity: 1; } 100% { opacity: 0; top: 18px; } }

/* ============ About ============ */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: start; }
.about-text p { color: var(--text-dim); font-size: 16.5px; margin-bottom: 18px; }
.about-text strong { color: var(--text); font-weight: 600; }
.about-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.about-tags span { font-size: 13.5px; padding: 7px 14px; border-radius: 100px; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); }
.about-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 22px; transition: transform .35s var(--ease), border-color .35s, background .35s; }
.info-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.info-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  margin-bottom: 14px; color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(225,29,42,0.26);
}
.info-icon svg { width: 23px; height: 23px; }
.info-card h3 { font-size: 18px; margin-bottom: 8px; }
.info-card p { font-size: 14px; color: var(--text-faint); }

/* ============ Timeline ============ */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--red), transparent); }
.tl-item { position: relative; }
.tl-dot { position: absolute; left: -30px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--red); box-shadow: 0 0 0 4px rgba(225,29,42,0.15); }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px clamp(20px,3vw,32px); transition: transform .35s var(--ease), border-color .35s; }
.tl-card:hover { border-color: var(--border-strong); }
.tl-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tl-top h3 { font-size: 21px; }
.tl-company { color: var(--red); font-size: 14.5px; font-weight: 500; }
.tl-date { font-family: "JetBrains Mono"; font-size: 13px; color: var(--text-faint); padding: 6px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 100px; height: fit-content; }
.tl-list { list-style: none; display: grid; gap: 11px; }
.tl-list li { position: relative; padding-left: 22px; font-size: 15px; color: var(--text-dim); }
.tl-list li::before { content: "▹"; position: absolute; left: 0; color: var(--red); }
.tl-list strong { color: var(--text); font-weight: 600; }

/* ============ Projects ============ */
.projects { display: grid; gap: 28px; }
.project { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; transition: transform .4s var(--ease), border-color .4s, box-shadow .4s; }
.project:hover { border-color: var(--border-strong); box-shadow: 0 24px 60px rgba(0,0,0,0.45); }
.project:nth-child(even) .project-media { order: 2; }
.project-media { position: relative; overflow: hidden; min-height: 260px; background: var(--bg-soft); }
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), filter .4s; filter: saturate(0.9); }
.project:hover .project-media img { transform: scale(1.06); filter: saturate(1.05); }
.project-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(0deg, rgba(10,10,11,0.6), rgba(10,10,11,0.1)); opacity: 0; transition: opacity .4s; }
.project:hover .project-overlay { opacity: 1; }
.proj-link { padding: 11px 20px; border-radius: 11px; background: rgba(16,16,18,0.88); border: 1px solid var(--border-strong); font-weight: 600; font-size: 14px; backdrop-filter: blur(6px); transition: background .3s, transform .3s, color .3s; }
.proj-link:hover { background: var(--red); color: #fff; transform: translateY(-2px); border-color: transparent; }
.project-body { padding: clamp(24px,3vw,34px); }
.project-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.project-head h3 { font-size: 24px; }
.project-badge { font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 100px; background: var(--red-soft); color: #ff8e8e; border: 1px solid rgba(225,29,42,0.3); }
.project-body > p { color: var(--text-dim); font-size: 15.5px; margin-bottom: 18px; }
.project-points { list-style: none; display: grid; gap: 9px; margin-bottom: 20px; }
.project-points li { position: relative; padding-left: 20px; font-size: 14.5px; color: var(--text-faint); }
.project-points li::before { content: "→"; position: absolute; left: 0; color: var(--red); }
.project-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.project-stack span { font-family: "JetBrains Mono"; font-size: 12.5px; padding: 5px 11px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); }

/* ============ Skills ============ */
.skills-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
.skill-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; transition: border-color .35s; }
.skill-group:hover { border-color: var(--border-strong); }
.skill-group h3 { font-size: 16px; color: var(--text-dim); margin-bottom: 16px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips span {
  font-size: 14px; padding: 9px 16px; border-radius: 11px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: transform .25s var(--ease), border-color .25s, color .25s, background .25s; cursor: default;
}
.chips span:hover { transform: translateY(-3px); border-color: var(--red); color: #fff; background: var(--red-soft); }

/* ============ Education ============ */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.edu-col { display: grid; gap: 20px; align-content: start; }
.edu-card, .achieve-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; transition: transform .35s var(--ease), border-color .35s; }
.edu-card:hover, .achieve-card:hover { border-color: var(--border-strong); }
.edu-date { font-family: "JetBrains Mono"; font-size: 12.5px; color: var(--red); }
.edu-card h3 { font-size: 19px; margin: 10px 0 6px; }
.edu-card p { color: var(--text-faint); font-size: 14.5px; }
.achieve-card { height: 100%; }
.achieve-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.achieve-head svg { width: 22px; height: 22px; color: var(--red); }
.achieve-head h3 { font-size: 19px; }
.achieve-card ul { list-style: none; display: grid; gap: 12px; }
.achieve-card li { position: relative; padding-left: 24px; color: var(--text-dim); font-size: 15px; }
.achieve-card li svg { position: absolute; left: 0; top: 4px; width: 14px; height: 14px; color: var(--red); }
.achieve-card strong { color: var(--text); }

/* ============ Contact ============ */
.contact { text-align: center; }
.contact-card { max-width: 720px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: clamp(40px,6vw,64px); position: relative; overflow: hidden; }
.contact-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 0%, rgba(225,29,42,0.14), transparent 60%); pointer-events: none; }
.contact-title { font-size: clamp(28px,5vw,46px); font-weight: 700; margin-bottom: 16px; }
.contact-sub { color: var(--text-dim); font-size: 16.5px; max-width: 480px; margin: 0 auto 32px; }
.contact-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.contact-socials { display: flex; gap: 26px; justify-content: center; }
.contact-socials a { color: var(--text-faint); font-weight: 500; transition: color .25s; }
.contact-socials a:hover { color: var(--red); }

/* ============ Footer ============ */
.footer { max-width: var(--maxw); margin: clamp(70px,9vw,120px) auto 0; padding: 30px clamp(20px,5vw,40px); border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer p { font-size: 14px; color: var(--text-faint); }
.back-top { font-size: 14px; color: var(--text-dim); font-weight: 500; transition: color .25s; }
.back-top:hover { color: var(--red); }

/* ============ Reveal animation ============ */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .001s !important; }
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .nav-links { position: fixed; inset: 0 0 0 auto; width: min(320px, 82vw); flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; padding: 40px 26px; background: rgba(12,12,13,0.97); backdrop-filter: blur(18px); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .4s var(--ease); }
  .nav-links.open { transform: none; }
  .nav-link { padding: 14px 18px; font-size: 17px; }
  .nav-toggle { display: flex; z-index: 110; }
  .hero-inner { grid-template-columns: 1fr; gap: 40px; text-align: center; }
  .hero-eyebrow, .hero-actions, .hero-socials { justify-content: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .hero-visual { order: -1; }
  .about-grid { grid-template-columns: 1fr; }
  .project, .project:nth-child(even) .project-media { grid-template-columns: 1fr; }
  .project:nth-child(even) .project-media { order: 0; }
  .skills-grid, .edu-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .about-cards { grid-template-columns: 1fr; }
  .hero-stats { gap: 26px; }
  .tl-top { flex-direction: column; }
  .footer { flex-direction: column; text-align: center; }
}
