/* ============================================================
   THEME TOKENS
   ============================================================ */

[data-theme="midnight"] {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface-hover: #1a2438;
  --accent: #00d4ff;
  --accent-hover: #33ddff;
  --text: #f0f4f8;
  --text-muted: #8899aa;
  --border: #1e2d40;
  --btn-text: #0a0e1a;
  --shadow: 0 4px 24px rgba(0, 212, 255, 0.15);
}

[data-theme="daylight"] {
  --bg: #F2F4F7;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --accent: #73A79D;
  --accent-hover: #5d918a;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e2e8f0;
  --btn-text: #ffffff;
  --shadow: 0 4px 24px rgba(115, 167, 157, 0.2);
}

[data-theme="forge"] {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-hover: #1e2a4a;
  --accent: #f5a623;
  --accent-hover: #f7b84b;
  --text: #ffffff;
  --text-muted: #a0aec0;
  --border: #2d3748;
  --btn-text: #1a1a2e;
  --shadow: 0 4px 24px rgba(245, 166, 35, 0.2);
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.1;
}

img, svg {
  display: block;
}

/* ============================================================
   UTILITY
   ============================================================ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 3rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  display: block;
  width: 3rem;
  height: 3px;
  background: var(--accent);
  margin-top: 0.5rem;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}

/* ============================================================
   NAV
   ============================================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  transition: background-color 0.2s ease, border-color 0.2s ease, backdrop-filter 0.2s ease;
}

.nav.scrolled {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.nav__monogram {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.nav__themes {
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.theme-btn:hover {
  color: var(--text);
}

.theme-btn.active {
  background: var(--accent);
  color: var(--btn-text);
}

.nav__contact {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav__contact:hover {
  color: var(--accent);
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  overflow: hidden;
}

/* Animated grid background */
.hero__bg {
  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;
  opacity: 0.4;
  animation: gridDrift 20s linear infinite;
  transition: background-image 0.2s ease;
}

@keyframes gridDrift {
  0% { transform: translateY(0); }
  100% { transform: translateY(60px); }
}

/* Radial fade over the grid so it fades to transparent at edges */
.hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 50%, transparent 30%, var(--bg) 100%);
  transition: background 0.2s ease;
}

.hero__content {
  position: relative;
  z-index: 1;
  animation: heroFadeUp 0.8s ease both;
}

@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero__eyebrow {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  transition: color 0.2s ease;
}

.hero__name {
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 60%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: background 0.2s ease;
}

.hero__subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  transition: color 0.2s ease;
}

.hero__tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text);
  opacity: 0.8;
  font-style: italic;
  transition: color 0.2s ease;
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  animation: bounce 2s ease infinite;
  z-index: 1;
  transition: color 0.2s ease;
}

.hero__scroll:hover {
  color: var(--accent);
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
  .hero__bg { animation: none; }
  .hero__content { animation: none; }
  .hero__scroll { animation: none; }
}

/* ============================================================
   ABOUT
   ============================================================ */

.about {
  padding: 6rem 0;
  border-top: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.about__bio {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text);
  opacity: 0.9;
  transition: color 0.2s ease;
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.badge--small {
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .about__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ============================================================
   APPS
   ============================================================ */

.apps {
  padding: 6rem 0;
  border-top: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

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

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

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.app-card__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-card__icon {
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  transition: color 0.2s ease;
}

.app-card__name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  transition: color 0.2s ease;
}

.app-card__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  transition: color 0.2s ease;
}

.app-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: var(--accent);
  color: var(--btn-text);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0.5rem;
  text-align: center;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.app-card__btn {
  align-self: flex-start;
  margin-top: auto;
}

/* ============================================================
   CONTACT
   ============================================================ */

.contact {
  padding: 6rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  transition: border-color 0.2s ease;
}

.contact__sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: -2rem auto 3rem;
  transition: color 0.2s ease;
}

.contact__links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

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

.contact-link svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .nav {
    padding: 0.75rem 1rem;
  }

  .nav__themes {
    gap: 0;
  }

  .theme-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
  }

  .nav__contact {
    font-size: 0.82rem;
  }

  .contact__links {
    flex-direction: column;
    align-items: center;
  }

  .contact-link {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }
}

.btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   FOCUS VISIBLE
   ============================================================ */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
