/* ==========================================================================
   Nikhil Rathore — Portfolio Stylesheet
   ========================================================================== */

:root{
  /* Dark theme (default) */
  --bg: #05070d;
  --bg-alt: rgba(9,13,26,0.62);
  --surface: rgba(255,255,255,0.04);
  --surface-strong: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.09);
  --text: #eaf0ff;
  --text-dim: #9aa4bf;
  --text-faint: #6b7594;
  --accent-1: #00d4ff;
  --accent-2: #7c5cff;
  --accent-grad: linear-gradient(120deg, var(--accent-1), var(--accent-2));
  --shadow: 0 10px 40px rgba(0,0,0,0.35);
  --glow: 0 0 40px rgba(0,212,255,0.18);
  --radius: 18px;
  --nav-h: 74px;
}

[data-theme="light"]{
  --bg: #f5f7fb;
  --bg-alt: rgba(255,255,255,0.7);
  --surface: rgba(15,23,42,0.035);
  --surface-strong: rgba(15,23,42,0.06);
  --border: rgba(15,23,42,0.09);
  --text: #10131c;
  --text-dim: #4a5273;
  --text-faint: #7b84a3;
  --shadow: 0 10px 34px rgba(15,23,42,0.08);
  --glow: 0 0 40px rgba(0,150,255,0.12);
}

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

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

html, body{ background: var(--bg); }

body{
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height:1.65;
  overflow-x:hidden;
  transition: background .4s ease, color .4s ease;
}

/* Whole-page space backdrop: starfield + drifting planets + meteors, drawn on canvas.
   Fixed + first in DOM + default stacking (no z-index) so every section (each already
   position:relative) simply paints over it in document order — the classic reliable
   "canvas background" pattern, no negative z-index trickery involved. */
#spaceCanvas{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display:block;
  pointer-events: none;
}

h1,h2,h3,.logo{ font-family:'Space Grotesk', 'Inter', sans-serif; }

img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
ul{ list-style:none; }
button{ font:inherit; cursor:pointer; border:none; background:none; color:inherit; }
input,textarea{ font:inherit; color:inherit; }

