/* ═══════════════════════════════════════════════════════
   QUANTA — Base Styles: Reset + Typography + Layout
   ═══════════════════════════════════════════════════════ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--ff-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Selection ── */
::selection { background: var(--accent-dim); color: var(--text-1); }

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

p { color: var(--text-2); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
code, kbd, samp, pre { font-family: var(--ff-mono); }

/* ── View System ── */
#app {
  min-height: 100dvh;
  position: relative;
}

.view {
  min-height: 100dvh;
  animation: viewEnter var(--dur-slow) var(--ease-out) both;
}

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

/* ── Splash Screen ── */
.splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  background: var(--bg);
  z-index: 999;
}

.splash-logo {
  font-family: var(--ff-display);
  font-size: var(--text-4xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-1);
}
.splash-logo span { color: var(--accent); }

.splash-ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-hi);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

/* ── Layout Utilities ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.container-sm {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.container-md {
  max-width: 840px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* ── Global Nav ── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0,0,0,0);
  border-bottom: 1px solid transparent;
  transition:
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.topnav.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-color: var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topnav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.nav-brand {
  font-family: var(--ff-display);
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-1);
  cursor: pointer;
}
.nav-brand span { color: var(--accent); }

.nav-spacer { flex: 1; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes ringDraw {
  from { stroke-dashoffset: 440; }
}

/* ── Staggered children ── */
.stagger > * { animation: fadeUp var(--dur-slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(n+7) { animation-delay: 360ms; }

/* ── Visibility utilities ── */
.is-hidden { display: none !important; }
.is-visible { display: flex !important; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .container, .container-sm, .container-md { padding: 0 var(--sp-4); }
  .topnav-inner { padding: var(--sp-3) var(--sp-4); }
}