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

:root {
  --ink: #0f0e0d;
  --ink-soft: #4a4845;
  --ink-muted: #8a8885;
  --paper: #fafaf8;
  --paper-alt: #f2f0eb;
  --accent: #c84b2f;
  --accent-light: #f5e8e4;
  --accent-dark: #9e3520;
  --card-bg: #ffffff;
  --mono: 'DM Mono', monospace;
  --serif: 'DM Serif Display', serif;
  --sans: 'Outfit', sans-serif;
  --nav-h: 68px;
  --radius: 12px;
  --radius-lg: 20px;
  --border: rgba(0,0,0,0.08);
  --btn-border: rgba(0,0,0,0.15);
  --icon-border: rgba(0,0,0,0.12);
}

[data-theme="dark"] {
  --ink: #edeae5;
  --ink-soft: #9a9793;
  --ink-muted: #6a6865;
  --paper: #141312;
  --paper-alt: #1c1b19;
  --accent: #e8694a;
  --accent-light: #2e1810;
  --accent-dark: #f0956f;
  --card-bg: #1e1c1a;
  --border: rgba(255,255,255,0.07);
  --btn-border: rgba(255,255,255,0.18);
  --icon-border: rgba(255,255,255,0.14);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* =============================
   NAV
   ============================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s, background 0.3s, border-color 0.3s;
}

.nav.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,0.08); }

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

.nav-logo {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  line-height: 1;
}
.nav-logo .dot { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--ink); }

.nav-cta {
  background: var(--ink) !important;
  color: var(--paper) !important;
  padding: 0.45rem 1.1rem !important;
  border-radius: 100px;
  font-size: 0.875rem !important;
  transition: background 0.2s !important;
}
.nav-cta:hover { background: var(--accent) !important; }

/* Nav right group — theme + hamburger */
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* =============================
   THEME TOGGLE
   ============================= */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1.5px solid var(--icon-border);
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.theme-toggle:hover { background: var(--paper-alt); border-color: var(--ink-muted); }

/* =============================
   HAMBURGER
   ============================= */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1.5px solid var(--icon-border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s;
  flex-shrink: 0;
}
.hamburger:hover { border-color: var(--ink-muted); }
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =============================
   MOBILE MENU
   ============================= */
.mobile-menu {
  display: none;
  position: absolute;
  top: var(--nav-h);
  left: 0; right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0 1rem;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease, background 0.3s;
}
.mobile-menu.open { opacity: 1; transform: translateY(0); pointer-events: all; }
.mobile-menu ul { list-style: none; }
.mobile-menu ul li a {
  display: block;
  padding: 0.85rem 2rem;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s, background 0.2s;
}
.mobile-menu ul li:last-child a {
  color: var(--accent);
  font-weight: 600;
  border-bottom: none;
}
.mobile-menu ul li a:hover { color: var(--ink); background: var(--paper-alt); }

/* =============================
   HERO
   ============================= */
.hero {
  min-height: 100vh;
  padding-top: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 4rem;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
  position: relative;
}

.hero-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at 30% 50%, black 30%, transparent 70%);
}

.badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  border: 1px solid rgba(200,75,47,0.2);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 1.5rem;
}
.hero-title em { font-style: italic; color: var(--accent); }

.hero-sub {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 440px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-actions { display: flex; gap: 1rem; margin-bottom: 3rem; flex-wrap: wrap; }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  padding: 0.8rem 2rem;
  border-radius: 100px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.2s;
}
.btn-primary:hover { background: var(--accent); transform: translateY(-2px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  padding: 0.8rem 2rem;
  border-radius: 100px;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1.5px solid var(--btn-border);
  transition: border-color 0.2s, transform 0.2s;
}
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-2px); }

.hero-stats { display: flex; align-items: center; gap: 1.5rem; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-family: var(--serif); font-size: 1.8rem; line-height: 1; color: var(--ink); }
.stat-label { font-size: 0.78rem; color: var(--ink-muted); margin-top: 0.2rem; }
.stat-divider { width: 1px; height: 36px; background: var(--border); }

/* =============================
   TERMINAL
   ============================= */
.hero-visual { position: relative; }

