/* ============================================================
   SOUVIK GHOSH — PORTFOLIO  |  main.css
   Minimalist · Responsive · Dark/Light · SPA
   ============================================================ */

/* ── 1. TOKENS ──────────────────────────────────────────── */
:root {
  /* Light — Rustic Day */
  --bg:          #f5f0e8;
  --surface:     #fdfaf4;
  --surface2:    #ede5d8;
  --border:      #d4c9ba;
  --text:        #2c2420;
  --text-muted:  #7a6655;
  --accent:      #8b5e3c;
  --accent-soft: rgba(139,94,60,0.09);
  --tag-bg:      #e8ddd0;
  --tag-text:    #5a3e2b;
  --nav-bg:      rgba(245,240,232,0.88);
  --shadow:      0 1px 3px rgba(44,36,32,0.07), 0 4px 16px rgba(44,36,32,0.06);
  --shadow-lg:   0 8px 32px rgba(44,36,32,0.10);
  --radius:      10px;
  --radius-lg:   18px;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
  --mono:        'JetBrains Mono', 'Fira Code', monospace;
  --transition:  0.22s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="dark"] {
  /* Dark — Rustic Night */
  --bg:          #1e1a16;
  --surface:     #2a2320;
  --surface2:    #332b26;
  --border:      #4a3d35;
  --text:        #ede0cc;
  --text-muted:  #a89080;
  --accent:      #c8845a;
  --accent-soft: rgba(200,132,90,0.10);
  --tag-bg:      #3d3028;
  --tag-text:    #c9b99a;
  --nav-bg:      rgba(30,26,22,0.92);
  --shadow:      0 1px 3px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.28);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.45);
}

/* ── 2. RESET ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
  min-height: 100vh;
}

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

/* ── 3. SVG BACKGROUND ───────────────────────────────────── */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

/* ── 4. NAVIGATION ──────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.nav-logo span { color: var(--text-muted); font-weight: 400; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  letter-spacing: 0.01em;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-soft);
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-theme {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.btn-theme:hover { background: var(--surface2); }
.btn-theme svg { width: 16px; height: 16px; }

.btn-resume-nav {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn-resume-nav:hover { background: var(--surface2); }

/* Hamburger */
.nav-hamburger {
  display: none;
  width: 36px; height: 36px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.nav-hamburger span {
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* Mobile drawer */
.nav-drawer {
  display: none;
  flex-direction: column;
  padding: 0.75rem 1.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--nav-bg);
  gap: 0.15rem;
}
.nav-drawer a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.5rem 0.5rem;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}
.nav-drawer a:hover { background: var(--accent-soft); color: var(--text); }
.nav-drawer.open { display: flex; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .btn-resume-nav { display: none; }
  .nav-hamburger { display: flex; }
}

/* ── 5. LAYOUT ──────────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  padding-top: 56px;
}

.section {
  max-width: 900px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fallback: if IntersectionObserver not supported, show everything */
@media (prefers-reduced-motion: reduce) {
  .section {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 2.5rem;
}

/* Divider */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 auto;
  max-width: 900px;
  padding: 0 1.5rem;
}

/* ── 6. HERO ─────────────────────────────────────────────── */
#hero {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 1.5rem 3rem;
  max-width: 900px;
  margin: 0 auto;
  opacity: 1;
  transform: none;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
  animation: pulse-dot 2.5s infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }
  50%       { box-shadow: 0 0 0 7px rgba(34,197,94,0.05); }
}

.hero-eyebrow-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.hero-name {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.0;
  margin-bottom: 0.6rem;
}

.hero-role {
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 1.8rem;
  line-height: 1.5;
}
.hero-role strong { color: var(--text); font-weight: 600; }

.hero-summary {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.75;
  margin-bottom: 2.5rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem;
  background: var(--text);
  color: var(--bg);
  font-size: 0.87rem;
  font-weight: 600;
  border-radius: 9px;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.87rem;
  font-weight: 600;
  border-radius: 9px;
  border: 1px solid var(--border);
  transition: background var(--transition), transform var(--transition);
}
.btn-secondary:hover { background: var(--surface2); transform: translateY(-1px); }

.hero-social {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-social a {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: color var(--transition);
}
.hero-social a:hover { color: var(--text); }
.hero-social svg { width: 14px; height: 14px; }

/* ── 7. FUN / QUIRKS ─────────────────────────────────────── */
.quirk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.quirk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  cursor: default;
}
.quirk-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--text-muted);
}

