@layer components {
/* A bounded branching reader. Connections are decorative; native buttons and
   links carry the complete interaction, including keyboard navigation. */
.shelf-threads { border: 1px solid var(--rule-faint); background: var(--paper-bright); margin-bottom: 1.5rem; }
.thread-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.2rem 1.4rem .8rem; }
.thread-toolbar .eyebrow { margin: 0 0 .4rem; font-size: .55rem; color: var(--moss-dark); }
.thread-toolbar h2 { margin: 0; font: italic 1.85rem/1 var(--display); }
.thread-toolbar h2 span { color: var(--rust); }
.thread-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.thread-actions button, .thread-more { border: 1px solid var(--rule-faint); background: var(--paper); padding: .65rem .7rem; font: .65rem var(--mono); }
.thread-actions button:disabled { opacity: .4; cursor: var(--cursor-default, default); }
.thread-actions button:not(:disabled):hover, .thread-more:hover { background: var(--paper-deep); }
.thread-trail { margin: 0; padding: .3rem 1.4rem 1rem; font: .65rem/1.5 var(--mono); color: var(--rust-dark); overflow-wrap: anywhere; }
.thread-board { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.8fr); gap: clamp(1.5rem, 4vw, 3.5rem); height: 560px; padding: 0 1.4rem; isolation: isolate; }
.thread-connections { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; overflow: hidden; }
.thread-connections path { fill: none; stroke: var(--moss); stroke-width: 1; opacity: .3; }
.thread-connections path.is-chosen { stroke: var(--rust); stroke-width: 1.7; opacity: .9; }
.thread-column { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-column > header { height: 90px; flex-shrink: 0; padding-top: .8rem; border-top: 1px solid var(--rule-faint); background: var(--paper-bright); }
.thread-column > header > span { font: .52rem var(--mono); letter-spacing: .05em; color: var(--moss-dark); }
.thread-column > header h3 { font: 500 1.4rem var(--display); margin: .4rem 0 .2rem; }
.thread-column > header p { margin: 0; font: .6rem/1.4 var(--mono); color: var(--ink-soft); overflow-wrap: anywhere; }
.thread-mobile-section { display: none; }
.thread-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 4px 8px 16px 3px; scroll-padding: 5px; }
.thread-scroll::-webkit-scrollbar { display: none; }
.thread-scroll-hint { position: absolute; top: 0; right: 0; width: 3px; border-radius: 3px; background: var(--moss); opacity: 0; pointer-events: none; transition: opacity .15s; }
.thread-scroll-hint.is-active { opacity: .7; }
.thread-choice { position: relative; display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; min-height: 38px; padding: .65rem .7rem; margin-bottom: .5rem; border: 1px solid var(--rule-faint); background: var(--paper-bright); text-align: left; font: .7rem/1.3 var(--mono); transition: background-color .14s, border-color .14s; }
.thread-choice > span { overflow-wrap: anywhere; }
.thread-choice small { color: var(--moss-dark); font: .58rem var(--mono); }
.thread-column--tags .thread-choice { border-radius: 22px; background: var(--thread-tag-background); }
.thread-choice[aria-pressed="true"] { background: var(--selected); border-color: var(--moss-dark); box-shadow: inset 3px 0 var(--rust); }
.thread-choice:not(:disabled):hover { background: var(--paper-deep); border-color: var(--moss-dark); }
.thread-choice:disabled { opacity: .45; cursor: var(--cursor-default, default); }
.thread-choice:focus-visible, .thread-actions button:focus-visible, .thread-more:focus-visible, .thread-scroll:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
.thread-placeholder { padding: 2rem .4rem; color: var(--ink-soft); }
.thread-placeholder > span { color: var(--moss); font-size: 1.4rem; }
.thread-placeholder h3 { margin: .8rem 0 .5rem; font: italic 1.3rem/1.2 var(--display); }
.thread-placeholder p { font: .77rem/1.7 var(--sans); margin: 0; max-width: 26ch; }
.thread-more { width: 100%; }
.thread-status { border-top: 1px solid var(--rule-faint); margin: 0; padding: .8rem 1.4rem; color: var(--moss-dark); font: .62rem/1.5 var(--mono); }
@media (max-width: 640px) {
  .thread-toolbar { padding: 1rem .8rem .6rem; gap: .5rem; }
  .thread-toolbar h2 { font-size: 1.5rem; }
  .thread-toolbar .eyebrow { font-size: .48rem; }
  .thread-actions { gap: .3rem; }
  .thread-actions button { padding: .55rem .4rem; font-size: .58rem; }
  .thread-trail { padding: .3rem .8rem .8rem; font-size: .6rem; }
  .thread-board { height: clamp(440px, calc(100svh - 310px), 530px); grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 185px minmax(0, 1fr); gap: 1rem 1.4rem; padding: 0 .8rem; }
  .thread-column > header { height: 75px; padding-top: .5rem; }
  .thread-column > header > span { font-size: .46rem; }
  .thread-column > header h3 { font-size: 1.2rem; }
  .thread-column > header p { font-size: .55rem; }
  .thread-column--notes { grid-column: 1 / -1; }
  .thread-column--notes > header { height: 65px; display: grid; grid-template-columns: 1fr auto; align-content: center; gap: .2rem; }
  .thread-column--notes > header > span { grid-column: 1 / -1; }
  .thread-column--notes > header h3 { margin: 0; }
  .thread-column--notes > header p { align-self: center; }
  .thread-choice { font-size: .62rem; padding: .6rem .5rem; min-height: 38px; }
  .thread-placeholder { padding: .5rem .2rem; }
  .thread-placeholder h3 { margin: .4rem 0; font-size: 1.15rem; }
  .thread-placeholder p { font-size: .7rem; }
  .thread-column--notes .thread-placeholder { padding: 1.3rem .3rem; }
  .thread-status { padding: .7rem .8rem; }
}
@media (max-width: 360px) {
  .thread-toolbar { flex-wrap: wrap; }
  .thread-toolbar > div:first-child { width: 100%; }
  .thread-actions { margin-top: .35rem; }
  .thread-choice { flex-wrap: wrap; gap: .2rem; }
  .thread-choice > span { width: 100%; font-size: .59rem; }
  .thread-choice small { margin-left: auto; }
  .thread-board { height: clamp(420px, calc(100svh - 345px), 530px); }
}
@media (prefers-reduced-motion: reduce) { .thread-choice, .thread-scroll-hint { transition: none; } }

}
