/* ==========================================================================
   Internal pages — layout layer (v6)
   Loaded LAST on: benchmarks, use-cases, about, contact, after-install,
   privacy, license, 404. Page layout only: section structure, the left
   section-nav, illustration placement, the indigo moment, internal-page
   type floors + contrast. Global tokens/components live in shared sheets.
   ========================================================================== */

/* ---------- D6: real-device guards (internal pages only) ---------- */
/* Android Chrome font inflation + consistent text rendering */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Quiet indigo tap flash instead of the default gray */
body { -webkit-tap-highlight-color: rgba(37, 59, 85, 0.16); }

/* Notched phones in landscape: keep nav content clear of the camera/home zones */
@media (orientation: landscape) and (pointer: coarse) {
  .site-nav-inner {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
}
/* Home-indicator clearance at page bottom */
.site-footer, .footer-minimal {
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
/* iOS momentum scroll on the internal scrollers */
.iv6-toc ol, .table-scroll { -webkit-overflow-scrolling: touch; }

/* ---------- Indigo moment: one per page, palette mirrors .continuity --- */
.iv6-indigo {
  background: #253b55;
  color: #fff8ed;
  border-radius:11px;
  padding: 30px 34px;
}
.iv6-indigo,
.iv6-indigo p,
.iv6-indigo li { color: #e1e5eb; }
.iv6-indigo h1,
.iv6-indigo h2,
.iv6-indigo h3,
.iv6-indigo .section-title { color: #fff8ed; }
.iv6-indigo .section-lead { color: #e1e5eb; }
.iv6-indigo .section-title em,
.iv6-indigo em { color: #edcd92; font-style: normal; }
.iv6-indigo strong,
.iv6-indigo b { color: #fff8ed; }
.iv6-indigo a { color: #edcd92; text-decoration: underline; text-underline-offset: 2px; }
.iv6-indigo a:hover { color: #fff8ed; }
.iv6-indigo code { background: rgba(255, 248, 237, 0.14); color: #edcd92; }
.iv6-indigo .bm-col-head,
.iv6-indigo .bm-toc-title,
.iv6-indigo .uc-sech { color: #edcd92; }
.iv6-indigo .bm-list-soft li { color: #aeb9c9; }
.iv6-indigo .updated { color: #edcd92; }

/* D3 — indigo section: compact, two clean columns split by a hairline */
#what-numbers-mean { padding-block: clamp(40px, 5vw, 60px); padding-inline: clamp(28px, 5vw, 56px); }
#what-numbers-mean .bm-prose { max-width: none; margin-bottom: 22px; }
#what-numbers-mean .bm-prose:last-child { margin-bottom: 0; }
#what-numbers-mean .bm-2col {
  max-width: none;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 26px;
}
#what-numbers-mean .bm-col { padding: 0; }
#what-numbers-mean .bm-col:first-child { padding-right: 38px; }
#what-numbers-mean .bm-col:last-child {
  padding-left: 38px;
  border-left: 1px solid rgba(255, 248, 237, 0.22);
}
#what-numbers-mean .bm-col-head { margin-bottom: 14px; }
#what-numbers-mean .bm-list { list-style: none; padding-left: 0; margin-bottom: 0; }
#what-numbers-mean .bm-list li { position: relative; padding-left: 22px; margin-bottom: 9px; }
#what-numbers-mean .bm-list li:before {
  content: "\2014";
  position: absolute;
  left: 0;
  color: #edcd92;
}
#what-numbers-mean .bm-list li:last-child { margin-bottom: 0; }
@media (max-width: 800px) {
  #what-numbers-mean .bm-2col { grid-template-columns: 1fr; }
  #what-numbers-mean .bm-col:first-child { padding-right: 0; }
  #what-numbers-mean .bm-col:last-child {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid rgba(255, 248, 237, 0.22);
    padding-top: 24px;
    margin-top: 24px;
  }
}
/* Paper cards inside an indigo section keep ink text */
.iv6-indigo .ai-prompt,
.iv6-indigo .ai-prompt .q { color: var(--ink); }
.iv6-indigo .ai-prompt .why { color: var(--ink-faint); }
.iv6-indigo .ai-prompt .q code { background: var(--sage); color: var(--moss-deep); }

/* Full-bleed variant for whole sections */
section.iv6-indigo {
  border-radius:11px;
  padding: 72px 0;
}

/* ---------- Section illustrations (sumi-ink assets, one per section) --- */
.iv6-illo {
  float: right;
  width: min(360px, 38%);
  margin: 6px 0 20px 40px;
}
.iv6-illo img { width: 100%; height: auto; display: block; }

/* Hero-corner art for pages continuity.js does not reach (no main>section) */
.legal-page, .contact-page, .notfound-page { position: relative; isolation: isolate; }
.iv6-hero-art {
  position: absolute;
  top: 120px;
  right: max(24px, 6%);
  width: min(360px, 28vw);
  opacity: 0.8;
  pointer-events: none;
  z-index: 0;
}
.legal-page .container-prose,
.contact-page .container-prose,
.notfound-page .container { position: relative; z-index: 1; }
/* Pages now carry real ink art + an indigo head — drop the injected enso mark */
.legal-page .container-prose:before,
.contact-page .container-prose:before { display: none; }

@media (max-width: 1400px) {
  .iv6-hero-art { width: 240px; }
}
@media (max-width: 1080px) {
  .iv6-hero-art { width: 200px; top: 100px; }
}
@media (max-width: 860px) {
  .iv6-illo { float: none; width: min(320px, 74%); margin: 8px auto 26px; }
  .iv6-hero-art { position: static; width: min(280px, 66%); margin: 0 auto 28px; display: block; }
}

/* Anchor jumps must clear the fixed nav */
main [id] { scroll-margin-top: 104px; }

/* ==========================================================================
   Benchmarks — left sticky section nav + column rhythm
   ========================================================================== */
.iv6-bm-grid {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  column-gap: 64px;
  align-items: start;
}

/* .bm-toc base styling comes from zen.css; .iv6-toc owns its placement */
.iv6-toc {
  position: sticky;
  top: 104px;
  max-width: none;
  padding: var(--section-y-tight, 56px) 0;
  font-size: 14px;
}
.iv6-toc ol { display: grid; gap: 6px; }
.iv6-toc a {
  display: block;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 14px;
  min-height: 0;
}
.iv6-toc a:hover { color: var(--moss); background: var(--paper-solid); }
/* Active = filled pill + indigo label, no edge bar */
.iv6-toc li.active a {
  color: var(--moss);
  background: rgba(37, 59, 85, 0.11);
  font-weight: 600;
}
.iv6-toc .bm-toc-title { font-size: 14px; }

.iv6-bm-grid .bm-section {
  padding: var(--section-y-tight, 56px) 0;
  border-top: 1px solid var(--line-soft);
}
.iv6-bm-grid .bm-section:first-of-type { border-top: none; }
.bm-hero { padding-bottom: 64px; }

/* Sections column must not force the grid wide on small screens */
.iv6-bm-sections { min-width: 0; }
/* Sections keep their .container wrappers in markup; inside the rail they
   fill the column instead of re-centering. */
.iv6-bm-sections .container { width: 100%; margin: 0; }

/* Readability floors on benchmark furniture */
.bm-note p { font-size: 16px; }
.bm-list li { font-size: 16px; }
.bm-section table { font-size: 16px; }
.bm-section th { font-size: 14px; }
.bm-col-head { font-size: 14px; }
.bench-card > span { font-size: 15px !important; }
.leader-badge { font-size: 14px; }
/* Shared chrome runs under 14px on these pages; floor it locally */
.site-nav .nav-cta { font-size: 14px; }

/* ==========================================================================
   Use cases
   ========================================================================== */
.uc-strip.iv6-indigo { margin-bottom: 40px; }
.uc-strip.iv6-indigo em { color: #edcd92; }

/* Detail view is a swapped-in top-level section; it needs nav clearance too */
.uc-detail { padding-top: 145px; }

/* Type floors + contrast on use-case furniture */
.uc-catchip, .uc-tag, .uc-card .save, .uc-rel .rk, .uc-rel .rs,
.uc-askline .ql, .uc-meta .mh, .uc-sech, .uc-srow .lab, .uc-srow .tot,
.uc-coltot, .uc-step .i, .uc-badge { font-size: 14px; }
.uc-coltot small { font-size: 13px; }
.uc-card p { font-size: 16px; }
.uc-step { font-size: 16px; }
.uc-meta .mv { font-size: 16px; }
.uc-colhead { font-size: 16px; }
.uc-stat span { font-size: 14px; }
.uc-chip { font-size: 15px; }

/* Ochre #b47a30 is ~3.2:1 on ivory — text uses the deepened shared token */
.uc-col.before .uc-colhead { color: var(--ochre-text, #7c5220); }
.uc-col.before .uc-badge { color: var(--ochre-text, #7c5220); background: rgba(180, 122, 48, 0.16); }

.uc-time { margin-top: 48px; }

/* ==========================================================================
   About — unify the top block with the story rail
   ========================================================================== */
@media (min-width: 861px) {
  .ab-hero-grid {
    grid-template-columns: minmax(0, 640px) auto;
    justify-content: space-between;
  }
}
@media (max-width: 860px) {
  .ab-hero-grid { grid-template-columns: 1fr; text-align: left; }
  .ab-photo { justify-content: flex-start; }
}
.ab-hero .section-lead { max-width: 54ch; }
.ab-photo img { width: 180px; height: 180px; }

/* Story column + illustrated side rail on one shared left edge */
.ab-main .container {
  display: grid;
  grid-template-columns: minmax(0, 660px) minmax(200px, 1fr);
  column-gap: 72px;
  align-items: start;
}
.ab-side { display: grid; gap: 36px; justify-items: start; }
.ab-side-art { width: min(340px, 100%); height: auto; }
.ab-socials { margin-top: 0; }
.ab-social-row { flex-wrap: wrap; }

/* The pull-quote becomes this page's indigo moment */
.ab-quote.iv6-indigo { margin: 36px 0; }
.ab-quote.iv6-indigo p { color: #fff8ed; }

/* ==========================================================================
   After-install
   ========================================================================== */
.ai-note { font-size: 16px; }
.ai-prompt { flex-wrap: wrap; }
.ai-prompt .q { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.ai-prompt .why { font-size: 14px; flex-basis: 100%; }
.ai-hero { padding-bottom: 56px; }

/* ==========================================================================
   Contact / legal / 404
   ========================================================================== */
.iv6-contact-band { margin: 8px 0 26px; }
.iv6-contact-band p { margin: 0; }
.iv6-contact-band .contact-email { color: #edcd92; }

.iv6-legal-head { margin-bottom: 40px; }
.iv6-legal-head h1 { margin-bottom: 10px; }
.iv6-legal-head .updated { margin-bottom: 0; }

.nf-link.iv6-indigo { border-color: transparent; }
.nf-link.iv6-indigo:hover { border-color: #edcd92; }
.nf-link.iv6-indigo .nf-mark { color: #edcd92; }
.nf-link.iv6-indigo .nf-desc { color: #e1e5eb; }
.nf-desc { font-size: 14px; }

/* 404 — dry, literate register */
.nf-kicker {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ochre-text, #7c5220);
  margin-bottom: 16px;
}
.nf-links-lead {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 44px 0 18px;
}
.nf-foot {
  margin-top: 44px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-faint);
  max-width: 52ch;
}

/* ==========================================================================
   Narrow widths — collapse the benchmarks rail into a scrollable top bar
   ========================================================================== */
@media (max-width: 1023px) {
  .iv6-bm-grid { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
  .iv6-toc {
    top: 96px;
    min-width: 0;
    z-index: var(--z-sticky);
    padding: 0;
    margin: 0 0 8px;
    background: rgba(250, 246, 237, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-soft);
    display: block;
  }
  .iv6-toc .bm-toc-title { display: none; }
  .iv6-toc ol {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 4px;
    scrollbar-width: none;
  }
  .iv6-toc ol::-webkit-scrollbar { display: none; }
  .iv6-toc a {
    white-space: nowrap;
    padding: 10px 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
  }
  .iv6-toc li.active a { background: rgba(37, 59, 85, 0.11); color: var(--moss); font-weight: 600; }
}

@media (max-width: 900px) {
  .ab-main .container { grid-template-columns: 1fr; }
  .ab-side { justify-items: center; text-align: center; }
  .ab-social-row { justify-content: center; }
  .ab-hero-grid { justify-content: start; }
}

@media (max-width: 700px) {
  .bm-2col { grid-template-columns: 1fr; }
  section.iv6-indigo { padding: 56px 0; }
  .iv6-indigo { padding: 24px; }
  .iv6-bm-grid .bm-section { padding: 44px 0; }
}

/* ---------- Unbreakable content must wrap, not clip ---------- */
.ai-step code, .legal-page a, .contact-page a {
  overflow-wrap: anywhere;
}
/* #30 repo URLs: full URL stays readable — breaks only at the <wbr> path
   boundaries in the markup, never mid-word, never ellipsized. */
.ab-proj-link { display: inline; overflow-wrap: break-word; }
.ab-proj-link svg { vertical-align: -2px; margin-right: 6px; }
.ab-proj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ai-steps { grid-template-columns: minmax(0, 1fr); }
.ai-step { min-width: 0; }
.ab-proj-card { min-width: 0; }
@media (max-width: 860px) {
  .ab-proj-grid { grid-template-columns: minmax(0, 1fr); }
}


/* ---------- v6 round-4: Fable review fixes ---------- */

/* #2 benchmark tables: never squeeze columns — scroll locally, with a fade hint.
   Fade applies only where the 560px table can actually overflow its box; above
   660px it fits, and a permanent fade would read as clipped text. */
.table-scroll table { min-width: 560px; }
@media (max-width: 660px) {
  .table-scroll {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), #0000);
    mask-image: linear-gradient(90deg, #000 calc(100% - 36px), #0000);
  }
}

/* #12 collapsed toc: right-edge fade + snap so truncation reads as scrollable */
@media (max-width: 1023px) {
  .iv6-toc ol {
    scroll-snap-type: x proximity;
    scroll-padding-inline: 16px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), #0000);
    mask-image: linear-gradient(90deg, #000 calc(100% - 36px), #0000);
  }
  .iv6-toc li { scroll-snap-align: start; }
}

/* #13 bm-hero art must not sit on the stat pills at phone widths */
@media (max-width: 600px) {
  .bm-hero .page-ink-art {
    position: static;
    display: block;
    width: 70%;
    height: auto;
    max-height: none;
    margin: 8px auto -8px;
  }
}

/* #15 the contact email must not hyphen-break */
.contact-email { white-space: nowrap; font-size: clamp(15px, 4.5vw, 19px); }

/* #16 readable measure on prose-heavy elements. DM Sans' ch is ~0.8em wide,
   so 68ch measured ~105 real characters; 46ch lands ~70. */
.bm-prose, .bm-prose p, .bm-list li, .bm-sources li, .bench-card p { max-width: 46ch; }
#what-numbers-mean .bm-prose { max-width: none; }
.ab-proj-card p, .uc-time-foot, .iv6-indigo .updated { max-width: 46ch; }

/* #31 minimal footer separators: dots are decoration on items, not free text */
.footer-minimal .container { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; }
.footer-minimal .container a { position: relative; }
.footer-minimal .container a + a::before {
  content: "\00b7";
  position: absolute;
  left: -11px;
  color: var(--ink-faint);
  pointer-events: none;
}

/* #32 internal CTA band aligns to the rail like every other head */
.cta-band { text-align: left; }
.cta-band p { margin-left: 0; margin-right: 0; }

/* #35 step titles: drop balance where the column is narrow */
@media (max-width: 400px) {
  .ai-step h3 { text-wrap: wrap; }
}

/* #14 hero stats: 4-up row on desktop, even 2x2 on phone */
@media (min-width: 1001px) {
  .uc-hero-grid { grid-template-columns: 1fr; }
  .uc-hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)) 220px; gap: 20px; margin-top: 8px; align-items: stretch; }
  .uc-hero-stats:before { grid-column: 5; grid-row: 1; height: auto; min-height: 88px; background-position: right center; }
  .uc-stat { text-align: left; padding: 14px 18px; }
  .uc-stat b { font-size: 26px; }
  .uc-stat span { font-size: 14px; white-space: nowrap; }
}
.uc-stat { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
@media (max-width: 860px) {
  /* Labels like "TOKENS AT REST" wrap to a second line before "LOCAL" does;
     equal label height keeps the rows aligned. */
  .uc-stat span { min-height: 2.4em; }
}
@media (max-width: 640px) {
  .uc-hero-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* #1 about hero: portrait and intro never share a row on phones */
@media (max-width: 600px) {
  .ab-hero-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* #21 faq-section heads on internal pages sit on the rail, not centered */
.faq-section .section-kicker, .faq-section .section-title, .faq-section .section-lead {
  text-align: left; margin-left: 0; margin-right: 0;
}
