/* ============================================================
   Divyanshu Parihar - Portfolio
   Dual theme: warm-beige editorial (light) + cinematic near-black (dark)
   Display: Instrument Serif / Labels: Space Grotesk / Body: Inter
   Premium smooth motion, fully self-contained (no libraries).
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Light - warm editorial */
  --bg: #F5EFE6;
  --bg-alt: #EAE0CE;
  --surface: #FBF8F1;
  --surface-2: #F3ECDD;
  --text: #1E2A38;
  --text-muted: #5A6677;
  --border: #E0D5C0;
  --border-strong: #D2C4A8;

  --accent: #4FB0DA;
  --accent-strong: #2E94C4;
  --accent-soft: #7EC8E3;
  --accent-ink: #0E6E96;
  --accent-tint: rgba(79, 176, 218, 0.12);
  --on-accent: #0C2230;
  --glow: 0 0 0 transparent;

  --shadow-sm: 0 1px 2px rgba(30, 42, 56, 0.06), 0 2px 6px rgba(30, 42, 56, 0.05);
  --shadow-md: 0 6px 18px rgba(30, 42, 56, 0.08), 0 2px 6px rgba(30, 42, 56, 0.05);
  --shadow-lg: 0 18px 40px rgba(30, 42, 56, 0.14), 0 6px 14px rgba(30, 42, 56, 0.08);

  --grain-opacity: 0.045;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --container: 1180px;
  --nav-h: 74px;

  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-head: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  /* Dark - cinematic near-black with glowing sky-blue */
  --bg: #0B0E14;
  --bg-alt: #0E1320;
  --surface: #121826;
  --surface-2: #161E2E;
  --text: #ECEFF4;
  --text-muted: #99A6B7;
  --border: #1E2737;
  --border-strong: #2A3647;

  --accent: #5FC4EF;
  --accent-strong: #88D6F5;
  --accent-soft: #7ED8F2;
  --accent-ink: #8FD6F4;
  --accent-tint: rgba(95, 196, 239, 0.14);
  --on-accent: #06121C;
  --glow: 0 0 26px rgba(95, 196, 239, 0.35);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 22px 52px rgba(0, 0, 0, 0.62);

  --grain-opacity: 0.07;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
  overflow-x: hidden;
}

h1, h2, h3, h4 { color: var(--text); line-height: 1.1; }
a { color: var(--accent-ink); text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; padding: 0; }
button { font-family: inherit; }

::selection { background: var(--accent-soft); color: #06121C; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 52px);
}

.section {
  position: relative;
  padding-block: clamp(72px, 10vw, 140px);
  overflow: clip;
}
.section--alt { background: var(--bg-alt); }

.section__num {
  position: absolute;
  top: clamp(24px, 5vw, 60px);
  right: clamp(8px, 4vw, 56px);
  font-family: var(--font-display);
  font-size: clamp(7rem, 22vw, 20rem);
  line-height: 0.8;
  color: var(--text);
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}
.section .container { position: relative; z-index: 1; }

.section__head { max-width: 820px; margin-bottom: clamp(40px, 5vw, 64px); }
.section__kicker {
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 16px;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -0.01em;
}

.accent-text { color: var(--accent-ink); }

