/* ============================================================================
   /learn/ — the in-depth site. Reading surface, not a sales surface.
   Loads on top of styles.css. Optimised for comprehension: one column,
   generous measure, real heading hierarchy, quiet colour.
   ========================================================================== */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --measure: 68ch;
}

/* ── learn nav ───────────────────────────────────────────────────────────── */
.learn-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--hairline);
  background: rgba(10, 12, 16, 0.86);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.learn-bar > .shell {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 60px;
}
.learn-bar .wordmark {
  flex: none;
}
.learn-bar .tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.learn-bar .tabs::-webkit-scrollbar {
  display: none;
}
.learn-bar .tabs a {
  flex: none;
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.learn-bar .tabs a[aria-current='page'] {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.22);
}
@media (hover: hover) and (pointer: fine) {
  .learn-bar .tabs a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
  }
}
.learn-bar .btn {
  flex: none;
}
@media (max-width: 860px) {
  .learn-bar > .shell {
    height: auto;
    flex-wrap: wrap;
    padding-block: 12px;
    gap: 10px;
  }
  .learn-bar .tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
}

/* ── doc layout ──────────────────────────────────────────────────────────── */
.doc {
  position: relative;
  z-index: 1;
  padding-block: clamp(40px, 6vw, 76px) clamp(56px, 8vw, 104px);
}
.doc-head {
  max-width: var(--measure);
  margin-bottom: clamp(36px, 5vw, 56px);
}
.doc-head .crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 18px;
}
.doc-head .crumb a {
  color: var(--ink-faint);
  transition: color 0.2s;
}
.doc-head .crumb a:hover {
  color: var(--cyan);
}
.doc-head h1 {
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.doc-head .standfirst {
  margin-top: 18px;
  font-size: clamp(1rem, 1.7vw, 1.125rem);
  line-height: 1.65;
  color: var(--ink-muted);
}

/* Two-column: content + sticky table of contents */
.doc-body {
  display: grid;
  gap: 40px;
}
@media (min-width: 1040px) {
  .doc-body {
    grid-template-columns: minmax(0, 1fr) 216px;
    gap: 56px;
    align-items: start;
  }
}

.toc {
  display: none;
}
@media (min-width: 1040px) {
  .toc {
    display: block;
    position: sticky;
    top: 84px;
  }
}
.toc h2 {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}
.toc a {
  display: block;
  padding: 7px 0 7px 12px;
  border-left: 1px solid var(--hairline);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-muted);
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.toc a:first-of-type {
  margin-top: 10px;
}
.toc a[aria-current='true'] {
  border-left-color: var(--emerald);
  color: var(--ink);
}
@media (hover: hover) and (pointer: fine) {
  .toc a:hover {
    color: var(--ink);
    border-left-color: var(--cyan);
  }
}

/* ── prose ───────────────────────────────────────────────────────────────── */
/* `min-width: 0` is load-bearing. A grid item defaults to min-width:auto, which
   means it refuses to shrink below its widest child — so the 460px table inside
   .tbl escaped its own overflow-x:auto and pushed the whole page sideways on
   mobile. Without this, every page carrying a table scrolls horizontally. */
.doc-body > * {
  min-width: 0;
}
.prose {
  min-width: 0;
  max-width: var(--measure);
}
.prose > * + * {
  margin-top: 20px;
}

/* Real hierarchy: 3.1rem → 1.6rem → 1.15rem → 1rem. Each step ≥1.25 ratio. */
.prose h2 {
  margin-top: clamp(44px, 5.5vw, 64px);
  font-size: clamp(1.4rem, 2.6vw, 1.6rem);
  line-height: 1.2;
  letter-spacing: -0.032em;
  scroll-margin-top: 84px;
}
.prose h2 + * {
  margin-top: 14px;
}
.prose h3 {
  margin-top: 34px;
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -0.026em;
  color: var(--ink);
}
.prose h3 + * {
  margin-top: 10px;
}
.prose p,
.prose li {
  font-size: 1rem;
  line-height: 1.72;
  color: var(--ink-muted);
}
.prose strong {
  color: var(--ink);
  font-weight: 600;
}
.prose a:not(.btn) {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-color: rgba(6, 182, 212, 0.4);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}
.prose a:not(.btn):hover {
  text-decoration-color: var(--cyan);
}
.prose ul,
.prose ol {
  display: grid;
  gap: 11px;
  padding-left: 0;
}
.prose ul > li {
  position: relative;
  padding-left: 22px;
}
.prose ul > li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--emerald);
}
.prose ol {
  counter-reset: n;
}
.prose ol > li {
  position: relative;
  padding-left: 30px;
  counter-increment: n;
}
.prose ol > li::before {
  content: counter(n);
  position: absolute;
  left: 0;
  top: 0.1em;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--emerald);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}
