/* Constellation reference layout: long guides with in-page nav, filter and
   collapsible sections. Classes are added by js/constellation-reference.js. */

.constellation-reference { padding-top: 3rem; }
.constellation-reference .node-lead { font-size: 1.2rem; line-height: 1.65; margin-bottom: 2.5rem; }

/* Layout: sticky sidebar nav on wide screens, chips on narrow ones. */
.ref-layout { margin-top: 2.5rem; }
@media (min-width: 992px) {
  .ref-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 3.5rem; align-items: start; }
  .ref-toc { position: sticky; top: 2rem; }
}
.ref-toc-title { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; opacity: .6; margin-bottom: .75rem; }
.ref-toc-list { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.ref-toc-list li { counter-increment: toc; }
.ref-toc-list a { display: block; padding: .45rem 0 .45rem .9rem; border-left: 2px solid rgba(0,0,0,.08); text-decoration: none; font-size: .92rem; line-height: 1.35; color: inherit; opacity: .7; }
.ref-toc-list a:hover, .ref-toc-list a:focus { opacity: 1; }
.ref-toc-list a.is-active { border-left-color: currentColor; opacity: 1; font-weight: 600; }
@media (max-width: 991.98px) {
  .ref-toc { margin-bottom: 1.5rem; }
  .ref-toc-list { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .5rem; -webkit-overflow-scrolling: touch; }
  .ref-toc-list a { white-space: nowrap; border: 1px solid rgba(0,0,0,.15); border-radius: 999px; padding: .35rem .85rem; opacity: 1; }
  .ref-toc-list a.is-active { border-color: currentColor; }
}

/* Toolbar: filter, result count, expand all. */
.ref-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: 1rem; margin-bottom: 1rem; background: rgba(0,0,0,.035); border-radius: 6px; }
.ref-search { flex: 1 1 18rem; margin: 0; }
.ref-search input { width: 100%; padding: .65rem .9rem; border: 1px solid rgba(0,0,0,.18); border-radius: 4px; font-size: 1rem; background: #fff; }
.ref-search input:focus { outline: 2px solid currentColor; outline-offset: 1px; }
.ref-results { font-size: .9rem; opacity: .75; min-width: 6rem; }
@media (max-width: 575.98px) { .ref-search { flex-basis: 100%; } }
.ref-expand-all { background: none; border: 1px solid rgba(0,0,0,.25); border-radius: 4px; padding: .5rem .9rem; font-size: .85rem; cursor: pointer; }

/* Sections as collapsible panels. */
.ref-section { border-top: 1px solid rgba(0,0,0,.12); scroll-margin-top: 1.5rem; }
.ref-section:last-child { border-bottom: 1px solid rgba(0,0,0,.12); }
.ref-section-head { padding: 1.1rem 0 .4rem; }
.ref-section-head h2 { margin: 0; font-size: inherit; }
.ref-toggle { display: flex; align-items: center; gap: .75rem; width: 100%; padding: 0; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; }
.ref-title { font-size: 1.35rem; font-weight: 600; line-height: 1.3; }
.ref-count { font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 999px; background: rgba(0,0,0,.06); white-space: nowrap; }
.ref-chevron { margin-left: auto; width: .65rem; height: .65rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s ease; flex: none; margin-right: .3rem; }
.ref-section.is-open > .ref-section-head .ref-toggle .ref-chevron { transform: rotate(-135deg); }
.ref-lead { margin: .45rem 0 .6rem; opacity: .75; max-width: none; }
.ref-panel { padding: .5rem 0 1.75rem; }
.ref-panel > p > strong:only-child { display: block; margin-top: 1.25rem; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.ref-panel ul { padding-left: 1.2rem; }
.ref-panel li { margin-bottom: .45rem; }

.ref-sub { border-top: 1px dashed rgba(0,0,0,.14); }
.ref-sub:first-child { margin-top: .25rem; }
.ref-sub h3 { margin: 0; font-size: inherit; }
.ref-subtoggle { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .85rem 0; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; }
.ref-subtitle { font-size: 1.08rem; font-weight: 600; }
.ref-subtoggle .ref-chevron { width: .55rem; height: .55rem; }
.ref-sub.is-open > h3 .ref-chevron { transform: rotate(-135deg); }
.ref-sub-panel { padding-bottom: .75rem; }

/* Numbered step cards for "bold lead" ordered lists. */
.ref-steps { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); counter-reset: step; }
.ref-steps > li { counter-increment: step; position: relative; padding: 2.6rem 1.1rem 1.1rem; margin: 0; border: 1px solid rgba(0,0,0,.12); border-radius: 6px; font-size: .95rem; line-height: 1.5; }
.ref-steps > li::before { content: counter(step); position: absolute; top: .9rem; left: 1.1rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #1a1a1a; color: #fff; font-size: .8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ref-steps > li strong { display: block; margin-bottom: .25rem; }

/* Tables. */
.ref-table-wrap { overflow-x: auto; margin: .5rem 0 1.25rem; }
.ref-table-wrap table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.ref-table-wrap th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; padding: .6rem .75rem; border-bottom: 2px solid rgba(0,0,0,.15); white-space: nowrap; }
.ref-table-wrap td { padding: .7rem .75rem; vertical-align: top; border-bottom: 1px solid rgba(0,0,0,.08); line-height: 1.45; }
.ref-table-wrap tbody tr:nth-child(even) { background: rgba(0,0,0,.022); }
.ref-table-wrap td:first-child { font-weight: 600; min-width: 9rem; }
@media (max-width: 767.98px) {
  .ref-table-wrap { overflow: visible; }
  .ref-table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ref-table-wrap table, .ref-table-wrap tbody, .ref-table-wrap tr, .ref-table-wrap td { display: block; width: 100%; }
  .ref-table-wrap tr { border: 1px solid rgba(0,0,0,.12); border-radius: 6px; padding: .5rem .25rem; margin-bottom: .85rem; background: #fff !important; }
  .ref-table-wrap td { border: 0; padding: .35rem .75rem; display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .75rem; }
  .ref-table-wrap td:first-child { font-size: 1.02rem; grid-template-columns: 1fr; }
  .ref-table-wrap td:first-child::before { display: none; }
  .ref-table-wrap td::before { content: attr(data-label); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; opacity: .6; padding-top: .15rem; }
}

/* Status badges. */
.ref-pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.ref-pill--good { background: #e6f4ea; color: #1d6b34; }
.ref-pill--info { background: #eaf0f7; color: #2c4a6b; }
.ref-pill--warn { background: #fdf1dc; color: #845400; }

/* Print and no-hidden fallbacks: show everything. */
@media print {
  .ref-toc, .ref-toolbar, .ref-chevron, .ref-count { display: none !important; }
  .ref-panel[hidden], .ref-sub-panel[hidden] { display: block !important; }
  .ref-layout { display: block; }
}

/* "Done (n)" toggles (buildCollapsibles in constellation-reference.js). */
.ref-collapse { margin: 12px 0 18px; border: 1px solid rgba(0, 0, 0, .12); border-radius: 8px; padding: 10px 16px; }
.ref-collapse summary { cursor: pointer; font-weight: 600; font-size: .9rem; opacity: .8; }
.ref-collapse[open] summary { margin-bottom: 8px; }
.ref-collapse ul { margin: 0; padding-left: 1.1rem; }
.ref-collapse li { opacity: .7; text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .35); }
@media print { .ref-collapse { border: 0; padding: 0; } }
