/*
  ============================================================================
  ASTRYX-COMPONENTS.CSS — pixel-fidelity HTML+CSS clone of Astryx components
  ============================================================================
  ATTRIBUTION: geometry, spacing, typography scale, shadow, and motion values
  below were measured with getComputedStyle() against the real React
  components of Astryx (github.com/facebook/astryx), packages
  @astryxdesign/core@0.5.1 and @astryxdesign/theme-neutral@0.5.1.
  Copyright (c) 2026 Meta Platforms, Inc. Licensed under the MIT License.
  https://github.com/facebook/astryx/blob/main/LICENSE

  This file does NOT import Astryx's CSS, JS, or color palette — every color
  below is ours (--ink / --paper / --amber / --magenta / --violet from
  system.css). Only shape, spacing, type, elevation and easing are Astryx's.

  METHOD: a Vite + React 19 app (../astryx-clone/src/App.tsx) renders every
  component/variant/state with the REAL @astryxdesign/core package, wrapped
  in the neutral theme. Playwright (../astryx-clone/measure/measure.mjs)
  opens that app and reads window.getComputedStyle() per element, including
  real :hover (mouse) and keyboard-triggered :focus-visible states. Results:
  ../astryx-clone/measure/measured.json. Zero hashed/atomic Astryx classes
  are read or copied — those are illegible and re-hash every release; the
  computed pixel values behind them do not.

  Class naming: `.ax-` prefix, BEM-ish modifiers (`.ax-btn--primary`).
  Deliberately NOT `.btn` / `.badge` — those names are already taken in
  system.css by this project's own (different) button/badge design; `.ax-`
  keeps this file a self-contained, optional component layer.

  Requires system.css to be loaded first (for --ink, --paper, --space-*,
  --radius-*, --duration-*, --ease-standard, --font-body, --shadow-*).
  This file adds only the Astryx tokens system.css does not already carry
  (a font-size scale, a few extra spacing/avatar-size steps) plus the
  component rules themselves.
  ============================================================================
*/

:root {
  /* ---- Astryx font-size scale ------------------------------------------
     Source: @astryxdesign/theme-neutral, --font-size-*. system.css's own
     --text-* scale (12/14/16/18/22/28/36...) only coincides with Astryx at
     12px and 14px; the rest (17/20/24px used by Heading/Text) has no home
     there, so it lives here under Astryx's own names for traceability. */
  --ax-font-size-2xs: 0.5rem;     /* 8px  — Astryx --font-size-2xs */
  --ax-font-size-xs: 0.625rem;    /* 10px — Astryx --font-size-xs  (Heading h6) */
  --ax-font-size-sm: 0.75rem;     /* 12px — Astryx --font-size-sm  (Heading h5, Badge, Text supporting) — == system.css --text-xs */
  --ax-font-size-base: 0.875rem;  /* 14px — Astryx --font-size-base (Button, Heading h4, Text body/label) — == system.css --text-sm */
  --ax-font-size-lg: 1.0625rem;   /* 17px — Astryx --font-size-lg  (Heading h3, Text large, Collapsible trigger) */
  --ax-font-size-xl: 1.25rem;     /* 20px — Astryx --font-size-xl  (Heading h2) */
  --ax-font-size-2xl: 1.5rem;     /* 24px — Astryx --font-size-2xl (Heading h1) */

  /* ---- Astryx spacing steps missing from system.css's --space-* subset -
     system.css already sources --spacing-1/2/3/4/6/8/12 (4/8/12/16/24/32/
     48px) from @astryxdesign/core. Button height and Avatar size use a few
     steps that subset skips. */
  --ax-spacing-5: 1.25rem;   /* 20px — Astryx --spacing-5 (Avatar xsm) */
  --ax-spacing-6: 1.5rem;    /* 24px — Astryx --spacing-6 (Avatar sm) — == system.css --spacing-6 */
  --ax-spacing-7: 1.75rem;   /* 28px — Astryx --spacing-7 (Button sm height) */
  --ax-spacing-9: 2.25rem;   /* 36px — Astryx --spacing-9 (Button lg height, Avatar md) */

  /* ---- Astryx overlay tokens --------------------------------------------
     Measured hover/press treatment on Button/ClickableCard/Collapsible is a
     flat black wash layered OVER the resting fill via background-image —
     not a background-color swap. Source: @astryxdesign/core
     --color-overlay-hover / --color-overlay-pressed (light mode). */
  --ax-overlay-hover: rgba(0, 0, 0, 0.05);
  --ax-overlay-pressed: rgba(0, 0, 0, 0.1);
  --ax-border-emphasized: rgba(0, 0, 0, 0.16); /* measured ClickableCard hover border, ~ Astryx --color-border-emphasized */
}

