/**
 * Shared Course Notes Stylesheet
 * Use this for all course note HTML files for consistent, muted styling.
 * Aligns with portfolio aesthetic: calm, readable, minimal color.
 */

/* Two-font system: Geist (sans) + Geist Mono (mono) - matches portfolio */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-Variable.woff2")
    format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-mono/GeistMono-Variable.woff2")
    format("woff2");
}

/* Design tokens - pure black, no smoky/hazy tint */
:root {
  --cn-bg: #000000;
  --cn-surface: #0a0a0a;
  --cn-surface2: #141414;
  --cn-border: #1f1f1f;
  --cn-accent: #c4b5a0;
  --cn-accent-subtle: #9ab0c4;
  --cn-text: #fafafa;
  --cn-text-muted: #a1a1a1;
  --cn-text-dim: #737373;
  --cn-destructive: #a65c5c;
  --cn-success: #6b8f6b;
  --cn-warning: #9a8f6a;
  /* Aliases for HTML files using old variable names */
  --bg: var(--cn-bg);
  --surface: var(--cn-surface);
  --surface2: var(--cn-surface2);
  --border: var(--cn-border);
  --accent: var(--cn-accent);
  --accent2: var(--cn-accent-subtle);
  --accent3: var(--cn-accent-subtle);
  --accent4: var(--cn-success);
  --text: var(--cn-text);
  --text-muted: var(--cn-text-muted);
  --text-dim: var(--cn-text-dim);
  --red: var(--cn-destructive);
  --yellow: var(--cn-warning);
  --purple: var(--cn-accent-subtle);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  background: var(--cn-bg);
  color: var(--cn-text);
  font-family:
    "Geist",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}

/* Simple lesson header - no decorative background */
.hero {
  padding: 24px 80px 28px;
  border-bottom: 1px solid var(--cn-border);
}
.hero-grid,
.hero-glow {
  display: none;
}
.lesson-tag {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  color: #b8b8b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.lesson-tag::before {
  content: none;
}
.hero h1 {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--cn-text);
}
.hero h1 em {
  color: var(--cn-accent);
  font-style: italic;
  font-weight: 500;
}
.hero-meta {
  margin-top: 12px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--cn-text-muted);
  letter-spacing: 0.04em;
}
.hero-meta strong {
  color: var(--cn-text);
}

.toc-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cn-bg);
  border-bottom: 1px solid var(--cn-border);
  padding: 0 80px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.toc-bar::-webkit-scrollbar {
  display: none;
}
.toc-link {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b8b8b8;
  text-decoration: none;
  padding: 14px 18px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}
.toc-link:hover {
  color: #c4b5a0;
  border-bottom-color: #c4b5a0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 80px;
}
section {
  padding: 72px 0;
  border-bottom: 1px solid var(--cn-border);
}
section:last-child {
  border-bottom: none;
}

/* Scroll-triggered section reveal (KBAI-style) */
section[id] {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}
section[id].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 44px;
}
.section-num {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  color: #c4b5a0;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.section-title {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
}

/* Section subsections (h3) - Geist, same as titles */
.container h3,
section h3 {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.3;
}
.container h3:not(:first-child),
section h3:not(:first-child) {
  margin-top: 1.75rem;
}

/* Cards - unified muted style, subtle accent variants */
.card {
  background: var(--cn-surface);
  border: 1px solid var(--cn-border);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.2s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  border-color: rgba(154, 139, 122, 0.35);
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cn-accent), transparent);
}
.card.c2::before,
.card.c3::before,
.card.c4::before {
  background: linear-gradient(90deg, var(--cn-accent-subtle), transparent);
}
.card.cr::before {
  background: linear-gradient(90deg, var(--cn-destructive), transparent);
}
.card.cp::before,
.card.cy::before {
  background: linear-gradient(90deg, var(--cn-accent), transparent);
}
.card-lbl {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c4b5a0;
  margin-bottom: 10px;
}
.card-lbl a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(154, 139, 122, 0.35);
  transition:
    border-color 0.2s,
    color 0.2s;
}
.card-lbl a:hover {
  border-bottom-color: var(--cn-accent);
  color: var(--cn-text);
}
.card.c2 .card-lbl,
.card.c3 .card-lbl,
.card.c4 .card-lbl {
  color: #9ab0c4;
}
.card.cr .card-lbl {
  color: #cc8888;
}
.card.cp .card-lbl,
.card.cy .card-lbl {
  color: #c4b5a0;
}
.card h3 {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 10px;
}
.card p,
.card li {
  color: var(--cn-text-muted);
  font-size: 14px;
  line-height: 1.65;
}