/* ---------- Accessibility ---------- */
.skip-link {
  position: fixed;
  left: 16px; top: -60px;
  z-index: 300;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 14px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Grain overlay ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Custom cursor ---------- */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  body.has-cursor { cursor: none; }
  body.has-cursor a,
  body.has-cursor button,
  body.has-cursor [data-magnetic],
  body.has-cursor .cert-card__media,
  body.has-cursor .project-card { cursor: none; }
  body.has-cursor .cursor { display: block; }
}
.cursor { position: fixed; top: 0; left: 0; z-index: 400; pointer-events: none; }
.cursor__dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--accent-ink);
  transform: translate(-100px, -100px);
}
.cursor__ring {
  position: fixed;
  top: 0; left: 0;
  width: 38px; height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  transform: translate(-100px, -100px);
  transition: width 0.25s var(--ease), height 0.25s var(--ease),
              background-color 0.25s var(--ease), border-color 0.25s var(--ease), opacity 0.25s var(--ease);
}
.cursor.is-hover .cursor__ring { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: var(--accent-tint); }
.cursor.is-view .cursor__ring { width: 76px; height: 76px; margin: -38px 0 0 -38px; background: var(--accent); border-color: var(--accent); }
.cursor__label {
  position: fixed;
  top: 0; left: 0;
  transform: translate(-50%, -50%);
  font-family: var(--font-head);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-accent);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.cursor.is-view .cursor__label { opacity: 1; }

/* ---------- Scroll-progress beam ---------- */
.scroll-beam {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 260;
  background: color-mix(in srgb, var(--border) 60%, transparent);
  pointer-events: none;
}
.scroll-beam__fill {
  position: relative;
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-ink), var(--accent), var(--accent-soft));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 80%, transparent);
  border-radius: 0 3px 3px 0;
}
.scroll-beam__fill::after {
  content: "";
  position: absolute;
  top: -3px; right: -2px;
  width: 10px; height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 14px 4px var(--accent-soft);
  opacity: 0.9;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-pad-y: 13px;
  --btn-pad-x: 24px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.96rem;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
              background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  white-space: nowrap;
  min-height: 46px;
  will-change: transform;
}
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm), var(--glow); }
.btn--primary:hover { background: var(--accent-strong); transform: translateY(-2px); box-shadow: var(--shadow-md), var(--glow); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-2px); background: var(--accent-tint); }
.btn--sm { --btn-pad-y: 9px; --btn-pad-x: 16px; font-size: 0.86rem; min-height: 40px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease), height 0.3s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: var(--container);
  margin-inline: auto; padding-inline: clamp(20px, 5vw, 52px); gap: 18px;
}
.nav__brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); will-change: transform; }
.nav__mark {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--font-head); font-weight: 700; font-size: 0.95rem;
  flex-shrink: 0; box-shadow: var(--glow);
}
.nav__name { font-family: var(--font-head); font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; }