/* ==========================================================================
   Button — .ax-btn
   Measured: padding 8/12px and border-radius identical across all four
   variants and all three sizes; ONLY height changes by size (sm 28 / md 32
   / lg 36px — Astryx's sizeStyles literally sets nothing else). Hover is a
   5% black overlay via background-image on every variant, disabled/loading
   both read as opacity 0.5 with cursor staying default (not not-allowed).
   Focus-visible is a 2px solid outline in the button's own ink color, 3px
   offset — measured via real keyboard-style focus, not synthesized.
   ========================================================================== */
.ax-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3); /* 8px 12px, measured on all variants/sizes */
  height: 2rem; /* 32px = md, default (overridden by --sm/--lg below) */
  border: 0;
  border-radius: var(--radius-md); /* 10px */
  font-family: var(--font-body);
  font-size: var(--ax-font-size-base); /* 14px */
  font-weight: 500;
  line-height: 20px;
  cursor: pointer;
  background-image: none;
  transition: background-image var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    opacity var(--duration-fast) var(--ease-standard);
}

.ax-btn:hover {
  background-image: linear-gradient(var(--ax-overlay-hover), var(--ax-overlay-hover));
}

.ax-btn:active {
  background-image: linear-gradient(var(--ax-overlay-pressed), var(--ax-overlay-pressed));
}

.ax-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.ax-btn:disabled,
.ax-btn[aria-disabled='true'],
.ax-btn--loading {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* Measured heights: sm 28px, md 32px, lg 36px (Button.d.ts sizeStyles).
   --ax-spacing-9 (36px) is reused for --lg only, since it's the one size
   that lands on an Astryx spacing step; sm/md are spelled out in rem. */
.ax-btn--sm { height: 1.75rem; }  /* 28px */
.ax-btn--md { height: 2rem; }     /* 32px */
.ax-btn--lg { height: var(--ax-spacing-9); } /* 36px */

.ax-btn--primary {
  background-color: var(--ink);
  color: var(--paper);
}

.ax-btn--secondary {
  background-color: color-mix(in srgb, var(--ink) 6%, transparent); /* measured rgba(0,0,0,.06) */
  color: var(--ink);
}

.ax-btn--ghost {
  background-color: transparent;
  color: var(--ink);
}

.ax-btn--destructive {
  /* Astryx destructive is a locked pastel-red fill + saturated red text —
     the one place Button breaks from the neutral ink/paper pattern. We
     substitute our own brand accent (magenta) for Astryx's red hue. */
  background-color: var(--magenta-tint);
  color: var(--magenta);
}

/* ==========================================================================
   Card — .ax-card
   Measured: default draws a 1px hairline border and subtracts its width
   from the padding token (12px card padding token → 11px measured, border
   eats 1px); transparent/muted are borderless at the full 12px. Radius
   12px on all three. No shadow at rest (elevation="none" default).
   ========================================================================== */
.ax-card {
  display: block;
  padding: var(--space-3); /* 12px */
  border-radius: var(--radius-lg); /* 12px */
  background-color: var(--paper);
  font-family: var(--font-body);
}

.ax-card--default {
  padding: calc(var(--space-3) - 1px); /* 11px — border width subtracted, measured */
  border: 1px solid var(--line);
}

.ax-card--transparent {
  background-color: transparent;
}

.ax-card--muted {
  background-color: var(--gray-100);
}

/* ==========================================================================
   ClickableCard — .ax-clickable-card
   Same geometry as Card--default. Hover measured: border goes from the
   faint hairline to a stronger neutral border (no background/shadow
   change) — Astryx's --color-border-emphasized swap.
   ========================================================================== */
.ax-clickable-card {
  display: block;
  padding: calc(var(--space-3) - 1px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background-color: var(--paper);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard);
}

.ax-clickable-card:hover {
  border-color: var(--ax-border-emphasized);
}

.ax-clickable-card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ==========================================================================
   Badge — .ax-badge
   Measured: 0/8px padding (vertical padding is 0 — height comes entirely
   from the 20px line-height), full pill radius, 12px/500 label. Semantic
   colors substituted with our own trio + neutral grays (Astryx's own
   info/success/warning/error hues are not carried over, per brief).
   ========================================================================== */
.ax-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2); /* 0 8px, measured */
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: var(--ax-font-size-sm); /* 12px */
  line-height: 20px;
  font-weight: 500;
}

