/* =========================================================
   Atonu Saha — Portfolio
   ========================================================= */

:root {
  --bg: #0a0e17;
  --bg-alt: #0f1420;
  --surface: #141a28;
  --surface-2: #1a2233;
  --border: #232c40;
  --text: #e8edf5;
  --text-dim: #9aa7bd;
  --text-muted: #6b7688;
  --brand: #38bdf8;
  --brand-2: #818cf8;
  --brand-3: #34d399;
  --accent: #f472b6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --max: 1140px;
  --ff: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-alt: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f2f5fb;
  --border: #dde4ef;
  --text: #0f1726;
  --text-dim: #4a5568;
  --text-muted: #7a869a;
  --shadow: 0 20px 50px -25px rgba(20, 40, 80, 0.25);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }

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

strong { color: var(--text); font-weight: 600; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
  z-index: 1000; transition: width 0.1s linear;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; border: 1px solid transparent; transition: all 0.25s ease;
  white-space: nowrap;
}
.btn-sm { padding: 9px 16px; font-size: 0.85rem; }
.btn-lg { padding: 15px 32px; font-size: 1.05rem; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #06121f; box-shadow: 0 10px 30px -10px rgba(56, 189, 248, 0.5);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -10px rgba(56, 189, 248, 0.65); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }

/* ---------- Navbar ---------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent; transition: all 0.3s ease;
}
.navbar.scrolled { border-bottom-color: var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #06121f;
  font-weight: 800; font-size: 0.9rem;
}
.brand-name { font-size: 1.02rem; }

/* Ambient orbs */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.orb {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.35;
  animation: orbFloat 18s ease-in-out infinite;
}
.orb-1 { width: 360px; height: 360px; background: rgba(56, 189, 248, 0.35); top: -80px; left: -60px; }
.orb-2 { width: 420px; height: 420px; background: rgba(129, 140, 248, 0.28); top: 40%; right: -120px; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; background: rgba(244, 114, 182, 0.18); bottom: 5%; left: 30%; animation-delay: -12s; }
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.08); }
  66% { transform: translate(-25px, 20px) scale(0.95); }
}
.nav-links { display: flex; gap: 6px; }
.nav-links a {
  padding: 8px 14px; border-radius: 8px; font-size: 0.92rem; color: var(--text-dim);
  font-weight: 500; transition: all 0.2s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 1rem;
  display: grid; place-items: center; transition: all 0.2s ease;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }
.menu-btn { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.menu-btn span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.3s ease; }
.menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; }
.menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 150px 0 90px; overflow: hidden; }
.hero-grid-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    radial-gradient(700px 400px at 75% 10%, rgba(129, 140, 248, 0.18), transparent 60%),
    radial-gradient(600px 500px at 10% 30%, rgba(56, 189, 248, 0.14), transparent 55%),
    linear-gradient(color-mix(in srgb, var(--border) 40%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--border) 40%, transparent) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 46px 46px, 46px 46px;
  mask-image: linear-gradient(180deg, #000 55%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.hero-inner {
  position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: 56px; align-items: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-size: 0.85rem; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border); padding: 7px 14px; border-radius: 999px;
  margin-bottom: 24px; font-weight: 500;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand-3);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.hero-title { font-size: clamp(2.1rem, 5vw, 3.5rem); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.gradient-text {
  background: linear-gradient(120deg, var(--brand), var(--brand-2), var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}
.hero-role {
  font-size: clamp(1.15rem, 2.4vw, 1.55rem); font-weight: 600; margin-bottom: 18px;
  color: var(--text); min-height: 1.5em;
}
.role-rotate {
  display: inline-block; color: var(--brand); border-bottom: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.role-rotate.fade-out { opacity: 0; transform: translateY(8px); }
.role-rotate.fade-in { opacity: 1; transform: translateY(0); }
.hero-subtitle { font-size: 1.12rem; color: var(--text-dim); max-width: 560px; margin-bottom: 34px; }
.anim-in {
  opacity: 0; transform: translateY(24px);
  animation: riseIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes riseIn { to { opacity: 1; transform: translateY(0); } }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 46px; }
.hero-stats { display: flex; gap: 40px; flex-wrap: wrap; }
.stat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--text); font-family: var(--mono); }
.stat-plus { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.stat-label { width: 100%; font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* ---------- Terminal card ---------- */
.terminal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; animation: floaty 6s ease-in-out infinite;
  transform-style: preserve-3d; transition: box-shadow 0.3s ease;
  min-height: 320px;
}
.terminal-card:hover { box-shadow: 0 24px 60px -18px rgba(56, 189, 248, 0.35); }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.terminal-bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.terminal-bar .dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f56; } .dot.yellow { background: #ffbd2e; } .dot.green { background: #27c93f; }
.terminal-title { margin-left: 10px; font-family: var(--mono); font-size: 0.8rem; color: var(--text-muted); }
.terminal-body { padding: 20px; font-family: var(--mono); font-size: 0.82rem; line-height: 1.7; color: var(--text-dim); overflow-x: auto; }
.c-green { color: #34d399; } .c-cyan { color: #38bdf8; } .c-yellow { color: #fbbf24; }
.c-purple { color: #a78bfa; } .c-dim { color: var(--text-muted); }
.cursor-blink { animation: blink 1s step-end infinite; color: var(--brand); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Sections ---------- */
.section { padding: 90px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { margin-bottom: 48px; }
.section-head.center { text-align: center; }
.section-index { font-family: var(--mono); font-size: 0.9rem; color: var(--brand); font-weight: 600; }
.section-title { font-size: clamp(1.7rem, 3.5vw, 2.4rem); font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.section-lead { color: var(--text-dim); font-size: 1.08rem; margin-top: 14px; max-width: 560px; margin-inline: auto; }
.sub-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 20px; color: var(--text); }
.sub-title.mt { margin-top: 34px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: start; }
.about-text p { color: var(--text-dim); margin-bottom: 16px; font-size: 1.05rem; }
.about-highlights { list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.about-highlights li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; color: var(--text-dim); border-bottom: 1px solid var(--border); font-size: 0.96rem; }
.about-highlights li:last-child { border-bottom: none; }
.hl-ico { color: var(--brand); font-size: 0.7rem; margin-top: 6px; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; transition: all 0.3s ease; position: relative; overflow: hidden;
}
.skill-card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s ease;
  background: linear-gradient(135deg, rgba(56,189,248,0.08), transparent 60%);
}
.skill-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.skill-card:hover::before { opacity: 1; }
.skill-ico {
  width: 50px; height: 50px; display: grid; place-items: center; border-radius: 12px;
  background: var(--surface-2); font-size: 1.5rem; margin-bottom: 16px; position: relative;
}
.skill-card h3 { font-size: 1.15rem; margin-bottom: 16px; position: relative; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; position: relative; }
.tags span {
  font-size: 0.82rem; padding: 6px 12px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-dim); font-family: var(--mono);
}
.tags-lg span { font-size: 0.9rem; padding: 9px 16px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--brand), var(--brand-2), transparent); }
.tl-item { position: relative; padding-bottom: 40px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -32px; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent);
}
.tl-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 26px; transition: all 0.3s ease; }
.tl-content:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); transform: translateX(4px); }
.tl-date { font-family: var(--mono); font-size: 0.8rem; color: var(--brand); font-weight: 600; }
.tl-content h3 { font-size: 1.15rem; margin: 6px 0 4px; }
.tl-company { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 12px; }
.tl-content ul { list-style: none; }
.tl-content ul li { position: relative; padding-left: 20px; margin-bottom: 8px; color: var(--text-dim); font-size: 0.95rem; }
.tl-content ul li::before { content: "▹"; position: absolute; left: 0; color: var(--brand); }

