/* ============================================================
   BASE.CSS - Reset, Typography, Layout, Default Theme (Ink + Teal)
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
}

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

ul { list-style: none; }

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ---------- DEFAULT THEME: INK + TEAL ---------- */
:root, [data-theme="default"] {
  --bg: #0a1a1f;
  --bg-secondary: #0f2429;
  --bg-card: #122a30;
  --ink: #f4e9cd;
  --ink-soft: #c8d6d4;
  --accent: #4f8b96;
  --accent-bright: #77aca2;
  --accent-glow: rgba(79, 139, 150, 0.35);
  --muted: #9dbebb;
  --border: rgba(119, 172, 162, 0.15);
  --glass: rgba(18, 42, 48, 0.6);
  --glass-border: rgba(119, 172, 162, 0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 64px rgba(0,0,0,0.4);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 36px;
  --font-mono: 'Space Mono', monospace;
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h1 { font-size: clamp(3rem, 8vw, 7rem); }
h2 { font-size: clamp(1.8rem, 4vw, 3.2rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.8rem); }
h4 { font-size: clamp(1rem, 1.8vw, 1.3rem); }

p {
  line-height: 1.65;
  color: var(--ink-soft);
}

.accent { color: var(--accent-bright); }
.mono { font-family: var(--font-mono); }

/* ---------- LAYOUT ---------- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.section {
  padding: clamp(4rem, 10vh, 8rem) 0;
  position: relative;
  z-index: 2;
}

/* ---------- NAV ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.25rem clamp(1rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 26, 31, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s, border-color 0.4s;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.nav-logo .logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--bg);
  box-shadow: 0 0 20px var(--accent-glow);
}

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

.nav-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--accent-bright);
  border-radius: 2px;
  transition: width 0.35s cubic-bezier(0.7, 0, 0.2, 1);
}

/* Scrim behind the mobile drawer — closes mis-taps and blocks background */
body.nav-open::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 98;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Theme Switcher */
.theme-switcher {
  position: relative;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  transition: all 0.3s;
}

.theme-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.theme-btn .icon { font-size: 1rem; }

.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.theme-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  width: 100%;
  text-align: left;
  transition: all 0.2s;
}

.theme-option:hover {
  background: var(--accent-glow);
  color: var(--ink);
}

.theme-option.active {
  background: var(--accent);
  color: var(--bg);
}

.theme-option .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Color Cycle Button */
.cycle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  transition: all 0.3s;
  animation: spin 4s linear infinite paused;
}

.cycle-btn:hover, .cycle-btn.active {
  background: var(--accent);
  color: var(--bg);
  animation-play-state: running;
}

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

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.3s;
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8rem 2rem 4rem;
  overflow: hidden;
  z-index: 2;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-bg canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  max-width: 900px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 1.5rem;
  opacity: 0;
}

.hero-name {
  font-size: clamp(2rem, 8vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin-bottom: 0.5rem;
  max-width: 100%;
  word-break: normal;
  overflow-wrap: normal;
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent-bright) 50%, var(--ink) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s ease-in-out infinite;
}

#nameLetters {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

.hero-letter {
  display: inline-block;
  flex: none;
  letter-spacing: normal;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-alias {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  color: var(--muted);
  letter-spacing: 0.15em;
  margin-bottom: 2rem;
  opacity: 0;
}

.hero-tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  color: var(--ink-soft);
  font-weight: 400;
  margin-bottom: 3rem;
  opacity: 0;
}

.hero-cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
  opacity: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.35s cubic-bezier(0.6, 0, 0.2, 1);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
  transform: translateY(-2px);
}

/* Download Button Chase */
.btn-download {
  position: relative;
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: all 0.35s cubic-bezier(0.6, 0, 0.2, 1);
  user-select: none;
}

.btn-download.chasing {
  animation: btn-shake 0.4s ease-in-out;
}

@keyframes btn-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-2deg); }
  40% { transform: translateX(8px) rotate(2deg); }
  60% { transform: translateX(-5px) rotate(-1deg); }
  80% { transform: translateX(5px) rotate(1deg); }
}

.btn-download.caught {
  background: var(--accent-bright);
  animation: none;
}

/* Floating Project Cards */
.hero-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 4;
  opacity: 0;
}

.hero-card {
  width: 160px;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  text-align: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.6, 0, 0.2, 1);
  will-change: transform;
}

.hero-card:hover {
  transform: translateY(-8px) scale(1.05);
  border-color: var(--accent);
  box-shadow: 0 12px 40px var(--accent-glow);
}

.hero-card .card-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.hero-card .card-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.hero-card .card-sub {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ---------- SECTION HEADERS ---------- */
.section-header {
  margin-bottom: 4rem;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent-bright);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.section-title {
  max-width: 700px;
}

.section-title em {
  font-style: italic;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.about-card {
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.4s;
}

.about-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 40px var(--accent-glow);
}

.about-card h3 {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.about-card p {
  font-size: 0.95rem;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.stat-item {
  text-align: center;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-bright);
  line-height: 1;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.4rem;
}

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

.project-card {
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.4s cubic-bezier(0.6, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s;
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px var(--accent-glow);
}

.project-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.project-card h3 {
  margin-bottom: 0.5rem;
}

.project-card .project-desc {
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  min-height: 3.3rem;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  align-items: center;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--ink);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.project-link:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bg);
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.7); }
}

.private-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--bg-secondary);
  border: 1px dashed var(--accent);
}

.tech-badge {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  color: var(--accent-bright);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.project-card:hover .tech-badge {
  border-color: var(--accent);
}

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

.skill-category {
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.4s;
}

.skill-category:hover {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

.skill-category h4 {
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--ink-soft);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
  transform: translateY(-1px);
}

/* ---------- EXPERIENCE ---------- */
.timeline {
  position: relative;
  padding-left: 3rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-bright), transparent);
}

.timeline-item {
  position: relative;
  padding: 1.5rem 0 2.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -3rem;
  top: 1.8rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: translateX(-5px);
}

.timeline-item h4 {
  margin-bottom: 0.25rem;
}

.timeline-role {
  font-size: 0.85rem;
  color: var(--accent-bright);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.timeline-item p {
  font-size: 0.9rem;
  max-width: 700px;
}

/* ---------- LEARNING ---------- */
.learning-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.learning-card {
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-align: center;
  transition: all 0.4s;
}

.learning-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px var(--accent-glow);
}

.learning-card .learning-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.learning-card h4 {
  margin-bottom: 0.5rem;
}

.learning-card p {
  font-size: 0.85rem;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 4px;
  margin-top: 1rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 4px;
  width: 0;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- HOBBIES ---------- */
.hobbies-section {
  text-align: center;
}

.hobbies-row {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.hobby-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.hobby-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: all 0.4s;
}

.hobby-icon:hover {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
  transform: scale(1.1);
}

.hobby-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

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

.contact-card {
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-align: center;
  transition: all 0.4s;
}

.contact-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px var(--accent-glow);
}

.contact-card .contact-icon {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
}

.contact-card h4 {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.contact-card p {
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* ---------- FOOTER ---------- */
.footer {
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 2;
}

.footer p {
  font-size: 0.8rem;
  color: var(--muted);
}

.footer .heart {
  color: var(--accent);
}

/* ---------- UTILITY ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 3px;
  margin: 1rem 0;
}

/* Grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