::selection{ background: var(--accent-2); color:#fff; }

::-webkit-scrollbar{ width:10px; }
::-webkit-scrollbar-track{ background: var(--bg); }
::-webkit-scrollbar-thumb{ background: var(--accent-2); border-radius:10px; }

/* Frosted-glass look for cards floating over the starfield */
.stat-card, .skill-card, .project-card, .timeline-card, .edu-card,
.contact-item, .contact-form, .chip, .scan-frame{
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.accent{ color: var(--accent-1); }
.accent-gradient{
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-container{
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.section{ padding: 120px 0; position:relative; }
.section-alt{
  background: var(--bg-alt);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.section-tag{
  display:inline-block;
  font-size:.8rem;
  font-weight:600;
  letter-spacing:.14em;
  text-transform:uppercase;
  color: var(--accent-1);
  margin-bottom: 14px;
}

.section-title{
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  font-weight:700;
  margin-bottom: 20px;
  max-width: 640px;
}

.section-sub{
  color: var(--text-dim);
  max-width: 560px;
  margin-bottom: 50px;
  font-size:1.02rem;
}

/* ---------------- Buttons ---------------- */
.btn{
  display:inline-flex; align-items:center; gap:10px;
  padding: 13px 26px;
  border-radius: 50px;
  font-weight:600;
  font-size:.95rem;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, color .25s ease;
  white-space:nowrap;
}
.btn-primary{
  background: var(--accent-grad);
  color:#04101a;
  box-shadow: 0 8px 24px rgba(0,212,255,0.25);
}
.btn-primary:hover{ transform: translateY(-3px); box-shadow: 0 14px 34px rgba(124,92,255,0.4); }
.btn-outline{
  border:1.5px solid var(--border);
  color: var(--text);
  background: var(--surface);
  backdrop-filter: blur(6px);
}
.btn-outline:hover{
  border-color: var(--accent-1);
  color: var(--accent-1);
  transform: translateY(-3px);
}

/* ---------------- Cosmic cursor ---------------- */
/* Comet-dust trail, drawn on canvas, sits between the page and the cursor graphics */
#cursorTrail{
  position:fixed; inset:0; width:100vw; height:100vh; z-index:9995; pointer-events:none;
}

/* Bright point sits exactly on the real pointer, like a fixed star */
.cursor-point{
  position:fixed; top:0; left:0; width:6px; height:6px; border-radius:50%;
  background:#fff; box-shadow: 0 0 10px 2px var(--accent-1), 0 0 2px #fff;
  transform: translate(-50%,-50%);
  pointer-events:none; z-index:9998;
  transition: opacity .3s ease;
}

/* Orb wrapper trails the pointer with easing — a little "planet" being pulled along */
.cursor-orb{
  position:fixed; top:0; left:0; width:0; height:0;
  pointer-events:none; z-index:9997;
  transition: transform .3s cubic-bezier(.2,.8,.3,1.4), opacity .3s ease;
}
.cursor-core{
  position:absolute; top:0; left:0; width:16px; height:16px; border-radius:50%;
  background: var(--accent-grad);
  box-shadow: 0 0 18px rgba(0,212,255,0.55);
  transform: translate(-50%,-50%);
  transition: transform .25s ease, box-shadow .25s ease;
}
.cursor-ring{
  position:absolute; top:0; left:0; width:40px; height:17px;
  border: 1.5px solid var(--accent-1);
  border-radius:50%;
  opacity:.8;
  transform-origin:center;
  animation: cursor-ring-spin 5s linear infinite;
  transition: width .25s ease, height .25s ease, border-color .25s ease, opacity .25s ease;
}
@keyframes cursor-ring-spin{
  from{ transform: translate(-50%,-50%) rotateX(72deg) rotate(0deg); }
  to{ transform: translate(-50%,-50%) rotateX(72deg) rotate(360deg); }
}
.cursor-orb.grow .cursor-core{
  transform: translate(-50%,-50%) scale(1.7);
  box-shadow: 0 0 30px rgba(124,92,255,0.7);
}
.cursor-orb.grow .cursor-ring{
  width:60px; height:26px; border-color: var(--accent-2); opacity:1;
}

@media (hover:none), (pointer:coarse){
  .cursor-point, .cursor-orb, #cursorTrail{ display:none; }
}

@keyframes spin{ to{ transform: rotate(360deg); } }

/* ---------------- Navbar ---------------- */
.navbar{
  position: fixed; top:0; left:0; right:0; z-index: 1000;
  height: var(--nav-h);
  display:flex; align-items:center;
  background: transparent;
  transition: background .35s ease, box-shadow .35s ease, height .3s ease, border-color .35s ease;
  border-bottom: 1px solid transparent;
}
.navbar.scrolled{
  background: rgba(10,14,23,0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-color: var(--border);
  height: 66px;
}
[data-theme="light"] .navbar.scrolled{ background: rgba(245,247,251,0.78); }

.nav-container{
  max-width:1180px; margin:0 auto; padding:0 24px;
  width:100%; display:flex; align-items:center; justify-content:space-between;
}

.logo{ font-size:1.4rem; font-weight:700; position:relative; display:flex; align-items:center; }
.logo .logo-dot{
  width:7px; height:7px; border-radius:50%; background: var(--accent-1);
  margin-left:6px; box-shadow: 0 0 10px var(--accent-1);
}

.nav-links{ display:flex; gap:2px; }
.nav-link{
  position:relative; padding: 8px 16px; font-size:.92rem; font-weight:500;
  color: var(--text-dim); border-radius:8px;
  transition: color .2s ease;
}
.nav-link::after{
  content:''; position:absolute; left:16px; right:16px; bottom:2px; height:2px;
  background: var(--accent-grad); border-radius:2px;
  transform: scaleX(0); transform-origin:left; transition: transform .25s ease;
}
.nav-link:hover{ color: var(--text); }
.nav-link:hover::after, .nav-link.active::after{ transform: scaleX(1); }
.nav-link.active{ color: var(--text); }

.nav-actions{ display:flex; align-items:center; gap:12px; }
.theme-toggle{
  width:38px; height:38px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border); background: var(--surface);
  transition: transform .3s ease, color .3s ease, border-color .2s ease;
}
.theme-toggle:hover{ transform: rotate(20deg); color: var(--accent-1); border-color: var(--accent-1); }
.nav-resume{ padding:9px 18px; font-size:.85rem; }

.hamburger{
  display:none; flex-direction:column; gap:5px; width:30px; height:22px; position:relative; z-index:1100;
}
.hamburger span{
  height:2px; width:100%; background: var(--text); border-radius:2px;
  transition: transform .3s ease, opacity .3s ease;
}
.hamburger.active span:nth-child(1){ transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2){ opacity:0; }
.hamburger.active span:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }

/* ---------------- Hero ---------------- */
.hero{
  position:relative; min-height:100vh; display:flex; align-items:center;
  padding-top: var(--nav-h);
  overflow:hidden;
}
.hero-bg{ position:absolute; inset:0; z-index:0; overflow:hidden; }
.grid-overlay{
  position:absolute; inset:0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 15%, transparent 70%);
  opacity:.5;
}

.hero-container{
  position:relative; z-index:1;
  display:grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items:center;
  width:100%;
}

.hero-eyebrow{
  display:inline-flex; align-items:center; gap:9px;
  font-size:.82rem; color: var(--text-dim); font-weight:500;
  background: var(--surface); border:1px solid var(--border);
  padding:8px 16px; border-radius:50px; margin-bottom:22px;
}
.pulse-dot{
  width:8px; height:8px; border-radius:50%; background:#3ddc84;
  box-shadow:0 0 0 0 rgba(61,220,132,.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse{
  0%{ box-shadow:0 0 0 0 rgba(61,220,132,.55); }
  70%{ box-shadow:0 0 0 9px rgba(61,220,132,0); }
  100%{ box-shadow:0 0 0 0 rgba(61,220,132,0); }
}

.hero-title{ font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight:700; line-height:1.15; margin-bottom:12px; }
.hero-role{ font-size: clamp(1.1rem, 2.4vw, 1.6rem); font-weight:600; color: var(--accent-1); min-height: 1.6em; margin-bottom:22px; }
.cursor-blink{ animation: blink 1s step-start infinite; color: var(--accent-2); }
@keyframes blink{ 50%{ opacity:0; } }

.hero-desc{ color: var(--text-dim); max-width: 560px; margin-bottom:32px; font-size:1.05rem; }
.hero-desc strong{ color: var(--text); }

.hero-actions{ display:flex; gap:16px; flex-wrap:wrap; margin-bottom:34px; }

.hero-socials{ display:flex; gap:14px; }
.hero-socials a{
  width:42px; height:42px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border); background: var(--surface); font-size:1.05rem;
  transition: all .25s ease;
}
.hero-socials a:hover{ background: var(--accent-grad); color:#04101a; transform: translateY(-4px); border-color:transparent; }

/* Hero visual — scan frame */
.hero-visual{ display:flex; align-items:center; justify-content:center; position:relative; }
.scan-frame{
  position:relative; width: 100%; max-width:340px; aspect-ratio:1/1;
  border-radius: 28px;
  background: linear-gradient(160deg, var(--surface-strong), var(--surface));
  border:1px solid var(--border);
  box-shadow: var(--shadow), var(--glow);
  display:flex; align-items:center; justify-content:center;
  animation: hoverfloat 5s ease-in-out infinite;
}
@keyframes hoverfloat{ 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-14px); } }

.scan-core{
  width:158px; height:158px; border-radius:50%;
  position:relative; overflow:hidden;
  background:#04101a;
  box-shadow: 0 0 60px rgba(0,212,255,0.45), 0 0 0 3px rgba(0,212,255,0.35);
}
.scan-photo{
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; object-position: 50% 22%;
  filter: grayscale(1) contrast(1.2) brightness(0.88);
}
.scan-tint{
  position:absolute; inset:0;
  background: var(--accent-grad);
  mix-blend-mode: color;
  opacity:.9;
}
.scan-vignette{
  position:absolute; inset:0;
  background: radial-gradient(circle, transparent 52%, rgba(2,6,14,0.85) 100%);
}
.scan-line{
  position:absolute; left:6%; right:6%; height:2px;
  background: linear-gradient(90deg, transparent, var(--accent-1), transparent);
  animation: scan 3s ease-in-out infinite;
  box-shadow: 0 0 14px var(--accent-1);
}
@keyframes scan{
  0%{ top:8%; opacity:0; } 10%{ opacity:1; } 50%{ top:92%; opacity:1; } 60%{ opacity:0;} 100%{ top:8%; opacity:0;}
}
.corner{ position:absolute; width:26px; height:26px; border: 3px solid var(--accent-1); opacity:.8; }
.corner.tl{ top:14px; left:14px; border-right:none; border-bottom:none; border-radius:6px 0 0 0; }
.corner.tr{ top:14px; right:14px; border-left:none; border-bottom:none; border-radius:0 6px 0 0; }
.corner.bl{ bottom:14px; left:14px; border-right:none; border-top:none; border-radius:0 0 0 6px; }
.corner.br{ bottom:14px; right:14px; border-left:none; border-top:none; border-radius:0 0 6px 0; }

.chip{
  position:absolute; font-size:.72rem; font-weight:600; padding:6px 12px; border-radius:50px;
  background: var(--surface-strong); border:1px solid var(--border); backdrop-filter: blur(8px);
  animation: chipfloat 4s ease-in-out infinite;
  white-space:nowrap;
}
.chip-1{ top:6%; left:-8%; animation-delay:0s; }
.chip-2{ bottom:16%; right:-14%; animation-delay:-1.4s; }
.chip-3{ bottom:-6%; left:8%; animation-delay:-2.6s; }
@keyframes chipfloat{ 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-8px);} }