.nav__links { display: flex; gap: 2px; }
.nav__links a {
  position: relative;
  color: var(--text-muted);
  font-family: var(--font-head);
  font-size: 0.9rem; font-weight: 500;
  padding: 8px 13px; border-radius: var(--radius-sm);
  transition: color 0.2s var(--ease);
}
.nav__links a::after {
  content: ""; position: absolute;
  left: 13px; right: 13px; bottom: 3px; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a.is-active { color: var(--accent-ink); }
.nav__links a.is-active::after { transform: scaleX(1); }

.nav__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
  will-change: transform;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.nav__burger { display: none; }

/* Mobile full-screen menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex; flex-direction: column; justify-content: center;
  gap: 4px;
  padding: clamp(28px, 8vw, 64px);
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a {
  display: flex; align-items: baseline; gap: 16px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.2rem);
  color: var(--text);
  padding: 6px 0;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out), color 0.2s var(--ease);
}
.mobile-menu.is-open a { opacity: 1; transform: none; }
.mobile-menu a span {
  font-family: var(--font-head);
  font-size: 0.8rem; font-weight: 600;
  color: var(--accent-ink); letter-spacing: 0.08em;
}
.mobile-menu a:hover { color: var(--accent-ink); }
.mobile-menu.is-open a:nth-child(1) { transition-delay: 0.05s; }
.mobile-menu.is-open a:nth-child(2) { transition-delay: 0.10s; }
.mobile-menu.is-open a:nth-child(3) { transition-delay: 0.15s; }
.mobile-menu.is-open a:nth-child(4) { transition-delay: 0.20s; }
.mobile-menu.is-open a:nth-child(5) { transition-delay: 0.25s; }
.mobile-menu.is-open a:nth-child(6) { transition-delay: 0.30s; }
.mobile-menu.is-open a:nth-child(7) { transition-delay: 0.35s; }
.mobile-menu.is-open a:nth-child(8) { transition-delay: 0.40s; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding-block: clamp(90px, 14vh, 160px) clamp(80px, 10vh, 120px);
  overflow: hidden;
}
.hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; will-change: transform; }
.blob--1 { width: 520px; height: 520px; top: -120px; right: -60px;
  background: radial-gradient(circle at 30% 30%, var(--accent-soft), transparent 65%);
  animation: drift1 20s ease-in-out infinite alternate; }
.blob--2 { width: 460px; height: 460px; bottom: -180px; left: -120px;
  background: radial-gradient(circle at 60% 40%, var(--accent), transparent 60%);
  opacity: 0.3; animation: drift2 24s ease-in-out infinite alternate; }
[data-theme="dark"] .blob--1 { opacity: 0.32; }
[data-theme="dark"] .blob--2 { opacity: 0.22; }
.grid-overlay {
  position: absolute; inset: -10%;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
  opacity: 0.5;
}
@keyframes drift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(-40px,40px) scale(1.08); } }
@keyframes drift2 { from { transform: translate(0,0) scale(1); } to { transform: translate(50px,-30px) scale(1.12); } }

.hero__inner { position: relative; z-index: 1; max-width: 960px; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-head); font-size: 0.84rem; font-weight: 500;
  color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 15px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm); margin-bottom: 28px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: var(--glow);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.9rem, 9vw, 7rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin-bottom: 28px;
}
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.hero__title .line__in {
  display: block;
  transform: translateY(115%);
  animation: lineRise 0.95s var(--ease-out) forwards;
}
.hero__title .line:nth-child(1) .line__in { animation-delay: 0.15s; }
.hero__title .line:nth-child(2) .line__in { animation-delay: 0.30s; }
.hero__title .line:nth-child(3) .line__in { animation-delay: 0.45s; }
@keyframes lineRise { to { transform: none; } }
.rotator {
  color: var(--accent-ink);
  font-style: italic;
  display: inline-block;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.rotator.is-out { opacity: 0; transform: translateY(-10px); }

.hero__lede {
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  color: var(--text-muted);
  max-width: 60ch; margin-bottom: 36px;
  opacity: 0; animation: fadeUp 0.8s var(--ease-out) 0.7s forwards;
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 48px;
  opacity: 0; animation: fadeUp 0.8s var(--ease-out) 0.85s forwards; }
.hero__stats {
  display: flex; flex-wrap: wrap; gap: clamp(24px, 5vw, 56px);
  padding-top: 30px; border-top: 1px solid var(--border);
  opacity: 0; animation: fadeUp 0.8s var(--ease-out) 1s forwards;
}
.hero__stats li { display: flex; flex-direction: column; gap: 3px; }
.hero__stats strong { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 400; color: var(--text); }
.hero__stats span { font-size: 0.84rem; color: var(--text-muted); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.hero__scroll {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--text-muted);
  font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
}
.hero__scroll-line { width: 1px; height: 46px; background: var(--border-strong); position: relative; overflow: hidden; }
.hero__scroll-line::after {
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 40%;
  background: var(--accent); animation: scrollCue 2s ease-in-out infinite;
}
@keyframes scrollCue { 0% { transform: translateY(-100%); } 100% { transform: translateY(250%); } }

/* ---------- About ---------- */
.about__grid {
  display: grid; grid-template-columns: 1.15fr 1fr;
  gap: clamp(28px, 5vw, 64px); align-items: center;
}
.about__lede p { font-size: 1.08rem; color: var(--text-muted); margin-bottom: 18px; max-width: 58ch; }
.about__lede strong { color: var(--text); font-weight: 600; }
.about__facts {
  display: grid; gap: 2px; margin-top: 26px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.about__facts li { display: flex; flex-direction: column; gap: 3px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.about__facts li:last-child { border-bottom: none; }
.about__facts-label { font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); }
.about__facts-value { font-weight: 500; }
.about__media { perspective: 1200px; }

/* ---------- Console (in About) ---------- */
.console {
  position: relative; width: 100%; max-width: 460px; margin-inline: auto;
  border-radius: 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface) 55%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent),
              0 24px 60px color-mix(in srgb, var(--accent) 22%, transparent);
  overflow: hidden;
  transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg));
  transition: transform 0.25s var(--ease);
  transform-style: preserve-3d;
}
.console::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--accent-soft) 45%, transparent), transparent);
  transform: skewX(-18deg); animation: sheen 6s ease-in-out infinite; pointer-events: none;
}
@keyframes sheen { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.console__bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px;
  background: color-mix(in srgb, var(--text) 6%, var(--surface)); border-bottom: 1px solid var(--border); }
