/* ============================================================
   ARROW BUTTON — a ghost button that is an arrow at rest and shows its label when wanted (ArrowButton.astro;
   first in the /routines templates, Liliya 19.11.2026).
   At rest: the round ↗ of card links (CardArrow, size s: 32). On its own hover or keyboard focus — or its host's,
   any ancestor marked .arrow-btn-host (a card that opens) — the circle widens to the left into a pill with the label
   on the left and the arrow on the right: the label column 0fr → 1fr on the Toggle motion.
   Geometry as the ghost link («Explore →», two-ways.css): 32 high, Paragraph SM, the label 16 from the left, round.
   Colours, by custom property on the button or a parent:
     --arrow-btn-fill       the circle at rest (default CTA Grey, as CardArrow on dark)
     --arrow-btn-ink        the arrow and the label at rest (default white)
     --arrow-btn-fill-open  the open pill (default white, as the ghost's hover)
     --arrow-btn-ink-open   the label and arrow when open (default black)
   --arrow-btn-fill-open is also what the pill turns on its own hover, so the open pill and the ghost read as one.
   Requires: tokens.css, card-arrow.css
   ============================================================ */
.arrow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: var(--space-md);
  border-radius: var(--radius-pill);
  background: var(--arrow-btn-fill, var(--color-bg-cta-grey));
  color: var(--arrow-btn-ink, var(--color-text));
  text-decoration: none;
  transition: background-color var(--duration-toggle) var(--ease-toggle), color var(--duration-toggle) var(--ease-toggle);
}
/* the circle is the pill itself: CardArrow keeps only its arrow (and its turn), never its own fill — on dark pages too */
.arrow-btn .card-arrow, .theme-dark .arrow-btn:is(:hover, :focus-visible) .card-arrow { background: transparent; color: inherit; }
.arrow-btn__label { display: grid; grid-template-columns: 0fr; transition: grid-template-columns var(--duration-toggle) var(--ease-toggle); }
.arrow-btn__label > * { overflow: hidden; white-space: nowrap; min-width: 0; padding-left: 0; transition: padding-left var(--duration-toggle) var(--ease-toggle); }
/* open: its own hover or focus, or its host's */
:is(.arrow-btn:is(:hover, :focus-visible), .arrow-btn-host:is(:hover, :focus-within) .arrow-btn) {
  background: var(--arrow-btn-fill-open, var(--color-bg-white));
  color: var(--arrow-btn-ink-open, var(--color-text-inverted));
}
:is(.arrow-btn:is(:hover, :focus-visible), .arrow-btn-host:is(:hover, :focus-within) .arrow-btn) .arrow-btn__label { grid-template-columns: 1fr; }
:is(.arrow-btn:is(:hover, :focus-visible), .arrow-btn-host:is(:hover, :focus-within) .arrow-btn) .arrow-btn__label > * { padding-left: var(--space-sm); }
/* a host may open a moment late (a pass of the mouse over a row shouldn't flash them all): it sets --arrow-btn-delay */
.arrow-btn-host:hover .arrow-btn, .arrow-btn-host:hover .arrow-btn__label, .arrow-btn-host:hover .arrow-btn__label > *, .arrow-btn-host:hover .arrow-btn__fill { transition-delay: var(--arrow-btn-delay, 0s); }
.arrow-btn:focus-visible { outline: var(--border-thick) solid var(--color-accent-indigo); outline-offset: var(--border-thin); }
/* m (ArrowButton `size="m"`): the circle of CardArrow m — 48, phones 32 — and the label in Paragraph MD */
.arrow-btn--m { min-height: var(--space-lg); }
@media (max-width: 47.9375rem) { .arrow-btn--m { min-height: var(--space-md); } }
/* reserve (ArrowButton `reserve`): the button is always as wide as the open pill, so the room is held and nothing beside
   it moves. Its fill is a layer of its own (.arrow-btn__fill) at the right end: the circle at rest, the whole pill open —
   it grows to the left while the label fades in. The button itself stays unpositioned and unclipped, so a host can
   stretch the link over a whole card (an ::after of the button, the host relative) */
.arrow-btn--reserve {
  --arrow-btn-circle: var(--space-md);
  display: inline-grid; flex: none; background: transparent; /* in a flex row it keeps its room: never squeezed */
  transition: color var(--duration-toggle) var(--ease-toggle);
}
.arrow-btn--reserve.arrow-btn--m { --arrow-btn-circle: var(--space-lg); }
@media (max-width: 47.9375rem) { .arrow-btn--reserve.arrow-btn--m { --arrow-btn-circle: var(--space-md); } }
.arrow-btn--reserve > * { grid-area: 1 / 1; }
.arrow-btn__fill {
  justify-self: end; align-self: stretch; width: var(--arrow-btn-circle);
  border-radius: var(--radius-pill); background: var(--arrow-btn-fill, var(--color-bg-cta-grey));
  transition: width var(--duration-toggle) var(--ease-toggle), background-color var(--duration-toggle) var(--ease-toggle);
}
.arrow-btn--reserve .card-arrow { justify-self: end; }
.arrow-btn--reserve .arrow-btn__label { grid-template-columns: 1fr; padding-right: var(--arrow-btn-circle); }
.arrow-btn--reserve .arrow-btn__label > * { padding-left: var(--space-sm); opacity: 0; transition: opacity var(--duration-toggle) var(--ease-toggle); }
:is(.arrow-btn--reserve:is(:hover, :focus-visible), .arrow-btn-host:is(:hover, :focus-within) .arrow-btn--reserve) { background: transparent; }
:is(.arrow-btn--reserve:is(:hover, :focus-visible), .arrow-btn-host:is(:hover, :focus-within) .arrow-btn--reserve) .arrow-btn__fill { width: 100%; background: var(--arrow-btn-fill-open, var(--color-bg-white)); }
:is(.arrow-btn--reserve:is(:hover, :focus-visible), .arrow-btn-host:is(:hover, :focus-within) .arrow-btn--reserve) .arrow-btn__label > * { opacity: 1; padding-left: var(--space-sm); }
@media (prefers-reduced-motion: reduce) { .arrow-btn, .arrow-btn__label, .arrow-btn__label > *, .arrow-btn__fill { transition: none; } }
