/* STREAM Labs: the cards on the Labs tab and the mini-site behind each Lab.
   Pages sit inside layout catalog-section (sysbar and section nav stay);
   scripts/publishing/lab_site.py writes the markup. */

/* ---------------------------------------------------------------- footprint
   One cell per design section, in the standard's order. Colour names the
   relation and so does height (changes tallest, uses shortest), so the strip
   reads without colour. Hatching marks a proposed, unrecorded mapping. */
.lab-site, .lab-card, .lab-legend {
  --fp-empty: #e3e4db; --fp-changes: #a94f34; --fp-demonstrates: #a97f2e;
  --fp-tests: #2c6da8; --fp-uses: #637656;
}
.lab-footprint { display: flex; gap: 3px; }
.lab-cell { --level: 0%; width: 11px; height: 24px; border-radius: 1px; background: var(--fp-empty) linear-gradient(var(--fill, transparent), var(--fill, transparent)) bottom / 100% var(--level) no-repeat; }
.is-changes { --fill: var(--fp-changes); --level: 100%; }
.is-demonstrates { --fill: var(--fp-demonstrates); --level: 80%; }
.is-tests { --fill: var(--fp-tests); --level: 62%; }
.is-uses { --fill: var(--fp-uses); --level: 36%; }
.lab-footprint.is-proposed .lab-cell, .lab-sections.is-proposed li::before { background-image: repeating-linear-gradient(135deg, var(--fill, transparent) 0 2px, transparent 2px 4px); }
.lab-mapping p { margin: 6px 0 0; font-size: 13px; line-height: 1.4; }

