/* ============================================================================
   account-flows.css: account sub-pages + system status pages, page geometry
   Pages: edit_account_heb, change_password_heb (My Account sub-pages),
          email_verification_required_heb, email_verified_heb, unsubscribed_heb,
          resubscribe_success_heb, invite_claim_heb, ai_credit_insufficient,
          mobile_heb (phone landing).
   EZ42 design system v4.1.0 (ez42-ui.css). Prefix af-.
   Replaces the inline <style> blocks and Tailwind utilities those templates
   carried (evfx-*, ev-*, unsubscribe-*, resubscribe-*, ij-*, grade-button).
   Geometry and composition only. Colours come from ez42-ui.css tokens; no new
   colours, no type scale. Never redefines ez- classes. Logical properties
   only, so the same markup mirrors to LTR by switching dir.
   Load after ez42-ui.css.
   ========================================================================= */

/* ---- Page shell ---------------------------------------------------------- */
.af-page { min-block-size: calc(100vh - 4rem); display: flex; flex-direction: column; }
.af-main { padding-block: var(--space-5) var(--space-8); inline-size: 100%; }

/* Host resets. base_heb loads Tailwind + styles-heb.css, whose global rules
   (button margin, list-style, heading/paragraph margins) and the class display
   rules that beat the UA [hidden] would otherwise leak into this page.
   Scoped to .af-page only. */
.af-page [hidden] { display: none !important; }
.af-page :where(button) { margin: 0; }
.af-page :where(*, *::before, *::after) { box-sizing: border-box; } /* ez- reset only covers ez- classes */
:where(.af-page) :where(h1, h2, h3, p, ul, dl, dd, blockquote, fieldset, figure) { margin: 0; } /* zero specificity: DS element margins win */

/* [ST-HERO-FIX] DS: .ez-hero__inner becomes a column at 768px, so __main's
   420px flex-basis would become its height. Same fix as acc.css / st.css. */
@media (max-width: 768px) {
  .af-page .ez-hero__main { flex-basis: auto; }
}

/* Flash alerts above a form card or a status card */
.af-alerts { margin-block-end: var(--space-5); }
.af-alerts:not(:has(.ez-alert)) { display: none; }

/* ---- My Account sub-pages (edit account, change password) ----------------- */
.af-hero .ez-back { align-self: flex-start; }
.af-hero .ez-back:not(:hover) { text-decoration: none; } /* host UA underline (Tailwind preflight absent in some hosts) */
.af-form-wrap { inline-size: 100%; max-inline-size: var(--width-reading); margin-inline: 0 auto; } /* start-aligned under the hero title */
.af-form-wrap--narrow { max-inline-size: 520px; }

.af-form { display: flex; flex-direction: column; gap: var(--space-5); }
.af-divider { margin: 0; border: 0; border-block-start: 1px solid var(--border-soft); }

/* A group of single-choice chips (grade, gender, read-aloud) */
.af-group { border: 0; padding: 0; min-inline-size: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.af-group > legend { padding: 0; margin-block-end: var(--space-2); display: inline-flex; align-items: center; gap: var(--space-2); }
.af-group .ez-help { margin-block-start: calc(-1 * var(--space-1)); }
.af-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.af-chips .ez-chip { min-inline-size: 5.5rem; justify-content: center; }

/* The page JS toggles the legacy `selected` class (not is-selected), so the
   DS selected chip look is mirrored onto it here, with the same tokens. */
.af-page .ez-chip.selected { background: var(--purple); border-color: var(--purple); color: var(--on-brand); }

.af-form__foot { display: flex; align-items: center; justify-content: flex-start; gap: var(--space-3);
  flex-wrap: wrap; padding-block-start: var(--space-2); }
.af-form__aside { display: flex; justify-content: center; padding-block-start: var(--space-2);
  border-block-start: 1px solid var(--border-soft); }
.af-form__aside .ez-btn { margin-block-start: var(--space-4); }

/* ---- Shared status card (verified, expired, unsubscribed, resubscribed,
        invite claim, AI credit, phone landing) ------------------------------ */
.af-main--status { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding-block: var(--space-7) var(--space-8); }
.af-main--status > .af-alerts { inline-size: 100%; max-inline-size: 640px; }

.af-status { inline-size: 100%; max-inline-size: 640px; align-items: center; text-align: center;
  overflow: hidden; padding-block-start: calc(var(--space-6) + var(--strip-height)); }
.af-status--wide { max-inline-size: 760px; }
.af-status--start { text-align: start; align-items: stretch; }
.af-status__strip { position: absolute; inset-block-start: 0; inset-inline: 0; }

.af-status__icon { inline-size: 72px; block-size: 72px; border-radius: var(--radius-circle); }
.af-status__icon .ez-icon { inline-size: 32px; block-size: 32px; }
.af-status--success .af-status__icon { background: var(--success-bg); color: var(--success-text); }
.af-status--warn .af-status__icon { background: var(--warn-bg); color: var(--warn-text); }
.af-status--error .af-status__icon { background: var(--error-bg); color: var(--error-text); }
.af-status--info .af-status__icon { background: var(--info-bg); color: var(--info-text); }

.af-status__head { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.af-status--start .af-status__head { align-items: flex-start; }
.af-status__title { text-wrap: balance; }
.af-status__body { display: flex; flex-direction: column; gap: var(--space-4); inline-size: 100%;
  max-inline-size: 56ch; align-items: center; }
.af-status--wide .af-status__body { max-inline-size: 62ch; }
.af-status--start .af-status__body { max-inline-size: none; align-items: stretch; }
.af-status__body > * { inline-size: 100%; }

/* Bulleted benefits / reasons, always start-aligned inside the centred card */
.af-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2);
  text-align: start; }
