/* Transitions.dev : pastille et accordéons, variables et recettes portables. */

:root {
  --tabs-dur: 250ms;
  --tabs-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --tabs-text-muted: rgba(15, 15, 15, 0.8);
  --tabs-text-active: #0f0f0f;
  --tabs-bar-bg: #f1f1f1;
  --tabs-pill-bg: #ffffff;
}


/* The bar is just a flex container with padding for the pill
   to sit inside. Tabs sit on z-index: 1, the pill on z-index: 0,
   so labels read above the pill background. */
.t-tabs {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 48px;
  background: var(--tabs-bar-bg);
}
.t-tab {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  height: 30px;
  padding: 4px 12px;
  color: var(--tabs-text-muted);
  cursor: pointer;
  border-radius: 48px;
  z-index: 1;
  transition: color var(--tabs-dur) var(--tabs-ease);
}
.t-tab:not([aria-selected="true"]):hover,
.t-tab[aria-selected="true"] {
  color: var(--tabs-text-active);
}

/* The pill: width + transform are written inline by JS so
   the transition tweens between the previous and next
   measured positions. */
.t-tabs-pill {
  position: absolute;
  top: 3px;
  left: 0;
  height: 30px;
  width: 0;
  background: var(--tabs-pill-bg);
  border-radius: 48px;
  transform: translateX(0);
  transition:
    transform var(--tabs-dur) var(--tabs-ease),
    width     var(--tabs-dur) var(--tabs-ease);
  will-change: transform, width;
  z-index: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .t-tabs-pill, .t-tab { transition: none !important; }
}


:root {
  --acc-expand: 250ms;
  --acc-collapse: 250ms;
  --acc-chevron: 250ms;
  --acc-ease: cubic-bezier(0.22, 1, 0.36, 1);
}


/* grid-template-rows 0fr → 1fr gives a clean height animation
   with no JS measurement; the inner element clips overflow. */
.t-acc-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--acc-collapse) var(--acc-ease);
}
.t-acc[data-open="true"] .t-acc-panel {
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--acc-expand) var(--acc-ease);
}
.t-acc-panel-inner {
  overflow: hidden;
  opacity: 0;
  filter: blur(2px);
  transition:
    opacity var(--acc-collapse) var(--acc-ease),
    filter var(--acc-collapse) var(--acc-ease);
}
.t-acc[data-open="true"] .t-acc-panel-inner {
  opacity: 1;
  filter: blur(0);
  transition:
    opacity var(--acc-expand) var(--acc-ease),
    filter var(--acc-expand) var(--acc-ease);
}
/* Flip the chevron vertically to turn the "v" into a "^".
   scaleY(-1) about the centre passes through a flat line at
   the midpoint (same look as a `d:` path morph) but animates
   in every browser, unlike CSS `d:` morphing (Chromium only).
   The chevron path is symmetric about the 16x16 viewBox
   centre, so the flip lands exactly on the "^"; non-scaling
   -stroke keeps the stroke width constant through the flip. */
.t-acc-chevron {
  display: inline-flex;
  transform: scaleY(1);
  transform-origin: center;
  transition: transform var(--acc-chevron) var(--acc-ease);
}
.t-acc-chevron path { vector-effect: non-scaling-stroke; }
.t-acc[data-open="true"] .t-acc-chevron {
  transform: scaleY(-1);
}

@media (prefers-reduced-motion: reduce) {
  .t-acc-panel, .t-acc-panel-inner, .t-acc-chevron {
    transition: none !important;
  }
}
/* Adaptation des recettes aux composants existants. */
.demo-lab .t-tabs { --tabs-pill-bg:var(--c-cobalt); --tabs-text-active:#fff; --tabs-text-muted:var(--c-text-2); }
.demo-lab .t-tabs .t-tab { height:auto; background:transparent; }
.demo-lab .t-tabs .t-tab[aria-selected=true] { background:transparent; color:#fff; }
.demo-lab .t-tabs .t-tab:not([aria-selected=true]):hover { color:var(--c-cobalt); background:transparent; }
.demo-lab .t-tabs-pill { top:4px; height:calc(100% - 8px); }
.demo-transition { position:absolute; left:0; width:100%; z-index:2; pointer-events:none; }
.qa.t-acc .qa__a { padding:0; gap:0; }
.qa.t-acc .t-acc-panel-inner { display:grid; gap:.8rem; padding-right:2.5rem; }
.qa.t-acc .t-acc-panel-inner::after { content:''; display:block; height:.6rem; }
.qa.t-acc .qa__v { display:block; transform-box:fill-box; transform-origin:center; transform:scaleY(1); transition:transform var(--acc-chevron) var(--acc-ease); }
.qa.t-acc[data-open=true] .qa__v { transform:scaleY(0); }
.motion-instant :is(.t-acc-panel,.t-acc-panel-inner) { transition:none!important; }
.motion-instant :is(.t-tab,.t-tabs-pill) { transition:none!important; }
.motion-instant .qa__v { transition:none!important; }
.hd__nav { transform-origin:top center; }
.deck-progress { display:none; }
[data-slide-deck].is-stacked .deck-progress { display:flex; align-items:center; gap:20px; position:absolute; top:calc(var(--deck-height) + 8px); left:0; right:0; height:20px; font-size:.75rem; line-height:1.2; color:var(--c-text-2); font-variant-numeric:tabular-nums; }
.deck-progress__track { flex:1; height:2px; background:var(--c-line); overflow:hidden; }
.deck-progress__track > span { display:block; height:100%; background:var(--c-cobalt); transform:scaleX(var(--deck-progress,0)); transform-origin:left; }
@media (prefers-reduced-motion:reduce) { .demo-transition { display:none; } .qa.t-acc .qa__v { transition:none; } }