.ax-badge--neutral { background-color: var(--gray-100); color: var(--ink); }
.ax-badge--info { background-color: var(--violet); color: var(--paper); }
.ax-badge--success { background-color: #2f7a52; color: var(--paper); } /* system.css --success */
.ax-badge--warning { background-color: var(--amber-tint); color: var(--amber); }
.ax-badge--error { background-color: var(--magenta); color: var(--paper); }

/* ==========================================================================
   Banner — .ax-banner
   Measured on the inner `.astryx-banner` node (the data-measure root is an
   unstyled `role="status"` wrapper): 12/16px padding, 12px radius, row gap
   12px column gap 8px, flex-start aligned icon+text. Card and section
   containers measured IDENTICAL padding/radius/gap — the difference is
   Banner's own margin/inset behavior in a page flow, not its own box, so
   .ax-banner does not need a --container modifier for geometry.
   ========================================================================== */
.ax-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3) var(--space-2); /* row 12px / column 8px, measured */
  padding: var(--space-3) var(--space-4); /* 12px 16px */
  border-radius: var(--radius-lg); /* 12px */
  font-family: var(--font-body);
}

.ax-banner__icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

.ax-banner__title {
  font-size: var(--ax-font-size-base);
  font-weight: 600;
  line-height: 20px;
}

.ax-banner__description {
  font-size: var(--ax-font-size-sm);
  line-height: 20px;
  color: var(--ink-soft);
}