.scroll-indicator{
  position:absolute; bottom:34px; left:50%; transform: translateX(-50%);
  width:26px; height:42px; border:2px solid var(--border); border-radius:16px;
  display:flex; align-items:flex-start; justify-content:center; padding-top:8px;
  z-index:2;
}
.scroll-indicator span{
  width:5px; height:9px; border-radius:3px; background: var(--accent-1);
  animation: scrolldown 1.6s ease infinite;
}
@keyframes scrolldown{ 0%{ opacity:1; transform: translateY(0);} 70%{opacity:0;} 100%{ transform: translateY(14px); opacity:0;} }

/* ---------------- About ---------------- */
.about-grid{ display:grid; grid-template-columns: 1.2fr .8fr; gap:56px; align-items:start; }
.about-text p{ color: var(--text-dim); margin-bottom:18px; font-size:1.02rem; }
.about-text strong{ color: var(--text); }
.about-meta{ display:flex; flex-direction:column; gap:12px; margin-top:26px; font-size:.92rem; color: var(--text-dim); }
.about-meta div{ display:flex; align-items:center; gap:10px; }
.about-meta i{ color: var(--accent-1); width:18px; }

.stats-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:18px; }
.stat-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 28px 20px; text-align:center;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.stat-card:hover{ transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--accent-1); }
.stat-number{ font-family:'Space Grotesk',sans-serif; font-size:2.2rem; font-weight:700; background: var(--accent-grad); -webkit-background-clip:text; background-clip:text; color:transparent; }
.stat-label{ margin-top:6px; font-size:.84rem; color: var(--text-dim); }