.quirk-icon {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  display: block;
}

.quirk-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.quirk-card p {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Joke widget */
#joke-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.7;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
#joke-text { flex: 1; min-width: 200px; }
#joke-btn {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  white-space: nowrap;
  transition: background var(--transition);
}
#joke-btn:hover { background: var(--accent-soft); }

/* ── Terminal ──────────────────────────────────────────── */
#terminal-game {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.82rem;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 8px 32px rgba(0,0,0,0.45);
}
[data-theme="light"] #terminal-game {
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 8px 32px rgba(0,0,0,0.12);
}

.terminal-bar {
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}
.terminal-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  cursor: default;
  transition: filter 0.15s;
}
.terminal-dot:hover { filter: brightness(1.25); }
.td-r { background: #ff5f56; }
.td-y { background: #ffbd2e; }
.td-g { background: #27c93f; }

.terminal-title {
  margin-left: 0.6rem;
  font-size: 0.71rem;
  color: #8b949e;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.terminal-body {
  padding: 1rem 1.25rem 0.75rem;
  min-height: 200px;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #30363d #0d1117;
}
.terminal-body::-webkit-scrollbar { width: 4px; }
.terminal-body::-webkit-scrollbar-track { background: #0d1117; }
.terminal-body::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }

.terminal-body p { margin: 0.18rem 0; line-height: 1.55; }
.terminal-body .prompt  { color: #22c55e; font-weight: 600; }
.terminal-body .output  { color: #8b949e; padding-left: 1.1rem; }
.terminal-body .success { color: #58d68d; padding-left: 1.1rem; }
.terminal-body .info    { color: #79c0ff; padding-left: 1.1rem; }
.terminal-body .warn    { color: #f0ad4e; padding-left: 1.1rem; }
.terminal-body .error   { color: #f85149; padding-left: 1.1rem; }
.terminal-body .divider { color: #30363d; padding-left: 1.1rem; }

.terminal-input-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.25rem 0.9rem;
  gap: 0.5rem;
  border-top: 1px solid #30363d;
}
.terminal-input-row .ps1 {
  color: #22c55e;
  font-family: var(--mono);
  font-size: 0.82rem;
  white-space: nowrap;
  user-select: none;
}
.terminal-input-row input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #e6edf3;
  caret-color: #22c55e;
}
.terminal-input-row input::placeholder { color: #484f58; }

/* ── 8. SKILLS ──────────────────────────────────────────── */
.skill-group { margin-bottom: 2rem; }
.skill-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skill-tag {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 100px;
  border: 1px solid var(--border);
  transition: background var(--transition), transform var(--transition);
}
.skill-tag:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  border-color: var(--text-muted);
}

/* ── 9. EXPERIENCE ──────────────────────────────────────── */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
}
.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.35rem;
}
.timeline-company {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.timeline-period {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.timeline-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
  letter-spacing: -0.01em;
}
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.timeline-list li {
  font-size: 0.87rem;
  color: var(--text-muted);
  padding-left: 1rem;
  position: relative;
  line-height: 1.65;
}
.timeline-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--border);
}
.timeline-list li strong { color: var(--text); }

/* ── 10. PROJECTS ───────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Flip card wrapper — perspective container */
.project-card {
  perspective: 900px;
  height: 260px;
  cursor: pointer;
}

/* Inner element that actually rotates */
.project-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.52s cubic-bezier(0.4,0,0.2,1);
  border-radius: var(--radius-lg);
}

/* Flipped state — toggled by JS on click */
.project-card.flipped .project-card-inner {
  transform: rotateY(180deg);
}

/* Shared face styles */
.project-card-front,
.project-card-back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* Front: normal state */
.project-card-front {
  z-index: 2;
}
.project-card:hover .project-card-front,
.project-card:hover .project-card-back {
  box-shadow: var(--shadow-lg);
  border-color: var(--text-muted);
}

/* Back: rotated 180deg so it shows when flipped */
.project-card-back {
  transform: rotateY(180deg);
  background: var(--surface2);
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
}

/* Hint label at bottom of front — always pinned, never overflows */
.project-flip-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: auto;
  flex-shrink: 0;
  opacity: 0.55;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Back content */
.project-back-icon { font-size: 2rem; line-height: 1; }
.project-back-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.project-back-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.project-back-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.25rem;
}
.project-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.9rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  transition: background var(--transition), border-color var(--transition);
}
.project-back-link:hover { background: var(--accent-soft); border-color: var(--text-muted); }
.project-back-link svg { width: 13px; height: 13px; flex-shrink: 0; }

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.project-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.project-links {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.project-link {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  font-size: 0.7rem;
}
.project-link:hover { background: var(--accent-soft); color: var(--text); }
.project-link svg { width: 13px; height: 13px; }

.project-title {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.project-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.project-tag {
  font-size: 0.73rem;
  font-weight: 500;
  padding: 0.18rem 0.6rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 100px;
}

/* ── 11. TOOLS ──────────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  text-decoration: none;
  color: inherit;
}
.tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--text-muted);
}
.tool-emoji {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}
.tool-info h3 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.tool-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.tool-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 100px;
  margin-top: 0.4rem;
  letter-spacing: 0.04em;
}

/* ── 12. CERTIFICATIONS / ACHIEVEMENTS ──────────────────── */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--transition);
}
.cert-card:hover { background: var(--surface2); }
.cert-card::before {
  content: '✦';
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 0.7rem;
}

/* ── Credly badge grid ───────────────────────────────────── */
.skill-group-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.credly-all-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  opacity: 0.75;
  transition: opacity var(--transition);
  text-decoration: none;
}
.credly-all-link:hover { opacity: 1; }

.credly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}
.credly-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.35;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.credly-badge:hover {
  background: var(--surface2);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.credly-badge img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 6px;
}

