/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --accent-dark: #1d4ed8;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --radius: 12px;
  --radius-sm: 6px;
  --nav-h: 68px;
  --max-w: 1100px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ============================================================
   Nav
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}

.nav.scrolled {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
}

.nav-links a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .2s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: width .25s;
}

.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .9rem;
  transition: all .2s;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.btn-sm {
  padding: .4rem 1rem;
  font-size: .82rem;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
}
.btn-sm:hover { background: var(--accent-light); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: calc(var(--nav-h) + 3rem) 2rem 4rem;
}

.hero-bg-accent {
  position: absolute;
  top: -10%; right: -5%;
  width: 60vw; height: 80vh;
  background: radial-gradient(ellipse at 70% 30%, rgba(37,99,235,.07) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: .9rem;
  color: var(--accent);
  margin-bottom: .75rem;
  opacity: 0;
  animation: fadeUp .6s .1s forwards;
}

.hero-name {
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.05;
  color: var(--text);
  opacity: 0;
  animation: fadeUp .6s .2s forwards;
}

.hero-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--text-muted);
  margin-top: .5rem;
  opacity: 0;
  animation: fadeUp .6s .3s forwards;
}

.hero-title .at { color: var(--accent); font-weight: 600; }

.hero-bio {
  max-width: 560px;
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: 1.5rem;
  opacity: 0;
  animation: fadeUp .6s .4s forwards;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp .6s .5s forwards;
}

.hero-scroll-hint {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: .8rem;
  font-family: var(--mono);
  opacity: 0;
  animation: fadeUp .6s .7s forwards;
}

.scroll-line {
  width: 60px; height: 1px;
  background: linear-gradient(to right, var(--text-muted), transparent);
}

/* ============================================================
   Sections
   ============================================================ */
.section { padding: 7rem 2rem; }
.section-alt { background: var(--bg-alt); }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-label {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: .75rem;
}

.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 3rem;
}

/* ============================================================
   About
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 4rem;
  align-items: start;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  font-size: 1.05rem;
}
.about-text strong { color: var(--text); font-weight: 600; }

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2.5rem;
}

.skill-group h4 {
  font-size: .78rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: .75rem;
}

.skill-group ul li {
  font-size: .95rem;
  color: var(--text-muted);
  padding: .3rem 0;
  border-bottom: 1px solid var(--border);
}
.skill-group ul li:last-child { border-bottom: none; }

.about-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: calc(var(--nav-h) + 2rem);
}

.about-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  border: 3px solid var(--accent);
}

.about-meta { display: flex; flex-direction: column; gap: 1rem; }

.meta-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.meta-item:last-child { border-bottom: none; padding-bottom: 0; }

.meta-label {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.meta-value { font-size: .95rem; font-weight: 500; }
.meta-link { color: var(--accent); }
.meta-link:hover { text-decoration: underline; }

/* ============================================================
   Timeline
   ============================================================ */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 1.5rem;
  padding-bottom: 3rem;
  position: relative;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-alt);
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 0 0 2px var(--accent);
  position: relative;
  z-index: 1;
}

.timeline-dot-outline {
  background: var(--bg-alt);
  border: 3px solid var(--border);
  box-shadow: 0 0 0 2px var(--border);
}

.timeline-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}

.timeline-content:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .75rem;
  gap: 1rem;
}

.timeline-role {
  font-size: 1.1rem;
  font-weight: 700;
}

.timeline-company {
  font-size: .9rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: .2rem;
}

.timeline-period {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  background: var(--bg-alt);
  padding: .3rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.timeline-desc {
  font-size: .95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tag {
  font-size: .75rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 500;
  border: 1px solid rgba(37,99,235,.15);
}

/* ============================================================
   Projects
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}

.project-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.project-card-placeholder {
  background: var(--bg-alt);
  border-style: dashed;
}

.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-icon { font-size: 1.8rem; }

.project-links a {
  color: var(--text-muted);
  transition: color .2s;
}
.project-links a:hover { color: var(--accent); }

.project-title { font-size: 1.1rem; font-weight: 700; }

.project-desc {
  font-size: .9rem;
  color: var(--text-muted);
  flex: 1;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: auto;
}

/* ============================================================
   Writing
   ============================================================ */
.writing-placeholder {
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
}

.writing-placeholder p {
  font-size: 1.1rem;
  color: var(--text-muted);
}
.writing-sub { font-size: .95rem; margin-top: .5rem; }
.writing-sub a { color: var(--accent); }
.writing-sub a:hover { text-decoration: underline; }

/* ============================================================
   Fun / Easter egg game
   ============================================================ */
.fun-section { background: #0f172a; }
.fun-section .section-label { color: #64748b; }
.fun-section .section-title { color: #f1f5f9; }

.fun-intro {
  color: #94a3b8;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.game-wrapper {
  background: #1e293b;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #334155;
}

.game-hud {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.5rem;
  background: #0f172a;
  border-bottom: 1px solid #334155;
  font-family: var(--mono);
  font-size: .85rem;
  color: #64748b;
}

.game-hud .game-stat span { color: #38bdf8; font-weight: 600; }

.game-area {
  position: relative;
  width: 100%;
  height: 360px;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
}

.game-start-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,.85);
  z-index: 10;
}

.game-start-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.game-title-ascii {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(56,189,248,.6);
  animation: pulse-glow 2s infinite;
}

.game-start-box p {
  color: #94a3b8;
  font-size: .95rem;
  line-height: 1.8;
}

.glitch-target {
  position: absolute;
  width: 36px; height: 36px;
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  animation: glitch-shake .4s infinite;
  transition: opacity .15s;
  border-radius: 4px;
  background: rgba(56,189,248,.08);
  border: 1px solid rgba(56,189,248,.3);
  filter: drop-shadow(0 0 6px rgba(56,189,248,.5));
}

.glitch-target:hover { background: rgba(56,189,248,.2); }

.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  z-index: 10;
}

.game-over-overlay h3 {
  font-family: var(--mono);
  font-size: 1.5rem;
  color: #38bdf8;
}

.game-over-overlay p { color: #94a3b8; }

/* ============================================================
   Contact
   ============================================================ */
.contact-container { text-align: center; }

.contact-desc {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 480px;
  margin: 0 auto 3rem;
}

.contact-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 2rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: all .2s;
  min-width: 140px;
  box-shadow: var(--shadow-sm);
}

.contact-card:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.contact-card span {
  font-weight: 600;
  font-size: .9rem;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  background: var(--bg-alt);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .85rem;
  color: var(--text-muted);
}

.footer-hint {
  cursor: pointer;
  transition: transform .2s;
  font-size: 1.2rem;
}
.footer-hint:hover { transform: scale(1.3) rotate(-10deg); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes glitch-shake {
  0%, 100% { transform: translate(0); }
  25%       { transform: translate(-1px, 1px); }
  50%       { transform: translate(1px, -1px); }
  75%       { transform: translate(-1px, -1px); }
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(56,189,248,.6); }
  50%       { text-shadow: 0 0 40px rgba(56,189,248,1), 0 0 60px rgba(56,189,248,.4); }
}

/* ============================================================
   Reveal-on-scroll
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s, transform .6s;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-card {
    position: static;
    max-width: 400px;
  }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    background: rgba(255,255,255,.98);
    padding: 2rem;
    gap: 1.5rem;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    z-index: 99;
  }
  .hero-name { letter-spacing: -1.5px; }
  .footer-inner { flex-direction: column; gap: .75rem; text-align: center; }
  .skills-grid { grid-template-columns: 1fr; }
  .timeline::before { left: 11px; }
  .game-area { height: 280px; }
}