.g2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.g3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
.g4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.tax-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.tax-table th {
  background: var(--cn-surface2);
  padding: 10px 14px;
  text-align: left;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b8b8b8;
  border: 1px solid var(--cn-border);
}
.tax-table td {
  padding: 11px 14px;
  border: 1px solid var(--cn-border);
  vertical-align: top;
  color: var(--cn-text-muted);
}
.tax-table tr:hover td {
  background: var(--cn-surface);
}

/* Tags - all use same muted style */
.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  font-weight: 600;
  background: rgba(154, 139, 122, 0.12);
  color: #c4b5a0;
}
.to,
.tc,
.tp,
.tg,
.tr,
.ty,
.tv {
  background: rgba(154, 139, 122, 0.12);
  color: var(--cn-accent);
}

.kc {
  background: var(--cn-surface);
  border: 1px solid var(--cn-border);
  border-left: 3px solid var(--cn-accent);
  border-radius: 0 12px 12px 0;
  padding: 22px 26px;
  margin: 20px 0;
  position: relative;
}
.kc::before {
  content: "!";
  position: absolute;
  top: 16px;
  right: 22px;
  font-family: "Geist", system-ui, sans-serif;
  font-size: 44px;
  color: rgba(154, 139, 122, 0.08);
  line-height: 1;
}
.kc-lbl {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #c4b5a0;
  margin-bottom: 6px;
}
.kc p {
  color: var(--cn-text-muted);
  font-size: 14px;
}

/* Viz boxes - diagrams and figures */
.viz-box {
  background: var(--cn-surface);
  border: 1px solid var(--cn-border);
  border-radius: 14px;
  padding: 28px;
  margin: 24px 0;
  overflow: hidden;
}
.viz-title {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b8b8b8;
  margin-bottom: 16px;
  text-align: center;
}

/* Alerts - toned down */
.alert {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 22px;
  border-radius: 10px;
  margin: 16px 0;
}
.alert.danger {
  background: rgba(166, 92, 92, 0.08);
  border: 1px solid rgba(166, 92, 92, 0.2);
}
.alert.info {
  background: rgba(122, 139, 154, 0.08);
  border: 1px solid rgba(122, 139, 154, 0.2);
}
.alert.success {
  background: rgba(107, 143, 107, 0.08);
  border: 1px solid rgba(107, 143, 107, 0.2);
}
.alert.warning {
  background: rgba(154, 143, 106, 0.08);
  border: 1px solid rgba(154, 143, 106, 0.2);
}
.alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}
.alert-title {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
  color: #e8e8e8;
}
.alert p {
  color: var(--cn-text-muted);
  font-size: 13px;
}

.code-blk {
  background: var(--cn-surface2);
  border: 1px solid var(--cn-border);
  border-radius: 8px;
  padding: 18px 22px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.8;
  color: var(--cn-text-muted);
  overflow-x: auto;
  margin: 14px 0;
}
.kw {
  color: var(--cn-accent-subtle);
}
.str {
  color: var(--cn-success);
}
.cvar {
  color: var(--cn-accent);
}
.cm {
  color: var(--cn-text-dim);
  font-style: italic;
}
.num {
  color: var(--cn-accent);
}

.pkt {
  display: flex;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--cn-border);
  font-family: "Geist Mono", ui-monospace, monospace;
  margin: 12px 0;
}
.pf {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--cn-border);
  padding: 0 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.pf:last-child {
  border-right: none;
}
.pfb {
  background: var(--cn-surface2);
  color: var(--cn-text-muted);
}
.pfa,
.pfh {
  background: rgba(154, 139, 122, 0.12);
  color: var(--cn-accent);
}
.pfc {
  background: rgba(122, 139, 154, 0.12);
  color: var(--cn-accent-subtle);
}
.pfr {
  background: rgba(166, 92, 92, 0.12);
  color: var(--cn-destructive);
}
.pfy {
  background: rgba(154, 143, 106, 0.12);
  color: var(--cn-warning);
}
.pfg {
  background: rgba(107, 143, 107, 0.12);
  color: var(--cn-success);
}

.stats-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.sc {
  background: var(--cn-surface2);
  border: 1px solid var(--cn-border);
  border-radius: 8px;
  padding: 12px 18px;
  text-align: center;
  min-width: 130px;
}
.sv {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--cn-accent);
  line-height: 1.1;
}
.sl {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b8b8b8;
  margin-top: 3px;
}

.tl {
  position: relative;
  padding-left: 26px;
  margin: 20px 0;
}
.tl::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--cn-border);
}
.tli {
  position: relative;
  margin-bottom: 20px;
}
.tli::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cn-accent);
  border: 2px solid var(--cn-bg);
}
.tly {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  color: #c4b5a0;
  letter-spacing: 0.1em;
  margin-bottom: 3px;
}
.tlt {
  color: var(--cn-text-muted);
  font-size: 14px;
}

.vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
  margin: 18px 0;
}
.vsc {
  padding: 22px;
  background: var(--cn-surface);
  border: 1px solid var(--cn-border);
}
.vsc:first-child {
  border-radius: 12px 0 0 12px;
  border-right: none;
}
.vsc:last-child {
  border-radius: 0 12px 12px 0;
  border-left: none;
}
.vsl {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: #b8b8b8;
}
.vsd {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cn-surface2);
  border-top: 1px solid var(--cn-border);
  border-bottom: 1px solid var(--cn-border);
  font-family: "Geist", system-ui, sans-serif;
  font-size: 18px;
  color: var(--cn-text-dim);
  padding: 0 14px;
  width: 44px;
}

ul.cl {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
ul.cl li {
  font-size: 14px;
  color: var(--cn-text-muted);
  padding-left: 18px;
  position: relative;
}
ul.cl li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--cn-accent);
  font-size: 18px;
  line-height: 1;
  top: 2px;
}

.formula {
  background: var(--cn-surface2);
  border: 1px solid var(--cn-border);
  border-left: 3px solid var(--cn-accent-subtle);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--cn-text-muted);
  margin: 14px 0;
}
.formula .fv {
  color: var(--cn-accent);
}
.formula .ft {
  color: var(--cn-text-muted);
  font-size: 12px;
}

.steps {
  counter-reset: steps;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.sn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--cn-surface2);
  border: 1px solid var(--cn-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  color: #c4b5a0;
  margin-top: 2px;
}
.st {
  color: var(--cn-text-muted);
  font-size: 14px;
  line-height: 1.6;
}
.st strong {
  color: var(--cn-text);
}

code {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  background: var(--cn-surface2);
  border: 1px solid var(--cn-border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--cn-accent);
}
.sp {
  height: 22px;
}

.dbox {
  background: var(--cn-surface);
  border: 1px solid var(--cn-border);
  border-radius: 12px;
  padding: 28px;
  margin: 20px 0;
}
.dlbl {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b8b8b8;
  margin-bottom: 18px;
  text-align: center;
}
.flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  row-gap: 14px;
}
.fn {
  background: var(--cn-surface2);
  border: 1px solid var(--cn-border);
  border-radius: 7px;
  padding: 9px 14px;
  font-size: 12px;
  font-family: "Geist Mono", ui-monospace, monospace;
  text-align: center;
  min-width: 90px;
}
.fa {
  color: var(--cn-text-dim);
  font-size: 16px;
  padding: 0 7px;
}
.fn.fo {
  border-color: var(--cn-accent);
  color: var(--cn-accent);
}
.fn.fc {
  border-color: var(--cn-accent-subtle);
  color: var(--cn-accent-subtle);
}
.fn.fr {
  border-color: var(--cn-destructive);
  color: var(--cn-destructive);
}
.fn.fg {
  border-color: var(--cn-success);
  color: var(--cn-success);
}

.footer {
  padding: 40px 80px;
  border-top: 1px solid var(--cn-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ft-txt {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--cn-text-muted);
}

.dbox h3 {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Course index / listing page */
.back-bar {
  padding: 12px 40px;
  background: var(--cn-surface);
  border-bottom: 1px solid var(--cn-border);
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.back-bar a {
  color: var(--cn-text-muted);
  text-decoration: none;
}
.back-bar a:hover {
  color: var(--cn-accent);
}
body.index-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.course-index {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.cn-main,
main.cn-main {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 40px;
}
.cn-main h1 {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.cn-meta {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--cn-text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 48px;
}
.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lesson-link {
  display: block;
  padding: 20px 24px;
  background: var(--cn-surface);
  border: 1px solid var(--cn-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--cn-text);
  transition:
    border-color 0.2s,
    color 0.2s;
}
.lesson-link:hover {
  border-color: var(--cn-accent);
}
.lesson-link strong {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.lesson-link span {
  font-size: 13px;
  color: var(--cn-text-muted);
}

/* Lucide icons (matches portfolio) */
.cn-icon {
  width: 1.25em;
  height: 1.25em;
  stroke-width: 2;
  flex-shrink: 0;
}
.alert-icon .cn-icon {
  width: 1.125em;
  height: 1.125em;
}
.cn-icon-lg {
  width: 1.5em;
  height: 1.5em;
}
.cn-icon-xl {
  width: 2em;
  height: 2em;
}
.cn-icon-inline {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.25em;
}

@media (max-width: 900px) {
  .hero,
  .container,
  .footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  .toc-bar {
    padding: 0 20px;
  }
  .g2,
  .g3,
  .g4 {
    grid-template-columns: 1fr;
  }
  .vs {
    grid-template-columns: 1fr;
  }
  .vsc:first-child,
  .vsc:last-child {
    border-radius: 0;
    border: 1px solid var(--cn-border);
  }
  .vsd {
    display: none;
  }
}