.prose blockquote {
  border-left: 2px solid rgba(16, 185, 129, 0.5);
  padding: 4px 0 4px 20px;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin-block: 40px;
}

/* callouts */
.note {
  display: flex;
  gap: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.025);
  padding: 16px 18px;
}
.note svg {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 3px;
  color: var(--cyan);
}
.note p {
  font-size: 0.9375rem !important;
  line-height: 1.65 !important;
}
.note.warn {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.06);
}
.note.warn svg {
  color: #fbbf24;
}
.note.good {
  border-color: rgba(16, 185, 129, 0.26);
  background: rgba(16, 185, 129, 0.055);
}
.note.good svg {
  color: var(--emerald);
}

/* data table inside prose */
.prose .tbl {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}
.prose table {
  min-width: 460px;
  font-size: 0.875rem;
}
.prose thead th {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.prose tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--ink-muted);
  vertical-align: top;
  line-height: 1.6;
}
.prose tbody tr:last-child td {
  border-bottom: 0;
}
.prose tbody td:first-child {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

/* ── hub cards ───────────────────────────────────────────────────────────── */
.hub-grid {
  display: grid;
  gap: 14px;
  margin-top: 36px;
}
@media (min-width: 680px) {
  .hub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.hub-card {
  display: block;
  padding: 22px;
  transition: border-color 0.25s var(--ease-out), transform 0.2s var(--ease-out);
}
.hub-card .n {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: var(--emerald);
}
.hub-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 1.125rem;
  letter-spacing: -0.03em;
}
.hub-card h2 svg {
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
  transition: transform 0.25s var(--ease-out), color 0.25s var(--ease-out);
}
.hub-card p {
  margin-top: 9px;
  font-size: 0.875rem;
  line-height: 1.65;
}
.hub-card .mins {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
@media (hover: hover) and (pointer: fine) {
  .hub-card:hover h2 svg {
    transform: translate(2px, -2px);
    color: var(--cyan);
  }
}
.hub-card:active {
  transform: scale(0.995);
}

/* ── next / prev pager ───────────────────────────────────────────────────── */
.pager {
  display: grid;
  gap: 12px;
  max-width: var(--measure);
  margin-top: clamp(48px, 6vw, 72px);
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
}
@media (min-width: 620px) {
  .pager {
    grid-template-columns: 1fr 1fr;
  }
}
.pager a {
  padding: 16px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.25s var(--ease-out), background 0.25s var(--ease-out);
}
.pager a.next {
  text-align: right;
}
.pager .dir {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pager .ttl {
  margin-top: 5px;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}
@media (hover: hover) and (pointer: fine) {
  .pager a:hover {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.05);
  }
}

/* ── closing CTA on every learn page ─────────────────────────────────────── */
.learn-cta {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--hairline);
  padding-block: clamp(48px, 7vw, 80px);
}
.learn-cta .inner {
  max-width: 44rem;
}
.learn-cta h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  letter-spacing: -0.038em;
}
.learn-cta p {
  margin-top: 14px;
  font-size: 0.9375rem;
  line-height: 1.7;
}
.learn-cta .row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

/* ── skip link (shared) ──────────────────────────────────────────────────── */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
}
.skip:focus {
  left: 12px;
  top: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--emerald);
  color: var(--base-950);
  font-size: 0.8125rem;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .hub-card:active,
  .hub-card:hover h2 svg {
    transform: none;
  }
}