/* ---------------- Skills ---------------- */
.skills-grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap:22px; }
.skill-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 26px; transition: transform .35s ease, box-shadow .35s ease, border-color .3s ease;
}
.skill-card:hover{ transform: translateY(-8px); box-shadow: var(--shadow), var(--glow); border-color: var(--accent-1); }
.skill-card-head{ display:flex; align-items:center; gap:12px; margin-bottom:16px; }
.skill-card-head i{
  width:42px; height:42px; border-radius:12px; display:flex; align-items:center; justify-content:center;
  background: var(--accent-grad); color:#04101a; font-size:1.15rem; flex-shrink:0;
}
.skill-card-head h3{ font-size:1.05rem; font-weight:600; }

.tag-list{ display:flex; flex-wrap:wrap; gap:8px; }
.tag{
  font-size:.78rem; font-weight:500; padding:6px 13px; border-radius:50px;
  background: var(--surface-strong); border:1px solid var(--border); color: var(--text-dim);
  transition: all .2s ease;
}
.tag:hover{ background: var(--accent-grad); color:#04101a; border-color:transparent; transform: translateY(-2px); }
.tag-list.small .tag{ font-size:.72rem; padding:5px 11px; }

/* ---------------- Experience Timeline ---------------- */
.timeline{ position:relative; padding-left: 34px; }
.timeline::before{
  content:''; position:absolute; left:5px; top:6px; bottom:6px; width:2px;
  background: linear-gradient(var(--accent-1), var(--accent-2));
  opacity:.4;
}
.timeline-item{ position:relative; margin-bottom:34px; }
.timeline-item:last-child{ margin-bottom:0; }
.timeline-dot{
  position:absolute; left:-34px; top:8px; width:12px; height:12px; border-radius:50%;
  background: var(--accent-grad); box-shadow:0 0 0 4px var(--bg), 0 0 14px var(--accent-1);
}
.timeline-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 28px; transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.timeline-card:hover{ transform: translateX(6px); box-shadow: var(--shadow); border-color: var(--accent-1); }
.timeline-head{ display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:10px; margin-bottom:16px; }
.timeline-head h3{ font-size:1.15rem; font-weight:600; margin-bottom:4px; }
.timeline-org{ color: var(--accent-1); font-size:.92rem; font-weight:500; }
.timeline-date{
  font-size:.8rem; font-weight:600; color: var(--text-dim);
  background: var(--surface-strong); padding:6px 14px; border-radius:50px; white-space:nowrap;
}
.timeline-card ul{ display:flex; flex-direction:column; gap:10px; }
.timeline-card li{ position:relative; padding-left:20px; color: var(--text-dim); font-size:.94rem; }
.timeline-card li::before{ content:'▹'; position:absolute; left:0; color: var(--accent-1); }

/* ---------------- Projects ---------------- */
.projects-grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap:22px; }
.project-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 30px; position:relative; overflow:hidden;
  transition: transform .35s ease, box-shadow .35s ease, border-color .3s ease;
  display:flex; flex-direction:column;
}
.project-card::before{
  content:''; position:absolute; inset:0; opacity:0;
  background: radial-gradient(400px circle at 50% 0%, rgba(0,212,255,0.12), transparent 60%);
  transition: opacity .35s ease; pointer-events:none;
}
.project-card:hover{ transform: translateY(-8px); box-shadow: var(--shadow), var(--glow); border-color: var(--accent-1); }
.project-card:hover::before{ opacity:1; }
.project-icon{
  width:52px; height:52px; border-radius:14px; margin-bottom:20px;
  background: var(--accent-grad); color:#04101a; font-size:1.3rem;
  display:flex; align-items:center; justify-content:center;
}
.project-card h3{ font-size:1.12rem; font-weight:600; margin-bottom:10px; }
.project-card p{ color: var(--text-dim); font-size:.92rem; margin-bottom:18px; flex-grow:1; }
.project-link{ font-size:.86rem; font-weight:600; color: var(--accent-1); display:inline-flex; align-items:center; gap:6px; margin-top:14px; }
.project-link i{ font-size:.75rem; transition: transform .2s ease; }
.project-link:hover i{ transform: translate(2px,-2px); }