.console__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.console__dot:nth-child(1) { background: #ef7a85; }
.console__dot:nth-child(2) { background: #f2c14e; }
.console__dot:nth-child(3) { background: #5ec98a; }
.console__title { margin-left: 8px; font-family: var(--font-head); font-size: 0.78rem; color: var(--text-muted); }
.console__body { padding: 18px 18px 22px; font-family: "Space Grotesk", ui-monospace, monospace; font-size: 0.88rem; line-height: 1.9; }
.console__line { white-space: nowrap; overflow: hidden; opacity: 0; transform: translateY(6px); animation: lineIn 0.5s var(--ease) forwards; }
.console__line .c-prompt, .console__line .c-key, .console__line .c-accent { color: var(--accent-ink); font-weight: 600; }
.console__line .c-str { color: #c98a2b; }
[data-theme="dark"] .console__line .c-str { color: #e6b25e; }
.console__line .c-mut { color: var(--text-muted); }
.console__line .c-ok { color: #2f9b5f; font-weight: 600; border: 1px solid color-mix(in srgb, #2f9b5f 40%, transparent); border-radius: 5px; padding: 0 6px; font-size: 0.74rem; }
[data-theme="dark"] .console__line .c-ok { color: #5ed99a; }
.console__line:nth-child(1) { animation-delay: 0.2s; }
.console__line:nth-child(2) { animation-delay: 0.5s; }
.console__line:nth-child(3) { animation-delay: 0.8s; }
.console__line:nth-child(4) { animation-delay: 1.1s; }
.console__line:nth-child(5) { animation-delay: 1.4s; }
.console__line:nth-child(6) { animation-delay: 1.7s; }
@keyframes lineIn { to { opacity: 1; transform: none; } }
.caret { display: inline-block; width: 8px; height: 1.05em; background: var(--accent); margin-left: 3px; vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Skills ---------- */
.skills__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.skill-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.skill-card h3 { font-family: var(--font-head); font-size: 1.02rem; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 9px; }
.skill-card h3::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); box-shadow: var(--glow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-size: 0.84rem; font-weight: 500; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: var(--radius-pill);
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.chips li:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden; white-space: nowrap;
  border-block: 1px solid var(--border);
  background: var(--bg);
  padding-block: 22px;
}
.marquee__track {
  display: inline-flex; align-items: center; gap: 28px;
  will-change: transform;
  animation: marquee 38s linear infinite;
}
.marquee__track span {
  font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--text); opacity: 0.55;
}
.marquee__track .marquee__sep { color: var(--accent); opacity: 0.9; font-size: 1rem; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--accent), var(--border)); }
.timeline__item { position: relative; padding-bottom: 28px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot { position: absolute; left: -30px; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--accent); }
.timeline__item.is-current .timeline__dot { animation: dotPulse 2.2s ease-out infinite; }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 70% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 0 transparent; } }
.timeline__card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px clamp(20px, 3vw, 30px); box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.timeline__card:hover { transform: translateX(4px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.timeline__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.timeline__role { font-family: var(--font-head); font-weight: 600; font-size: 1.2rem; }
.timeline__period { font-family: var(--font-head); font-size: 0.82rem; font-weight: 500; color: var(--on-accent); background: var(--accent-soft); padding: 4px 12px; border-radius: var(--radius-pill); }
[data-theme="dark"] .timeline__period { background: var(--accent); }
.timeline__org { color: var(--accent-ink); font-weight: 600; font-size: 0.95rem; margin: 6px 0 16px; }
.timeline__points { display: grid; gap: 11px; }
.timeline__points li { position: relative; padding-left: 24px; color: var(--text-muted); font-size: 0.97rem; }
.timeline__points li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 7px; height: 7px; border: 2px solid var(--accent); border-radius: 50%; }

/* ---------- Projects (bento) ---------- */
.projects__grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 22px; }
.project-card {
  position: relative; grid-column: span 3;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer;
  transition: transform 0.26s var(--ease), box-shadow 0.26s var(--ease), border-color 0.26s var(--ease);
}
.project-card--lg { grid-column: span 4; }
.project-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-soft)); transform: scaleX(0); transform-origin: left; transition: transform 0.3s var(--ease); }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg), var(--glow); border-color: var(--accent); }
.project-card:hover::before { transform: scaleX(1); }
.project-card__icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--accent-tint); color: var(--accent-ink); margin-bottom: 16px; }
.project-card__tag { position: absolute; top: 28px; right: 28px; font-family: var(--font-head); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); padding: 4px 10px; border-radius: var(--radius-pill); }
.project-card__title { font-family: var(--font-head); font-weight: 600; font-size: 1.24rem; margin-bottom: 11px; max-width: 24ch; }
.project-card__desc { color: var(--text-muted); font-size: 0.96rem; margin-bottom: 18px; }
.project-card__stack { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px; }
.project-card__stack li { font-size: 0.78rem; font-weight: 500; color: var(--accent-ink); background: var(--accent-tint); padding: 4px 10px; border-radius: 7px; }
.project-card__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.project-card__links a[hidden] { display: none; }

