/* ============================================================
   REVEAL CARD — a card that opens over itself (RevealCard.astro; /routines «Start from a template», Liliya 18–23.11.2026)
   Requires: tokens.css, surface.css (.card), arrow-button.css, close-button.css; a parent grid that gives it two rows
   At rest: the icon and the title; at the foot, 8 in from the card's edges, a black strip — «Learn more» and the round
   arrow in the card's accent. Open (a mouse resting on it after the Reveal step, focus, or a tap on a touch screen):
   the strip grows up over the whole card (it lies over it, so the card and the row keep their height), the text opens
   on top (grid rows 0fr → 1fr, the Toggle motion), «Learn more» goes and the arrow widens into its button in Primary
   yellow along the bottom. On touch screens a × in the top corner, as far from it as the arrow from its own, closes it.
   The card's height: an unseen open strip with the row's texts in one cell, the tallest at this width, + 32 under it.
   ============================================================ */
.reveal-card {
  position: relative;
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 0;
  padding: 0;
  /* the arrow (arrow-button.css): the card's accent at rest, Primary yellow open; the card is its host, opening after
     the Reveal step, so a pass of the mouse over a row doesn't flash the cards open one by one */
  --arrow-btn-fill: var(--reveal-accent);
  --arrow-btn-ink: var(--color-text-inverted);
  --arrow-btn-fill-open: var(--color-primary);
  --arrow-btn-delay: var(--reveal-step);
}
.reveal-card:focus-visible { outline: var(--border-thick) solid var(--color-accent-indigo); outline-offset: var(--border-thin); }

/* the top: the icon (grey, 24) over the title, 24 in */
.reveal-card__head { grid-row: 1; grid-column: 1; display: grid; align-content: start; gap: var(--space-sm); padding: var(--space); }
.reveal-card__head h3 { margin: 0; color: var(--color-text); }
.reveal-card__icon { display: block; width: var(--space); height: var(--space); color: var(--color-text-grey); }
.reveal-card__icon svg { display: block; width: 100%; height: 100%; }
.reveal-card__text { margin: 0; color: var(--color-text-grey-on-grey); }

/* the height: an unseen open strip over both rows, every text of the row in one cell (the one that takes the most
   lines wins), 32 under it */
.reveal-card__tallest { grid-row: 1 / 3; grid-column: 1; visibility: hidden; display: grid; margin: var(--space-xs); padding: var(--space-sm) var(--space-sm) var(--space-lg); }
.reveal-card__texts { display: grid; }
.reveal-card__texts > * { grid-area: 1 / 1; display: block; padding: var(--space-sm) var(--space-xs) 0 0; }
:is(.reveal-card__tallest, .reveal-card__sizer) .reveal-card__learn { display: flex; min-height: var(--space-md); }

/* the foot: the closed strip's room (an unseen copy), the strip itself lying over the card from there */
.reveal-card__box { grid-row: 2; grid-column: 1; align-self: end; display: grid; margin: 0 var(--space-xs) var(--space-xs); }
.reveal-card__sizer { visibility: hidden; display: grid; padding: var(--space-sm); }
.reveal-card__strip {
  position: absolute; z-index: 1; left: var(--space-xs); right: var(--space-xs); bottom: var(--space-xs);
  max-height: calc(100% - 2 * var(--space-xs)); min-height: 0; overflow: hidden;
  display: grid; align-content: space-between; padding: var(--space-sm);
  border-radius: calc(var(--radius-lg) - var(--space-xs)); background: var(--color-bg);
  transition: min-height var(--duration-toggle) var(--ease-toggle);
}
/* «Learn more» and the arrow; open, the label column goes (1fr → 0fr) and the button takes the strip's width */
.reveal-card__strip .reveal-card__learn { display: grid; grid-template-columns: 1fr auto; align-items: center; transition: grid-template-columns var(--duration-toggle) var(--ease-toggle); }
.reveal-card__strip .reveal-card__learn > .t-para-sm { overflow: hidden; white-space: nowrap; min-width: 0; transition: opacity var(--duration-toggle) var(--ease-toggle); }
/* the text: closed to nothing, on top when open */
.reveal-card__more { order: -1; display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--duration-toggle) var(--ease-toggle); }
.reveal-card__more > * { overflow: hidden; min-height: 0; }
.reveal-card__more .reveal-card__text { display: block; color: var(--color-text-grey); padding: 0 var(--space-xs) var(--space-sm) 0; }

/* open: a mouse (hover), the keyboard (focus), or a tap (.is-open, touch screens — where hover and focus are off) */
.reveal-card:is(.is-open, :not(.is-touch):hover, :not(.is-touch):focus-within) .reveal-card__strip { min-height: calc(100% - 2 * var(--space-xs)); }
.reveal-card:is(.is-open, :not(.is-touch):hover, :not(.is-touch):focus-within) .reveal-card__learn { grid-template-columns: 0fr 1fr; }
.reveal-card:is(.is-open, :not(.is-touch):hover, :not(.is-touch):focus-within) .reveal-card__learn > .t-para-sm { opacity: 0; }
.reveal-card:is(.is-open, :not(.is-touch):hover, :not(.is-touch):focus-within) .reveal-card__more { grid-template-rows: 1fr; }
/* a tap-opened card opens its arrow too: the button's own rule needs the host's :hover, which a phone keeps after a tap
   only sometimes (the values of arrow-button.css «open») */
.reveal-card.is-open .arrow-btn { background: var(--arrow-btn-fill-open, var(--color-bg-white)); color: var(--arrow-btn-ink-open, var(--color-text-inverted)); }
.reveal-card.is-open .arrow-btn__label { grid-template-columns: 1fr; }
.reveal-card.is-open .arrow-btn__label > * { padding-left: var(--space-sm); }

/* the × (CloseButton): touch screens only, shown open, in the corner as far from it as the arrow from its own; the
   text keeps clear of it, and the unseen copy narrows the same so the card stays tall enough */
.reveal-card__close { display: none; }
.reveal-card.is-touch .reveal-card__close { display: grid; position: absolute; z-index: 1; top: var(--space-sm); right: var(--space-sm); color: var(--color-text); opacity: 0; pointer-events: none; transition: opacity var(--duration-toggle) var(--ease-toggle); }
.reveal-card.is-touch.is-open .reveal-card__close { opacity: 1; pointer-events: auto; }
.reveal-card.is-touch :is(.reveal-card__more .reveal-card__text, .reveal-card__texts > *) { padding-right: var(--space-lg); }

/* the button's touch area: 44 high (--tap-min) round its 32, unseen — the layout check's «touch targets under 44px» on
   phones (24.11.2026); the button itself keeps its size */
.reveal-card .arrow-btn { position: relative; }
.reveal-card .arrow-btn::after { content: ""; position: absolute; inset: calc((var(--space-md) - var(--tap-min)) / 2) 0; }
