/* The shared Markets stylesheet owns typography, colors, page chrome and logo. */
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
.learning-page { --line: var(--slate-200); --muted: var(--slate-600); }
.learning-page p { margin: 0 0 16px; }
.learning-page a { color: var(--accent); text-underline-offset: 4px; }
.learning-page button, .learning-page input, .learning-page select, .learning-page textarea { font: inherit; }
.learning-page button, .learning-page .button { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; border: 1px solid var(--slate-200); border-radius: 10px; color: var(--slate-700); background: white; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 500; }
.learning-page button:hover, .learning-page .button:hover { background: var(--accent-light); border-color: var(--slate-300); color: var(--accent); }
.learning-page button[aria-pressed=true], .learning-page .primary { background: var(--accent); color: white; border-color: var(--accent); }
.learning-page :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.learning-page button:disabled { opacity: .45; cursor: default; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 12px; top: -100px; z-index: 10; background: white; padding: 12px; }
.skip:focus { top: 12px; }
.learning-page .navbar { gap: 20px; }
.learning-page .back-link { color: var(--slate-500); }
.language-switch { display: inline-flex; flex-shrink: 0; padding: 4px; gap: 4px; background: var(--slate-100); border: 1px solid var(--slate-200); border-radius: 12px; }
.learning-page .language-link { padding: 6px 12px; color: var(--slate-500); text-decoration: none; border-radius: 8px; font-size: 13px; font-weight: 600; }
.learning-page .language-link[aria-current=page] { color: white; background: var(--accent); }
.layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; margin-top: 40px; }
.layout aside { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow: auto; padding-top: 8px; }
.layout aside nav { display: flex; flex-direction: column; gap: 4px; }
.layout aside nav a { display: block; padding: 8px 10px; border-left: 2px solid transparent; border-radius: 0 8px 8px 0; color: var(--slate-500); text-decoration: none; font-size: 13px; }
.layout aside nav a:hover, .layout aside nav a:focus-visible { color: var(--accent); background: var(--accent-light); border-color: var(--accent); }
.layout aside p { margin: 20px 10px; }
.layout main { min-width: 0; }
.learning-page .hero { padding: 28px 0 48px; color: var(--slate-900); background: none; border: 0; border-radius: 0; }
.learning-page .hero h1 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(2.7rem, 4.5vw, 4.5rem); letter-spacing: -.03em; line-height: 1.1; margin: 16px 0 24px; }
.hero-emphasis { font-style: italic; text-decoration: underline; text-decoration-color: rgba(37,99,235,.2); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.learning-page .hero p { max-width: 650px; color: var(--slate-600); font-size: 19px; font-weight: 300; line-height: 1.7; }
.learning-page .hero .button { margin: 8px 8px 20px 0; }
.learning-page .hero .meta { font-size: 12px; color: var(--slate-500); }
.learning-page section { scroll-margin-top: 24px; }
.learning-page .chapter { padding: 40px 0 16px; margin-top: 48px; border-top: 2px solid var(--slate-300); }
.learning-page .chapter > h2 { display: flex; align-items: baseline; gap: 16px; margin-bottom: 28px; }
.chapter-number { font: 500 14px var(--font-sans, Inter, sans-serif); color: var(--accent); flex-shrink: 0; }
.chapter-number:empty, .nav-number:empty { display: none; }
.nav-number { display: inline-block; width: 24px; font-variant-numeric: tabular-nums; color: var(--slate-500); }
.chapter-next { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 32px; padding-top: 16px; font-size: 14px; }
.chapter-next:empty { display: none; }
.learning-page .takeaway { border-top: 1px solid var(--line); padding: 20px 0 0; margin-top: 28px; color: var(--slate-700); font-weight: 500; }
.learning-page h2 { font-family: var(--font-serif); font-size: 30px; font-weight: 400; line-height: 1.3; letter-spacing: -.02em; margin: 8px 0 20px; }
.learning-page h3 { font-size: 20px; font-weight: 600; margin: 26px 0 12px; letter-spacing: -.02em; }
.learning-page h4 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
.learning-page .lead, .learning-page .muted { color: var(--slate-600); }
.learning-page .small { font-size: 13px; }
.learning-page .grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.learning-page .thirds { grid-template-columns: repeat(3, minmax(0,1fr)); }
.learning-page .card, .learning-page .card:hover { display: block; padding: 20px 0; min-width: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; transform: none; transition: none; }
.learning-page .card h3 { margin: 4px 0 8px; font-family: var(--font-serif); font-weight: 400; }
.learning-page .card p:last-child { margin-bottom: 0; }
.notice { background: transparent; border-left: 2px solid var(--accent); padding: 8px 18px; margin: 24px 0; border-radius: 0; }
.notice.warn { background: transparent; border-color: #d97706; }
.notice.error { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.learning-page .formula { display: block; white-space: pre-wrap; background: var(--slate-50); color: var(--slate-700); border: 1px solid var(--slate-200); border-radius: 4px; padding: 18px; margin: 20px 0; font: 13px/1.8 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.flow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 20px 0; }
.flow span { padding: 4px 0; color: var(--accent); font-size: 13px; }
.flow b { color: var(--slate-300); }
.learning-page .table { overflow: auto; border: 1px solid var(--slate-300); border-radius: 4px; margin: 24px 0; background: white; }
.learning-page table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.6; }
.learning-page th, .learning-page td { padding: 14px 16px; border-bottom: 1px solid var(--slate-200); text-align: left; vertical-align: top; }
.learning-page th { background: var(--slate-100); color: var(--slate-700); font-weight: 600; }
.learning-page th + th, .learning-page td + td { border-left: 1px solid var(--slate-200); }
.learning-page tbody tr:nth-child(even) { background: var(--slate-50); }
.learning-page caption { text-align: left; padding: 12px 16px; color: var(--slate-600); border-bottom: 1px solid var(--slate-300); font-weight: 500; }
.learning-page tr:last-child td { border-bottom: 0; }
.numeric td:not(:first-child), .numeric th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.route-choice { border: 0; padding: 0; margin: 28px 0 16px; min-width: 0; }
.route-choice legend { font-weight: 600; font-size: 16px; padding: 0; margin-bottom: 14px; }
.route-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.learning-page .route-options button { display: block; text-align: left; padding: 20px; border-radius: 4px; }
.learning-page .route-options button strong { display: block; font-size: 16px; margin-bottom: 8px; }
.learning-page .route-options button span { display: block; font-weight: 400; font-size: 13px; line-height: 1.6; }
.learning-page .route-options button[aria-pressed=true] { color: var(--slate-900); background: var(--accent-light); border-color: var(--accent); box-shadow: none; }
.learning-page .route-options button[aria-pressed=true] strong { color: var(--accent); }
.learning-page .hero p.small { font-size: 13px; line-height: 1.6; }
.input-group { border: 0; border-top: 1px solid var(--line); margin: 28px 0; padding: 12px 0 0; min-width: 0; }
.input-group legend { font-size: 16px; font-weight: 600; padding-right: 16px; }
.input-group .inputs { margin: 0; }
.learning-page .badge { font-size: 12px; background: var(--accent-light); color: var(--accent); border-radius: 20px; padding: 4px 10px; display: inline-block; }
.field { display: block; margin: 10px 0; min-width: 0; }
.field span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--slate-600); }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; background: white; color: var(--slate-900); border: 1px solid var(--slate-300); border-radius: 8px; }
.field small { display: block; color: var(--slate-500); font-size: 12px; }
.inputs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0 16px; margin: 20px 0; }
.inputs .field { margin: 6px 0; }
.result { padding: 20px 16px; border: 1px solid var(--accent); border-radius: 4px; background: transparent; color: var(--slate-900); min-width: 0; }
.result strong { display: block; font-size: clamp(24px,3vw,34px); font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.4; overflow-wrap: anywhere; }
.result span { font-size: 12px; color: var(--slate-500); }
.result p { margin: 12px 0 0; font-size: 13px; }
.bars { display: grid; gap: 12px; margin: 20px 0; }
.barline { display: grid; grid-template-columns: 110px minmax(0,1fr) 90px; gap: 12px; align-items: center; font-size: 12px; }
.bartrack { height: 16px; background: var(--slate-100); border-radius: 4px; overflow: hidden; }
.barfill { display: block; height: 100%; background: var(--accent); }
.negative .barfill { background: #d97706; }
.learning-page details { border: 0; border-top: 1px solid var(--slate-200); border-bottom: 1px solid var(--slate-200); border-radius: 0; margin: 20px 0; padding: 0; background: transparent; }
.learning-page summary { font-weight: 500; cursor: pointer; padding: 14px 0; }
.learning-page details[open] { padding-bottom: 16px; }
.heat-low { background: #fffbeb; }
.heat-high { background: var(--accent-light); }
.check { display: flex; gap: 10px; align-items: start; margin: 12px 0; font-size: 14px; }
.check input { margin-top: 5px; accent-color: var(--accent); }
.learning-page textarea { min-height: 180px; resize: vertical; }
.quiz { border-bottom: 1px solid var(--slate-200); padding: 20px 0; }
.quiz output { display: block; margin-top: 12px; }
.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.learning-page ul, .learning-page ol { padding-left: 22px; margin: 16px 0; }
.learning-page li { margin: 8px 0; }
.learning-page code { overflow-wrap: anywhere; }
.learning-page noscript { display: block; padding: 18px; background: #fffbeb; }
@media (max-width: 1000px) {
    .layout { grid-template-columns: minmax(0,1fr); gap: 16px; margin-top: 24px; }
    .layout aside { position: static; max-height: none; min-width: 0; }
    .layout aside nav { flex-direction: row; overflow-x: auto; padding-bottom: 8px; }
    .layout aside nav a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; }
    .layout aside p { display: none; }
    .learning-page .navbar { flex-direction: row; flex-wrap: wrap; }
    .learning-page .navbar__left { flex: 1; }
}
@media (max-width: 650px) {
    .learning-page { padding-left: 16px; padding-right: 16px; }
    .learning-page .navbar__left { gap: 12px; }
    .learning-page .back-link span { display: none; }
    .learning-page .hero { padding: 20px 0 32px; }
    .learning-page .hero h1 { font-size: clamp(2.4rem,9vw,3rem); }
    .learning-page .hero p { font-size: 17px; }
    .learning-page .grid, .learning-page .thirds, .inputs, .risk-grid, .route-options { grid-template-columns: minmax(0,1fr); }
    .learning-page .chapter { padding-top: 24px; }
    .learning-page h2 { font-size: 26px; }
    .barline { grid-template-columns: 90px minmax(0,1fr) 70px; gap: 8px; }
    .learning-page .table table { min-width: 540px; }
    .controls button { flex-grow: 1; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
    .navbar, aside, .skip, .controls, button, .route-choice, .chapter-next, .hero .button { display: none !important; }
    .learning-page, .layout { display: block; margin: 0; padding: 0; }
    .app-body { background: white; font-size: 12px; }
    .learning-page .hero, .learning-page .chapter { padding: 16px 0; }
    .learning-page .card, .result, .formula { break-inside: avoid; box-shadow: none; }
    .learning-page .table { overflow: visible; break-inside: avoid; }
    .learning-page table { font-size: 8px; min-width: 0; }
    .learning-page th, .learning-page td { padding: 5px; }
    .learning-page .numeric th, .learning-page .numeric td { white-space: normal; overflow-wrap: anywhere; }
    .learning-page h2, .learning-page h3 { break-after: avoid; }
}
