:root {
  color-scheme: light dark;
  --sitebar-height: 64px;
  --bg: #f5f5f7;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-2: #ffffff;
  --surface-3: #f9f9fb;
  --elevated: #ffffff;
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #86868b;
  --accent: #006edb;
  --accent-rgb: 0, 110, 219;
  --accent-2: #8a5cf6;
  --accent-3: #0a84ff;
  --success: #248a3d;
  --danger: #d70015;
  --warning: #a05a00;
  --teal: #007a78;
  --green: #248a3d;
  --blue: #006edb;
  --purple: #7b4dff;
  --red: #d70015;
  --gold: #8a6200;
  --lime: #4c7d14;
  --emerald: #248a3d;
  --orange: #b95a00;
  --pink: #c43a71;
  --mint: #00cfa1;
  --cyan: #00b8ff;
  --amber: #ffb347;
  --magenta: #d27bff;
  --violet: #8a5cf6;
  --rose: #ff5e8a;
  --peach: #ffb58a;
  --bg3: var(--surface-3);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.06);
  --focus: 0 0 0 4px rgba(var(--accent-rgb), 0.18);
  --font-body: "Segoe UI", Arial, Helvetica, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-head: "Segoe UI", Arial, Helvetica, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-2: #101012;
    --surface: rgba(22, 22, 24, 0.76);
    --surface-2: #151517;
    --surface-3: #1c1c1e;
    --elevated: #202124;
    --border: rgba(255, 255, 255, 0.11);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --muted-2: #8e8e93;
    --accent: #0a84ff;
    --accent-rgb: 10, 132, 255;
    --accent-2: #bf9bff;
    --accent-3: #64d2ff;
    --success: #30d158;
    --danger: #ff453a;
    --warning: #ffd60a;
    --teal: #64d2ff;
    --green: #30d158;
    --blue: #0a84ff;
    --purple: #bf9bff;
    --red: #ff453a;
    --gold: #ffd60a;
    --lime: #a4d65e;
    --emerald: #30d158;
    --orange: #ff9f0a;
    --pink: #ff7ab6;
    --mint: #63f3c0;
    --cyan: #64d2ff;
    --amber: #ffd27a;
    --magenta: #e09bff;
    --violet: #bf9bff;
    --rose: #ff8bb1;
    --peach: #ffc49a;
    --bg3: var(--surface-3);
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.26);
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #101012;
  --surface: rgba(22, 22, 24, 0.76);
  --surface-2: #151517;
  --surface-3: #1c1c1e;
  --elevated: #202124;
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --muted-2: #8e8e93;
  --accent: #0a84ff;
  --accent-rgb: 10, 132, 255;
  --accent-2: #bf9bff;
  --accent-3: #64d2ff;
  --success: #30d158;
  --danger: #ff453a;
  --warning: #ffd60a;
  --teal: #64d2ff;
  --green: #30d158;
  --blue: #0a84ff;
  --purple: #bf9bff;
  --red: #ff453a;
  --gold: #ffd60a;
  --lime: #a4d65e;
  --emerald: #30d158;
  --orange: #ff9f0a;
  --pink: #ff7ab6;
  --mint: #63f3c0;
  --cyan: #64d2ff;
  --amber: #ffd27a;
  --magenta: #e09bff;
  --violet: #bf9bff;
  --rose: #ff8bb1;
  --peach: #ffc49a;
  --bg3: var(--surface-3);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.26);
}

:root[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-2: #ffffff;
  --surface-3: #f9f9fb;
  --elevated: #ffffff;
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #86868b;
  --accent: #006edb;
  --accent-rgb: 0, 110, 219;
  --accent-2: #8a5cf6;
  --accent-3: #0a84ff;
  --success: #248a3d;
  --danger: #d70015;
  --warning: #a05a00;
  --teal: #007a78;
  --green: #248a3d;
  --blue: #006edb;
  --purple: #7b4dff;
  --red: #d70015;
  --gold: #8a6200;
  --lime: #4c7d14;
  --emerald: #248a3d;
  --orange: #b95a00;
  --pink: #c43a71;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

::selection {
  background: rgba(var(--accent-rgb), 0.18);
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.045), transparent 320px),
    var(--bg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color 220ms ease, color 220ms ease;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  color: var(--text);
}

