/* ============================================================================
   /learn — the public learning pages.

   PAPER world only (DESIGN-GUIDELINES §1): cream editorial documents, ink
   rules, cobalt for interactive, hard offset shadows and no blur.

   The contract with /styles/site.css: that sheet owns the shared nav, mobile
   menu, footer, skip link and the `.btn`/`.btn-ink`/`.btn-line` button system,
   and this one owns everything below the chrome. Never re-declare a shared
   component here — these pages load only those two sheets, so a component
   defined in a marketing page's inline <style> does not exist on /learn, and a
   component defined twice is the drift this file is meant to prevent.

   Loaded by every /learn page, so it is the one place their treatment lives.
   ========================================================================= */

:root {
  --paper: #F4F1E8;
  --paper2: #ECE8DB;
  --card: #FDFCF6;
  --ink: #161511;
  --ink2: rgba(22, 21, 17, .66);
  --ink3: rgba(22, 21, 17, .44);
  /* .44 fails AA at the 14px floor; captions here carry meaning, not decoration */
  --ink3-aa: rgba(22, 21, 17, .64);
  --hair: rgba(22, 21, 17, .16);
  --hair2: rgba(22, 21, 17, .34);
  --rule: #161511;
  --blue: #2438F0;
  --blue-dim: rgba(36, 56, 240, .07);
  --orange: #F04A00;
  --orange-ink: #A83400;
  --mark: #F6E14B;
  --black: #131210;
  --dk: #0A0B0E;
  --dkline: rgba(255, 255, 255, .09);
  --dkline2: rgba(255, 255, 255, .16);
  --dktxt: #F2F5F9;
  --dktxt2: rgba(235, 240, 248, .64);
  /* .50 put the shared footer's headings and the Amazon trademark line below AA
     on 161 pages. The landing's .64 is the one value; the footer markup and the
     rules that colour it are shared, so the token must be too. */
  --dktxt3: rgba(235, 240, 248, .64);
  --grn: #00E68A;
  --serif: 'Instrument Serif', 'Instrument Serif Fallback', Georgia, 'Times New Roman', serif;
  --ui: 'Space Grotesk', 'Space Grotesk Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* Same 76px header the marketing pages set. It was 60px here, so moving
     between a marketing page and /learn visibly jumped the top of the page —
     and site.css consumes `--nav-h` without declaring it, so this declaration
     has to exist, not merely agree. */
  --nav-h: 4.75rem;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* Metric-matched fallbacks, mirrored byte-for-byte from index.html: /learn never
   loads that page's inline <style>, so without its own copy every Learn heading
   re-wraps when the webfont lands. Georgia is 33% wider than Instrument Serif;
   size-adjust makes the fallback occupy the same box, so the swap is invisible. */
@font-face { font-family: 'Instrument Serif Fallback'; src: local('Georgia'), local('Times New Roman'), local('Times'); size-adjust: 75.2%; ascent-override: 107.6%; descent-override: 29.5%; line-gap-override: 0%; }
@font-face { font-family: 'Space Grotesk Fallback'; src: local('Helvetica Neue'), local('Arial'), local('Liberation Sans'); size-adjust: 100.6%; ascent-override: 97.5%; descent-override: 24.4%; line-gap-override: 0%; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 28px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(22, 21, 17, .022) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, rgba(22, 21, 17, .022) 0 1px, transparent 1px 64px);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
::selection { background: var(--blue); color: var(--paper); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
.mono { font-family: var(--mono); }
.container { max-width: 1280px; margin: 0 auto; padding-left: clamp(24px, 5vw, 64px); padding-right: clamp(24px, 5vw, 64px); }

/* `.lrn-skip` now lives in site.css — the marketing pages needed the same skip
   link and do not load this sheet. Keeping a second copy here would let the two
   drift; the shared rule is the only one. */

/* ---------- Shell ---------- */
main { padding-top: var(--nav-h); }
/* Longhand on purpose. `.lrn-body` also carries `.container`, and a `padding`
   shorthand here wins the cascade and zeroes the container's horizontal
   padding — which put every /learn page hard against the left edge on a phone. */
.lrn-body {
  padding-top: clamp(28px, 4.6vw, 56px);
  padding-bottom: clamp(64px, 8vw, 104px);
  max-width: 1040px;
}
.lrn-article { max-width: 800px; }

.lrn-crumbs {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  font-family: var(--mono); font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink3-aa); margin-bottom: clamp(20px, 3vw, 30px);
}
.lrn-crumbs a { color: var(--ink2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hair2); }
.lrn-crumbs a:hover { color: var(--blue); text-decoration-color: var(--blue); }
.lrn-crumbs span[aria-hidden] { color: var(--hair2); }
.lrn-crumbs [aria-current] { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(52ch, 60vw); }

.lrn-eyebrow {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink3-aa);
  display: inline-flex; align-items: center; gap: 11px;
}
.lrn-eyebrow::before { content: ""; width: 9px; height: 9px; background: var(--blue); flex: none; }