/* ---------- Education ---------- */
.edu-card {
  display: flex; gap: 22px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(22px, 3vw, 32px); box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.edu-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.edu-card__icon { display: grid; place-items: center; width: 54px; height: 54px; flex-shrink: 0; border-radius: 15px; background: var(--accent-tint); color: var(--accent-ink); }
.edu-card__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.edu-card__top h3 { font-family: var(--font-head); font-weight: 600; font-size: 1.18rem; }
.edu-card__period { font-family: var(--font-head); font-size: 0.82rem; font-weight: 500; color: var(--text-muted); }
.edu-card__org { color: var(--accent-ink); font-weight: 600; margin: 8px 0 6px; }
.edu-card__meta { color: var(--text-muted); font-size: 0.95rem; }
.edu-card__meta strong { color: var(--text); }

/* ---------- Certifications ---------- */
.certs__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.cert-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease), border-color 0.24s var(--ease);
}
.cert-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg), var(--glow); border-color: var(--accent); }
.cert-card__media {
  position: relative; display: block; width: 100%; overflow: hidden;
  background: var(--surface-2); border: none; border-bottom: 1px solid var(--border);
  aspect-ratio: 16 / 10; cursor: pointer; padding: 0;
}
.cert-card__media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform 0.5s var(--ease); }
.cert-card:hover .cert-card__media img { transform: scale(1.05); }
.cert-card__zoom { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 92%, #fff); color: var(--on-accent); box-shadow: var(--shadow-md); opacity: 0; transform: translateY(6px); transition: opacity 0.22s var(--ease), transform 0.22s var(--ease); }
.cert-card:hover .cert-card__zoom { opacity: 1; transform: none; }
.cert-card__body { padding: 20px 22px 24px; text-align: left; }
.cert-card__tag { display: inline-block; font-family: var(--font-head); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-tint); padding: 4px 11px; border-radius: var(--radius-pill); margin-bottom: 12px; }
.cert-card__body h3 { font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; margin-bottom: 8px; }
.cert-card__body p { color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Awards ---------- */
.awards__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.award-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease); }
.award-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md), var(--glow); border-color: var(--accent); }
.award-card__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; background: var(--accent-tint); color: var(--accent-ink); margin-bottom: 16px; }
.award-card h3 { font-family: var(--font-head); font-weight: 600; font-size: 1.04rem; margin-bottom: 8px; }
.award-card p { color: var(--text-muted); font-size: 0.94rem; }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 56px); align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(28px, 5vw, 56px); box-shadow: var(--shadow-md); }
.contact__intro .section__title { margin-bottom: 16px; }
.contact__lede { color: var(--text-muted); margin-bottom: 26px; max-width: 42ch; }
.contact__list { display: grid; gap: 12px; }
.contact__list a { display: flex; align-items: center; gap: 16px; padding: 15px 18px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease); }
.contact__list a:hover { transform: translateX(4px); border-color: var(--accent); background: var(--accent-tint); }
.contact__ic { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 11px; background: var(--accent-tint); color: var(--accent-ink); }
.contact__txt { display: flex; flex-direction: column; font-weight: 500; word-break: break-word; }
.contact__label { font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }

/* ---------- Footer ---------- */
.footer { position: relative; background: var(--bg-alt); border-top: 1px solid var(--border); padding-block: 56px 40px; overflow: hidden; }
.footer__big { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; overflow: hidden; }
.footer__big span { font-family: var(--font-display); font-size: clamp(4rem, 20vw, 18rem); line-height: 1; color: var(--text); opacity: 0.05; white-space: nowrap; letter-spacing: 0.02em; }
.footer__inner { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.footer__brand { display: flex; align-items: center; gap: 13px; }
.footer__name { font-family: var(--font-head); font-weight: 600; }
.footer__role { font-size: 0.86rem; color: var(--text-muted); }
.footer__social { display: flex; gap: 10px; }
.footer__social a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease); will-change: transform; }
.footer__social a:hover { border-color: var(--accent); color: var(--accent-ink); }
.footer__copy { font-size: 0.85rem; color: var(--text-muted); width: 100%; padding-top: 18px; border-top: 1px solid var(--border); }

/* ---------- Back to top ---------- */
.to-top { position: fixed; right: 24px; bottom: 24px; z-index: 90; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); background: var(--accent); color: var(--on-accent); cursor: pointer; box-shadow: var(--shadow-md), var(--glow); opacity: 0; transform: translateY(12px); transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), background 0.2s var(--ease); }
.to-top.is-visible { opacity: 1; transform: none; }
.to-top:hover { background: var(--accent-strong); transform: translateY(-2px); }
.to-top[hidden] { display: none; }

/* ---------- Modal / lightbox ---------- */
.modal { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: clamp(16px, 4vw, 48px); }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(6, 10, 16, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity 0.3s var(--ease); }
.modal.is-open .modal__backdrop { opacity: 1; }
.modal__card { position: relative; z-index: 1; max-width: min(960px, 100%); max-height: 88vh; width: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: auto; transform: scale(0.94); opacity: 0; transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out); }
.modal.is-open .modal__card { transform: none; opacity: 1; }
.modal__close { position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; transition: border-color 0.2s var(--ease), color 0.2s var(--ease); }
.modal__close:hover { border-color: var(--accent); color: var(--accent-ink); }
.modal__content img { width: 100%; height: auto; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal__detail { padding: clamp(24px, 4vw, 40px); }
.modal__detail .cert-card__tag { margin-bottom: 14px; }
.modal__detail h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 14px; }
.modal__detail p { color: var(--text-muted); margin-bottom: 18px; max-width: 60ch; }
.modal__detail .project-card__stack { margin-bottom: 24px; }