/* ---------------- Education ---------------- */
.edu-grid{ display:grid; grid-template-columns: 1.3fr .9fr; gap:22px; }
.edu-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 32px; transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.edu-card:hover{ transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--accent-1); }
.edu-icon{
  width:50px; height:50px; border-radius:14px; margin-bottom:18px;
  background: var(--accent-grad); color:#04101a; font-size:1.3rem;
  display:flex; align-items:center; justify-content:center;
}
.edu-card h3{ font-size:1.1rem; font-weight:600; margin-bottom:8px; }
.edu-sub{ color: var(--accent-1); font-size:.9rem; font-weight:500; margin-bottom:14px; }
.edu-courses{ color: var(--text-dim); font-size:.9rem; }
.achieve-list{ display:flex; flex-direction:column; gap:14px; }
.achieve-list li{ display:flex; align-items:center; gap:12px; color: var(--text-dim); font-size:.94rem; }
.achieve-list i{ color:#ffc857; }

/* ---------------- Contact ---------------- */
.contact-grid{ display:grid; grid-template-columns: .8fr 1.2fr; gap:40px; }
.contact-info{ display:flex; flex-direction:column; gap:16px; }
.contact-item{
  display:flex; align-items:center; gap:16px; padding:18px 20px;
  background: var(--surface); border:1px solid var(--border); border-radius: 16px;
  transition: all .25s ease;
}
.contact-item:hover{ border-color: var(--accent-1); transform: translateX(6px); box-shadow: var(--shadow); }
.contact-icon{
  width:46px; height:46px; border-radius:12px; flex-shrink:0;
  background: var(--accent-grad); color:#04101a; font-size:1.1rem;
  display:flex; align-items:center; justify-content:center;
}
.contact-item span{ display:block; font-size:.76rem; text-transform:uppercase; letter-spacing:.06em; color: var(--text-faint); margin-bottom:3px; }
.contact-item p{ font-size:.95rem; font-weight:500; word-break:break-word; }

.contact-form{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 34px;
}
.form-row{ display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.form-group{ position:relative; margin-bottom:20px; }
.form-group input, .form-group textarea{
  width:100%; padding: 16px 16px 8px; background: var(--surface-strong);
  border:1px solid var(--border); border-radius:12px; color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease;
  resize: vertical;
}
.form-group input:focus, .form-group textarea:focus{
  outline:none; border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}
.form-group label{
  position:absolute; left:16px; top:16px; color: var(--text-faint); font-size:.95rem;
  pointer-events:none; transition: all .2s ease;
}
.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label,
.form-group textarea:not(:placeholder-shown) + label{
  top:6px; font-size:.72rem; color: var(--accent-1);
}
.form-submit{ width:100%; justify-content:center; position:relative; margin-top:4px; }
.btn-loader{
  display:none; width:18px; height:18px; border-radius:50%;
  border:2.5px solid rgba(4,16,26,0.3); border-top-color:#04101a;
  animation: spin .7s linear infinite;
}
.form-submit.loading .btn-text{ display:none; }
.form-submit.loading .btn-loader{ display:inline-block; }
.form-note{ margin-top:14px; font-size:.86rem; text-align:center; min-height:1em; }
.form-note.error{ color:#ff6b6b; }
.form-note.success{ color:#3ddc84; }

/* ---------------- Footer ---------------- */
.footer{ padding: 32px 0; border-top:1px solid var(--border); }
.footer-inner{ display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:14px; }
.footer-inner p{ color: var(--text-faint); font-size:.86rem; }
.footer-socials{ display:flex; gap:14px; }
.footer-socials a{ color: var(--text-dim); font-size:1.05rem; transition: color .2s ease, transform .2s ease; }
.footer-socials a:hover{ color: var(--accent-1); transform: translateY(-3px); }

/* ---------------- Back to top ---------------- */
.back-to-top{
  position:fixed; right:26px; bottom:26px; width:48px; height:48px; border-radius:50%;
  background: var(--accent-grad); color:#04101a; font-size:1.05rem;
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 8px 24px rgba(0,212,255,0.3);
  opacity:0; visibility:hidden; transform: translateY(16px);
  transition: all .3s ease; z-index: 900;
}
.back-to-top.show{ opacity:1; visibility:visible; transform: translateY(0); }
.back-to-top:hover{ transform: translateY(-4px) scale(1.05); }

/* ---------------- Toast ---------------- */
.toast{
  position:fixed; bottom:26px; left:50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-strong); border:1px solid var(--border); backdrop-filter: blur(10px);
  padding:14px 24px; border-radius:50px; font-size:.9rem; font-weight:500;
  opacity:0; visibility:hidden; transition: all .3s ease; z-index: 1200; box-shadow: var(--shadow);
}
.toast.show{ opacity:1; visibility:visible; transform: translateX(-50%) translateY(0); }

/* ---------------- Reveal animations ---------------- */
/* Only hidden pre-reveal when JS is confirmed running (html.js, set synchronously
   in <head>) — if JS ever fails to load, content stays fully visible instead of
   being stuck invisible forever. */
.js .reveal-up{ opacity:0; transform: translateY(36px); transition: opacity .7s ease, transform .7s cubic-bezier(.16,.84,.44,1); }
.js .reveal-up.in-view{ opacity:1; transform: translateY(0); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px){
  .projects-grid{ grid-template-columns: repeat(2, 1fr); }
  .skills-grid{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px){
  .hero-container{ grid-template-columns: 1fr; }
  .hero-visual{ order:-1; margin-bottom:10px; }
  .scan-frame{ max-width:260px; }
  .about-grid{ grid-template-columns: 1fr; }
  .edu-grid{ grid-template-columns: 1fr; }
  .contact-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 860px){
  .nav-links{
    position:fixed; top: var(--nav-h); left:0; right:0; bottom:0;
    flex-direction:column; align-items:stretch; gap:4px;
    background: rgba(10,14,23,0.97); backdrop-filter: blur(16px);
    padding: 24px; transform: translateX(100%); transition: transform .35s ease;
    overflow-y:auto;
  }
  [data-theme="light"] .nav-links{ background: rgba(245,247,251,0.98); }
  .nav-links.open{ transform: translateX(0); }
  .nav-link{ padding:16px; font-size:1.05rem; border-bottom:1px solid var(--border); border-radius:0; }
  .nav-link::after{ display:none; }
  .nav-resume{ display:none; }
  .hamburger{ display:flex; }
}

@media (max-width: 720px){
  .section{ padding: 84px 0; }
  .projects-grid, .skills-grid{ grid-template-columns: 1fr; }
  .stats-grid{ grid-template-columns: 1fr 1fr; }
  .form-row{ grid-template-columns: 1fr; }
  .timeline{ padding-left:26px; }
  .timeline-dot{ left:-26px; }
}

@media (max-width: 480px){
  .section-container{ padding: 0 18px; }
  .hero-actions{ flex-direction:column; align-items:stretch; }
  .hero-actions .btn{ justify-content:center; }
  .footer-inner{ flex-direction:column; text-align:center; }
  .chip{ display:none; }
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; }
  html{ scroll-behavior:auto; }
}