.ax-banner--info { background-color: var(--violet-tint); color: var(--violet); }
.ax-banner--warning { background-color: var(--amber-tint); color: var(--amber); }
.ax-banner--error { background-color: var(--magenta-tint); color: var(--magenta); }
.ax-banner--success { background-color: #d7ecd2; color: #2f7a52; }

/* ==========================================================================
   Heading — .ax-heading (level 1..6)
   Measured directly on <h1>..<h6>: font-size and font-weight follow
   Astryx's --text-heading-N-* tokens exactly (semibold 600 for h1/h2/h5/h6,
   bold 700 for h3/h4). Line-height values below are the measured px, which
   match Astryx's leading ratios (e.g. h1: 24px * 1.3333 = 32px).
   ========================================================================== */
.ax-heading {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
}

.ax-heading--1 { font-size: var(--ax-font-size-2xl); font-weight: 600; line-height: 32px; }
.ax-heading--2 { font-size: var(--ax-font-size-xl); font-weight: 600; line-height: 28px; }
.ax-heading--3 { font-size: var(--ax-font-size-lg); font-weight: 700; line-height: 24px; }
.ax-heading--4 { font-size: var(--ax-font-size-base); font-weight: 700; line-height: 20px; }
.ax-heading--5 { font-size: var(--ax-font-size-sm); font-weight: 600; line-height: 20px; }
.ax-heading--6 { font-size: var(--ax-font-size-xs); font-weight: 600; line-height: 16px; }

/* ==========================================================================
   Text / Blockquote — .ax-text / .ax-blockquote
   Measured 4 Text `type`s directly. Blockquote: 16px left padding only
   (no top/bottom/right), secondary ink color, body-size text.
   ========================================================================== */
.ax-text {
  font-family: var(--font-body);
  margin: 0;
}

.ax-text--body { font-size: var(--ax-font-size-base); font-weight: 400; line-height: 20px; color: var(--ink); }
.ax-text--large { font-size: var(--ax-font-size-lg); font-weight: 600; line-height: 24px; color: var(--ink); }
.ax-text--label { font-size: var(--ax-font-size-base); font-weight: 500; line-height: 20px; color: var(--ink); }
.ax-text--supporting { font-size: var(--ax-font-size-sm); font-weight: 400; line-height: 20px; color: var(--ink-soft); }

.ax-blockquote {
  margin: 0;
  padding-left: var(--space-4); /* 16px, measured (no other side padded) */
  font-family: var(--font-body);
  font-size: 1rem; /* 16px, measured — Blockquote is one of the few nodes NOT on the 14px base scale */
  line-height: 24px;
  color: var(--ink-soft);
}

/* ==========================================================================
   Divider — .ax-divider
   Measured: 1px line, faint hairline color, full-width. subtle vs strong
   read identically in this theme at rest (both mapped to the same
   `--color-border` token); we keep the modifier for API parity and darken
   `strong` slightly since Astryx's own strong override differs by theme.
   ========================================================================== */
.ax-divider {
  display: flex;
  align-items: center;
  border: 0;
  /* No gap here — measured: spacing around the label comes from the
     label's own 12px horizontal padding (below), not a parent flex gap. */
}

.ax-divider__line {
  flex: 1 1 auto;
  height: 1px;
  background-color: var(--line); /* measured rgba(0,0,0,.08) */
}

.ax-divider--strong .ax-divider__line {
  background-color: var(--line-strong);
}

.ax-divider__label {
  padding: 0 var(--space-3); /* 12px, measured */
  font-family: var(--font-body);
  font-size: var(--ax-font-size-sm);
  line-height: 20px; /* measured */
  color: var(--ink-soft);
}

/* ==========================================================================
   Avatar / AvatarGroup — .ax-avatar
   Measured widths per named size: xsm 20 / sm 24 / md 36 / lg 48 / xl
   128px. Fallback initials font-size scales ~0.4x the box (measured 14.4px
   on a 36px md avatar via Astryx's own inline style var).
   ========================================================================== */
.ax-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: var(--radius-pill);
  background-color: var(--gray-100);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 500;
  overflow: hidden;
}

/* Fallback-initials font-size measured directly on `.astryx-avatar-fallback`
   (not the avatar box itself, which sets no font of its own): it is exactly
   0.4x the box size at every named size (8/9.6/14.4/19.2/51.2px on 20/24/
   36/48/128px boxes) — Astryx computes it from the box, not a fixed scale
   step, so we do the same instead of picking nearby rem values. */
.ax-avatar--xsm { width: var(--ax-spacing-5); height: var(--ax-spacing-5); font-size: 0.5rem; }    /* 20px box, 8px font */
.ax-avatar--sm { width: var(--space-5); height: var(--space-5); font-size: 0.6rem; }                /* 24px box, 9.6px font, --space-5 = --spacing-6 */
.ax-avatar--md { width: var(--ax-spacing-9); height: var(--ax-spacing-9); font-size: 0.9rem; }      /* 36px box, 14.4px font */
.ax-avatar--lg { width: var(--space-7); height: var(--space-7); font-size: 1.2rem; }                 /* 48px box, 19.2px font, --space-7 = --spacing-12 */
.ax-avatar--xl { width: 8rem; height: 8rem; font-size: 3.2rem; }                                     /* 128px box, 51.2px font — off the 4px scale, literal */

.ax-avatar-group {
  display: flex;
  align-items: center;
}

.ax-avatar-group .ax-avatar {
  border: 2px solid var(--paper);
  margin-left: -9px; /* measured overlap on md avatars */
}

.ax-avatar-group .ax-avatar:first-child {
  margin-left: 0;
}

/* ==========================================================================
   AspectRatio — .ax-aspect-ratio
   Measured structure: outer box carries the ratio via padding-top trick /
   aspect-ratio, inner absolutely-positioned box fills it edge-to-edge.
   ========================================================================== */