.achieve-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.achieve-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.achieve-item::before {
  content: '→';
  color: var(--text);
  flex-shrink: 0;
  font-weight: 700;
  margin-top: 0.02em;
}

/* ── 13. CV / DOWNLOAD SECTION ──────────────────────────── */
#cv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  transition: background var(--transition), border-color var(--transition);
}
.cv-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
#cv-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
#cv-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
  line-height: 1.65;
}
.cv-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.cv-note {
  margin-top: 1rem !important;
  margin-bottom: 0 !important;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── 14. CONTACT ────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.contact-link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--transition), transform var(--transition);
}
.contact-link:hover {
  background: var(--surface2);
  transform: translateY(-2px);
}
.contact-link svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); }

/* ── 15. FOOTER ─────────────────────────────────────────── */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--text); }

/* ── 16. SCROLL-TO-TOP ──────────────────────────────────── */
#scroll-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
#scroll-top.visible { opacity: 1; pointer-events: auto; }
#scroll-top:hover { background: var(--surface2); }
#scroll-top svg { width: 14px; height: 14px; }

/* ── 17. PROGRESS BAR ───────────────────────────────────── */
#reading-bar {
  position: fixed;
  top: 56px; left: 0;
  height: 2px;
  width: 0%;
  background: var(--text);
  z-index: 101;
  transition: width 0.1s linear;
}

/* ── 18. ANIMATIONS ─────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.anim-fade-up { animation: fade-up 0.6s ease forwards; }
.anim-fade-in { animation: fade-in 0.5s ease forwards; }

/* Stagger delay helpers */
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.22s; opacity: 0; }
.delay-3 { animation-delay: 0.34s; opacity: 0; }
.delay-4 { animation-delay: 0.46s; opacity: 0; }

/* ── 19. UTILITIES ──────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── 20. RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 600px) {
  .section { padding: 3.5rem 1.1rem; }
  #hero { padding: 2.5rem 1.1rem 2rem; }
  .hero-name { letter-spacing: -0.035em; }
  .project-grid { grid-template-columns: 1fr; }
  .tools-grid  { grid-template-columns: 1fr; }
  .cert-grid   { grid-template-columns: 1fr; }
  .contact-grid{ grid-template-columns: 1fr; }
  #cv-card { padding: 1.5rem 1.1rem; }
  .timeline { padding-left: 1.1rem; }
}

@media (min-width: 900px) {
  .quirk-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── 21. HERO LAYOUT (two-column) ───────────────────────── */
#hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-layout {
  display: flex;
  align-items: center;
  gap: 3rem;
  width: 100%;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-terminal {
  flex-shrink: 0;
  width: 380px;
  max-width: 100%;
}

/* Make terminal taller and more prominent in hero */
.hero-terminal #terminal-game {
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}
.hero-terminal .terminal-body {
  min-height: 200px;
  max-height: 260px;
}

