:root {
  --ink: #15253d;
  --muted: #5e6b81;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --panel-border: rgba(21, 37, 61, 0.12);
  --blue: #2f63ff;
  --green: #1f8a62;
  --orange: #d37522;
  --red: #d34134;
  --yellow: #b29200;
  --shadow: 0 18px 50px rgba(21, 37, 61, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(211, 117, 34, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(47, 99, 255, 0.14), transparent 34%),
    linear-gradient(180deg, #f4ede1 0%, #f7f6f3 44%, #edf4fa 100%);
}

.site-shell {
  width: min(1400px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.hero,
.lesson-panel,
.footer-notes {
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: start;
  padding: clamp(1.5rem, 3vw, 2.6rem);
  border-radius: 30px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.92)),
    linear-gradient(135deg, rgba(47, 99, 255, 0.08), rgba(211, 117, 34, 0.06));
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -4rem -5rem auto;
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(211, 117, 34, 0.20), rgba(211, 117, 34, 0));
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Newsreader", serif;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 0.98;
  max-width: 10ch;
}

.hero-main {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 66ch;
  margin: 1rem 0 0;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-mark {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-self: end;
  gap: 0.25rem;
  min-width: 13rem;
  padding: 0.8rem 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(21, 37, 61, 0.08);
  box-shadow: 0 10px 24px rgba(21, 37, 61, 0.08);
  text-align: center;
}

.hero-mark-name {
  font-family: "Newsreader", serif;
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 0.9;
  color: var(--ink);
}

.hero-mark-expansion {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--orange);
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  padding: 0.3rem 0;
  margin: 1rem 0 1.25rem;
}

.tab-button {
  border: 1px solid rgba(21, 37, 61, 0.10);
  border-radius: 16px;
  padding: 0.95rem 1.2rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(21, 37, 61, 0.08);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.tab-button:hover,
.tab-button:focus-visible {
  background: rgba(255, 255, 255, 1);
  color: var(--ink);
  border-color: rgba(47, 99, 255, 0.32);
  box-shadow: 0 12px 28px rgba(47, 99, 255, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.tab-button.is-active {
  background: linear-gradient(135deg, var(--ink), #274166);
  color: white;
  border-color: rgba(21, 37, 61, 0.55);
  box-shadow: 0 14px 30px rgba(21, 37, 61, 0.22);
  transform: translateY(-2px);
}

.lesson-panel {
  display: none;
  margin-top: 1rem;
  padding: 1.5rem;
  border-radius: 28px;
  background: var(--surface);
  backdrop-filter: blur(16px);
}

.lesson-panel.is-active {
  display: block;
}

.panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 440px);
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.25rem;
}

.panel-step {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.panel-header h2 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.panel-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid rgba(21, 37, 61, 0.08);
}

.control-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.control-label {
  font-size: 0.95rem;
  font-weight: 800;
}

.control-value {
  font-size: 0.9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent, var(--ink));
}

.control input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent, var(--ink));
}

.accent-blue {
  --accent: var(--blue);
}

.accent-green {
  --accent: var(--green);
}

.accent-orange {
  --accent: var(--orange);
}

.segment-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 0.6rem;
}

.control-segment {
  grid-column: span 2;
}

.segment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.82rem 0.8rem;
  min-height: 3.25rem;
  border-radius: 14px;
  border: 1px solid rgba(21, 37, 61, 0.12);
  background: white;
  text-align: center;
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.2;
  white-space: normal;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.segment-option input:checked + span {
  color: white;
  border-color: var(--ink);
  background: linear-gradient(135deg, var(--ink), #2f4e77);
  transform: translateY(-1px);
}

.plots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

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

.plots-grid-single {
  grid-template-columns: 1fr;
}

.plot-card {
  padding: 0.85rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(21, 37, 61, 0.08);
}

.plot-card h3 {
  margin-bottom: 0.45rem;
  font-size: 1.18rem;
}

.plot-card-feature {
  padding-top: 1rem;
}

.plot-frame {
  min-height: 360px;
}

.plot-frame-feature {
  min-height: 520px;
}

.note {
  margin: 1rem 0 0;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border-left: 5px solid var(--blue);
  line-height: 1.65;
}

.feature-block {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(21, 37, 61, 0.08);
}

.feature-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 440px);
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.15rem;
}

.feature-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}

.feature-header h3 {
  margin: 0;
  font-size: 1.5rem;
}

.feature-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.equation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.equation-card {
  padding: 1rem 1.05rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(21, 37, 61, 0.08);
}

.equation-card h4 {
  margin-bottom: 0.8rem;
  font-size: 1.18rem;
}

.equation-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.equation-chip,
.axis-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(21, 37, 61, 0.06);
  font-weight: 800;
  color: var(--ink);
}

.binding-scheme {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.scheme-species {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 246, 251, 0.95));
  border: 1px solid rgba(21, 37, 61, 0.08);
  font-family: "Newsreader", serif;
  font-size: 2.5rem;
  line-height: 1;
}

.scheme-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.scheme-rate {
  font-size: 1.05rem;
  font-weight: 800;
}

.scheme-arrow {
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
}

.equation-line,
.equation-line-inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 1.55rem;
  line-height: 1.2;
  font-family: "Newsreader", serif;
}

.math-frac {
  display: inline-grid;
  grid-template-rows: auto auto;
  justify-items: center;
  min-width: 3.4em;
  vertical-align: middle;
}

.math-frac-top,
.math-frac-bottom {
  display: block;
  padding: 0 0.18em;
  white-space: nowrap;
}