.lrn-h1 {
  font-family: var(--ui); font-weight: 700;
  font-size: clamp(2rem, 4.4vw, 2.85rem); line-height: 1.05; letter-spacing: -.02em;
  color: var(--ink); margin: 16px 0 12px; text-wrap: balance;
}
.lrn-h2 {
  font-family: var(--ui); font-weight: 700;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem); line-height: 1.2; letter-spacing: -.01em;
  color: var(--ink); margin-bottom: 18px;
}
.lrn-h3 {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink3-aa); margin-bottom: 12px;
}
.lrn-sub { font-size: clamp(1.02rem, 1.6vw, 1.14rem); color: var(--ink2); margin-bottom: 10px; }
.lrn-lede { font-size: clamp(1.02rem, 1.6vw, 1.14rem); line-height: 1.62; color: var(--ink2); max-width: 68ch; }
.lrn-meta { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3-aa); margin-top: 18px; }

/* ---------- Index hero ---------- */
.lrn-hero { padding: clamp(56px, 8vw, 104px) 0 clamp(20px, 3vw, 34px); border-bottom: 1px solid var(--hair); }
/* text-wrap:balance — at 360/390 this headline stranded "it." on a fourth line,
   11% of the widest line. Ignored where unsupported. */
.lrn-hero h1 { font-size: clamp(2.2rem, 5.4vw, 3.4rem); line-height: 1.02; letter-spacing: -.025em; margin: 18px 0 16px; font-weight: 700; text-wrap: balance; }

.lrn-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.lrn-section {
  display: block; background: var(--card); border: 1px solid var(--rule); border-radius: 2px;
  padding: clamp(22px, 2.6vw, 30px); box-shadow: 6px 6px 0 rgba(22, 21, 17, .08);
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.lrn-section:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 rgba(22, 21, 17, .08); }
.lrn-section:active { transform: translate(0, 0); box-shadow: 4px 4px 0 rgba(22, 21, 17, .08); }
.lrn-section:focus-visible { transform: translate(-2px, -2px); }
.lrn-section-n { font-size: 13px; font-weight: 600; letter-spacing: .16em; color: var(--blue); }
.lrn-section h2 { font-size: 1.36rem; font-weight: 700; letter-spacing: -.01em; margin: 10px 0 10px; }
.lrn-section p { font-size: .97rem; line-height: 1.6; color: var(--ink2); }
.lrn-section-go { display: inline-block; margin-top: 16px; font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
@media (max-width: 900px) { .lrn-sections { grid-template-columns: 1fr; } }

.lrn-block { margin-top: clamp(40px, 5vw, 62px); }

/* ---------- Guide list ---------- */
.lrn-guide-list { border-top: 1px solid var(--hair); }
.lrn-guide-list li { border-bottom: 1px solid var(--hair); }
.lrn-guide-list a {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 18px; align-items: baseline;
  padding: 18px 8px; transition: background 180ms var(--ease), padding-left 180ms var(--ease);
}
.lrn-guide-list a:hover { background: var(--blue-dim); padding-left: 14px; }
.lrn-guide-list a:focus-visible { background: var(--blue-dim); }
.lrn-guide-list a:active { background: rgba(36, 56, 240, .12); }
.lrn-guide-n { color: var(--blue); font-weight: 600; font-size: 14px; }
.lrn-guide-main { display: grid; gap: 3px; }
.lrn-guide-main b { font-size: 1.06rem; font-weight: 600; }
.lrn-guide-main span { font-size: .93rem; color: var(--ink2); line-height: 1.5; }
.lrn-guide-time { font-size: 13px; color: var(--ink3-aa); white-space: nowrap; }
@media (max-width: 640px) {
  .lrn-guide-list a { grid-template-columns: 34px 1fr; gap: 12px; }
  .lrn-guide-time { grid-column: 2; }
}

.lrn-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: clamp(26px, 3vw, 36px); }
.lrn-card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 2px;
  padding: clamp(20px, 2.4vw, 28px); box-shadow: 6px 6px 0 rgba(22, 21, 17, .08);
}
.lrn-card-n { font-size: 13px; font-weight: 600; letter-spacing: .16em; color: var(--blue); }
.lrn-card h2 { font-size: 1.24rem; font-weight: 700; letter-spacing: -.01em; margin: 8px 0 6px; line-height: 1.2; }
.lrn-card h2 a { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--hair2); }
.lrn-card h2 a:hover { color: var(--blue); text-decoration-color: var(--blue); text-decoration-thickness: 2px; }
.lrn-card-sub { font-size: .95rem; color: var(--ink); font-weight: 500; margin-bottom: 10px; line-height: 1.45; }
.lrn-card p { font-size: .95rem; line-height: 1.6; color: var(--ink2); }
.lrn-card-foot { display: block; margin-top: 14px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3-aa); }
@media (max-width: 780px) { .lrn-cards { grid-template-columns: 1fr; } }

