/* ============================================================
   MiaoMi — global.css
   Design system | Reset | Typography
   Version 1.0
   ============================================================ */

/* ── Google Fonts ───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Sora:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables (Design System) ─────────────────────────── */
:root {
  /* Background layers */
  --bg-void:       #0A0A0A;
  --bg-surface-1:  #111111;
  --bg-surface-2:  #1C1C1C;
  --bg-surface-3:  #252525;

  /* Brand colors */
  --orange-fire:   #FF5500;
  --orange-dim:    #CC3D00;
  --orange-glow:   rgba(255, 85, 0, 0.12);

  /* Text */
  --text-primary:   #F0EEE8;
  --text-secondary: #9E9896;
  --text-muted:     #6B6560;
  --text-titanium:  #C0B9B0;

  /* Borders */
  --border-hairline: #1E1E1E;
  --border-subtle:   #2A2A2A;
  --border-active:   #FF5500;

  /* Semantic status */
  --status-stable:   #4CAF50;
  --status-beta:     #FF9800;
  --status-alpha:    #F44336;
  --status-official: #2196F3;

  /* Spacing scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* Border radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 280ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-card:   0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-modal:  0 25px 60px rgba(0, 0, 0, 0.8);
  --shadow-orange: 0 4px 20px rgba(255, 85, 0, 0.2);

  /* Z-index layers */
  --z-base:    0;
  --z-raised:  10;
  --z-overlay: 100;
  --z-navbar:  200;
  --z-modal:   300;
  --z-toast:   400;
  --z-loader:  999;

  /* Layout */
  --max-width: 1200px;
  --navbar-height: 64px;

  /* Fonts */
  --font-ui:   'Sora', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

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

body {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-void);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Remove list styles */
ul, ol { list-style: none; }

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

a:hover { color: var(--orange-fire); }

/* Images */
img, svg {
  display: block;
  max-width: 100%;
}

img { loading: lazy; }

/* Buttons */
button {
  font-family: var(--font-ui);
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* Inputs */
input, textarea, select {
  font-family: var(--font-ui);
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

/* Tables */
table { border-collapse: collapse; width: 100%; }

/* HR */
hr {
  border: none;
  border-top: 1px solid var(--border-hairline);
}

/* ── Typography Scale ───────────────────────────────────────── */
.text-display {
  font-family: var(--font-ui);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.text-h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.text-h2 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.text-h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.3;
}

.text-h4 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
}

.text-body-lg {
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.7;
}

.text-body {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
}

.text-body-sm {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
}

.text-caption {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.text-label {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-mono {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Text colors */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-titanium  { color: var(--text-titanium); }
.text-orange    { color: var(--orange-fire); }

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

@media (max-width: 768px) {
  .container { padding: 0 var(--space-md); }
}

.section {
  padding: var(--space-2xl) 0;
}

@media (max-width: 768px) {
  .section { padding: var(--space-xl) 0; }
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

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

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Flex helpers */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }

/* Spacing */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ── Visibility ─────────────────────────────────────────────── */
.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;
}

.hide-mobile { display: block; }
.hide-desktop { display: none; }

@media (max-width: 768px) {
  .hide-mobile  { display: none; }
  .hide-desktop { display: block; }
}

/* ── Status Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-stable   { background: rgba(76, 175, 80, 0.15);  color: var(--status-stable); }
.badge-beta     { background: rgba(255, 152, 0, 0.15);  color: var(--status-beta); }
.badge-alpha    { background: rgba(244, 67, 54, 0.15);  color: var(--status-alpha); }
.badge-official { background: rgba(33, 150, 243, 0.15); color: var(--status-official); }
.badge-orange   { background: var(--orange-glow);       color: var(--orange-fire); }

/* ── Focus States ───────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--orange-fire);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── Scrollbar ──────────────────────────────────────────────── */
/* Firefox scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-surface-3) transparent;
}

/* Chrome/Safari/Edge scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-void); }
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-3);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-subtle); }

/* ── Selection ──────────────────────────────────────────────── */
::selection {
  background: rgba(255, 85, 0, 0.25);
  color: var(--text-primary);
}

/* ── Page wrapper (padding for fixed navbar) ────────────────── */
.page-wrapper {
  padding-top: var(--navbar-height);
  min-height: 100vh;
}

/* ── Divider with label ─────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-hairline);
}

/* ── Section header ─────────────────────────────────────────── */
.section-header {
  margin-bottom: var(--space-xl);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--orange-fire);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.section-label::before {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--orange-fire);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.section-subtitle {
  margin-top: var(--space-sm);
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 560px;
}
