/**
 * Base styles: Reset, typography, CSS custom properties
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */

:root {
  /* Typography Scale (using a 1.25 ratio) */
  --font-size-xs: 0.64rem;
  --font-size-sm: 0.8rem;
  --font-size-base: 1rem;
  --font-size-md: 1.25rem;
  --font-size-lg: 1.563rem;
  --font-size-xl: 1.953rem;
  --font-size-2xl: 2.441rem;
  --font-size-3xl: 3.052rem;
  
  /* Font Families */
  --font-body: 'Source Serif 4', 'Georgia', serif;
  --font-heading: 'Fraunces', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-ui: 'DM Sans', system-ui, sans-serif;
  
  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-base: 1.6;
  --line-height-relaxed: 1.8;
  
  /* Spacing Scale */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  
  /* Layout */
  --content-width: 65ch;
  --content-width-wide: 85ch;
  --page-padding: var(--space-md);
  
  /* Z-index scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

@media (min-width: 768px) {
  :root {
    --page-padding: var(--space-lg);
  }
}

/* ============================================
   CSS Reset (Modern, Minimal)
   ============================================ */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
}

body {
  min-height: 100vh;
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* ============================================
   Base Typography
   ============================================ */

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--color-text-heading);
}

h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

h2 {
  font-size: var(--font-size-xl);
}

h3 {
  font-size: var(--font-size-lg);
}

h4 {
  font-size: var(--font-size-md);
}

p {
  margin-block: var(--space-sm);
}

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-link-hover);
}

strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  background: var(--color-code-bg);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

blockquote {
  border-left: 3px solid var(--color-border-accent);
  padding-left: var(--space-md);
  margin-left: 0;
  font-style: italic;
  color: var(--color-text-muted);
}

/* ============================================
   Utility Classes
   ============================================ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.content-width {
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--page-padding);
}

/* ============================================
   Loading & No-JS States
   ============================================ */

.no-js-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-lg);
  text-align: center;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: var(--space-md);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Hide loading state once app is mounted */
#app:has(.app-shell) .loading-state {
  display: none;
}