button {
  border: 0;
}

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

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

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

img,
svg,
canvas,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

canvas {
  border-radius: var(--radius);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.65em;
  color: var(--text);
  font-family: var(--font-head);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.08;
}

h1 {
  font-size: 3.65rem;
}

h2 {
  font-size: 2.35rem;
}

h3 {
  font-size: 1.6rem;
}

h4 {
  font-size: 1.08rem;
}

p {
  margin: 0 0 1em;
}

ul,
ol {
  margin-top: 0;
}

code,
pre,
.fx,
.formula-box,
.formula-wrap,
.big-eq,
.eq {
  font-family: var(--font-mono);
}

code {
  padding: 0.08rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--accent);
  font-size: 0.92em;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

th,
td {
  padding: 0.82rem 0.9rem;
  border-top: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

tr:first-child th,
tr:first-child td {
  border-top: 0;
}

th {
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

tr:hover td {
  background: rgba(var(--accent-rgb), 0.035);
}

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

.sitebar {
  position: sticky;
  top: 0;
  z-index: 3000;
  min-height: var(--sitebar-height);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(18px);
}

.sitebar__inner {
  width: min(1180px, calc(100% - 32px));
  min-height: var(--sitebar-height);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sitebar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
}

.sitebar__mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.sitebar__links {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sitebar__link,
.btn,
.resource-link,
.res-link,
.rl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  border-radius: var(--radius-pill);
  font-weight: 650;
  line-height: 1;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.sitebar__link {
  padding: 0 0.95rem;
  color: var(--muted);
}

.sitebar__link:hover {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  width: 3.35rem;
  height: 2rem;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  left: 0.22rem;
  width: 1.48rem;
  height: 1.48rem;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: transform 220ms ease, background-color 220ms ease;
}

:root[data-theme="dark"] .theme-toggle::before {
  transform: translateX(1.32rem);
}

.theme-toggle__icon {
  position: absolute;
  inset: 0;
}

.theme-toggle__icon::before,
.theme-toggle__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  transform: translateY(-50%);
}

.theme-toggle__icon::before {
  left: 0.76rem;
  background: var(--bg);
}

.theme-toggle__icon::after {
  right: 0.76rem;
  border: 1px solid var(--muted-2);
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 2rem 0 4.5rem;
}

.app {
  display: flex;
  min-height: calc(100vh - var(--sitebar-height));
}

.main {
  width: 100%;
  max-width: 1120px;
  min-width: 0;
  margin: 0 auto;
  padding: 3rem 2.5rem 5rem;
}

.sidebar,
.sb {
  position: sticky;
  top: var(--sitebar-height);
  width: 19.5rem;
  height: calc(100vh - var(--sitebar-height));
  flex: 0 0 19.5rem;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: saturate(160%) blur(16px);
}

.sidebar::-webkit-scrollbar,
.sb::-webkit-scrollbar {
  width: 0.6rem;
}

.sidebar::-webkit-scrollbar-thumb,
.sb::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

.s-brand,
.sidebar-header,
.s-head {
  padding: 1.55rem 1.35rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.s-logo,
.s-icon,
.s-sym {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  margin-bottom: 0.8rem;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.s-title,
.sidebar-header h1 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 750;
  line-height: 1.2;
}

.s-sub,
.sidebar-header p,
.s-bn,
.bn-title,
.ch-bn,
.topic-subtitle,
.module-subtitle,
.t-bn,
.bn {
  color: var(--muted);
}

.s-bn,
.bn-title {
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

.s-sub,
.sidebar-header p {
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.prog-wrap,
.prog-row,
.pg-row {
  margin-top: 1rem;
}

.prog-label,
.prog-row,
.pg-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.prog-bar,
.progress-bar,
.pg-bar {
  height: 0.46rem;
  margin-top: 0.5rem;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}

.prog-fill,
.progress-fill,
.pg-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 260ms ease;
}

.nav-list,
.nav-wrap,
#nav-buttons,
#nl {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem;
}

.nav-btn,
.nb,
.topic-btn,
.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.7rem;
  padding: 0.68rem 0.72rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-btn:hover,
.nb:hover,
.topic-btn:hover,
.nav-item:hover {
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--text);
}

.nav-btn.active,
.nb.active,
.topic-btn.active,
.nav-item.active {
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.11);
  color: var(--text);
}

.nav-num,
.nb-num,
.topic-num,
.nb-n {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.nav-btn.active .nav-num,
.nb.active .nb-num,
.topic-btn.active .topic-num,
.nb.active .nb-n {
  background: var(--accent);
  color: #ffffff;
}

.mob,
.mobile-nav,
.mob-nav {
  display: none;
}

.mob,
.mobile-nav,
.mob-nav {
  position: sticky;
  top: var(--sitebar-height);
  z-index: 2500;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: saturate(160%) blur(16px);
}

.mob::before,
.mobile-nav::before,
.mob-nav::before {
  content: "Quick jump";
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mob select,
.mobile-nav select,
.mob-nav select,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 2.4rem 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.section,
.card,
.law-card,
.gbox,
.ex,
.ex-box,
.exercise-box,
.mlb,
.mlbox,
.ml-app-box,
.ml-box,
.analogy,
.analogy-box,
.insight,
.cw,
.visual-wrap,
.canvas-wrap,
.bayes-box,
.dist-card,
.concept-side,
.vs-side,
.cmp-cell,
.curse-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
}

.section,
.card,
.law-card,
.gbox,
.ex,
.ex-box,
.exercise-box,
.mlb,
.mlbox,
.ml-app-box,
.ml-box,
.analogy,
.analogy-box,
.insight,
.cw,
.visual-wrap,
.canvas-wrap,
.bayes-box,
.dist-card,
.concept-side,
.vs-side,
.cmp-cell,
.curse-box {
  padding: 1.25rem;
}

.card,
.section,
.law-card,
.gbox,
.ex,
.ex-box,
.exercise-box,
.mlb,
.mlbox,
.ml-app-box,
.ml-box,
.analogy,
.analogy-box,
.insight,
.cw,
.visual-wrap,
.canvas-wrap,
.bayes-box,
.dist-card {
  margin: 1rem 0;
}

.card:hover,
.section:hover,
.module-card:hover {
  border-color: rgba(var(--accent-rgb), 0.22);
}

.topic-section,
.sec {
  display: none;
}

.topic-section.active,
.sec.active {
  display: block;
  animation: fadeUp 260ms ease both;
}

.topic-header,
.ch,
.ch-header,
.t-header {
  margin-bottom: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
}

.topic-title,
.ch-title,
.t-title {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 2.1rem;
  font-weight: 750;
  line-height: 1.12;
}

.topic-title em,
.ch-title em,
.t-title em {
  color: var(--accent);
  font-style: normal;
}

.topic-subtitle,
.ch-bn,
.t-bn {
  margin-top: 0.35rem;
  font-size: 1rem;
}

.topic-tags,
.ch-tags,
.t-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.card-hd,
.ch-hd,
.card-title,
.mlb-t,
.ml-box-title,
.gbox-t,
.gbox-title,
.insight-t,
.insight-title,
.curse-title,
.dist-name,
.cmp-hd,
.canvas-label,
.formula-label,
.f-label,
.clabel,
.clbl,
.eq-sub {
  margin-bottom: 0.7rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 780;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: uppercase;
}

.tag,
.tag-ml,
.tag-math,
.tag-law,
.tc,
.tl,
.to,
.tv,
.te,
.ts,
.ta,
.tg,
.tt,
.tp {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0 0.65rem;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: var(--radius-pill);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.law1,
.law-red,
.law-card {
  border-color: rgba(var(--accent-rgb), 0.22);
  background:
    linear-gradient(0deg, rgba(var(--accent-rgb), 0.045), rgba(var(--accent-rgb), 0.045)),
    var(--surface-2);
}

.law2,
.law-dark {
  border-color: color-mix(in srgb, var(--danger) 26%, var(--border));
  background:
    linear-gradient(0deg, color-mix(in srgb, var(--danger) 7%, transparent), color-mix(in srgb, var(--danger) 7%, transparent)),
    var(--surface-2);
}

.callout,
.call,
.call-bn,
.callout-bn,
.callout-red,
.call-r,
.call-v,
.call-s,
.call-b,
.call-l,
.callout-lime {
  margin: 1rem 0;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--text);
}

.callout-red,
.call-r {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface-2));
}