/* ---------- Scroll reveal + split text ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.is-in { opacity: 1; transform: none; }

.split .word { display: inline-block; overflow: hidden; vertical-align: top; }
.split .word__in { display: inline-block; transform: translateY(110%); transition: transform 0.7s var(--ease-out); transition-delay: calc(var(--wi, 0) * 45ms); }
.split.is-in .word__in { transform: none; }

/* ---------- Hero animated name ---------- */
.hero__name {
  margin-bottom: 18px;
  width: fit-content;
  max-width: 100%;
}
.hero__name span {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 4.6vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, var(--accent-ink) 0%, var(--accent) 30%, var(--accent-soft) 50%, var(--accent) 70%, var(--accent-ink) 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: nameShine 6s linear infinite, fadeUp 0.8s var(--ease-out) 0.45s both;
}
@keyframes nameShine { to { background-position: 220% center; } }

/* ---------- Right-side roadmap rail ---------- */
.roadmap {
  position: fixed;
  right: clamp(14px, 2.2vw, 30px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 80;
  pointer-events: none;
}
.roadmap__list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 24px);
}
.roadmap__list::before {
  content: "";
  position: absolute;
  right: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border-strong);
  border-radius: 2px;
}
.roadmap__fill {
  position: absolute;
  right: 6px; top: 6px;
  width: 2px;
  height: 0%;
  background: linear-gradient(var(--accent-ink), var(--accent), var(--accent-soft));
  box-shadow: 0 0 10px var(--accent);
  border-radius: 2px;
  z-index: 1;
  transition: height 0.1s linear;
}
.roadmap__list a {
  pointer-events: auto;
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  color: var(--text-muted);
}
.roadmap__dot {
  position: relative;
  display: grid; place-items: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.roadmap__dot b {
  font-family: var(--font-head);
  font-size: 0.5rem; font-weight: 700;
  color: transparent;
  transition: color 0.2s var(--ease);
}
.roadmap__label {
  font-family: var(--font-head);
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  opacity: 0; transform: translateX(8px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  white-space: nowrap;
}
.roadmap__list a:hover .roadmap__label,
.roadmap__list a.is-active .roadmap__label { opacity: 1; transform: none; }
.roadmap__list a:hover .roadmap__dot,
.roadmap__list a.is-active .roadmap__dot {
  border-color: var(--accent);
  background: var(--accent);
  transform: scale(1.18);
  box-shadow: var(--glow);
}
.roadmap__list a.is-active .roadmap__dot b { color: var(--on-accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) { .roadmap { display: none; } }
@media (max-width: 920px) {
  .about__grid { grid-template-columns: 1fr; }
  .about__media { order: -1; max-width: 460px; margin-inline: auto; width: 100%; }
  .contact { grid-template-columns: 1fr; }
  .project-card, .project-card--lg { grid-column: span 6; }
}
@media (max-width: 760px) {
  .nav__links { display: none; }
  .nav__burger { display: grid; }
  .nav__name { display: none; }
  .hero__stats { gap: 24px; }
  .projects__grid { grid-template-columns: 1fr; }
  .project-card, .project-card--lg { grid-column: auto; }
}
@media (max-width: 460px) {
  .hero__cta .btn { flex: 1 1 auto; justify-content: center; }
  .project-card__tag { position: static; align-self: flex-start; margin-bottom: 12px; }
  .project-card__title { max-width: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal, .split .word__in, .hero__title .line__in,
  .hero__lede, .hero__cta, .hero__stats { opacity: 1 !important; transform: none !important; }
  .blob, .marquee__track, .hero__scroll-line::after { animation: none !important; }
  .cursor { display: none !important; }
  body.has-cursor { cursor: auto !important; }
}
