:root {
  color-scheme: light;
  --paper: #f8f6ef;
  --white: #fffefa;
  --ink: #222820;
  --muted: #545b50;
  --line: #deded1;
  --orange: #a53d21;
  --orange-bright: #c9512d;
  --sage: #e9eee3;
  --green: #325844;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-size: 16px; line-height: 1.75; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .24em; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 4px; }
:where(section[id], h3[id], .widget[id]) { scroll-margin-top: 96px; }
p, h1, h2, h3, h4, figure, dl, dd { margin: 0; }
strong, h1, h2, h3, h4 { font-weight: 700; }
h1, h2, h3, h4 { line-height: 1.26; }

.shell { width: min(1200px, calc(100% - 96px)); margin-inline: auto; }
.skip { position: fixed; inset: 10px auto auto 10px; z-index: 5; transform: translateY(-180%); padding: 8px 14px; background: var(--white); }
.skip:focus { transform: none; }

.site-header { position: sticky; top: 0; z-index: 3; background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand { display: inline-flex; gap: 3px; align-items: center; font: 750 23px/1 "Geist", "Inter", sans-serif; letter-spacing: -.055em; white-space: nowrap; text-decoration: none; }
.brand-number { color: var(--orange); }
.brand-mark { display: inline-flex; gap: 3px; align-items: end; justify-content: center; width: 30px; height: 30px; margin-right: 6px; padding-bottom: 7px; border-radius: 7px; background: var(--orange-bright); }
.brand-mark i { width: 3px; height: 6px; border-radius: 1px; background: #fffefa; }
.brand-mark i:nth-child(2) { height: 11px; }
.brand-mark i:nth-child(3) { height: 16px; }
.top-nav { display: flex; gap: clamp(15px, 3vw, 46px); color: var(--muted); }
.top-nav a, .lookup { font-size: .875rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.top-nav a:hover, .lookup:hover, .chapters a:hover { color: var(--orange); }
.lookup { display: inline-flex; align-items: center; gap: 9px; padding: 7px 13px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; }
.search-icon { display: inline-block; color: var(--orange); width: 13px; height: 13px; border: 1.5px solid currentColor; border-radius: 50%; margin-right: 3px; position: relative; flex: 0 0 auto; }
.search-icon::after { position: absolute; content: ""; width: 6px; height: 1.5px; background: currentColor; transform: rotate(46deg); left: 9px; top: 10px; }

.hero { min-height: 520px; display: grid; grid-template-columns: 1.13fr 1fr; align-items: center; column-gap: clamp(35px, 6vw, 95px); padding-block: 64px 54px; }
.hero-figure { min-width: 0; }
.eyebrow, .kicker, .chapter-no { color: var(--orange); font-size: .77rem; font-weight: 700; letter-spacing: .105em; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 4px 11px; border: 1px solid #e7cbbd; border-radius: 100px; background: #faeee5; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.hero h1 { margin-top: 20px; font-size: clamp(3rem, 5.25vw, 5.15rem); line-height: 1.11; letter-spacing: -.067em; }
.hero h1 span { color: var(--orange); }
.lede { max-width: 455px; margin-top: 22px; color: var(--muted); font-size: clamp(.98rem, 1.35vw, 1.13rem); line-height: 1.85; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 27px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); font-size: .9rem; font-weight: 700; text-decoration: none; }
.button:hover { background: var(--sage); }
.button.primary { background: var(--ink); border-color: var(--ink); color: var(--white); }
.button.primary:hover { background: var(--green); border-color: var(--green); }
.button.small { min-height: 36px; font-size: .82rem; white-space: nowrap; }
.hero-chart { position: relative; border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: 0 14px 39px #3435250d, 0 2px 5px #34352507; }
.hero-chart::before { content: ""; position: absolute; z-index: -1; inset: -23px -24px -10px 27px; background: radial-gradient(#b8b8a5 1px, transparent 1px) 0 0 / 13px 13px; mask-image: linear-gradient(105deg, transparent, #000); }
.chart-top { display: flex; justify-content: space-between; padding: 12px 19px; border-bottom: 1px solid var(--line); color: var(--green); font-size: .76rem; font-weight: 700; }
.chart-top span { display: flex; align-items: center; gap: 7px; }
.chart-body { padding: 16px 19px; }
.chart-title { color: var(--muted); font-size: .83rem; }
.chart-title span { padding-left: 5px; font-size: .72rem; }
.chart-value { display: flex; align-items: center; gap: 10px; font: 700 2rem/1.35 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.06em; }
.chart-value span { padding: 4px 7px; background: var(--sage); border-radius: 5px; color: var(--green); font-size: .69rem; letter-spacing: 0; }
canvas { display: block; width: 100%; height: clamp(144px, 17vw, 192px); margin-top: 5px; }
.chart-legend { display: flex; gap: 15px; align-items: center; justify-content: space-between; padding-top: 7px; font-size: .75rem; color: var(--muted); }
.chart-legend span { display: flex; gap: 7px; align-items: center; }
.chart-legend i { width: 15px; height: 2px; background: var(--green); border-radius: 2px; }
figcaption { margin-top: 12px; color: var(--muted); font-size: .79rem; }

.roadmap { padding-block: 27px 53px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: 21px; }
.section-heading h2 { font-size: clamp(1.55rem, 3.05vw, 2.22rem); letter-spacing: -.05em; margin-top: 5px; }
.section-heading > p { color: var(--muted); font-size: .9rem; }
.roadmap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.roadmap-grid a { position: relative; display: block; min-width: 0; padding: 15px 16px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); text-decoration: none; }
.roadmap-grid a:hover { background: #f7eee3; border-color: #caa48f; }
.roadmap-grid h3 { margin-top: 8px; font-size: 1.11rem; }
.roadmap-grid p { margin-top: 5px; font-size: .84rem; color: var(--muted); }
.card-arrow { position: absolute; top: 11px; right: 15px; color: var(--orange); }

.course { display: grid; grid-template-columns: 186px minmax(0, 46rem); justify-content: center; gap: clamp(36px, 6vw, 90px); padding-block: 64px 86px; }
.chapters { position: sticky; top: 134px; display: grid; gap: 7px; }
.chapters > p { padding: 0 9px 5px; color: var(--muted); font-size: .74rem; font-weight: 700; }
.chapters a { padding: 8px 9px; font-size: .86rem; text-decoration: none; border-left: 2px solid transparent; border-radius: 3px; color: var(--muted); }
.chapters a[aria-current="location"] { background: #f5e9dc; border-color: var(--orange-bright); color: var(--ink); font-weight: 700; }
.chapters span { display: inline-block; min-width: 29px; font: 600 .78rem var(--mono); color: var(--orange); }
.chapters hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.lessons { min-width: 0; }
.lesson { scroll-margin-top: 136px; }
.lesson:not([hidden]) + .lesson:not([hidden]) { border-top: 1px solid var(--line); padding-top: 48px; margin-top: 64px; }
.lesson-head { margin-bottom: clamp(28px, 5vw, 48px); }
.lesson-head h2 { margin-top: 10px; font-size: clamp(2.25rem, 4.5vw, 3.65rem); line-height: 1.15; letter-spacing: -.06em; text-wrap: balance; }
.lesson-head > p:last-child { margin-top: 16px; max-width: 33em; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); }
.lesson > h3 { margin-block: 35px 14px; font-size: 1.25rem; }
.lesson > p { margin-block: 18px; }

.number-example { margin-block: 30px; padding: clamp(18px, 4vw, 33px); border-radius: 12px; background: #f2eadf; }
.number-example > p:last-child { max-width: 35em; color: var(--muted); }
.equation { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4em; margin-block: 12px; font-size: clamp(1.33rem, 3.4vw, 2.15rem); font-weight: 700; letter-spacing: -.045em; line-height: 1.22; }
.equation span:nth-child(even) { color: var(--muted); font-size: .72em; }
.equation strong { color: var(--orange); }
.market-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 5vw, 45px); margin-block: 18px 33px; }
.market-pair article { min-width: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.market-pair h4 { font-size: 1.22rem; font-weight: 700; }
.market-pair p { margin-top: 7px; color: var(--muted); font-size: .95rem; }
.index-pair { margin-top: 32px; }

.lesson-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 43px; }
.lesson-nav a { display: grid; gap: 2px; align-content: center; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); text-decoration: none; }
.lesson-nav a:hover { border-color: #caa48f; background: #f7eee3; }
.lesson-nav a:last-child { text-align: right; }
.lesson-nav span { color: var(--orange); font-size: .79rem; }
.lesson-nav strong { line-height: 1.5; }
.grid { display: grid; gap: 14px; margin-block: 20px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { min-width: 0; padding: 15px 16px; background: var(--white); border: 1px solid var(--line); border-radius: 9px; }
.card p { margin-top: 7px; color: var(--muted); font-size: .91rem; }
.table-wrap { margin-block: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
table { width: 100%; min-width: 535px; border-collapse: collapse; font-size: .89rem; line-height: 1.65; text-align: left; }
th, td { vertical-align: top; padding: 10px 13px; border-bottom: 1px solid var(--line); }
thead { background: var(--sage); color: #2b4939; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { min-width: 5.2em; }
.source-note { font-size: .8rem; line-height: 1.6; color: var(--muted); }
.source-note a { color: var(--green); }
details { border-top: 1px solid var(--line); padding-bottom: 2px; }
details:not(:has(+ details)) { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; padding: 13px 0; font-weight: 650; }
summary::marker { color: var(--orange); }
summary:hover { color: var(--orange); }
details p { margin-block: 6px 16px; max-width: 42em; color: var(--muted); font-size: .94rem; }
.steps { margin: 18px 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; gap: 11px; margin-top: 14px; }
.steps li::before { content: counter(step, decimal-leading-zero); display: grid; place-items: center; border-radius: 7px; height: 29px; color: var(--orange); background: #f5e9dc; font: 600 .8rem var(--mono); }
.steps h3 { font-size: 1rem; }
.steps p { font-size: .92rem; margin-top: 5px; }
.quote-board { max-width: 420px; margin-block: 2px 18px; border-top: 1px solid #c6d1c4; }
.quote-row { display: grid; grid-template-columns: 1fr auto minmax(4.5em, auto); gap: 8px; padding: 7px 2px; color: var(--muted); font-size: .86rem; border-bottom: 1px solid #c6d1c4; }
.quote-row span:last-child { text-align: right; }
.quote-row strong { color: var(--ink); font-family: var(--mono); }

.widget { padding: clamp(17px, 4vw, 29px); margin-block: 22px 33px; border: 1px solid #d4ddcf; border-radius: 11px; background: var(--sage); }
.widget-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px 15px; margin-bottom: 12px; }
.widget h4 { font-size: 1.28rem; }
.widget-head p { margin-top: 7px; color: var(--muted); font-size: .94rem; }
.widget label { display: block; min-width: 0; font-size: .86rem; font-weight: 650; }
.widget label output { margin-left: 7px; color: var(--green); font: 700 .86rem var(--mono); }
.input-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 12px; }
.order-inputs { grid-template-columns: repeat(2, minmax(0, 204px)); }
input[type="number"], input[type="search"] { background: var(--white); color: var(--ink); }
input[type="number"] { display: block; width: 100%; padding: 6px 9px; min-height: 38px; margin-top: 4px; border: 1px solid #bdc9ba; border-radius: 6px; }
input[type="range"] { display: block; width: 100%; min-height: 28px; margin: 3px 0; accent-color: var(--green); cursor: pointer; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.metrics div { min-width: 0; display: grid; align-content: start; gap: 3px; padding: 8px 10px; border-radius: 7px; background: var(--white); }
.metrics span { color: var(--muted); font-size: .74rem; }
.metrics strong { color: var(--green); font-size: .92rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.widget > .source-note, .widget form > .source-note { margin-top: 9px; }

.search-field { display: flex; gap: 9px; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); }
.search-field:focus-within { outline: 2px solid var(--orange); outline-offset: 2px; }
.search-field input { width: 100%; min-height: 44px; outline: none; border: 0; }
.term-count { min-height: 1.35em; }
.terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.terms div { padding-block: 12px 3px; border-top: 1px solid var(--line); }
.terms dt { font-weight: 700; }
.terms dd { margin-top: 4px; color: var(--muted); font-size: .91rem; }
#all-terms { margin-top: 27px; }
.references ul { margin-block: 9px 16px; padding-left: 1.25em; font-size: .9rem; }
.references li { margin-top: 6px; }
.references a { color: var(--green); }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { min-height: 85px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 15px; }
.footer-inner p, .footer-inner a, .no-js { color: var(--muted); font-size: .8rem; }
.no-js { text-align: center; padding: 9px; background: var(--sage); }

@media (max-width: 950px) {
  .shell { width: calc(100% - 48px); }
  .hero { min-height: auto; gap: 32px; padding-block: 55px 48px; }
  .hero h1 { font-size: clamp(2.65rem, 6vw, 4.4rem); }
  .course { grid-template-columns: 164px minmax(0, 1fr); gap: 25px; }
}

@media (max-width: 700px) {
  .shell { width: calc(100% - 36px); }
  .header-inner { min-height: 59px; gap: 10px; }
  .hero-copy .eyebrow { font-size: .72rem; }
  .top-nav { margin-left: auto; }
  .top-nav a:not(:first-child), .sidebar { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); padding-block: 35px 33px; }
  .hero-figure { max-width: 540px; width: 100%; }
  .hero-chart::before { inset: -13px -8px -8px 14px; }
  .hero h1 { font-size: clamp(2.75rem, 10vw, 4.4rem); }
  .lede { margin-top: 15px; }
  .hero-actions { margin-top: 18px; }
  .section-heading { display: grid; gap: 6px; }
  .roadmap { padding-bottom: 30px; }
  .roadmap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roadmap-grid a { padding: 11px 10px; }
  .roadmap-grid .chapter-no { font-size: .66rem; letter-spacing: 0; }
  .card-arrow { right: 9px; top: 7px; }
  .roadmap-grid h3 { font-size: 1rem; }
  .roadmap-grid p { font-size: .76rem; }
  .course { grid-template-columns: minmax(0, 1fr); padding-block: 39px 55px; }
  :where(section[id], h3[id], .widget[id]) { scroll-margin-top: 75px; }
  .lesson { scroll-margin-top: 98px; }
  .footer-inner { flex-wrap: wrap; }
  .footer-inner p { width: 100%; order: 3; }
}

@media (max-width: 470px) {
  .two, .three, .terms, .market-pair { grid-template-columns: minmax(0, 1fr); }
  .market-pair { gap: 14px; }
  .input-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget { padding: 14px; }
  .widget-head { flex-wrap: wrap; }
  .metrics { gap: 5px; }
  .metrics div { padding: 7px 6px; }
  .metrics strong { font-size: .81rem; }
  .metrics span { font-size: .69rem; }
}

@media (max-width: 380px) {
  .header-inner .brand { font-size: 20px; }
  .header-inner .brand-mark { width: 25px; height: 25px; margin-right: 3px; padding-bottom: 5px; }
  .header-inner .lookup { padding-inline: 8px; }
  .top-nav a { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
