/* =========================================================================
   templates/atomic/showcase/css/kit.css (Kit page)

   STRUCTURE ONLY, linked by kit.html alone. Must pass
   `node tools/atomic-lint.mjs --kind=structure-paint`. Every colour, edge,
   radius, shadow and type metric on the Kit page comes from the floor and
   core components resolved against the previewed style's tokens. This file
   decides only where things sit.

   Three things the core ships as `position: fixed` (tooltip, popover, menu
   list) are re-anchored here so a witness page can show them in flow.

   Sections:
     1. page rhythm - intro, band heads, grids
     2. type band
     3. buttons band - the state matrix
     4. fields band
     5. feedback band
     6. surfaces band - cards and anchored layers
     7. navigation + data bands
   ========================================================================= */

/* ---- 1. page rhythm ----------------------------------------------------- */

.kit { gap: var(--space-8); }
.kit > * { min-width: 0; }

.kit-intro {
  display: grid;
  gap: var(--space-4);
  max-inline-size: 46rem;
}
.kit-lead { margin: 0; }
.kit-jump {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.kit-band {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
}
.kit-band-head {
  display: grid;
  gap: var(--space-2);
  max-inline-size: 46rem;
}
.kit-band-head > * { margin: 0; }

.kit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
  min-width: 0;
}
.kit-block {
  display: grid;
  gap: var(--space-4);
  align-content: start;
  min-width: 0;
}
.kit-block > h3,
.kit-block > h4 { margin: 0; }
.kit-stack {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  min-width: 0;
}
.kit-stack > * { margin: 0; min-width: 0; }
.kit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

@media (min-width: 760px) {
  .kit-span-2 { grid-column: span 2; }
  .kit-grid-2,
  .kit-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .kit-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- 2. type band ------------------------------------------------------- */

.kit-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (min-width: 900px) {
  .kit-split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8); }
}
.kit-list { margin: 0; padding-inline-start: var(--space-5); display: grid; gap: var(--space-1); }
.kit-figure { white-space: nowrap; }

/* ---- 3. buttons band ---------------------------------------------------- */

.kit-states {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: var(--space-4) var(--space-3);
  align-items: end;
}
.kit-state {
  display: grid;
  justify-items: start;
  gap: var(--space-1);
  margin: 0;
  min-width: 0;
}
.kit-state > .btn { max-inline-size: 100%; white-space: nowrap; }
.kit-row .btn { white-space: nowrap; }
.kit-full { max-inline-size: 28rem; }

/* ---- 4. fields band ----------------------------------------------------- */

.kit-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: var(--space-4) var(--space-5);
  min-width: 0;
}
.kit-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-5);
  row-gap: 0;
  margin: 0;
  min-width: 0;
}
.kit-choices > .field-label { flex: 0 0 100%; }
.kit-choice {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
}
.kit-choice > input { flex: none; }
/* a select keeps room for its longest option in every style's type */
select.input { min-inline-size: min(100%, 14rem); }
.kit-top { margin: 0; justify-self: end; }

/* ---- 5. feedback band --------------------------------------------------- */

.kit-meter {
  display: grid;
  gap: var(--space-2);
}
.kit-loading {
  display: grid;
  gap: var(--space-2);
  max-inline-size: 26rem;
}
.kit-loading-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
/* The progress track has no height of its own anywhere in the core, so a bare
   .progress collapses to nothing. Layout gives it a measure; the style gives
   it a colour (a floor gap). */
.progress { min-block-size: var(--space-2); }
.progress-fill { min-block-size: var(--space-2); }
/* live toasts land in the core's fixed .toast-region; the static ones are in flow */
#kit-toast-static .toast { max-inline-size: 26rem; }

/* ---- 6. surfaces band --------------------------------------------------- */

.kit-card-media { margin: 0; }
/* the image card runs media beside copy once it has room, so a square photo
   does not make it taller than everything around it */
@media (min-width: 600px) {
  .kit-card-wide {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    align-items: stretch;
  }
}
.kit-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}
.kit-card-body > * { margin: 0; }
/* the trailing action sits on the card's foot, as in the shop cards */
.kit-card-body > .kit-row { margin-block-start: auto; }

/* the core fixes .popover, .tooltip and .menu-list to the viewport; on this
   page each hangs off its trigger or sits in flow instead */
.kit-anchor {
  position: relative;
  display: inline-flex;
}
.kit-anchor > .popover {
  position: absolute;
  inset-block-start: calc(100% + var(--space-2));
  inset-inline-start: 0;
  inline-size: min(18rem, 78vw);
  z-index: 5;
}
.kit-anchor > .popover[hidden] { display: none; }
.kit-anchor > .popover p { margin: var(--space-1) 0 0; }
.kit-tip-anchor > .tooltip {
  position: absolute;
  inset-block-start: calc(100% + var(--space-2));
  inset-inline-start: 0;
  z-index: 5;
  display: none;
}
.kit-tip-anchor:hover > .tooltip,
.kit-tip-anchor:focus-within > .tooltip { display: block; }
.kit-tip-anchor[data-dismissed] > .tooltip { display: none; }

.kit-live-layers {
  /* room under the triggers so the popover and tooltip open into empty space */
  min-block-size: 11rem;
  align-items: flex-start;
}
.kit-layer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-5);
}
.kit-menu-static {
  position: static;
  flex: 0 1 12rem;
}
.kit-tip-static { padding-block-start: var(--space-2); }
.kit-tooltip-static { position: static; }

/* the dialog's centring, size and ::backdrop are the core/floor's */
dialog.kit-dialog:not([open]) { display: none; }

/* ---- 7. navigation + data bands ----------------------------------------- */

.kit-acc { display: grid; min-width: 0; }
/* accordion: closed panels collapse 1fr to 0fr, keyed off aria-expanded.
   The tween is the style's motion channel (floor gap, see report). */
.acc-panel-wrap {
  display: grid;
  grid-template-rows: 0fr;
}
.acc-trigger[aria-expanded="true"] + .acc-panel-wrap { grid-template-rows: 1fr; }
.acc-panel-wrap > div { min-block-size: 0; overflow: hidden; }

.tabpanel[hidden] { display: none; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* avatars: the core only centres their content and clips overflow. Give the
   box a size from the data-size hook so initials do not collapse to text. */
.avatar { inline-size: 2.5rem; block-size: 2.5rem; }
.avatar[data-size="sm"] { inline-size: 1.75rem; block-size: 1.75rem; }
.avatar[data-size="lg"] { inline-size: 4rem; block-size: 4rem; }

/* the orders table scrolls inside .table-wrap on a phone; cells keep their
   words on one line so it scrolls cleanly instead of breaking order numbers */
.table th, .table td { white-space: nowrap; }

/* segmented control sits at its content width, with room before the next group */
.kit-block > .segmented { justify-self: start; margin-block-end: var(--space-3); }