.math-frac-top {
  border-bottom: 2px solid currentColor;
  padding-bottom: 0.08em;
}

.math-frac-bottom {
  padding-top: 0.08em;
}

.equation-steps {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.75;
}

.axis-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.equation-substitution {
  margin: 1rem 0 0;
  font-weight: 800;
  color: var(--ink);
}

.equation-substitution-muted {
  margin-top: 0.5rem;
  font-weight: 700;
  color: var(--muted);
}

.two-step-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.two-step-card {
  padding: 1rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(21, 37, 61, 0.08);
}

.two-step-card h3 {
  margin-bottom: 0.85rem;
  font-size: 1.3rem;
}

.two-step-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr) 140px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: stretch;
}

.state-node {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.95rem 0.8rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 246, 251, 0.95));
  border: 1px solid rgba(21, 37, 61, 0.08);
  text-align: center;
}

.state-node-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.state-node-name {
  font-size: 1rem;
  line-height: 1.25;
}

.state-node-formula {
  font-family: "Newsreader", serif;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
}

.state-node-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--blue);
}

.step-connector {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.35rem;
  text-align: center;
}

.step-connector-label {
  font-size: 0.86rem;
  font-weight: 800;
}

.binding-step .step-connector-label,
.binding-step .step-connector-rate {
  color: #d39600;
}

.activation-step .step-connector-label,
.activation-step .step-connector-rate {
  color: var(--green);
}

.step-connector-arrow {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--ink);
}

.step-connector-rate {
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.diagram-intro {
  margin: 0 0 1rem;
  color: var(--muted);
}

.ant-class-layout {
  display: grid;
  gap: 1rem;
}

.ant-class-wrap {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.ant-class-map {
  position: relative;
  min-width: 1200px;
  min-height: 720px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 252, 0.94)),
    linear-gradient(135deg, rgba(47, 99, 255, 0.03), rgba(211, 117, 34, 0.04));
  border: 1px solid rgba(21, 37, 61, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ant-class-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ant-class-lines line {
  stroke: rgba(21, 37, 61, 0.34);
  stroke-width: 4;
  stroke-linecap: round;
}

.ant-class-node {
  position: absolute;
  z-index: 1;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(21, 37, 61, 0.12);
  border-radius: 16px;
  padding: 0.72rem 0.8rem;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  font-size: 0.94rem;
  text-align: center;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(21, 37, 61, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.ant-class-node:hover,
.ant-class-node:focus-visible {
  transform: translate(-50%, calc(-50% - 2px));
  border-color: rgba(47, 99, 255, 0.34);
  box-shadow: 0 14px 30px rgba(47, 99, 255, 0.12);
  outline: none;
}

.ant-class-node.is-selected {
  z-index: 2;
  border-color: rgba(21, 37, 61, 0.58);
  box-shadow: 0 16px 34px rgba(21, 37, 61, 0.18);
  transform: translate(-50%, calc(-50% - 2px));
}

.tier-root {
  background: linear-gradient(135deg, #203555, #314f7a);
  color: white;
}

.tier-group {
  background: linear-gradient(135deg, rgba(92, 118, 164, 0.16), rgba(92, 118, 164, 0.26));
}

.tier-branch {
  background: linear-gradient(135deg, rgba(47, 99, 255, 0.10), rgba(47, 99, 255, 0.18));
}

.tier-step {
  background: rgba(255, 255, 255, 0.98);
  font-size: 0.95rem;
}

.tier-leaf {
  background: linear-gradient(135deg, rgba(211, 117, 34, 0.08), rgba(255, 255, 255, 0.98));
  font-size: 0.9rem;
}

.ant-class-detail {
  padding: 1.15rem 1.2rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(21, 37, 61, 0.08);
}

.detail-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.ant-class-detail h3 {
  font-size: 1.55rem;
}

.detail-summary {
  margin: 0.7rem 0 0;
  line-height: 1.7;
  color: var(--muted);
}

.detail-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.detail-highlight {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(47, 99, 255, 0.08), rgba(211, 117, 34, 0.08));
  border: 1px solid rgba(21, 37, 61, 0.08);
}

.detail-highlight-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.detail-highlight-value {
  margin: 0;
  line-height: 1.6;
  color: var(--ink);
}

.detail-list {
  margin: 0.9rem 0 0;
  padding-left: 1.2rem;
  line-height: 1.75;
  color: var(--ink);
}

.footer-notes {
  margin-top: 1.25rem;
  padding: 1.5rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
}

.footer-notes h2 {
  font-size: 1.6rem;
}

.footer-notes ul {
  margin: 0.9rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.8;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-mark {
    justify-self: start;
    min-width: 0;
  }

  .panel-header {
    grid-template-columns: 1fr;
  }

  .feature-header,
  .equation-grid,
  .two-step-layout,
  .two-step-flow,
  .binding-scheme {
    grid-template-columns: 1fr;
  }

  .plot-frame,
  .plot-frame-feature {
    min-height: 320px;
  }

  .plots-grid-two {
    grid-template-columns: 1fr;
  }

  .control-segment {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(100% - 1rem, 1400px);
    padding-top: 0.75rem;
  }

  .hero,
  .lesson-panel,
  .footer-notes {
    border-radius: 22px;
  }

  .lesson-panel,
  .footer-notes {
    padding: 1rem;
  }

  .tab-bar {
    gap: 0.5rem;
    justify-content: flex-start;
  }

  .tab-button {
    padding: 0.8rem 1rem;
  }

  .plot-frame-feature {
    min-height: 440px;
  }

  .ant-class-map {
    min-width: 1020px;
  }
}
