@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
/* Compound family aggregation: importing `cinder/tabs/styles` pulls the whole
 * Tabs family (TabList, Tab, TabPanel). Sibling-leaf paths resolve identically
 * in `src/` and the verbatim-copied `dist/` because the layout mirrors. */
@import '/assets/f47cf25678047dc1d0c5372c25b330b4ffdf35604610caa62c68ff9ad26b877e/components/tab/tab.css';
@import '/assets/f47cf25678047dc1d0c5372c25b330b4ffdf35604610caa62c68ff9ad26b877e/components/tab-list/tab-list.css';
@import '/assets/f47cf25678047dc1d0c5372c25b330b4ffdf35604610caa62c68ff9ad26b877e/components/tab-panel/tab-panel.css';

@layer cinder.components {
  /* ========================================
 * TABS
 * Outer wrapper provides flex layout for horizontal vs vertical orientation.
 * Contains a TabList (with role="tablist") and one or more TabPanels.
 * ======================================== */

  .cinder-tabs {
    display: flex;
    flex-direction: column;
    gap: var(--cinder-space-4);
    min-inline-size: 0;
    container-type: inline-size;
    container-name: cinder-tabs;
  }

  .cinder-tabs[data-cinder-fill] {
    flex: 1 1 auto;
    min-block-size: 0;
  }

  .cinder-tabs[data-cinder-orientation='horizontal'] {
    /* Inline-size containment gives an auto-sized flex item no content width.
     * Give the root a width the parent can shrink, so the list has a scrollport
     * and overflow collapse can measure the space available. */
    inline-size: 100%;
  }

  .cinder-tabs[data-cinder-orientation='vertical'] {
    flex-direction: row;
  }

  /* The narrow form's select, drawn in place of the hidden tab bar: one full-width control above
     the panels. */
  .cinder-tabs__collapse {
    inline-size: 100%;
  }

  .cinder-tabs__collapse .cinder-select {
    min-block-size: var(--cinder-touch-target-min);
  }

  @media (any-pointer: coarse) {
    .cinder-tabs__collapse button[data-cinder-compact-touch] {
      min-block-size: var(--_cinder-painted-height-md);
    }
  }

  /* ----------------------------------------
 * Tab list
 * ---------------------------------------- */

  .cinder-tab-list {
    display: flex;
    gap: var(--cinder-space-1);
    border-bottom: 1px solid var(--cinder-border-muted);
    min-inline-size: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    /* A bar that overflows fades out at its inline end (the shared inline-end fade, driven by
     * `overflowFadeEdges`), in the page surface. Keyboard focus parks a tab at the edge it scrolls
     * to, so the scrollport keeps the fade's width clear: a focused tab is never under the fade. */
    --_cinder-scroll-fade-color: var(--cinder-surface);
    scroll-padding-inline-end: var(--cinder-space-6);
  }

  .cinder-tab-list[data-cinder-orientation='horizontal'] {
    /* Leave room beyond the last trigger when the scroll offset rounds to a CSS pixel. */
    padding-inline-end: var(--cinder-border-width);
  }

  .cinder-tab-list[data-cinder-orientation='vertical'] {
    flex-direction: column;
    border-bottom: none;
    border-inline-end: 1px solid var(--cinder-border-muted);
    align-self: stretch;
  }

  /* ----------------------------------------
 * Tab button
 * ---------------------------------------- */

  .cinder-tab {
    appearance: none;
    background: none;
    border: none;
    padding: var(--cinder-space-2) var(--cinder-space-3);
    font: inherit;
    font-size: var(--cinder-text-sm);
    font-weight: var(--cinder-font-medium);
    color: var(--cinder-text-muted);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: var(--cinder-space-2);
    white-space: nowrap;
    border-radius: var(--cinder-radius-sm) var(--cinder-radius-sm) 0 0;
    transition:
      color var(--cinder-duration-fast) var(--cinder-ease-standard),
      background var(--cinder-duration-fast) var(--cinder-ease-standard);
  }

  /* Decorative trailing slot (badges, kbd hints, counters). Wrapped in
 * `aria-hidden="true"` in the markup so it never enters the accessible name. */
  .cinder-tab__trailing {
    display: inline-flex;
    align-items: center;
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-xs);
  }

  /* A count of things in the tab that want attention. A tab keeps its height whether or not it
 * carries one: the pill is 18px and the tab's padding already clears it. It does not shrink when
 * the strip is tight, so a "1" is never squeezed into an oval. */
  .cinder-tab__count {
    flex: none;
    min-inline-size: 1.125rem;
    box-sizing: border-box;
    justify-content: center;
    border-radius: 9999px;
    font-weight: var(--cinder-font-semibold);
  }

  /* Sticky-hover suppression on touch: wrap hover-only chrome so it doesn't
 * "stick" after tap on touch devices that emulate :hover. */
  @media (hover: hover) {
    .cinder-tab:hover:not([data-cinder-disabled]) {
      color: var(--cinder-text-default);
      background: var(--cinder-surface-hover);
    }
  }

  /* Vertical tab radius — override the horizontal top-rounded/bottom-square
 * shape so the focus-ring box-shadow does not paint a tombstone in vertical
 * tablists. Emitted from `tabs.orientation` context as `data-variant`. */
  .cinder-tab[data-variant='vertical'] {
    border-radius: var(--cinder-radius-sm);
  }

  .cinder-tab[data-cinder-active] {
    color: var(--cinder-accent-text);
  }

  /* Active indicator — bottom (horizontal) / right (vertical) accent stripe. */
  .cinder-tab[data-cinder-active]::after {
    content: '';
    position: absolute;
    background: var(--cinder-accent-solid);
    pointer-events: none;
  }

  .cinder-tabs[data-cinder-orientation='horizontal'] .cinder-tab[data-cinder-active]::after,
  .cinder-tab-list[data-cinder-orientation='horizontal'] .cinder-tab[data-cinder-active]::after {
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
  }

  .cinder-tabs[data-cinder-orientation='vertical'] .cinder-tab[data-cinder-active]::after,
  .cinder-tab-list[data-cinder-orientation='vertical'] .cinder-tab[data-cinder-active]::after {
    top: 0;
    bottom: 0;
    right: -1px;
    width: 2px;
    height: auto;
  }

  /* The tab list is a clipping container: `.cinder-tab-list` sets
   * `overflow-x: auto`, and per the CSS Overflow spec a non-`visible` value on
   * one axis forces the other axis's used `overflow` to `auto` too — so the
   * list clips on BOTH axes. The list has zero block padding and a 1px
   * `border-bottom`, so the standard OUTSET focus ring (offset + ring-width
   * painted outside the tab border box) pokes past the list's content box and
   * gets clipped on the top, bottom, and trailing edges — only the first tab's
   * inline-start edge survives. Use the policy-sanctioned Strategy B-inset
   * variant: an INSET single-band ring painted entirely within the tab border
   * box, so the overflow clamp can never clip it in either orientation, with
   * zero layout shift (no padding or scroll-geometry change). The
   * `--_cinder-tab-ring` fallback hook matches the dropdown/number-input
   * inset-ring convention. */
  .cinder-tab:focus-visible {
    outline: var(--cinder-ring-width) solid transparent;
    box-shadow: inset 0 0 0 var(--cinder-ring-width)
      var(--_cinder-tab-ring, var(--cinder-ring-color));
  }

  @media (forced-colors: active) {
    /* Inset box-shadow rings vanish in Windows High Contrast Mode, so repaint
     * the outline channel with a negative offset that draws the outline INSIDE
     * the tab border box — a positive/outset offset would itself be clipped by
     * the list. `ButtonText` is the policy-correct system color for a
     * button-shaped `role="tab"` pressable (not `Highlight`). */
    .cinder-tab:focus-visible {
      outline: var(--cinder-ring-width) solid ButtonText;
      outline-offset: calc(var(--cinder-ring-width) * -1);
    }
  }

  .cinder-tab[data-cinder-disabled] {
    color: var(--cinder-text-disabled);
    cursor: not-allowed;
  }

  /* On a coarse pointer a tab keeps its painted height (about 36px) and reaches the 44px touch
   * minimum through a positioned `::before` that takes no layout space (`::after` is the active
   * indicator), as a Button does. The extension rises above the tab, because the bar's bottom edge
   * is the rule the active indicator sits on and a row above the tabs is empty. The list scrolls
   * sideways, which clips its other axis too, so it pads its top by the extension's reach and
   * cancels the padding with a matching negative margin: the bar does not move. That padding
   * overlaps whatever sits above the bar, so the list itself takes no taps and only its tabs (and
   * their extensions) do: a button above the bar keeps its whole hit area. A vertical bar stacks
   * tabs a few pixels apart, so it keeps the painted box. */
  @media (pointer: coarse) {
    .cinder-tab-list:not([data-cinder-orientation='vertical']) {
      padding-block-start: var(--cinder-space-3);
      margin-block-start: calc(var(--cinder-space-3) * -1);
      pointer-events: none;
    }

    .cinder-tab-list:not([data-cinder-orientation='vertical']) > * {
      pointer-events: auto;
    }

    .cinder-tab:not([data-variant='vertical'])::before {
      content: '';
      position: absolute;
      inset-inline: 0;
      inset-block-end: 0;
      inset-block-start: min(0px, calc(100% - var(--cinder-touch-target-min)));
    }
  }

  /* ----------------------------------------
 * Tab panel
 * ---------------------------------------- */

  .cinder-tab-panel {
    flex: 1 1 auto;
    min-block-size: 0;
    padding: var(--cinder-space-2) 0;
    outline: none;
  }

  @container cinder-tabs (max-width: 30rem) {
    .cinder-tabs[data-cinder-orientation='vertical'] {
      flex-direction: column;
    }

    .cinder-tabs[data-cinder-orientation='vertical'] .cinder-tab-list {
      flex-direction: row;
      border-inline-end: none;
      border-bottom: 1px solid var(--cinder-border-muted);
      align-self: stretch;
    }
  }

  .cinder-tab-panel:focus-visible {
    outline: var(--cinder-ring-width) solid transparent;
    box-shadow: var(--_cinder-focus-ring-shadow);
  }

  @media (forced-colors: active) {
    .cinder-tab-panel:focus-visible {
      outline: var(--cinder-ring-width) solid Highlight;
      outline-offset: 2px;
    }
  }
}