/* ---------- Article ---------- */
.lrn-art-head { padding-bottom: clamp(20px, 3vw, 28px); border-bottom: 1px solid var(--hair); }
.lrn-status {
  margin-top: 14px; padding: 12px 16px; border-left: 3px solid var(--orange);
  background: rgba(240, 74, 0, .06); color: var(--orange-ink); font-size: .95rem; line-height: 1.55;
}

.lrn-toc {
  background: var(--paper2); border: 1px solid var(--hair2); border-radius: 2px;
  padding: clamp(18px, 2.4vw, 24px); margin: clamp(24px, 3.4vw, 34px) 0;
}
.lrn-toc h2 { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink3-aa); margin-bottom: 14px; }
.lrn-toc ol { display: grid; gap: 8px; counter-reset: toc; }
.lrn-toc li { counter-increment: toc; }
.lrn-toc a { font-family: var(--mono); font-size: 14px; color: var(--ink2); display: flex; gap: 11px; align-items: baseline; padding: 2px; }
.lrn-toc a::before { content: counter(toc, decimal-leading-zero); color: var(--blue); font-weight: 600; flex: none; }
.lrn-toc a:hover { color: var(--blue); }

/* 1ch is 1.388 real characters in Space Grotesk, so this cap is ~97 real
   characters — it trims the widest desktop lines without re-flowing the 800px
   article. A tighter measure is a separate editorial decision. */
.lrn-prose { font-size: clamp(1rem, 1.35vw, 1.06rem); line-height: 1.72; color: var(--ink2); margin-top: clamp(24px, 3vw, 32px); max-width: 70ch; }
.lrn-prose p { margin: 0 0 18px; }
.lrn-prose h2 {
  font-family: var(--ui); font-weight: 700; font-size: clamp(1.3rem, 2.2vw, 1.56rem);
  line-height: 1.18; letter-spacing: -.01em; color: var(--ink);
  margin: clamp(34px, 4.4vw, 46px) 0 14px; scroll-margin-top: calc(var(--nav-h) + 24px);
}
.lrn-prose h3 {
  font-family: var(--ui); font-weight: 600; font-size: 1.12rem; color: var(--ink);
  margin: clamp(26px, 3.2vw, 32px) 0 10px; scroll-margin-top: calc(var(--nav-h) + 24px);
}
.lrn-prose strong { color: var(--ink); font-weight: 600; }
.lrn-prose em { font-style: italic; }
.lrn-prose code { font-family: var(--mono); font-size: .9em; background: var(--paper2); padding: 2px 6px; border-radius: 2px; color: var(--ink); }
/* These blocks are prose formulas and worked arithmetic, not code where column
   alignment carries meaning — so they wrap. With the UA default `pre` the widest
   one (729px) was clipped at EVERY width the site can render, 1440 included,
   with no scrollbar, no fade and no tab stop: `= $3.00 × 25% = $0` read as a
   wrong answer. pre-wrap keeps the authored newlines; overflow-x stays as a
   backstop for a token longer than the line. */
