/* ============================================
   NathGate — a learning lab
   Edit the variables below to tweak the look.
   ============================================ */

:root {
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --accent: #6d28d9;
  --on-accent: #ffffff;
  --done: #15803d;
  --next: #b45309;
  --border: #d2d2d7;
  --nav-bg: rgba(255, 255, 255, 0.72);
  --card-bg: #ffffff;
  --good: #15803d;
  --bad: #c62828;
  /* Chart colors (validated for color-blind safety on these surfaces) */
  --python: #2a78d6;
  --math: #eb6834;
  --heat-1: #86b6ef;
  --heat-2: #3987e5;
  --heat-3: #1c5cab;
  --heat-4: #0d366b;
  --radius: 18px;
  --max-width: 980px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f5f5f7;
    --text-secondary: #98989d;
    --bg: #000000;
    --bg-alt: #161617;
    --accent: #a78bfa;
    --on-accent: #1a1033;
    --done: #4ade80;
    --next: #fbbf24;
    --border: #333336;
    --nav-bg: rgba(22, 22, 23, 0.72);
    --card-bg: #1d1d1f;
    --good: #4ade80;
    --bad: #f87171;
    --python: #3987e5;
    --math: #d95926;
    --heat-1: #184f95;
    --heat-2: #2a78d6;
    --heat-3: #6da7ec;
    --heat-4: #b7d3f6;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Classes like .btn set display, which would otherwise un-hide [hidden] elements. */
[hidden] {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Navigation ---------- */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.nav-name span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

/* ---------- Hero ---------- */

.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 22px 90px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(44px, 8vw, 72px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.07;
}

.hero h1 span {
  color: var(--accent);
}

.hero .tagline {
  margin-top: 18px;
  font-size: clamp(19px, 3vw, 26px);
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.hero .actions {
  margin-top: 34px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 980px;
  font-size: 15px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-secondary {
  color: var(--accent);
  border: 1px solid var(--accent);
}

a.text-link {
  color: var(--accent);
  text-decoration: none;
}

a.text-link:hover {
  text-decoration: underline;
}

/* ---------- Page sections ---------- */

.page-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 90px 22px 30px;
  text-align: center;
}

.page-header h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-header p {
  margin: 14px auto 0;
  font-size: 19px;
  color: var(--text-secondary);
  max-width: 620px;
}

section.band {
  padding: 70px 0;
}

section.band.alt {
  background: var(--bg-alt);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
}

.section-inner h2 {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-inner > p.lede {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: 36px;
}

/* ---------- Stats ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.stat-num {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.progress {
  height: 8px;
  border-radius: 980px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 12px;
}

.progress > div {
  height: 100%;
  width: 0;
  background: var(--done);
  transition: width 0.6s ease;
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 20px;
  margin-top: 32px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.card .eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.card h3 {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card p {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-secondary);
}

.card-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card .card-link {
  font-size: 15px;
  color: var(--accent);
  text-decoration: none;
}

.card .card-link:hover {
  text-decoration: underline;
}

/* ---------- Status badges ---------- */

.badge {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 980px;
  padding: 3px 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  white-space: nowrap;
}

.badge.done {
  color: var(--done);
  background: color-mix(in srgb, var(--done) 14%, transparent);
}

.badge.next {
  color: var(--next);
  background: color-mix(in srgb, var(--next) 14%, transparent);
}

/* ---------- Filters & search ---------- */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

span.filter-pill {
  cursor: default;
  pointer-events: none;
}

.search {
  width: 100%;
  max-width: 420px;
  font: inherit;
  font-size: 15px;
  padding: 9px 16px;
  border-radius: 980px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
}

.search:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.feed-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 20px;
}

.empty {
  color: var(--text-secondary);
  font-size: 15px;
  padding: 20px 0;
}

/* ---------- Simple lists ---------- */

.item-list {
  list-style: none;
  margin-top: 24px;
}

.item-list li {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.item-list li:last-child {
  border-bottom: none;
}

.item-list .item-title {
  font-size: 17px;
  font-weight: 600;
}

.item-list .item-meta {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---------- Notes (journal) ---------- */

.note-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 20px;
  padding: 28px 32px;
  margin-top: 22px;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.note-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.note-body p {
  font-size: 16px;
  margin-bottom: 12px;
}

.note-body p:last-child {
  margin-bottom: 0;
}

.note-related {
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--border);
  padding: 34px 22px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

footer a {
  color: var(--text-secondary);
}

/* ---------- Subject chips ---------- */

.subject-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: baseline;
}

.subject-dot.python { background: var(--python); }
.subject-dot.math { background: var(--math); }

/* ---------- Today: checklist ---------- */

.checklist {
  list-style: none;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  overflow: hidden;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.checklist li:last-child { border-bottom: none; }

.checklist input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: none;
}

.checklist .task { flex: 1; min-width: 0; }
.checklist .task-title { font-weight: 600; }
.checklist .task-meta { font-size: 13px; color: var(--text-secondary); }
.checklist li.logged .task-title::after {
  content: "  ✓ logged";
  font-size: 12px;
  font-weight: 600;
  color: var(--good);
}

.mini-input {
  width: 64px;
  font: inherit;
  font-size: 14px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.cmd-box {
  margin-top: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.cmd-box pre {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-alt);
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

button.btn {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--accent);
}

button.btn-secondary { background: transparent; }
button.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Today: math warm-up ---------- */

.problems {
  list-style: none;
  counter-reset: q;
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 14px;
}

.problem {
  counter-increment: q;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
}

.problem .q::before {
  content: counter(q) ". ";
  font-weight: 700;
  color: var(--accent);
}

.problem .q { font-size: 16px; }
.problem .topic { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }

.problem input {
  margin-top: 10px;
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.problem.right { border-color: var(--good); }
.problem.wrong { border-color: var(--bad); }
.problem .feedback { margin-top: 8px; font-size: 14px; font-weight: 600; }
.problem.right .feedback { color: var(--good); }
.problem.wrong .feedback { color: var(--bad); }

.score-line {
  margin-top: 18px;
  font-size: 18px;
  font-weight: 600;
}

/* ---------- Today: Python challenge ---------- */

.challenge-box {
  margin-top: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.challenge-box .prompt { margin-top: 8px; white-space: pre-wrap; }
.challenge-box code, .note-body code, .card code { font-size: 0.92em; }

.code-editor {
  display: block;
  width: 100%;
  min-height: 200px;
  margin-top: 16px;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.55;
  tab-size: 4;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  resize: vertical;
}

.code-editor:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.test-list { list-style: none; margin-top: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.test-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.test-list li:last-child { border-bottom: none; }
.test-list .pass { color: var(--good); font-weight: 700; }
.test-list .fail { color: var(--bad); font-weight: 700; }

.console {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-alt);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-x: auto;
}

.console.error { color: var(--bad); }

details.hint { margin-top: 14px; font-size: 15px; color: var(--text-secondary); }
details.hint summary { cursor: pointer; color: var(--accent); }

/* ---------- Progress charts ---------- */

.chart-card {
  margin-top: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: relative;
}

.chart-card h3 { font-size: 18px; font-weight: 600; }
.chart-card .chart-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.chart-scroll { overflow-x: auto; margin-top: 16px; }

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}

.heat-0 { fill: var(--bg-alt); stroke: var(--border); }
.heat-1 { fill: var(--heat-1); }
.heat-2 { fill: var(--heat-2); }
.heat-3 { fill: var(--heat-3); }
.heat-4 { fill: var(--heat-4); }
.swatch.heat-0 { background: var(--bg-alt); border: 1px solid var(--border); }
.swatch.heat-1 { background: var(--heat-1); }
.swatch.heat-2 { background: var(--heat-2); }
.swatch.heat-3 { background: var(--heat-3); }
.swatch.heat-4 { background: var(--heat-4); }

svg.chart text { fill: var(--text-secondary); font-size: 11px; font-family: inherit; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; }
svg.chart .today-ring { fill: none; stroke: var(--text); stroke-width: 1.5; }
svg.chart .hit { fill: transparent; cursor: default; }
svg.chart .line { fill: none; stroke: var(--math); stroke-width: 2; }
svg.chart .dot { fill: var(--math); stroke: var(--card-bg); stroke-width: 2; }

.bar-list { list-style: none; margin-top: 16px; }
.bar-list li { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 64px; gap: 12px; align-items: center; padding: 6px 0; font-size: 14px; }
.bar-list .bar-track { height: 10px; }
.bar-list .bar { height: 10px; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-list .bar.python { background: var(--python); }
.bar-list .bar.math { background: var(--math); }
.bar-list .bar-val { text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.45;
  padding: 7px 10px;
  border-radius: 8px;
  max-width: 260px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

details.table-view { margin-top: 14px; font-size: 13px; }
details.table-view summary { cursor: pointer; color: var(--accent); }
details.table-view table { margin-top: 10px; border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
details.table-view th, details.table-view td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); }

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  .nav-links {
    gap: 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-links a {
    white-space: nowrap;
  }
  .hero {
    padding: 80px 22px 60px;
  }
  .page-header {
    padding: 60px 22px 20px;
  }
  .note-card {
    padding: 22px 20px;
  }
}