.lab-status { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border: 1px solid currentColor; border-radius: 999px; font-size: 12.5px; font-weight: 650; line-height: 1.5; white-space: nowrap; }
.lab-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3f9c63; }
.lab-status.is-deferred::before { background: #c8901f; }
.lab-status.is-rejected::before, .lab-status.is-withdrawn::before, .lab-status.is-superseded::before { background: #c4463a; }

/* ---------------------------------------------------------------- cards */
.lab-card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 14px; }
.lab-card { position: relative; display: flex; flex-direction: column; padding: 22px 24px 18px; border: 1px solid #d8dbd2; border-top: 5px solid #233d58; border-radius: 3px 3px 8px 8px; background: #fff; }
.lab-card:hover, .lab-card:focus-within { border-color: #233d58; }
.lab-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; color: #172333; }
.stream-visual-group .lab-card h3 { margin: 0; font: 400 25px/1.2 var(--bn-serif); letter-spacing: -.02em; }
.lab-card h3 a { color: #172333; text-decoration: none; }
.lab-card h3 a::after { content: ""; position: absolute; inset: 0; }
.lab-card:hover h3 a { text-decoration: underline; text-decoration-thickness: 1px; }
.lab-card .lab-card-byline { margin: 6px 0 12px; color: #68736f; font-size: 13px; }
.lab-card .lab-card-question { flex: 1; margin: 0 0 18px; color: #36434f; font-size: 15px; line-height: 1.55; }
.lab-card .lab-cell { flex: 1; width: auto; }
.lab-card .lab-mapping p { color: #68736f; }
.lab-card-counts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid #e3e4db; list-style: none; color: #68736f; font-size: 13px; }
.lab-card-counts strong { color: #172333; font-size: 16px; font-variant-numeric: tabular-nums; }
.lab-legend { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 18px; margin: 0 0 16px; color: #53635d; font-size: 13px; }
.lab-legend span { display: inline-flex; align-items: flex-end; gap: 6px; line-height: 1.2; }
.lab-legend .lab-cell { width: 9px; height: 16px; }

/* ---------------------------------------------------------------- filters */
.lab-filters { display: grid; gap: 14px; margin: 0 0 20px; }
.lab-filters[hidden], .lab-card[hidden] { display: none; }
.lab-filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-filter-label { flex: 0 0 110px; color: #53635d; font-size: 13px; }
.lab-filter-group > button, .lab-filter-clear { padding: 5px 13px; border: 1px solid #c9cfc4; border-radius: 999px; background: transparent; color: #23352e; font: 600 13px/1.5 var(--bn-sans, system-ui, sans-serif); cursor: pointer; }
.lab-filter-group > button span { margin-left: 4px; color: #68736f; font-weight: 400; }
.lab-filter-group > button[aria-pressed="true"] { border-color: #233d58; background: #233d58; color: #fff; }
.lab-filter-group > button[aria-pressed="true"] span { color: #c3ccd6; }
.lab-filter-group select { padding: 6px 10px; border: 1px solid #c9cfc4; border-radius: 6px; background: #fff; color: #23352e; font: 13px/1.4 var(--bn-sans, system-ui, sans-serif); }
.lab-section-filter { display: flex; gap: 3px; max-width: 100%; }
.lab-section-filter button { display: flex; align-items: flex-end; width: 22px; height: 40px; min-width: 0; flex: 0 1 22px; padding: 0; border: 0; border-radius: 2px; background: #e3e4db; cursor: pointer; }
.lab-section-filter i { display: block; width: 100%; border-radius: 2px; background: #8fa0b3; }
.lab-section-filter button:hover:not(:disabled) i { background: #4d6985; }
.lab-section-filter button[aria-pressed="true"] { box-shadow: 0 0 0 2px #233d58; }
.lab-section-filter button[aria-pressed="true"] i { background: #233d58; }
.lab-section-filter button:disabled { cursor: default; opacity: .6; }
.lab-filters button:focus-visible, .lab-filters select:focus-visible { outline: 3px solid #a94f34; outline-offset: 2px; }
.lab-section-name { flex: 1 1 200px; margin: 0; min-height: 1.4em; color: #23352e; font-size: 13px; }
.lab-filter-summary { display: flex; align-items: center; gap: 14px; margin: 0; min-height: 1px; color: #53635d; font-size: 13px; }
.lab-filter-clear[hidden] { display: none; }
@media (max-width: 600px) { .lab-filter-label { flex-basis: 100%; } .lab-section-filter { width: 100%; } .lab-section-name { flex-basis: 100%; } }

/* ---------------------------------------------------------------- mini-site frame */
.lab-site { padding-bottom: 72px; font-size: 16px; line-height: 1.65; color: var(--bn-ink); }
.lab-shell { width: calc(100% - clamp(32px, 6vw, 80px)); max-width: 1200px; margin-inline: auto; }
.lab-body { padding-top: 36px; }
.lab-masthead { --fp-empty: #ffffff26; --fp-changes: #f08a66; --fp-demonstrates: #e5bd6a; --fp-tests: #84bdf0; --fp-uses: #b3d093; background: #233d58; color: #fbfaf6; padding-top: 18px; }
.babb-redesign .lab-masthead a { color: inherit; }
.babb-redesign .lab-masthead a:hover { color: #f0d49a; }
.babb-redesign .lab-masthead a:focus-visible { outline-color: #f0d49a; outline-offset: 2px; }
.lab-masthead .lab-crumb { margin: 0 0 18px; font-size: 13px; }
.lab-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.lab-masthead h1, .lab-masthead .lab-name { margin: 0; font: 400 clamp(32px, 4.6vw, 52px)/1.1 var(--bn-serif); letter-spacing: -.03em; }
.lab-masthead.is-compact h1, .lab-masthead .lab-name { font-size: clamp(24px, 3vw, 32px); }
.lab-name a { text-decoration: none; }
.lab-masthead .lab-question { max-width: 36em; margin: 18px 0 0; font: 400 clamp(19px, 2.1vw, 25px)/1.45 var(--bn-serif); color: #e6ebf0; }
.lab-facts { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 48px; margin-top: 28px; }
.lab-facts dl { display: flex; flex-wrap: wrap; gap: 12px 34px; margin: 0; }
.lab-facts dt { color: #aebccb; font-size: 12.5px; }
.lab-facts dd { margin: 0; font-size: 15px; }
.lab-facts .lab-mapping p { color: #aebccb; }
.lab-tabs { display: flex; gap: 4px; margin-top: 28px; overflow-x: auto; scrollbar-width: thin; }
.lab-masthead.is-compact .lab-tabs { margin-top: 18px; }
.lab-tabs a { flex: none; padding: 10px 18px; border-radius: 7px 7px 0 0; background: #ffffff12; font-size: 14px; font-weight: 600; text-decoration: none; }
.lab-tabs a:focus-visible { outline-offset: -4px !important; }
.babb-redesign .lab-tabs a[aria-current="page"] { background: var(--bn-bg); color: var(--bn-ink); }
.lab-count { margin-left: 5px; font-weight: 400; font-variant-numeric: tabular-nums; opacity: .68; }

/* ---------------------------------------------------------------- reading */
.lab-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 330px); gap: 56px; align-items: start; }
.lab-columns.is-reversed { grid-template-columns: minmax(0, 280px) minmax(0, 1fr); }
.lab-prose { min-width: 0; color: #2b3947; }
.lab-prose > p, .lab-prose > ul, .lab-prose > ol, .lab-prose > section > p, .lab-prose > section > ul, .lab-prose > section > ol, .lab-prose > blockquote { max-width: 70ch; }
.lab-site h2 { margin: 40px 0 14px; color: var(--bn-ink); font-size: 27px; line-height: 1.25; letter-spacing: -.02em; }
.lab-site h3 { margin: 30px 0 10px; color: var(--bn-ink); font-size: 21px; line-height: 1.3; letter-spacing: -.015em; }
.lab-site h4, .lab-site h5 { margin: 22px 0 8px; color: var(--bn-ink); font: 700 16px/1.4 var(--bn-sans); letter-spacing: 0; }
.lab-prose > section:first-child > h2, .lab-prose > h2:first-child, .lab-aside:first-child > section:first-child > h2, .lab-aside > h2:first-child { margin-top: 0; }
.lab-prose li { margin: 8px 0; }
.lab-prose ul, .lab-prose ol { padding-left: 22px; }
.lab-prose li::marker { color: var(--bn-rust); }
.lab-prose h1 { margin: 0 0 8px; font-size: clamp(28px, 3.4vw, 38px); line-height: 1.18; letter-spacing: -.025em; }
.lab-prose blockquote { margin: 18px 0; padding: 2px 0 2px 18px; border-left: 3px solid #c49a53; }
.lab-site code { font: .86em/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.lab-prose :not(pre) > code { padding: 1px 5px; border-radius: 3px; background: #e8e8df; }
.lab-site pre { max-width: 100%; overflow-x: auto; padding: 14px 16px; border: 1px solid #d8dbd2; border-radius: 6px; background: #fbfaf6; }
.lab-site pre code { overflow-wrap: normal; }
.lab-site p, .lab-site li, .lab-site td { overflow-wrap: break-word; }
.lab-site .tscroll { max-width: 100%; overflow-x: auto; }
.lab-site table { width: 100%; margin: 14px 0; border-collapse: collapse; background: #fff; font-size: 14px; line-height: 1.5; }
.lab-site th, .lab-site td { padding: 7px 10px; border: 1px solid #d8dbd2; text-align: left; vertical-align: top; }
.lab-site th { background: #e9eae2; color: var(--bn-ink); }
.lab-site td.num { text-align: right; font-variant-numeric: tabular-nums; }
.lab-site .lab-meta, .lab-record .meta { color: #68736f; font-size: 13.5px; }
.lab-material > .lab-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 24px; }
.lab-aside > .lab-sections { margin-top: 0; }
.lab-notice { padding: 12px 16px; border-left: 4px solid #c49a53; background: #fbf5e8; }

/* Overview: exhibit index and side column. */
.lab-prose ul.lab-exhibit-index { max-width: none; padding: 0; list-style: none; }
.lab-exhibit-index li { margin: 0; padding: 13px 0; border-top: 1px solid #d8dbd2; }
.lab-exhibit-index a { font: 400 19px/1.35 var(--bn-serif); }
.lab-exhibit-index p { margin: 3px 0 0; color: #5b6874; font-size: 14.5px; }
.lab-aside { min-width: 0; font-size: 14.5px; line-height: 1.55; }
.lab-aside > section { padding: 20px 22px; border: 1px solid #d8dbd2; border-radius: 8px; background: #fbfaf6; }
.lab-aside > section + section { margin-top: 14px; }
.lab-aside > section > h2 { margin: 0 0 10px; font-size: 19px; }
.lab-aside p { margin: 0 0 8px; }
.lab-aside ul { margin: 0 0 8px; padding: 0; list-style: none; }
.lab-aside li { margin: 7px 0; }
.lab-sections li { display: grid; grid-template-columns: 9px 1fr; column-gap: 12px; align-items: stretch; }
.lab-sections li::before { content: ""; grid-row: span 2; background: var(--fp-empty) linear-gradient(var(--fill, transparent), var(--fill, transparent)) bottom / 100% var(--level, 0%) no-repeat; }
.lab-sections li.is-untouched { --level: 0%; color: #7a847f; }
.lab-relation { grid-column: 2; color: #68736f; font-size: 12.5px; }
.lab-sections li > a { grid-column: 2; }

/* ---------------------------------------------------------------- exhibits */
.lab-exhibits { display: grid; grid-template-columns: minmax(0, 244px) minmax(0, 1fr); gap: 32px; align-items: start; }
.lab-rail { position: sticky; top: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 24px); overflow-y: auto; border-top: 1px solid #d8dbd2; }
.lab-rail button { flex: none; padding: 12px 14px; border: 0; border-bottom: 1px solid #d8dbd2; border-left: 4px solid transparent; background: none; color: #425064; font: 500 14.5px/1.4 var(--bn-sans); text-align: left; cursor: pointer; }
.lab-rail button:hover { background: #fbfaf6; color: var(--bn-ink); }
.lab-rail button[aria-selected="true"] { border-left-color: #233d58; background: #fff; color: var(--bn-ink); font-weight: 700; }
.lab-panels { min-width: 0; }
.lab-site .lab-panel > h2 { margin: 0 0 6px; }
.lab-panel-summary p { max-width: 70ch; margin: 0 0 16px; color: #475463; }
.lab-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.lab-files button { max-width: 100%; padding: 7px 14px; border: 1px solid #c9cfc4; border-radius: 999px; background: none; color: #425064; font: 500 13px/1.4 var(--bn-sans); text-align: left; cursor: pointer; }
.lab-files button[aria-selected="true"] { border-color: #233d58; background: #233d58; color: #fff; }
.lab-rail button:focus-visible, .lab-files button:focus-visible { outline: 3px solid var(--bn-rust); outline-offset: -3px; }
.lab-view { border: 1px solid #c9cfc4; border-radius: 8px; overflow: hidden; background: #fff; }
.lab-view + .lab-view { margin-top: 14px; }
.lab-view-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 0; padding: 9px 14px; border-bottom: 1px solid #d8dbd2; background: #fbfaf6; font-size: 13.5px; }
.lab-view iframe { display: block; width: 100%; height: max(520px, 80vh); border: 0; background: #fff; }
.lab-report { padding: 4px clamp(16px, 3vw, 36px) 28px; }
.lab-report > p, .lab-report > ul, .lab-report > ol { max-width: 72ch; }
.lab-also { margin-top: 14px; color: #68736f; font-size: 13.5px; }
.lab-also p { margin: 0; }
.lab-also ul { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 0; padding: 0; list-style: none; }
.lab-remarks { margin-top: 24px; font-size: 14.5px; }
@media (scripting: enabled) {
  .lab-exhibits:not(.is-ready) .lab-panel ~ .lab-panel, .lab-exhibits:not(.is-ready) .lab-view ~ .lab-view { display: none; }
}
@media (scripting: none) {
  .lab-rail, .lab-files, .lab-view iframe { display: none; }
  .lab-exhibits { grid-template-columns: minmax(0, 1fr); }
  .lab-panel + .lab-panel { margin-top: 40px; }
}
.lab-site [hidden] { display: none !important; }

/* ---------------------------------------------------------------- materials and record */
.lab-material-groups { columns: 2 360px; column-gap: 48px; margin-top: 24px; }
.lab-material-group { break-inside: avoid-column; margin-bottom: 34px; }
.lab-site .lab-material-group h2 { margin: 0 0 8px; font-size: 22px; }
.lab-material-group ul { margin: 0; padding: 0; list-style: none; }
.lab-material-group li { break-inside: avoid; padding: 9px 0; border-top: 1px solid #d8dbd2; line-height: 1.45; }
.lab-material-group li code { display: block; color: #7a847f; font-size: 12px; }
.lab-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; font-size: 13.5px; line-height: 1.45; }
.lab-side summary { padding: 0 0 8px; color: var(--bn-ink); font-weight: 700; cursor: pointer; }
.lab-side nav p { margin: 16px 0 4px; color: #68736f; font-size: 12.5px; }
.lab-side ul { margin: 0; padding: 0; list-style: none; }
.lab-side li a { display: block; padding: 6px 10px; border-left: 3px solid #d8dbd2; text-decoration: none; }
.lab-side li a:hover { border-left-color: var(--bn-rust); }
.lab-side a[aria-current="page"] { border-left-color: #233d58; background: #fff; font-weight: 700; }
.lab-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.lab-steps a { display: block; padding: 12px 16px; border: 1px solid #d8dbd2; border-radius: 8px; background: #fbfaf6; text-decoration: none; line-height: 1.4; }
.lab-steps a:hover { border-color: var(--bn-rust); }
.lab-steps span { display: block; color: #68736f; font-size: 12.5px; }
.lab-steps .is-next { grid-column: 2; text-align: right; }
.lab-record h2 { scroll-margin-top: 12px; }
.lab-record .banner { padding: 12px 16px; border-left: 4px solid #233d58; background: #fbfaf6; }
.lab-record .banner p { margin: 4px 0; }
.lab-record [class^="status-"] { font-weight: 700; }
.lab-record details { margin: 10px 0; padding: 9px 14px; border: 1px solid #d8dbd2; border-radius: 6px; background: #fbfaf6; }
.lab-record summary { cursor: pointer; font-weight: 600; }
.lab-record footer { margin-top: 48px; padding-top: 12px; border-top: 1px solid #d8dbd2; }

@media (max-width: 860px) {
  .lab-columns, .lab-columns.is-reversed { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .lab-columns.is-reversed > .lab-aside { order: 0; }
  .lab-side { position: static; max-height: none; padding: 10px 14px; border: 1px solid #d8dbd2; border-radius: 8px; background: #fbfaf6; }
  .lab-side summary { padding: 0; }
  .lab-exhibits { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .lab-rail { position: static; flex-direction: row; gap: 6px; max-height: none; overflow-x: auto; border: 0; padding-bottom: 6px; }
  .lab-rail button { max-width: 230px; border: 1px solid #c9cfc4; border-bottom-width: 4px; border-radius: 6px; }
  .lab-rail button[aria-selected="true"] { border-color: #233d58; }
}
@media (max-width: 520px) {
  .lab-body { padding-top: 24px; }
  .lab-steps { grid-template-columns: 1fr; }
  .lab-steps .is-next { grid-column: 1; }
  .lab-tabs a { padding: 9px 13px; }
}

/* Elements index: kind badges and the per-section groups. */
.lab-elements-page .lab-elements-group { margin-top: 32px; }
.lab-elements-page .lab-elements-list { list-style: none; padding-left: 0; }
.lab-elements-page .lab-elements-list li { margin: 6px 0; line-height: 1.5; }
.lab-kind {
  display: inline-block; font-size: 0.8em; font-weight: 600;
  border: 1px solid #d6cfc2; border-radius: 999px; padding: 0 8px; margin: 0 4px;
}
.lab-kind-math { background: #eff6ff; border-color: #93c5fd; }
.lab-kind-logic { background: #f0fdf4; border-color: #86efac; }
.lab-kind-grammar { background: #fff7ed; border-color: #fdba74; }
.lab-kind-question { background: #fdf4ff; border-color: #d8b4fe; }
.lab-kind-definition { background: #f5f5f4; border-color: #d6d3d1; }