/* ---------- Certifications ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.cert-card {
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 18px; font-size: 0.94rem; color: var(--text-dim);
  transition: all 0.25s ease;
}
.cert-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); color: var(--text); }
.cert-card.featured { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 18%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); color: var(--text); font-weight: 600; }
.cert-badge {
  flex-shrink: 0; font-family: var(--mono); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em;
  background: var(--surface-2); color: var(--brand); border: 1px solid var(--border);
  padding: 5px 8px; border-radius: 7px; min-width: 48px; text-align: center;
}
.cert-card.featured .cert-badge { background: var(--brand); color: #06121f; border-color: transparent; }
.verify-row { margin-bottom: 40px; }

/* ---------- Education ---------- */
.edu-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.edu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px 22px; margin-bottom: 16px; transition: all 0.25s ease; }
.edu-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); transform: translateY(-2px); }
.edu-card h4 { font-size: 1.05rem; margin-bottom: 4px; }
.edu-card p { color: var(--text-dim); font-size: 0.94rem; margin-bottom: 8px; }
.edu-meta { font-family: var(--mono); font-size: 0.8rem; color: var(--brand); }

/* ---------- Contact ---------- */
.contact-card {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; max-width: 900px; margin: 0 auto 40px;
}
.contact-item {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px 22px; transition: all 0.3s ease;
}
.contact-item:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.ci-ico { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); font-size: 1.3rem; color: var(--brand); margin-bottom: 6px; }
.ci-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ci-value { font-weight: 600; font-size: 1rem; word-break: break-all; }
.contact-cta { text-align: center; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 30px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer p { color: var(--text-dim); font-size: 0.9rem; }
.footer-muted { color: var(--text-muted); }

.back-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 850;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1.2rem; cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: all 0.3s ease; box-shadow: var(--shadow);
}
.back-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-3px); }

.skill-card, .cert-card, .edu-card, .contact-item, .tl-content {
  will-change: transform;
}
.tags span { transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease; cursor: default; }
.tags span:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
  color: var(--brand);
}

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero-visual { order: -1; }
  .about-grid, .edu-columns { grid-template-columns: 1fr; gap: 28px; }
  .skills-grid, .cert-grid, .contact-card { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav-links {
    position: fixed; top: 68px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 12px 24px 20px;
    transform: translateY(-120%); transition: transform 0.3s ease; z-index: 800;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 12px 8px; border-radius: 8px; }
  .menu-btn { display: flex; }
  .nav-actions .btn { display: none; }
  .brand-name { display: none; }
}
@media (max-width: 560px) {
  .section { padding: 64px 0; }
  .hero { padding: 120px 0 60px; }
  .skills-grid, .cert-grid, .contact-card { grid-template-columns: 1fr; }
  .hero-stats { gap: 26px; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .anim-in { opacity: 1; transform: none; }
  .orb { display: none; }
}