.callout-lime,
.call-l {
  border-left-color: var(--success);
  background: color-mix(in srgb, var(--success) 8%, var(--surface-2));
}

.mlb,
.mlbox,
.ml-app-box,
.ml-box {
  border-color: rgba(var(--accent-rgb), 0.2);
  background:
    linear-gradient(0deg, rgba(var(--accent-rgb), 0.04), rgba(var(--accent-rgb), 0.04)),
    var(--surface-2);
}

.analogy,
.analogy-box,
.insight {
  background: var(--surface-3);
}

.fx,
.formula-box,
.formula-wrap,
.big-eq,
.eq {
  display: block;
  width: 100%;
  margin: 0.75rem 0;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
}

.g2,
.grid-2,
.concept-pair,
.vs-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.g3,
.cmp {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.g4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.fail-item,
.fi,
.cout-row,
.ctrl-row,
.dp,
.dist-props {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.ctrl,
.ctrl-output,
.cout,
.cval,
.ctrl-val {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
}

.ctrl,
.ctrl-output,
.cout {
  padding: 1rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.q,
.qbtn,
.q-btn,
.qb {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.65rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-weight: 650;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.q:hover,
.qbtn:hover,
.q-btn:hover,
.qb:hover {
  border-color: rgba(var(--accent-rgb), 0.24);
  background: rgba(var(--accent-rgb), 0.07);
}

.q-arrow,
.qa-a {
  display: inline-block;
  color: var(--muted);
  transition: transform 180ms ease;
}

.q.open .q-arrow,
.qbtn.open .q-arrow,
.q-btn.open .q-arrow,
.qb.open .qa-a {
  transform: rotate(90deg);
}

.a,
.apanel,
.a-panel,
.ap {
  display: none;
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.a.open,
.apanel.open,
.a-panel.open,
.ap.open {
  display: block;
  animation: fadeUp 180ms ease both;
}

.qa,
.qa-item {
  margin-top: 0.7rem;
}

.resource-link,
.res-link,
.rl {
  min-height: 2.8rem;
  margin: 0.45rem 0.45rem 0 0;
  padding: 0 1rem;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--accent);
}

.resource-link:hover,
.res-link:hover,
.rl:hover {
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.08);
  transform: translateY(-1px);
}

.hl-blue,
.hl-teal,
.hl-t,
.hs,
.hc,
.ht,
.hsk,
.fb,
.ft {
  color: var(--blue);
  font-weight: 700;
}

.hl-green,
.hl-g,
.hg,
.hgr,
.fg,
.f-green {
  color: var(--green);
  font-weight: 700;
}

.hl-purple,
.hl-p,
.hv,
.hi,
.fp,
.fv {
  color: var(--purple);
  font-weight: 700;
}

.hl-red,
.hr,
.fr {
  color: var(--red);
  font-weight: 700;
}

.hl-gold,
.hl-y,
.hy,
.fw,
.f-yellow {
  color: var(--gold);
  font-weight: 700;
}

.hl-o,
.ho,
.fo {
  color: var(--orange);
  font-weight: 700;
}

.hl,
.hl-muted,
.ha,
.hb,
.he,
.hm,
.hp,
.fi,
.fa,
.fc,
.fe,
.fm,
.f-pink {
  color: var(--muted);
}

.module-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: baseline;
  font-size: 1.05rem;
  font-weight: 750;
}

.module-title a {
  color: var(--text);
}

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

.path {
  padding-left: 1.35rem;
}

.path > li {
  margin: 1.25rem 0;
  padding-left: 0.25rem;
}

.topics {
  margin-top: 0.7rem;
  padding-left: 1.1rem;
  color: var(--muted);
}

.topics li {
  margin: 0.28rem 0;
}

footer,
.site-footer {
  color: var(--muted);
}

.home-page main {
  width: 100%;
  max-width: none;
  padding: 0;
}

.home-hero,
.home-section,
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.home-hero {
  padding: 5.5rem 0 3.5rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(20rem, 0.95fr);
  gap: 3rem;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  margin-bottom: 1.1rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.hero-title {
  max-width: 12ch;
  margin-bottom: 1rem;
  font-size: 4.25rem;
}

.hero-copy {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.22rem;
  line-height: 1.55;
}

.hero-actions,
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.btn {
  min-height: 3rem;
  padding: 0 1.25rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

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

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  color: #ffffff;
  background: var(--blue);
}

.btn-ghost {
  background: var(--surface);
}

.hero-visual {
  position: relative;
  min-height: 27rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.path-map {
  display: grid;
  height: 100%;
  min-height: 25rem;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.path-node {
  display: flex;
  min-height: 7.4rem;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
}

.path-node strong {
  color: var(--text);
  font-size: 0.98rem;
}

.path-node span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.path-node.is-active {
  border-color: rgba(var(--accent-rgb), 0.3);
  background: rgba(var(--accent-rgb), 0.09);
}

.home-section {
  padding: 3rem 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-head p {
  max-width: 34rem;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.metric {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
}

.metric strong {
  display: block;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 0.55rem;
  color: var(--muted);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.module-card {
  display: flex;
  min-height: 18rem;
  flex-direction: column;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.module-card:hover {
  transform: translateY(-2px);
  color: var(--text);
}

.module-card__step {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
}

.module-card h3 {
  margin: 0.75rem 0 0.65rem;
  font-size: 1.22rem;
}

.module-card p {
  color: var(--muted);
}

.module-card ul {
  margin: auto 0 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.module-card li {
  margin: 0.25rem 0;
}

.site-footer {
  margin: 2.5rem auto 0;
  padding: 2.2rem 0 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.site-footer__wrap {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-weight: 600;
}

.site-footer__top a {
  font-weight: 650;
}

.site-footer__contact {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
}

.site-footer__title {
  color: var(--text);
  font-weight: 700;
}

.site-footer__details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  color: var(--muted);
}


@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .sidebar,
  .sb {
    width: 17rem;
    flex-basis: 17rem;
  }

  .main {
    padding: 2rem 1.5rem 4rem;
  }

  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  :root {
    --sitebar-height: 58px;
  }

  h1 {
    font-size: 2.65rem;
  }

  h2 {
    font-size: 1.9rem;
  }

  .sitebar__inner {
    width: min(1180px, calc(100% - 24px));
  }

  .sitebar__links .sitebar__link:not(:first-child) {
    display: none;
  }

  .app {
    display: block;
  }

  .sidebar,
  .sb {
    display: none;
  }

  .main {
    max-width: 100%;
    padding: 1rem 1rem 3.5rem;
  }

  .mob,
  .mobile-nav,
  .mob-nav {
    display: block;
  }

  .hero-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .home-hero {
    padding: 3.6rem 0 2rem;
  }

  .hero-title {
    max-width: 100%;
    font-size: 3.2rem;
  }

  .hero-copy {
    font-size: 1.08rem;
  }

  .hero-visual {
    min-height: auto;
  }

  .path-map {
    min-height: auto;
  }

  .metric-grid,
  .module-grid,
  .g3,
  .g4,
  .cmp {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: block;
  }

  .site-footer__top {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer__details {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  main {
    width: min(100% - 24px, 1120px);
  }

  h1,
  .hero-title {
    font-size: 2.45rem;
  }

  h2 {
    font-size: 1.65rem;
  }

  .sitebar__brand span:last-child {
    display: none;
  }

  .topic-header,
  .ch,
  .ch-header,
  .t-header,
  .section,
  .card,
  .law-card,
  .gbox,
  .ex,
  .ex-box,
  .exercise-box,
  .mlb,
  .mlbox,
  .ml-app-box,
  .ml-box,
  .analogy,
  .analogy-box,
  .insight,
  .cw,
  .visual-wrap,
  .canvas-wrap,
  .bayes-box,
  .dist-card,
  .concept-side,
  .vs-side,
  .cmp-cell,
  .curse-box,
  .module-card,
  .metric {
    padding: 1rem;
  }

  .topic-title,
  .ch-title,
  .t-title {
    font-size: 1.65rem;
  }

  .g2,
  .grid-2,
  .concept-pair,
  .vs-strip,
  .path-map {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    min-width: 9rem;
  }

  .fx,
  .formula-box,
  .formula-wrap,
  .big-eq,
  .eq {
    font-size: 0.86rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
