/* =============================================================
   Claude Code Course — Design System
   base.css: Tokens, Reset, Typography, Base Styles
   ============================================================= */

/* ---------------------------------------------------------------
   Design Tokens — Dark Theme (default)
--------------------------------------------------------------- */
:root,
html.dark {
  /* Backgrounds */
  --bg-primary:   #0d1117;
  --bg-secondary: #161b22;
  --bg-card:      #1c2128;

  /* Text */
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #6e7681;

  /* Accent */
  --accent:       #f78166;
  --accent-hover: #ff9580;

  /* UI chrome */
  --border:   #30363d;
  --code-bg:  #161b22;

  /* Semantic */
  --success: #3fb950;
  --warning: #d29922;
  --info:    #58a6ff;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);

  /* Sidebar */
  --sidebar-width: 260px;

  /* Transition */
  --transition: 150ms ease;
  --transition-med: 250ms ease;

  /* Border radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Z-indices */
  --z-sidebar:   100;
  --z-overlay:   200;
  --z-modal:     300;
  --z-tooltip:   400;
}

/* ---------------------------------------------------------------
   Light Theme Override
--------------------------------------------------------------- */
html.light {
  --bg-primary:   #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-card:      #ffffff;

  --text-primary:   #1f2328;
  --text-secondary: #656d76;
  --text-muted:     #9198a1;

  --accent:       #e25c1a;
  --accent-hover: #c94e2a;

  --border:  #d0d7de;
  --code-bg: #f6f8fa;

  --success: #1a7f37;
  --warning: #9a6700;
  --info:    #0969da;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
}

/* ---------------------------------------------------------------
   Terminal Theme (Claude Code CRT)
--------------------------------------------------------------- */
html.terminal {
  --bg-primary:   #1a1a2e;
  --bg-secondary: #1e1e32;
  --bg-card:      #24243a;

  --text-primary:   #e0ddd5;
  --text-secondary: #9a9690;
  --text-muted:     #5a5750;

  --accent:       #e8937a;
  --accent-hover: #f0a58e;

  --border:  #33334d;
  --code-bg: #1e1e32;

  --success: #7ec9a0;
  --warning: #dac87e;
  --info:    #7eb8da;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);

  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
}

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

/* ---------------------------------------------------------------
   Root Element
--------------------------------------------------------------- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family:
    "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  transition:
    background-color var(--transition-med),
    color var(--transition-med);
}

/* ---------------------------------------------------------------
   Typography Scale
--------------------------------------------------------------- */
/* Sizes */
/* xs:  0.75rem / 12px */
/* sm:  0.875rem / 14px */
/* base: 1rem / 16px */
/* lg:  1.125rem / 18px */
/* xl:  1.25rem / 20px */
/* 2xl: 1.5rem / 24px */
/* 3xl: 1.875rem / 30px */
/* 4xl: 2.25rem / 36px */
/* 5xl: 3rem / 48px */

/* Monospace stack */
code,
kbd,
samp,
pre {
  font-family:
    "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono",
    "Consolas", "Liberation Mono", "Menlo", monospace;
  font-size: 0.875em;
}

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

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------
   Images & Media
--------------------------------------------------------------- */
img,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---------------------------------------------------------------
   Lists (reset — component/module CSS sets visual styles)
--------------------------------------------------------------- */
ul,
ol {
  list-style: none;
}

/* ---------------------------------------------------------------
   Text Selection
--------------------------------------------------------------- */
::selection {
  background-color: var(--accent);
  color: #ffffff;
}

::-moz-selection {
  background-color: var(--accent);
  color: #ffffff;
}

/* ---------------------------------------------------------------
   Scrollbar — WebKit
--------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-secondary);
  transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::-webkit-scrollbar-corner {
  background: var(--bg-secondary);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-secondary);
}

/* ---------------------------------------------------------------
   Focus Visible (global)
--------------------------------------------------------------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------
   HR
--------------------------------------------------------------- */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

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

/* ---------------------------------------------------------------
   Utility: no-transition (suppress during theme switch)
--------------------------------------------------------------- */
.no-transition,
.no-transition * {
  transition: none !important;
}

/* ---------------------------------------------------------------
   Password Gate
--------------------------------------------------------------- */
html.cc-locked > body > *:not(.cc-gate) {
  display: none !important;
}

.cc-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.cc-gate-box {
  text-align: center;
  max-width: 320px;
  width: 100%;
  padding: 2rem;
}

.cc-gate-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cc-gate-logo img {
  border-radius: 8px;
  flex-shrink: 0;
}

.cc-gate-logo-text {
  text-align: left;
  line-height: 1.2;
}

.cc-gate-logo small {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cc-gate-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition);
}

.cc-gate-input:focus {
  border-color: var(--accent);
}

.cc-gate-btn {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.cc-gate-btn:hover { background: var(--accent-hover); }
.cc-gate-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.cc-gate-error {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #f85149;
  min-height: 1.25rem;
}
