/* ============================================================
   Data Analyst Interview Prep — base styles & theme
   Dark mode is the default. Colors MUST use CSS variables.
   ============================================================ */

:root {
  /* ---- Dark theme (default) ---- */
  --bg: #0f1117;
  --bg-elevated: #151824;
  --surface: #1a1e2b;
  --surface-2: #202636;
  --text: #e8eaf0;
  --text-light: #a0a6b5;
  --text-muted: #6b7280;
  --border: #2a3040;
  --border-strong: #3a4258;
  --primary: #4f8cff;
  --primary-light: #7aa8ff;
  --primary-dark: #2f5ecf;
  --accent: #2dd4a7;
  --accent-light: #5fe6bf;
  --accent-dark: #16a37f;
  --warning: #f5a623;
  --danger: #ef5350;
  --info: #38bdf8;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 64px;
  --grad-hero: linear-gradient(135deg, #1a1a3e 0%, #2c1f52 55%, #14304d 100%);
  --code-bg: #11141c;
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --text: #1b2230;
  --text-light: #4b5563;
  --text-muted: #8a93a5;
  --border: #e2e6ef;
  --border-strong: #c8cfdd;
  --primary: #2f5ecf;
  --primary-light: #4f8cff;
  --primary-dark: #2247a3;
  --accent: #0ea37f;
  --accent-light: #16c79a;
  --accent-dark: #0b7d62;
  --warning: #c47a0a;
  --danger: #d64541;
  --info: #0ea5e9;
  --shadow: 0 8px 24px rgba(30, 40, 70, 0.12);
  --code-bg: #0f1117;
}

/* ---- Reset & base ---- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

h1, h2, h3, h4, h5 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5em;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em 1.4em; }
li { margin-bottom: 0.35em; }
img { max-width: 100%; height: auto; display: block; }
code, pre, kbd { font-family: "SFMono-Regular", "Fira Code", Consolas, "Liberation Mono", Menlo, monospace; }

::selection {
  background: var(--primary);
  color: #fff;
}

/* ---- Layout container ---- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

main.page {
  min-height: calc(100vh - var(--header-h) - 200px);
  padding: 40px 0 64px;
}

/* ---- Site header (injected) ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  white-space: nowrap;
}

.brand-icon { font-size: 1.4rem; }

.brand-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  color: var(--text-light);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.site-nav a.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.15s ease, transform 0.1s ease;
}

.theme-toggle:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}

/* ---- Site footer (injected) ---- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 40px 0 32px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
}

.footer-brand .brand-text {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
}

.footer-tagline {
  margin-top: 8px;
  color: var(--text-light);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links h4,
.footer-meta h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--text-light);
  font-size: 0.92rem;
}

.footer-meta p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

/* ---- Hero ---- */
.hero {
  background: var(--grad-hero);
  color: #fff;
  padding: 72px 0 64px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero .container { max-width: 820px; }

.hero h1 {
  color: #fff;
  font-size: 2.6rem;
  margin-bottom: 16px;
}

.hero p.lead {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.18rem;
  margin-bottom: 28px;
}

.hero .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.hero .badge {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 140, 255, 0.35);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-accent {
  background: var(--accent);
  color: #06281e;
  box-shadow: 0 6px 18px rgba(45, 212, 167, 0.3);
}
.btn-accent:hover { background: var(--accent-dark); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--surface); }

/* ---- Cards / grids ---- */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.card h3 { font-size: 1.15rem; }
.card p { color: var(--text-light); font-size: 0.95rem; margin-bottom: 0; }

.card .icon { font-size: 1.8rem; margin-bottom: 10px; }
.card .tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-light);
  margin-bottom: 10px;
}

/* ---- Section titles ---- */
.section-title {
  text-align: center;
  margin: 0 0 12px;
}

.section-sub {
  text-align: center;
  color: var(--text-light);
  max-width: 640px;
  margin: 0 auto 40px;
}

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 0.94rem;
}

th, td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

tr:hover td { background: var(--surface); }

/* ---- Utility ---- */
.text-light { color: var(--text-light); }
.text-accent { color: var(--accent-light); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  .hero h1 { font-size: 2rem; }
  .site-nav a { padding: 8px 10px; font-size: 0.88rem; }
  .brand-text .brand-sub { display: none; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
}