.lrn-prose pre {
  background: var(--dk); color: var(--dktxt); border-radius: 2px;
  padding: 18px 20px; margin: 0 0 20px;
  white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto;
}
.lrn-prose pre code { background: none; padding: 0; color: inherit; font-size: 14px; line-height: 1.65; }
.lrn-prose ul, .lrn-prose ol { margin: 2px 0 20px; display: grid; gap: 10px; }
.lrn-prose li { position: relative; padding-left: 26px; }
.lrn-prose ul li::before { content: ""; position: absolute; left: 5px; top: .66em; width: 6px; height: 6px; background: var(--blue); }
.lrn-prose ol { counter-reset: step; }
.lrn-prose ol li { counter-increment: step; }
.lrn-prose ol li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  font-family: var(--mono); font-size: .82em; font-weight: 600; color: var(--blue);
}
.lp-link, .lrn-prose a {
  color: var(--blue); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.lp-link:hover, .lrn-prose a:hover { text-decoration-thickness: 2px; }

/* ---------- Q + term lists ---------- */
.lrn-qlist, .lrn-termlist { border-top: 1px solid var(--hair); }
.lrn-qlist li, .lrn-termlist li { border-bottom: 1px solid var(--hair); }
.lrn-qlist a, .lrn-termlist a {
  display: grid; gap: 4px; padding: 16px 8px;
  transition: background 180ms var(--ease), padding-left 180ms var(--ease);
}
.lrn-qlist a:hover, .lrn-termlist a:hover { background: var(--blue-dim); padding-left: 14px; }
.lrn-qlist a:focus-visible, .lrn-termlist a:focus-visible { background: var(--blue-dim); }
.lrn-qlist a:active, .lrn-termlist a:active { background: rgba(36, 56, 240, .12); }
.lrn-qlist b, .lrn-termlist b { font-size: 1.02rem; font-weight: 600; color: var(--ink); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.lrn-qlist span, .lrn-termlist span { font-size: .94rem; color: var(--ink2); line-height: 1.5; }
.lrn-partial {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--orange-ink); background: rgba(240, 74, 0, .1);
  padding: 2px 7px; border-radius: 2px;
}
.lrn-expand { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink3-aa); }

.lrn-alpha { display: flex; flex-wrap: wrap; gap: 4px; margin: clamp(22px, 3vw, 30px) 0 6px; }
.lrn-alpha a {
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hair2); border-radius: 2px; color: var(--ink2);
  transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.lrn-alpha a:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lrn-alpha a:active { background: var(--blue); border-color: var(--blue); color: var(--paper); }

.lrn-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0 4px; }
.lrn-filter > .mono { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink3-aa); margin-right: 4px; }
.lrn-filter button {
  font-family: var(--mono); font-size: 13px; letter-spacing: .04em;
  padding: 6px 12px; border: 1px solid var(--hair2); border-radius: 2px;
  background: none; color: var(--ink2); cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.lrn-filter button:hover { border-color: var(--ink); color: var(--ink); }
.lrn-filter button:active { background: var(--blue-dim); }
.lrn-filter button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.lrn-letter {
  font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: .2em;
  color: var(--blue); margin-bottom: 10px; scroll-margin-top: calc(var(--nav-h) + 24px);
}

/* ---------- Related ---------- */
.lrn-related {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(22px, 3vw, 34px);
  margin-top: clamp(38px, 5vw, 54px); padding-top: clamp(24px, 3vw, 32px); border-top: 1px solid var(--hair);
}
@media (max-width: 720px) { .lrn-related { grid-template-columns: 1fr; } }
.lrn-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lrn-chips a {
  display: inline-block; font-family: var(--mono); font-size: 13px;
  padding: 5px 11px; border: 1px solid var(--hair2); border-radius: 2px; color: var(--ink2);
  transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.lrn-chips a:hover { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.lrn-chips a:active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.lrn-links { display: grid; gap: 9px; }
.lrn-links a { font-size: .97rem; color: var(--ink2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hair2); }
.lrn-links a:hover { color: var(--blue); text-decoration-color: var(--blue); }

/* ---------- CTA ---------- */
.lrn-cta {
  margin-top: clamp(44px, 6vw, 68px); padding: clamp(24px, 3.4vw, 34px);
  background: var(--paper2); border: 1px solid var(--hair2); border-radius: 2px;
  display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.lrn-cta p { font-size: .99rem; line-height: 1.6; color: var(--ink2); max-width: 62ch; }
.lrn-cta .btn { white-space: nowrap; }

@media (max-width: 560px) {
  .lrn-cta { flex-direction: column; align-items: stretch; }
  .lrn-cta .btn { text-align: center; }
}
