/* Selected CSS recipes from transitions.dev; see TRANSITIONS-LICENSE.txt.
 * https://github.com/Jakubantalik/transitions.dev/tree/main/skills/transitions-dev
 */

/* transitions.dev / 21-accordion.md */
: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);
}

/* transitions.dev / 16-tabs-sliding.md */
: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;
}

/* transitions.dev / 14-skeleton-reveal.md */
:root {
  --pulse-dur: 1000ms;
  --pulse-count: 1;
  --pulse-min: 0.5;
  --reveal-dur: 400ms;
  --reveal-blur: 2px;
  --reveal-ease: ease-in-out;
}

/* The wrap stacks two layers on the same coordinates. The
   skeleton owns the cold pulse + the fade-out side of the
   reveal; the content owns the fade-in side. They share the
   same duration / ease so the swap reads as one motion. */
.t-skel { position: relative; }
.t-skel-skeleton,
.t-skel-content {
  position: absolute;
  inset: 0;
}

.t-skel-skeleton {
  z-index: 1;
  opacity: 1;
  filter: blur(0);
  transition:
    opacity var(--reveal-dur) var(--reveal-ease),
    filter  var(--reveal-dur) var(--reveal-ease);
}
.t-skel-content {
  z-index: 2;
  opacity: 0;
  filter: blur(var(--reveal-blur));
  transition:
    opacity var(--reveal-dur) var(--reveal-ease),
    filter  var(--reveal-dur) var(--reveal-ease);
}
.t-skel.is-revealed .t-skel-skeleton {
  opacity: 0;
  filter: blur(var(--reveal-blur));
}
.t-skel.is-revealed .t-skel-content {
  opacity: 1;
  filter: blur(0);
}
/* Snap-back when replaying: kill transitions so the reverse
   (revealed → skeleton) is instant. Drop `.is-resetting`
   after a forced reflow and the next reveal animates again. */
.t-skel.is-resetting .t-skel-skeleton,
.t-skel.is-resetting .t-skel-content {
  transition: none !important;
}

/* Pulse: place the animation on the bar/avatar children, not
   on the skeleton itself, so the skeleton's opacity / filter
   stay free for the cross-fade transition above. */
.t-skel-skeleton.is-pulsing > * {
  animation: t-skel-pulse var(--pulse-dur) ease-in-out var(--pulse-count);
}
@keyframes t-skel-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: var(--pulse-min); }
}

/* Integration with the existing page layout. */

.t-acc-panel, .t-acc-panel-inner { min-width: 0; min-height: 0; }
.t-acc[data-open="false"] > .t-acc-panel { grid-template-rows: 0fr; }
.t-acc[data-open="false"] > .t-acc-panel > .t-acc-panel-inner { opacity: 0; filter: blur(2px); }
.t-acc > summary .t-acc-chevron { transform: scaleY(1); }
.t-acc[data-open="true"] > summary .t-acc-chevron { transform: scaleY(-1); }
.t-acc .principle-content { animation: none; }
.t-acc > summary:focus-visible { outline: 2px solid #3273dc; outline-offset: -3px; }

.t-tabs { max-width: 100%; }
.t-tabs .t-tab { white-space: nowrap; }
.t-tabs .t-tabs-pill { border-radius: inherit; box-shadow: 0 1px 4px #0000000b; }
.t-tabs .t-tab:focus-visible { outline: 2px solid #3273dc; outline-offset: -2px; }

.rl-research .tabs.t-tabs { gap: 3px; padding: 3px; border: 1px solid #e0e4e8; border-radius: 8px; background: #f1f3f5; overflow: visible; }
.rl-research .tabs.t-tabs .t-tab { position: relative; border: 0; border-radius: 5px; background: transparent; color: #69727e; height: auto; padding: 8px 12px; font-size: 13px; font-weight: 500; }
.rl-research .tabs.t-tabs .t-tab[aria-pressed="true"] { background: transparent; color: #24547b; }
.rl-research .tabs.t-tabs .t-tabs-pill { background: #fff; border-radius: 5px; }
.rollout-stage { height: 640px; min-width: 0; background: #f3f5f7; --reveal-dur: 300ms; --reveal-blur: 1px; --pulse-count: infinite; }
.rollout-stage #rollout-frame { height: 100%; width: 100%; }
.rollout-stage:not(.is-revealed) .t-skel-content { pointer-events: none; }
.rollout-stage.is-revealed .t-skel-skeleton { pointer-events: none; }
.rollout-stage .t-skel-skeleton { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; padding: 30px; color: #78828c; text-align: center; }
.rollout-placeholder { width: min(260px, 70%); height: 170px; border-radius: 16px; background: linear-gradient(135deg, #e4e9ed, #f7f8f9); display: grid; place-content: center; gap: 12px; }
.rollout-placeholder span { display: block; width: 120px; height: 9px; border-radius: 10px; background: #d5dde3; }
.rollout-placeholder span:nth-child(2) { width: 85px; }
.rollout-placeholder span:nth-child(3) { width: 102px; }
#rollout-loading-label { font-size: 13px; max-width: 32em; }
.rollout-stage[data-state="error"] .rollout-placeholder { display: none; }
#rollout-retry[hidden] { display: none; }
@media (max-width: 600px) {
  .rollout-stage { height: 560px; }
  .rl-research .tabs.t-tabs .t-tab { padding: 8px; font-size: 12px; }
}