.af-list > li { display: flex; align-items: flex-start; gap: var(--space-3); line-height: var(--lh-body); }
.af-list > li > .ez-icon { margin-block-start: 0.35em; }
.af-panel { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5); color: var(--text-soft); }
.af-status .ez-callout { text-align: start; grid-template-columns: auto minmax(0, 1fr); } /* no dismiss column here */

.af-status__actions { display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  flex-wrap: wrap; inline-size: 100%; }
.af-status--start .af-status__actions { justify-content: flex-start; }
.af-status__actions form { display: contents; }
.af-status__lead-in { margin-block-end: calc(-1 * var(--space-2)); }

.af-status__foot { inline-size: 100%; display: flex; flex-direction: column; align-items: center;
  gap: var(--space-1); padding-block-start: var(--space-4); border-block-start: 1px solid var(--border-soft); }
.af-status__foot p { line-height: 1.6; }
.af-status__links { display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.af-status__links a { display: inline-flex; align-items: center; min-block-size: var(--tap-min); }

/* Six hero characters (unsubscribe / resubscribe) */
.af-heroes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3);
  inline-size: 100%; }
.af-heroes img { inline-size: 100%; aspect-ratio: 1; object-fit: contain; border-radius: var(--radius-md);
  background: var(--surface-alt); border: 1px solid var(--border-soft); padding: var(--space-1); }
.af-heroes__caption { color: var(--text-muted); font-weight: var(--fw-semibold); }

.af-quote { text-align: start; }
.af-quote .ez-callout__text { font-size: var(--fs-body); font-style: italic; }

/* Invite claim: summary rows, the inviter's message */
.af-summary { inline-size: 100%; text-align: start; }
.af-summary .ez-summary__row { grid-template-columns: minmax(7rem, 35%) minmax(0, 1fr); }
.af-summary dd { margin: 0; overflow-wrap: anywhere; }
.af-message { text-align: start; white-space: pre-line; }
.af-error { display: none; inline-size: 100%; text-align: start; }

/* ---- Success modal (email verification required) --------------------------
   The page JS shows it with style.display = 'flex' and animates the panel via
   the keyframe names modalSlideIn / modalSlideOut, so those names are hooks. */
.ez-modal.af-modal { display: none; background: var(--overlay); }
.af-modal__panel { text-align: center; animation: modalSlideIn var(--dur-slow) var(--ease-out); }
.af-modal__inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: var(--space-6) var(--space-6) var(--space-5); }
.af-modal__inner .ez-modal__title { margin: 0; }
.af-modal__inner p { margin: 0; line-height: var(--lh-relaxed); color: var(--text-soft); }
.af-modal__inner .ez-btn { margin-block-start: var(--space-2); }
.af-modal__check { inline-size: 56px; block-size: 56px; border-radius: var(--radius-circle);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--success-bg); color: var(--success-text); }
@keyframes modalSlideIn { from { transform: translateY(-100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes modalSlideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-100px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .af-modal__panel { animation-duration: 1ms !important; } /* !important: the page JS sets the animation inline */
}

/* ---- Phone landing (mobile_heb) ------------------------------------------ */
.af-page--phone { min-block-size: 100vh; min-block-size: 100dvh; }
.af-phone-hero { text-align: center; }
.af-phone-hero .ez-hero__inner { justify-content: center; }
.af-phone-hero .ez-hero__main { align-items: center; flex-basis: auto; }
.af-phone-hero__logo { inline-size: 72px; block-size: 72px; object-fit: contain; }
.af-phone-hero .ez-hero__title { text-wrap: balance; }
.af-phone .af-status { max-inline-size: 560px; }
.af-phone__char { display: block; block-size: 150px; inline-size: auto; max-inline-size: 100%;
  object-fit: contain; margin-inline: auto; border-radius: var(--radius-md); }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 640px) {
  .af-heroes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .af-summary .ez-summary__row { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
}
@media (max-width: 480px) {
  .af-main { padding-block: var(--space-4) var(--space-7); }
  .af-main--status { justify-content: flex-start; padding-block: var(--space-5) var(--space-7); }
  .af-page .ez-container { padding-inline: var(--space-4); }
  .af-page .ez-card { padding: var(--space-5) var(--space-4); }
  .af-page .af-status { padding-block-start: calc(var(--space-5) + var(--strip-height)); }
  .af-status__actions > .ez-btn, .af-status__actions form .ez-btn, .af-form__foot > .ez-btn { inline-size: 100%; }
  .af-status__icon { inline-size: 64px; block-size: 64px; }
  .af-panel, .af-status .ez-callout { padding: var(--space-3) var(--space-4); }
  .af-phone-hero.ez-hero--compact .ez-hero__title { font-size: var(--fs-hero-mobile); }
}