.ax-aspect-ratio {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 0; /* measured 0 — AspectRatio itself adds no radius; round the media you put inside it */
}

.ax-aspect-ratio--16-9 { aspect-ratio: 16 / 9; }
.ax-aspect-ratio--1-1 { aspect-ratio: 1 / 1; }
.ax-aspect-ratio--4-3 { aspect-ratio: 4 / 3; }

.ax-aspect-ratio__inner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   Grid / Center — layout primitives
   Grid measured: equal-width columns via `grid-template-columns: repeat(N,
   1fr)`. Astryx's own `gap` prop is opt-in (SpacingStep, no default) — our
   demo passed none and measured `gap: normal`, so .ax-grid stays gap-less
   by default too; add `gap: var(--space-N)` per-instance to opt in, same
   as the real component. Center measured: simple flex centering box, no
   padding/gap of its own.
   ========================================================================== */
.ax-grid {
  display: grid;
  grid-template-columns: repeat(var(--ax-grid-columns, 3), 1fr);
}

.ax-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   EmptyState — .ax-empty-state
   Measured: 32px top/bottom, 24px left/right padding, 16px gap between
   icon/title/description/actions, center-aligned column.
   ========================================================================== */
.ax-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4); /* 16px, measured */
  padding: var(--space-6) var(--space-5); /* 32/24px, measured — space-6=32px, space-5=24px */
  font-family: var(--font-body);
}

.ax-empty-state__title {
  font-size: var(--ax-font-size-lg);
  font-weight: 700;
  color: var(--ink);
}

.ax-empty-state__description {
  font-size: var(--ax-font-size-base);
  color: var(--ink-soft);
}

/* ==========================================================================
   Collapsible — .ax-collapsible (used for FAQ accordions)
   Trigger measured: flex row, space-between, 17px/600 label (Text "large"
   token), pointer cursor, chevron rotates on open. Content height animates
   via grid-template-rows per Astryx's own technique (0fr <-> 1fr) using
   --duration-medium/--ease-standard, matching the measured transition
   property list (`grid-template-rows`).
   ========================================================================== */
.ax-collapsible {
  /* No border of its own — measured Collapsible has none; dividers between
     FAQ items belong to a `.ax-collapsible-group` wrapper, not here. */
}

.ax-collapsible__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0; /* measured — trigger itself has no padding, spacing comes from line-height */
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--ax-font-size-lg); /* 17px */
  font-weight: 600;
  line-height: 25.5px;
  color: var(--ink);
  text-align: left;
}

.ax-collapsible__chevron {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--ink-soft);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.ax-collapsible[data-open='true'] .ax-collapsible__chevron {
  transform: rotate(180deg);
}

.ax-collapsible__content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--duration-medium) var(--ease-standard);
}

.ax-collapsible[data-open='true'] .ax-collapsible__content {
  grid-template-rows: 1fr;
}

.ax-collapsible__content-inner {
  overflow: hidden;
  padding-bottom: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--ax-font-size-base);
  color: var(--ink-soft);
}

/* ==========================================================================
   Carousel — .ax-carousel
   Measured: horizontal flex scroller, 4px gap at gap=1 (Astryx multiplies
   the gap prop by 4px), edge-fade mask via a gradient on the container,
   nav buttons sit outside the scroll track.
   ========================================================================== */
.ax-carousel {
  position: relative;
}

.ax-carousel__scroller {
  display: flex;
  align-items: center;
  gap: var(--space-1); /* 4px, measured at gap=1 */
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.ax-carousel__scroller::-webkit-scrollbar {
  display: none;
}

.ax-carousel__item {
  scroll-snap-align: start;
  flex: none;
}

.ax-carousel--edge-fade {
  -webkit-mask-image: linear-gradient(to right, transparent, black var(--space-4), black calc(100% - var(--space-4)), transparent);
  mask-image: linear-gradient(to right, transparent, black var(--space-4), black calc(100% - var(--space-4)), transparent);
}

.ax-carousel__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
}