.terminal {
  background: #1a1a1a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,255,255,0.05);
  font-family: var(--mono);
}
.terminal-bar {
  background: #2a2a2a;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid #333;
}
.tb { width: 12px; height: 12px; border-radius: 50%; }
.tb.r { background: #ff5f57; } .tb.y { background: #febc2e; } .tb.g { background: #28c840; }
.terminal-title { font-size: 0.75rem; color: #666; margin-left: 0.5rem; flex: 1; text-align: center; }
.terminal-body { padding: 1.2rem 1.4rem; font-size: 0.8rem; line-height: 1.9; color: #ccc; }
.line { white-space: nowrap; } .indent { padding-left: 1.5rem; }
.kw { color: #82aaff; } .fn { color: #c792ea; } .cm { color: #546e7a; }
.str { color: #c3e88d; } .num { color: #f78c6c; } .dim { color: #546e7a; }
.pass { color: #c3e88d; } .fail { color: #ff5370; } .summary { color: #eee; }
.cursor { color: #c3e88d; animation: blink 1.2s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* =============================
   SECTIONS
   ============================= */
.section { padding: 6rem 2rem; }
.section-alt { background: var(--paper-alt); transition: background 0.3s; }
.container { max-width: 1100px; margin: 0 auto; }

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.section-label.center { text-align: center; }

.section-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 3rem;
}
.section-title.center { text-align: center; }
.section-title em { font-style: italic; color: var(--accent); }

/* =============================
   ABOUT
   ============================= */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5rem; align-items: start; }

.body-text { color: var(--ink-soft); font-size: 1rem; line-height: 1.8; margin-bottom: 1.2rem; }

.about-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
.tag {
  background: var(--paper-alt);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.82rem;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  font-weight: 500;
  transition: background 0.3s, color 0.3s;
}

.about-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.mini-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}
.mini-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.mini-card.accent { background: var(--accent); border-color: var(--accent-dark); }
.mini-card.accent h4, .mini-card.accent p { color: #fff !important; }

.mini-icon { font-size: 1.4rem; margin-bottom: 0.5rem; display: block; }
.mini-card h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--ink); }
.mini-card p { font-size: 0.82rem; color: var(--ink-muted); line-height: 1.5; }

/* =============================
   SKILLS
   ============================= */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

.skill-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  transition: background 0.3s;
}
.skill-header { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1.5rem; }
.skill-icon { font-size: 1.5rem; }
.skill-header h3 { font-size: 1rem; font-weight: 600; color: var(--ink); }

.skill-bars { display: flex; flex-direction: column; gap: 1rem; }
.skill-bar-item { display: flex; flex-direction: column; gap: 0.3rem; }
.skill-bar-item span { font-size: 0.82rem; color: var(--ink-soft); }

.bar { height: 6px; background: var(--paper-alt); border-radius: 100px; overflow: hidden; transition: background 0.3s; }
.bar-fill {
  height: 100%;
  width: var(--w);
  background: linear-gradient(90deg, var(--accent) 0%, #e8713a 100%);
  border-radius: 100px;
  animation: grow 1.2s cubic-bezier(0.4,0,0.2,1) both 0.3s;
}
@keyframes grow { from { width: 0; } to { width: var(--w); } }

/* =============================
   PROJECTS
   ============================= */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}
.project-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.12); }

.project-card.featured {
  background: #1a1818;
  color: #edeae5;
  grid-column: span 2;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.2rem;
  padding: 2.8rem;
}
[data-theme="dark"] .project-card.featured { background: #0e0d0c; }

.project-card.featured h3 { color: #edeae5; font-size: 1.6rem; }
.project-card.featured p { color: rgba(237,234,229,0.65); }
.project-card.featured .featured-extra {
  color: rgba(237,234,229,0.45);
  font-size: 0.88rem;
  line-height: 1.8;
  padding-top: 0.2rem;
}
.project-card.featured .project-tag { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); }
.project-card.featured .project-stack span { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.75); }
.project-card.featured .project-link { color: #f0956f; margin-top: 0.5rem; font-size: 0.95rem; }

.project-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
}

.project-card h3 { font-family: var(--serif); font-size: 1.3rem; line-height: 1.2; color: var(--ink); }
.project-card p { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.7; }

.project-meta { margin-top: 0.4rem; }
.project-stats-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.pstat {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.project-stack { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.project-stack span {
  font-size: 0.78rem;
  font-family: var(--mono);
  background: var(--paper-alt);
  color: var(--ink-soft);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.project-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  margin-top: auto;
}
.project-link:hover { text-decoration: underline; }


/* =============================
   TOOLS
   ============================= */
.tools-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

.tool-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.2s, transform 0.2s, background 0.3s;
}
.tool-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-name { font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.tool-cat { font-size: 0.75rem; color: var(--ink-muted); }

/* =============================
   CONTACT
   ============================= */
.contact-section {
  background: #111110;
  transition: background 0.3s;
}
[data-theme="dark"] .contact-section { background: #0a0908; }

.contact-section .section-label { color: var(--accent); opacity: 0.85; }
.contact-section .section-title { color: #edeae5; }
.contact-section .section-title em { color: #f0956f; }

.contact-sub {
  text-align: center;
  color: rgba(237,234,229,0.45);
  font-size: 1rem;
  margin-top: -1.5rem;
  margin-bottom: 2.5rem;
}

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

.contact-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #edeae5;
  text-decoration: none;
  padding: 0.8rem 1.6rem;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, transform 0.2s;
}
.contact-btn:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.contact-icon { font-size: 0.9rem; font-weight: 700; font-family: var(--mono); }

/* =============================
   FOOTER
   ============================= */
.footer {
  background: #0a0908;
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.footer .container { display: flex; justify-content: space-between; align-items: center; }
.footer span { font-size: 0.8rem; color: rgba(255,255,255,0.28); }

/* =============================
   REVEAL ANIMATIONS
   ============================= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeUp 0.7s cubic-bezier(0.22,1,0.36,1) forwards;
}
.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 0.45s; }
.delay-4 { animation-delay: 0.6s; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* =============================
   RESPONSIVE
   ============================= */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: calc(var(--nav-h) + 2rem);
    min-height: auto;
    padding-bottom: 4rem;
  }
  .hero-visual { display: none; }
  .about-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .skills-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card.featured { grid-column: span 1; flex-direction: column; }
  .featured-left { flex: none; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .mobile-menu { display: block; }
  .footer .container { flex-direction: column; gap: 0.5rem; text-align: center; }
}

@media (max-width: 480px) {
  .hero-stats { gap: 1rem; }
  .stat-num { font-size: 1.4rem; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-links { flex-direction: column; align-items: center; }
  .section { padding: 4rem 1.2rem; }
}
