/* ============================================================
   SIDE TABS — vertical tabs on the left, a panel on the right, one wrapper round both (SideTabs.astro;
   Liliya, 23.11.2026: the /routines comparison and connectors filter made one component)
   Requires: tokens.css, page.css, surface.css (.card), tabs.css + tabs.js (.tabs--vertical, the glide), select.css,
   gallery.css (phone="gallery")
     .side-tabs--lg / --md         the tabs' text: Paragraph LG / Paragraph MD
     .side-tabs--spread            each tab two lines high, the tabs spread over the panel's height (else packed at the top) /
                                   Paragraph MD, packed at the top
     .side-tabs--stack-phone       the tabs give way to a dropdown over the panel at ≤767
     .side-tabs--stack-tablet      …at ≤991
     .side-tabs--phone-gallery     at ≤767 the block steps aside for a row of cards, one per tab
     --side-tabs-accent / -ink     the open tab's fill and text (an accent and black, or with accent="dark" the page's
                                   black and white; set by the component)
     .side-tabs--split-5-7         the tabs on 5 columns, the panel on 7 (4 / 8 from 1280)
     .side-tabs--options           tabs with a text: option cards (H5 label, grey text) on Grey Hover
     .side-tabs--panel-field       the page's black under the panels, no padding; the content draws its own air
   Phones with the dropdown: no wrapper, the dropdown and the panel on the page.
   Dark pages only for now (both uses are on /routines): Background/Grey wrapper, CTA Grey panel. A light page gets
   its colours when one needs it.
   ============================================================ */

/* the wrapper: Background/Grey, 8 round the tabs and the panel and between them; on the page grid's twelve columns,
   the tabs on three, the panel on nine (as the comparison was) */
.side-tabs__frame {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-xs); align-items: stretch;
  padding: var(--space-xs); border-radius: var(--radius-xl); background: var(--color-bg-grey);
}
.side-tabs__side { grid-column: span 3; display: flex; }
.side-tabs__panels { grid-column: span 9; display: grid; }

/* the tabs lose their own tray (the wrapper is the tray); the open one in the accent with black text */
.side-tabs__tabs.tabs { width: 100%; padding: 0; background: none; border-radius: 0; align-content: start; }
.side-tabs__tabs .tabs__indicator { background: var(--side-tabs-accent); }
.side-tabs__tabs .tabs__tab:is([aria-selected="true"], [aria-pressed="true"]) { background: var(--side-tabs-accent); color: var(--side-tabs-ink); }
.tabs--glide.side-tabs__tabs .tabs__tab:is([aria-selected="true"], [aria-pressed="true"]) { background: transparent; }
.side-tabs__label { display: block; }
/* spread: few long labels — each tab two lines high, the tabs spread over the panel's height (the comparison, 18.11.2026) */
.side-tabs--spread .side-tabs__tabs.tabs { align-content: space-between; }
.side-tabs--spread .side-tabs__label { min-height: 2lh; }
.side-tabs__pick { display: none; }

/* the panel: CTA Grey, its radius nested in the wrapper's (24 − 8). Tabs mode: every panel in one cell, the hidden
   ones keep their height, so switching never moves the page */
.side-tabs__panel {
  grid-area: 1 / 1; min-width: 0; padding: var(--pad-card-fluid);
  border-radius: calc(var(--radius-xl) - var(--space-xs)); background: var(--color-bg-cta-grey);
}
.side-tabs__panel[hidden] { display: block; visibility: hidden; }
/* filter mode: the items of the other groups dim (a fade, not movement: it stays under reduced motion) */
.side-tabs [data-group] { transition: opacity var(--duration-toggle) var(--ease-toggle); }
.side-tabs [data-group].is-dim { opacity: 0.2; }

/* split 5/7: options that carry a text get the room (/stage, Liliya 23.11.2026); 4/8 from 1280, as /stage was */
.side-tabs--split-5-7 .side-tabs__side { grid-column: span 5; }
.side-tabs--split-5-7 .side-tabs__panels { grid-column: span 7; }
@media (min-width: 80rem) {
  .side-tabs--split-5-7 .side-tabs__side { grid-column: span 4; }
  .side-tabs--split-5-7 .side-tabs__panels { grid-column: span 8; }
}

/* option cards (/stage): a label in H5 at the top, its text in grey at the bottom; each its own Grey Hover card, CTA
   Grey under the mouse; the options share the column's height. The open one lies on the glide plate. */