.hero-terminal-hint {
  margin-top: 0.55rem;
  font-size: 0.73rem;
  color: var(--text-muted);
  text-align: center;
}
.hero-terminal-hint code {
  font-family: var(--mono);
  font-size: 0.78em;
  background: var(--tag-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  color: var(--text);
}

/* Blinking cursor on first prompt line */
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.terminal-body .prompt:first-child::after {
  content: '█';
  display: inline-block;
  animation: blink 1.1s step-end infinite;
  margin-left: 2px;
  font-size: 0.75em;
  vertical-align: middle;
  color: #22c55e;
}

@media (max-width: 760px) {
  .hero-layout {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }
  .hero-terminal {
    width: 100%;
  }
  .hero-social {
    justify-content: center;
  }
  .hero-cta {
    justify-content: center;
  }
  .hero-eyebrow {
    justify-content: center;
  }
}

/* ── 22. ABOUT LAYOUT ───────────────────────────────────── */
.about-layout {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

/* ── About photo swap on hover ──────────────────────────── */
.about-photo {
  position: relative;
  flex-shrink: 0;
  width: 220px;
  height: 270px;
}

/* Both images stacked; main is on top */
.about-photo img:first-child,
.about-gh-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: opacity 0.38s ease, transform 0.38s ease, box-shadow 0.38s ease;
  backface-visibility: hidden;
}

/* Real photo: visible by default */
.about-photo img:first-child {
  z-index: 2;
  opacity: 1;
  transform: scale(1) rotate(0deg);
  box-shadow: var(--shadow);
}

/* GitHub avatar: hidden by default, circular */
.about-gh-avatar {
  z-index: 1;
  opacity: 0;
  border-radius: var(--radius-lg);
  transform: scale(0.92) rotate(-3deg);
  box-shadow: var(--shadow-lg);
  /* override positioning from old badge style */
  bottom: unset;
  right: unset;
  width: 100% !important;
  height: 100% !important;
}

/* Toggled class swaps images */
.about-photo.swapped img:first-child {
  opacity: 0;
  transform: scale(0.92) rotate(3deg);
  box-shadow: none;
}
.about-photo.swapped .about-gh-avatar {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  box-shadow: var(--shadow-lg);
}

/* Click-to-swap cursor */
.about-photo { cursor: pointer; }

/* Tap hint label */
.about-photo::after {
  /* content: ' click to swap'; */
  position: absolute;
  bottom: -1.7rem;
  left: 0; right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
/* Hide hint once swapped */
.about-photo.swapped::after { opacity: 0; }

/* Fun section hint */
.fun-hint {
  margin-top: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.fun-hint code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--tag-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  color: var(--text);
}
.fun-hint kbd {
  font-family: var(--mono);
  padding: 0.1em 0.4em;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8em;
  background: var(--surface2);
}

.about-photo img {
  width: 220px;
  height: 270px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.about-photo img:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--text-muted);
}

.about-body {
  flex: 1;
  min-width: 0;
}

.about-para {
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}
.about-para strong { color: var(--text); }

.about-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.about-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.about-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.about-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (max-width: 700px) {
  .about-layout {
    flex-direction: column;
    gap: 1.5rem;
  }
  .about-photo img {
    width: 100%;
    height: 220px;
  }
  .about-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 400px) {
  .about-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── 23. CV VIEWER ──────────────────────────────────────── */
#cv-viewer-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

#cv-rendered {
  max-width: 720px;
  margin: 0 auto;
  font-size: 0.93rem;
  line-height: 1.75;
  color: var(--text);
}

/* Headings inside rendered CV */
#cv-rendered h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}
#cv-rendered h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin: 1.75rem 0 0.75rem;
}
#cv-rendered h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.1rem 0 0.3rem;
}
#cv-rendered p {
  margin: 0.4rem 0;
  color: var(--text-muted);
}
#cv-rendered p:first-child {
  color: var(--text-muted);
  font-size: 0.85rem;
}
#cv-rendered strong { color: var(--text); }
#cv-rendered a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
#cv-rendered ul {
  padding-left: 1.2rem;
  margin: 0.4rem 0 0.8rem;
}
#cv-rendered li {
  list-style: disc;
  margin: 0.3rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}
#cv-rendered li strong { color: var(--text); }
#cv-rendered hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}
#cv-rendered code {
  font-family: var(--mono);
  font-size: 0.83em;
  background: var(--tag-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
