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

/* ── Theme Tokens ─────────────────────────────────── */
:root {
  --bg: #0a0a0a;
  --fg: #e8e8e8;
  --accent: #4FC3F7;
  --glow: rgba(79, 195, 247, 0.6);
  --dim: #666;
  --card-bg: #111;
  --card-border: #1a1a1a;
  --footer-border: #222;
  --badge-border: #333;
  --radius: 6px;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
}

[data-theme="light"] {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --accent: #0288D1;
  --glow: rgba(2, 136, 209, 0.4);
  --dim: #777;
  --card-bg: #fff;
  --card-border: #e0e0e0;
  --footer-border: #d0d0d0;
  --badge-border: #ccc;
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── Splash ──────────────────────────────────────── */
.splash {
  position: fixed; inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.4s ease;
}

.splash-logo {
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 300;
  letter-spacing: 0.15em;
  color: var(--fg);
  opacity: 0;
  animation: ignite 2.4s ease-out 0.4s forwards;
  will-change: transform, opacity;
}

/* Step 1: fade out + slide down slightly in center (0.3s) */
.splash-logo.disappear {
  animation: disappearRight 0.3s ease-in forwards;
}

@keyframes ignite {
  0%   { opacity: 0; text-shadow: 0 0 0 transparent; }
  40%  { opacity: 1; text-shadow: 0 0 4px var(--glow), 0 0 10px var(--glow); }
  70%  { text-shadow: 0 0 6px var(--glow), 0 0 16px var(--glow), 0 0 30px var(--glow); }
  100% { opacity: 1; text-shadow: 0 0 3px var(--glow), 0 0 8px var(--glow); }
}

@keyframes disappearRight {
  0%   { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(80px); }
}

.splash.fade-bg {
  background: transparent;
  transition: background 0.4s ease;
}

/* ── Header ──────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1.25rem 2rem;
  opacity: 0;
  transition: opacity 0.5s ease-out;
}
.header.visible { opacity: 1; }

.header-logo {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--fg);
  text-decoration: none;
  text-shadow: 0 2px 4px var(--glow);
}

/* ── Main ────────────────────────────────────────── */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.main.visible { opacity: 1; }

/* ── Section spacing (consistent margins) ────────── */
.main > section {
  margin-bottom: 6rem;
}
.main > section:last-child {
  margin-bottom: 8rem; /* extra space above fixed footer */
}

/* ── Hero ────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 2rem 0;
}

.hero h1 {
  font-family: var(--sans);
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.hero-sub {
  margin-top: 1.2rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  color: var(--dim);
  text-transform: uppercase;
}

/* ── Services ────────────────────────────────────── */
.services { padding: 0; }

.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

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

.service-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.service-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(79,195,247,0.08);
}

.service-icon {
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

.service-card h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.service-card p {
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 1.5;
}

/* ── Projects ────────────────────────────────────── */
.projects {
  padding: 0 0 4rem;
}

.projects-layout {
  display: flex;
  gap: 2rem;
}

.projects-nav {
  display: flex; flex-direction: column;
  gap: 0.5rem;
  position: sticky; top: 5rem;
  align-self: flex-start;
  min-width: 140px;
}

.project-tab {
  background: none; border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--dim);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s, border-color 0.2s;
}
.project-tab:hover { color: var(--fg); }
.project-tab.active {
  color: var(--accent);
  border-color: var(--accent);
}

.projects-detail { flex: 1; }

.project-card {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: background 0.3s ease;
}
.project-card.visible { display: block; }

.project-card h3 {
  font-family: var(--mono);
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
}

.project-card p {
  color: var(--dim);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.tech-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--badge-border);
  border-radius: 3px;
  color: var(--dim);
  transition: border-color 0.3s;
}

.status-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  margin-bottom: 1rem;
}
.status-badge.dev  { background: rgba(79,195,247,0.12); color: var(--accent); }
.status-badge.beta { background: rgba(156,204,101,0.12); color: #9CCC65; }
.status-badge.live { background: rgba(129,199,132,0.12); color: #81C784; }

.appstore-btn {
  display: inline-block;
  margin-top: 0.5rem;
  margin-left: 0.3rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
.appstore-btn:hover { opacity: 0.7; }

/* ── Footer ──────────────────────────────────────── */
.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 100;
  display: flex; justify-content: center; gap: 2rem;
  padding: 1.2rem 2rem;
  background: linear-gradient(transparent, var(--bg) 40%);
  transition: background 0.3s ease;
}

.footer-btn {
  background: none; border: 1px solid var(--footer-border);
  border-radius: var(--radius);
  padding: 0.5rem 1.2rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--dim);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.footer-btn:hover { color: var(--fg); border-color: var(--accent); }

/* ── Theme toggle ────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--footer-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--accent); }

/* ── Mobile ──────────────────────────────────────── */
@media (max-width: 768px) {
  .projects-layout { flex-direction: column; }

  .projects-nav {
    flex-direction: row;
    position: sticky; top: 0;
    background: var(--bg);
    padding: 0.5rem 0;
    min-width: unset;
    overflow-x: auto;
    z-index: 10;
  }

  .project-tab { white-space: nowrap; }
  .footer { gap: 0.8rem; padding: 1rem; }
  .footer-btn { padding: 0.4rem 0.8rem; font-size: 0.75rem; }
  .theme-toggle { padding: 0.4rem 0.5rem; font-size: 0.75rem; }
}

/* ── Utilities ───────────────────────────────────── */
::selection { background: var(--accent); color: var(--bg); }