.side-tabs--options .side-tabs__tabs.tabs { grid-auto-rows: 1fr; align-content: stretch; gap: var(--space-xs); }
.side-tabs--options .tabs__tab {
  flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: var(--space-xs);
  padding: var(--space); background: var(--color-bg-grey-hover); color: var(--color-text);
  transition: background var(--duration-hover) var(--ease-hover), color var(--duration-toggle) var(--ease-toggle);
}
.side-tabs__text { display: block; color: var(--color-text-grey-on-grey); transition: color var(--duration-toggle) var(--ease-toggle); }
.side-tabs--options .tabs__tab:is([aria-selected="true"], [aria-pressed="true"]) .side-tabs__text { color: var(--side-tabs-ink); }
@media (hover: hover) { .side-tabs--options .tabs__tab:not([aria-selected="true"], [aria-pressed="true"]):hover { background: var(--color-bg-cta-grey); color: var(--color-text); } }
@media (prefers-reduced-motion: reduce) { .side-tabs--options .tabs__tab, .side-tabs__text { transition: none; } }

/* panel field: the page's black under every panel (so a leaving panel and the coming one share one field), the
   radius nested; the panels clear and unpadded — the content draws its own air and is clipped to the field */
.side-tabs--panel-field .side-tabs__panels { border-radius: calc(var(--radius-xl) - var(--space-xs)); background: var(--color-bg); overflow: clip; }
.side-tabs--panel-field .side-tabs__panel { padding: 0; border-radius: 0; background: none; overflow: clip; }
.side-tabs__panel.is-leaving { visibility: visible; }

/* stacked: the dropdown over the panel, the panel the wrapper's full width */
@media (max-width: 61.9375rem) {
  .side-tabs--stack-tablet .side-tabs__side, .side-tabs--stack-tablet .side-tabs__panels { grid-column: 1 / -1; }
  .side-tabs--stack-tablet .side-tabs__tabs { display: none; }
  .side-tabs--stack-tablet .side-tabs__pick { display: block; flex: 1; max-width: none; }
}
@media (max-width: 47.9375rem) {
  .side-tabs--stack-phone .side-tabs__side, .side-tabs--stack-phone .side-tabs__panels { grid-column: 1 / -1; }
  .side-tabs--stack-phone .side-tabs__tabs { display: none; }
  .side-tabs--stack-phone .side-tabs__pick { display: block; flex: 1; max-width: none; }
}
/* under a dropdown the panel takes its own task's height, not the tallest's (Liliya, 23.11.2026: a short task under
   the longest one's height read as empty); beside the tabs the tallest still holds, so the tabs never jump */
@media (max-width: 61.9375rem) { .side-tabs--stack-tablet .side-tabs__panel[hidden] { display: none; } }
@media (max-width: 47.9375rem) { .side-tabs--stack-phone .side-tabs__panel[hidden] { display: none; } }

/* phone="gallery": where it stacks, a card per tab — its title (H3, or H5 and the text for an option card) over or
   under its content; a swipe row on phones (the connectors' group cards, Liliya's pick C on /lab/routines-connectors;
   /stage's scheme cards, 23.11.2026) */
.side-tabs__cards { display: none; }
@media (max-width: 47.9375rem) {
  .side-tabs--phone-gallery .side-tabs__frame { display: none; }
  .side-tabs--phone-gallery .side-tabs__cards { display: block; }
}
/* stack="tablet": the cards from 991 — two a row on tablets (the row's Gallery steps aside there, its cards on this grid) */
@media (min-width: 48rem) and (max-width: 61.9375rem) {
  .side-tabs--stack-tablet.side-tabs--phone-gallery .side-tabs__frame { display: none; }
  .side-tabs--stack-tablet.side-tabs--phone-gallery .side-tabs__cards { display: grid; }
  .side-tabs--stack-tablet .side-tabs__card { grid-column: span 6; }
}
.card.side-tabs__card { display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: var(--space); padding: var(--pad-card-fluid); background: var(--side-tabs-card-fill); }
.side-tabs__card-head { display: flex; flex-direction: column; gap: var(--space-xs); }
.side-tabs__card-head > h3 { margin: 0; }
.side-tabs__card-text { margin: 0; color: var(--color-text-grey-on-grey); }
/* the title under the content (/stage): the body takes the first row, the head the second */
.side-tabs__card--title-bottom > .side-tabs__card-body { grid-row: 1; }
.side-tabs__card--title-bottom > .side-tabs__card-head { grid-row: 2; }
/* a framed picture: 8 round it, the title and text 24 from the card's edge */
.card.side-tabs__card--frame { padding: var(--space-xs); }
.side-tabs__card--frame > .side-tabs__card-head { padding-inline: var(--space-sm); }
.side-tabs__card--frame.side-tabs__card--title-bottom { padding-bottom: var(--pad-card-fluid); }
.side-tabs__card--frame.side-tabs__card--title-top { padding-top: var(--pad-card-fluid); }

/* phones, the dropdown: no wrapper — the dropdown and the panel stand on the page, the panel keeps the width the
   wrapper's 8 took and its own full radius (Liliya, 23.11.2026: the wrapper read as an extra frame on a phone) */
@media (max-width: 47.9375rem) {
  .side-tabs__frame { row-gap: var(--grid-gap); padding: 0; border-radius: 0; background: none; }
  .side-tabs__panel { border-radius: var(--radius-xl); }
}
