/*  ═══════════════════════════════════════════════════════════════
    Base Styles — Reset, body, and global layout
    ═══════════════════════════════════════════════════════════════ */

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

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

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background:
    radial-gradient(1200px 700px at 10% -15%, var(--color-bg-orb-2), transparent 55%),
    radial-gradient(1200px 700px at 100% -20%, var(--color-bg-orb-1), transparent 55%),
    var(--color-bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--color-accent-glow);
  color: var(--color-text-primary);
}

/* ── Links ────────────────────────────────────────────────────── */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-2);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Images ───────────────────────────────────────────────────── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Buttons (base) ───────────────────────────────────────────── */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
}

/* ── Page wrapper ─────────────────────────────────────────────── */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding-top: var(--navbar-height);
}

/* ── Container ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.surface-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(255, 255, 255, 0) 100%
  ), var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

/* ── Utilities ────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Animated background gradient ─────────────────────────────── */
.bg-gradient-animated {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.bg-gradient-animated::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, var(--color-bg-orb-1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, var(--color-bg-orb-2) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, var(--color-bg-orb-3) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(2%, -3%) rotate(1deg); }
  50%      { transform: translate(-1%, 2%) rotate(-0.5deg); }
  75%      { transform: translate(3%, 1%) rotate(0.5deg); }
}

/* ── Fade-in animation ────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.6s ease-out forwards;
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Live Theme Switcher ──────────────────────────────────────── */
.theme-switcher {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 1200;
}

.theme-switcher__toggle {
  border: 1px solid var(--color-border);
  background: var(--color-panel-bg);
  color: var(--color-text-primary);
  border-radius: var(--radius-full);
  padding: 10px var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--shadow-md);
}

.theme-switcher__panel {
  margin-top: var(--space-2);
  width: 220px;
  border: 1px solid var(--color-border);
  background: var(--color-panel-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
}

.theme-switcher__label {
  display: block;
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  margin-bottom: var(--space-2);
}

.theme-switcher__select {
  width: 100%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}

.theme-switcher__swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.theme-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.theme-swatch--asiimov { background: linear-gradient(135deg, #ff7a1a, #1f2631); }
.theme-swatch--midnight { background: linear-gradient(135deg, #5d86ff, #111b2e); }
.theme-swatch--graphite { background: linear-gradient(135deg, #22c55e, #1d232b); }
.theme-swatch--cyber { background: linear-gradient(135deg, #8b5cf6, #141b3c); }
.theme-swatch--forest { background: linear-gradient(135deg, #22c55e, #1a2b20); }
.theme-swatch--sunset { background: linear-gradient(135deg, #fb923c, #321d21); }
