* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   Design Tokens & Color Modes (Light default, Dark override)
   Modeled after sister repo realworldbas01
   ========================================================================== */

:root {
  color-scheme: light;
  --bg-page: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #eaf0f7;
  --bg-surface-elevated: #f1f5f9;
  --topbar-bg: rgba(244, 247, 251, 0.94);
  --text-primary: #142238;
  --text-secondary: #52647a;
  --text-tertiary: #71849a;
  --border-subtle: #d9e2ec;
  --border-medium: #b9c9da;
  --border-dashed: #cbd5e1;
  --brand-teal: #0d9488;
  --brand-teal-hover: #0f766e;
  --brand-teal-soft: #e6f7f5;
  --brand-teal-soft-border: #99f6e4;
  --brand-teal-ink: #ffffff;
  --brand-teal-text: #0f766e;
  --shadow-card: 0 10px 30px rgba(15, 35, 58, 0.08);
  --shadow-floating: 0 12px 40px rgba(15, 35, 58, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg-page: #07111c;
    --bg-surface: #0c1926;
    --bg-surface-secondary: #102131;
    --bg-surface-elevated: #08141f;
    --topbar-bg: rgba(7, 17, 28, 0.95);
    --text-primary: #f4f7fa;
    --text-secondary: #8da4be;
    --text-tertiary: #70889a;
    --border-subtle: #1d3549;
    --border-medium: #2a4257;
    --border-dashed: #294258;
    --brand-teal: #32c4ba;
    --brand-teal-hover: #45d0c4;
    --brand-teal-soft: #12352f;
    --brand-teal-soft-border: #24544f;
    --brand-teal-ink: #07111c;
    --brand-teal-text: #32c4ba;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-floating: 0 12px 40px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg-page: #07111c;
  --bg-surface: #0c1926;
  --bg-surface-secondary: #102131;
  --bg-surface-elevated: #08141f;
  --topbar-bg: rgba(7, 17, 28, 0.95);
  --text-primary: #f4f7fa;
  --text-secondary: #8da4be;
  --text-tertiary: #70889a;
  --border-subtle: #1d3549;
  --border-medium: #2a4257;
  --border-dashed: #294258;
  --brand-teal: #32c4ba;
  --brand-teal-hover: #45d0c4;
  --brand-teal-soft: #12352f;
  --brand-teal-soft-border: #24544f;
  --brand-teal-ink: #07111c;
  --brand-teal-text: #32c4ba;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-floating: 0 12px 40px rgba(0, 0, 0, 0.55);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg-page: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #eaf0f7;
  --bg-surface-elevated: #f1f5f9;
  --topbar-bg: rgba(244, 247, 251, 0.94);
  --text-primary: #142238;
  --text-secondary: #52647a;
  --text-tertiary: #71849a;
  --border-subtle: #d9e2ec;
  --border-medium: #b9c9da;
  --border-dashed: #cbd5e1;
  --brand-teal: #0d9488;
  --brand-teal-hover: #0f766e;
  --brand-teal-soft: #e6f7f5;
  --brand-teal-soft-border: #99f6e4;
  --brand-teal-ink: #ffffff;
  --brand-teal-text: #0f766e;
  --shadow-card: 0 10px 30px rgba(15, 35, 58, 0.08);
  --shadow-floating: 0 12px 40px rgba(15, 35, 58, 0.14);
}

html {
  background: var(--bg-page);
  color: var(--text-primary);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   Theme Toggle Component Styles (realworldbas01 design language)
   ========================================================================== */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 3px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  color: inherit;
  transition: opacity 0.15s ease;
}

.theme-toggle:hover {
  opacity: 0.9;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--brand-teal);
  outline-offset: 2px;
}

.theme-toggle-track {
  position: relative;
  width: 52px;
  height: 26px;
  padding: 0 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-surface-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.theme-toggle-thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

:root[data-theme='dark'] .theme-toggle-thumb {
  transform: translateX(26px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle-thumb {
    transform: translateX(26px);
  }
}

.theme-toggle-icon {
  position: relative;
  z-index: 1;
  line-height: 1;
  font-size: 12px;
}

@media (max-width: 600px) {
  .theme-toggle-track {
    width: 48px;
    height: 24px;
    padding: 0 6px;
  }

  .theme-toggle-thumb {
    width: 16px;
    height: 16px;
    top: 3px;
    left: 3px;
  }

  :root[data-theme='dark'] .theme-toggle-thumb {
    transform: translateX(24px);
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .theme-toggle-thumb {
      transform: translateX(24px);
    }
  }
}

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