/* A quiet reading room within the shared Habit Hatch frame. */
.reader-shell { overflow-wrap: break-word; }
.reader-intro { max-width: 67ch; margin-bottom: 1.5rem; }
.reader-intro h1 { max-width: 26ch; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.15; letter-spacing: -.025em; }
.reader-back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: .75rem; color: var(--terracotta-light); }
.reader-lede, .reading-intro, .reading-copy { max-width: 67ch; font-size: 1.125rem; line-height: 1.65; color: var(--cream-soft); }
.reader-lede { margin-bottom: 2rem; }
.reader-prose { max-width: none; }
.reading-intro { margin-bottom: 1.5rem; }
.reading-intro p { margin: 0 0 1rem; }
.reading-layout { display: grid; gap: 1rem; }
.reading-copy { min-width: 0; }
.reader-prose section { padding-block: 2rem .25rem; border: 0; }
.reader-prose section:first-child { padding-top: 1rem; }
.reader-prose h2 { font-size: clamp(1.5rem, 2.3vw, 1.875rem); line-height: 1.25; scroll-margin-top: 1.5rem; }
.reader-prose h3 { font-size: 1.25rem; line-height: 1.35; margin: 2rem 0 .5rem; }
.reader-prose p { margin-block: 1rem; }
.reader-index { align-self: start; min-width: 0; border-block: 1px solid var(--line); }
.reader-index summary, .calculation summary { cursor: pointer; padding-block: .75rem; min-height: 48px; font-weight: 700; color: var(--cream); }
.reader-index ul { list-style: none; padding: 0; margin: .5rem 0 1rem; }
.reader-index a { display: block; line-height: 1.45; min-height: 44px; padding-block: .6rem; color: var(--terracotta-light); }
.calculation { margin-top: 2rem; padding-inline: 1rem; border: 1px solid var(--line); }
.reader-prose blockquote { margin: 1.5rem 0; padding: .1rem 1.25rem; border-left: 3px solid var(--sage); background: var(--ink-soft); }
.guide-table table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.guide-table th, .guide-table td { padding: 1rem .65rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide-table th { color: var(--cream); }
.guide-table td { color: var(--cream-soft); }
.guide-list { max-width: 48rem; margin-block: 1.5rem 2rem; }
.guide-entry { display: grid; gap: .25rem; padding-block: 1rem; border-top: 1px solid var(--line); }
.guide-entry h2 { font-size: clamp(1.375rem, 2.2vw, 1.75rem); line-height: 1.25; letter-spacing: -.025em; }
.guide-entry p { max-width: 60ch; margin: 0; color: var(--cream-soft); }
.guide-entry a { display: flex; align-items: center; min-height: 44px; padding-block: .25rem; text-decoration-thickness: 1px; }
.guide-entry a, .reader-next a, .reader-lede a { color: var(--terracotta-light); text-underline-offset: .2em; }
.reader-next { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.reader-next h2 { font-size: 1.75rem; }
.reader-next p { max-width: 65ch; color: var(--cream-soft); }
.reader-tools { display: grid; grid-template-columns: 1fr 1fr; align-items: start; margin-bottom: .75rem; }
.reader-tools .reader-back { grid-area: 1 / 1; justify-self: start; z-index: 1; margin: 0; font-size: 1rem; }
.reader-tools .reader-index { grid-area: 1 / 1 / auto / -1; border: 0; }
.reader-tools summary { width: max-content; max-width: 100%; margin-left: auto; padding-block: .55rem; min-height: 44px; font-size: 1rem; }
.reader-tools .reader-index[open] { border-bottom: 1px solid var(--line); }
.guide-reader .reading-layout { display: block; }
.guide-reader .reading-intro { margin-bottom: .5rem; }
@media (max-width: 45.99rem) {
  .reader-shell:has(.guide-reader), .reader-shell:has(.guide-list) { padding-top: 1rem; }
  .reader-shell:has(.guide-list) .reader-intro { margin-bottom: 1rem; }
  .reader-shell:has(.guide-list) .reader-lede { margin-top: 0; margin-bottom: 1.25rem; }
}
@media (min-width: 1100px) {
  .reading-intro, .reader-intro:has(.reader-back) { margin-left: 18rem; }
  .reading-layout { grid-template-columns: 15rem minmax(0, 1fr); gap: 3rem; }
  .reader-index { position: sticky; top: 1.5rem; border: 0; }
  /* ONE native index, expanded visually only where a rail fits. */
  .reader-index::details-content { content-visibility: visible; display: block; }
  .reader-index > nav { display: block; }
  .reader-index summary { display: block; }
  .reader-prose section:first-child { padding-top: 0; }
  .guide-reader { display: grid; grid-template-columns: 15rem minmax(0, 1fr); column-gap: 3rem; }
  .guide-reader .reader-tools { display: contents; }
  .guide-reader .reader-back { grid-column: 2; grid-row: 1; margin-bottom: .75rem; }
  .guide-reader .reader-index { grid-column: 1; grid-row: 2 / span 2; border: 0; }
  .guide-reader .reader-index summary { width: auto; margin: 0; }
  .guide-reader .reader-intro { grid-column: 2; grid-row: 2; }
  .guide-reader .reader-prose { grid-column: 2; grid-row: 3; }
  .guide-reader .reading-intro { margin-left: 0; }
}
@media (max-width: 599px) {
  /* Explicit roles + headers preserve associations in the stacked comparison. */
  .guide-table table, .guide-table tbody, .guide-table tr, .guide-table td { display: block; }
  .guide-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .guide-table tr { padding-block: .75rem; border-top: 1px solid var(--line); }
  .guide-table td { padding: .4rem 0; border: 0; }
  .guide-table td::before { content: attr(data-label); display: block; font-size: .875rem; font-weight: 700; color: var(--cream); }
}
