/* frontend/css/aver-design/components.css
 *
 * Aver Learning unified component library — foundation sprint 2026-05-09.
 *
 * Naming: every class is `.av-*` to keep this namespace orthogonal to
 * the legacy classes (`.btn-primary`, `.skill-card`, `.tab-btn`,
 * `.main-tab-btn`, etc.) which JS hooks target. Adopting `.av-*` on a
 * page is opt-in per redesign sprint; legacy classes stay functional
 * until their page is migrated.
 *
 * Theme awareness: every value resolves through `--av-*` tokens defined
 * in tokens.css. No hardcoded colors. Switching the page theme via
 * `[data-theme]` on `<html>` automatically flips every component.
 *
 * Required pre-load: tokens.css MUST link before this file.
 */


/* ── Reset / base ───────────────────────────────────────────────── */

.av-page {
  background: var(--av-surface-page);
  color: var(--av-text-primary);
  font-family: var(--av-font-sans);
  font-feature-settings: 'ss01', 'cv01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: var(--av-lh-normal);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.av-mono {
  font-family: var(--av-font-mono);
  font-feature-settings: 'tnum';     /* tabular numerals */
}


/* ── Page eyebrow (Sprint 6.19 canonical primitive) ──────────────
 *
 * Uppercase, tracking-widest, primary-tinted label that sits above
 * the page <h1>. Promoted from `.greeting .eyebrow` in home.css to a
 * standalone primitive so every canonical-chrome page can adopt the
 * same hierarchy:
 *
 *     <p class="eyebrow">SPEAKING</p>
 *     <h1>Practice page title</h1>
 *     <p class="subtitle">Supporting paragraph.</p>
 *
 * Per-page eyebrow values (Sprint 6.19 Phase B Andy approval):
 *   - home.html                          → "Trang chủ"
 *   - speaking / practice / result       → "Speaking"
 *   - full-test-result.html              → "Speaking" (canonical),
 *       "Overall Band Score" preserved as hero subtitle
 *   - writing-dashboard / writing-result → "Writing"
 *   - vocabulary / my-vocabulary /
 *     flashcards / exercises             → "Vocabulary"
 *   - grammar-roadmap / grammar-search /
 *     grammar-compare / grammar-article  → "Grammar Wiki"
 *   - grammar.html                       → preserved editorial badge
 *       (.ds-badge.ds-badge-teal — § 14.2 sub-system, Phase B Q3)
 *   - profile.html                       → "Hồ sơ"
 *   - onboarding.html                    → "Bắt đầu"
 *
 * Margin-bottom uses --av-space-3 so the eyebrow sits ~12px above the
 * <h1> — matches the existing home.css scoped rule byte-for-byte. */
.eyebrow {
  font-size: var(--av-fs-xs);
  font-weight: var(--av-fw-semibold);
  letter-spacing: var(--av-tracking-widest);
  color: var(--av-primary);
  text-transform: uppercase;
  margin: 0 0 var(--av-space-3);
}


/* Theme toggle button rules retired Sprint 7.14 — moved into
   frontend/js/components/aver-chrome.js as inline shadow-root styles.
   All 18 chrome pages consume <aver-chrome>; this file no longer
   needs the .av-theme-toggle, .icon-sun, .icon-moon, or [data-theme]
   icon-swap rules. */


/* ── Buttons ────────────────────────────────────────────────────── */

.av-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--av-space-2);
  padding: var(--av-space-3) var(--av-space-6);
  border: 1px solid transparent;
  border-radius: var(--av-radius-md);
  font-family: var(--av-font-sans);
  font-size: var(--av-fs-sm);
  font-weight: var(--av-fw-semibold);
  line-height: var(--av-lh-snug);
  letter-spacing: var(--av-tracking-normal);
  cursor: pointer;
  transition:
    background var(--av-duration-fast) var(--av-easing-default),
    border-color var(--av-duration-fast) var(--av-easing-default),
    color var(--av-duration-fast) var(--av-easing-default),
    transform var(--av-duration-fast) var(--av-easing-default);
  user-select: none;
}

.av-button:focus-visible {
  outline: none;
  box-shadow: var(--av-shadow-focus);
}

.av-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.av-button-primary {
  background: var(--av-primary);
  color: var(--av-text-on-primary);
  border-color: var(--av-primary);
}
.av-button-primary:hover:not(:disabled) {
  background: var(--av-primary-hover);
  border-color: var(--av-primary-hover);
  transform: translateY(-1px);
}
.av-button-primary:active:not(:disabled) {
  background: var(--av-primary-active);
  transform: translateY(0);
}

.av-button-secondary {
  background: transparent;
  color: var(--av-text-primary);
  border-color: var(--av-border-default);
}
.av-button-secondary:hover:not(:disabled) {
  background: var(--av-primary-soft);
  border-color: var(--av-primary-border);
  color: var(--av-primary);
}

.av-button-tertiary {
  background: transparent;
  color: var(--av-primary);
  border-color: transparent;
  padding-inline: var(--av-space-3);
}
.av-button-tertiary::after {
  content: '→';
  transition: transform var(--av-duration-fast) var(--av-easing-default);
}
.av-button-tertiary:hover:not(:disabled) {
  color: var(--av-primary-hover);
}
.av-button-tertiary:hover:not(:disabled)::after {
  transform: translateX(4px);
}

.av-button-destructive {
  background: transparent;
  color: var(--av-error);
  border-color: var(--av-error);
}
.av-button-destructive:hover:not(:disabled) {
  background: var(--av-error-soft);
}

.av-button-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--av-radius-pill);
}

.av-button-sm {
  padding: var(--av-space-2) var(--av-space-4);
  font-size: var(--av-fs-xs);
}
.av-button-lg {
  padding: var(--av-space-4) var(--av-space-8);
  font-size: var(--av-fs-base);
}


/* ── Cards ──────────────────────────────────────────────────────── */

.av-card {
  background: var(--av-surface-card);
  border: 1px solid var(--av-border-subtle);
  border-radius: var(--av-radius-lg);
  padding: var(--av-space-6);
  box-shadow: var(--av-shadow-sm);
  transition:
    transform var(--av-duration-base) var(--av-easing-default),
    box-shadow var(--av-duration-base) var(--av-easing-default),
    border-color var(--av-duration-base) var(--av-easing-default);
}

.av-card-interactive {
  cursor: pointer;
}
.av-card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--av-shadow-md);
  border-color: var(--av-primary-border);
}
.av-card-interactive:focus-visible {
  outline: none;
  box-shadow: var(--av-shadow-focus);
}

.av-card-elevated {
  box-shadow: var(--av-shadow-md);
}

.av-card-flat {
  box-shadow: none;
}

/* Coming-soon variant — muted, no hover lift */
.av-card-locked {
  opacity: 0.65;
  cursor: not-allowed;
}
.av-card-locked:hover {
  transform: none;
  box-shadow: var(--av-shadow-sm);
  border-color: var(--av-border-subtle);
}


/* ── Stats ──────────────────────────────────────────────────────── */

.av-stat-block {
  display: flex;
  flex-direction: column;
  gap: var(--av-space-2);
  padding-block: var(--av-space-3);
}

.av-stat-label {
  font-size: var(--av-fs-xs);
  font-weight: var(--av-fw-semibold);
  color: var(--av-text-faint);
  letter-spacing: var(--av-tracking-widest);
  text-transform: uppercase;
  line-height: var(--av-lh-snug);
}

.av-stat-value {
  font-family: var(--av-font-mono);
  font-feature-settings: 'tnum';
  font-size: var(--av-fs-4xl);
  font-weight: var(--av-fw-medium);
  color: var(--av-text-primary);
  letter-spacing: var(--av-tracking-tight);
  line-height: var(--av-lh-tight);
}

.av-stat-unit {
  font-family: var(--av-font-sans);
  font-size: var(--av-fs-sm);
  font-weight: var(--av-fw-regular);
  color: var(--av-text-muted);
  margin-inline-start: var(--av-space-1);
  letter-spacing: var(--av-tracking-normal);
}

/* Streak emphasis — warm amber when alive */
.av-stat-block.is-streak .av-stat-value {
  color: var(--av-accent);
}


/* ── Badges ─────────────────────────────────────────────────────── */

.av-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--av-space-1);
  padding: var(--av-space-1) var(--av-space-3);
  border-radius: var(--av-radius-pill);
  font-size: var(--av-fs-xs);
  font-weight: var(--av-fw-semibold);
  letter-spacing: var(--av-tracking-wide);
  line-height: var(--av-lh-snug);
  white-space: nowrap;
}

.av-badge-neutral {
  background: var(--av-surface-sunken);
  color: var(--av-text-secondary);
  border: 1px solid var(--av-border-subtle);
}

.av-badge-primary {
  background: var(--av-primary-soft);
  color: var(--av-primary);
}

.av-badge-success {
  background: var(--av-success-soft);
  color: var(--av-success);
}

.av-badge-warning {
  background: var(--av-warning-soft);
  color: var(--av-warning);
}

.av-badge-error {
  background: var(--av-error-soft);
  color: var(--av-error);
}

.av-badge-locked {
  background: var(--av-surface-sunken);
  color: var(--av-text-faint);
  border: 1px solid var(--av-border-subtle);
}

/* Vocabulary review-state badges (Sprint 6.0 vocab-landing) */
.av-badge-used-well     { background: var(--av-success-soft); color: var(--av-success); }
.av-badge-needs-review  { background: var(--av-warning-soft); color: var(--av-warning); }


/* ── Tabs ───────────────────────────────────────────────────────── */

.av-tabs {
  display: flex;
  align-items: center;
  gap: var(--av-space-1);
  border-bottom: 1px solid var(--av-border-default);
  margin-bottom: var(--av-space-6);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.av-tabs::-webkit-scrollbar { display: none; }

.av-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--av-space-2);
  padding: var(--av-space-3) var(--av-space-4);
  background: transparent;
  border: 0;
  font-family: var(--av-font-sans);
  font-size: var(--av-fs-sm);
  font-weight: var(--av-fw-medium);
  color: var(--av-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--av-duration-fast) var(--av-easing-default);
}

.av-tab:hover { color: var(--av-text-primary); }

.av-tab[aria-selected="true"],
.av-tab.is-active {
  color: var(--av-primary);
}

.av-tab[aria-selected="true"]::after,
.av-tab.is-active::after {
  content: '';
  position: absolute;
  inset-inline: var(--av-space-3);
  bottom: -1px;
  height: 2px;
  background: var(--av-primary);
  border-radius: 2px;
}

.av-tab:focus-visible {
  outline: none;
  border-radius: var(--av-radius-sm);
  box-shadow: var(--av-shadow-focus);
}

.av-tab[disabled] {
  color: var(--av-text-faint);
  cursor: not-allowed;
}
.av-tab[disabled]::after { display: none; }


/* ── Forms ──────────────────────────────────────────────────────── */

.av-input,
.av-select,
.av-textarea {
  display: block;
  width: 100%;
  padding: var(--av-space-3) var(--av-space-4);
  background: var(--av-surface-card);
  border: 1px solid var(--av-border-default);
  border-radius: var(--av-radius-md);
  color: var(--av-text-primary);
  font-family: var(--av-font-sans);
  font-size: var(--av-fs-sm);
  line-height: var(--av-lh-normal);
  transition:
    border-color var(--av-duration-fast) var(--av-easing-default),
    background var(--av-duration-fast) var(--av-easing-default),
    box-shadow var(--av-duration-fast) var(--av-easing-default);
}

.av-input::placeholder,
.av-textarea::placeholder {
  color: var(--av-text-faint);
}

.av-input:focus,
.av-select:focus,
.av-textarea:focus {
  outline: none;
  border-color: var(--av-primary);
  box-shadow: var(--av-shadow-focus);
}

.av-input:disabled,
.av-select:disabled,
.av-textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--av-surface-sunken);
}

.av-textarea {
  min-height: 96px;
  resize: vertical;
  font-family: var(--av-font-sans);
}

.av-label {
  display: block;
  margin-bottom: var(--av-space-2);
  font-size: var(--av-fs-xs);
  font-weight: var(--av-fw-semibold);
  letter-spacing: var(--av-tracking-wide);
  color: var(--av-text-secondary);
}

.av-help-text {
  margin-top: var(--av-space-2);
  font-size: var(--av-fs-xs);
  color: var(--av-text-muted);
}

.av-error-text {
  margin-top: var(--av-space-2);
  font-size: var(--av-fs-xs);
  color: var(--av-error);
}

/* Checkbox + radio — styled wrapper around native input */
.av-check {
  display: inline-flex;
  align-items: center;
  gap: var(--av-space-2);
  font-size: var(--av-fs-sm);
  color: var(--av-text-primary);
  cursor: pointer;
}
.av-check input[type="checkbox"],
.av-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--av-primary);
  cursor: pointer;
}


/* ── Modals ─────────────────────────────────────────────────────── */

.av-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--av-surface-overlay);
  backdrop-filter: blur(4px);
  z-index: var(--av-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--av-space-6);
  animation: av-fade-in var(--av-duration-fast) var(--av-easing-default);
}

.av-modal {
  background: var(--av-surface-elevated);
  border: 1px solid var(--av-border-subtle);
  border-radius: var(--av-radius-xl);
  box-shadow: var(--av-shadow-xl);
  padding: var(--av-space-8);
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - var(--av-space-12));
  overflow-y: auto;
  animation: av-slide-up var(--av-duration-base) var(--av-easing-default);
}

.av-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--av-space-4);
  margin-bottom: var(--av-space-4);
}

.av-modal-title {
  font-size: var(--av-fs-xl);
  font-weight: var(--av-fw-semibold);
  color: var(--av-text-primary);
  letter-spacing: var(--av-tracking-tight);
}

.av-modal-body {
  color: var(--av-text-secondary);
  line-height: var(--av-lh-normal);
}

.av-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--av-space-3);
  margin-top: var(--av-space-6);
  padding-top: var(--av-space-4);
  border-top: 1px solid var(--av-border-subtle);
}


/* ── Audio recorder + player ────────────────────────────────────── */

.av-recorder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border: 2px solid var(--av-primary);
  border-radius: var(--av-radius-pill);
  background: var(--av-primary-soft);
  color: var(--av-primary);
  cursor: pointer;
  transition:
    transform var(--av-duration-fast) var(--av-easing-default),
    background var(--av-duration-fast) var(--av-easing-default);
}
.av-recorder:hover {
  transform: scale(1.04);
  background: var(--av-primary);
  color: var(--av-text-on-primary);
}
.av-recorder.is-recording {
  background: var(--av-error);
  border-color: var(--av-error);
  color: #fff;
  animation: av-pulse-record 1.6s ease-in-out infinite;
}

.av-player {
  display: inline-flex;
  align-items: center;
  gap: var(--av-space-3);
  padding: var(--av-space-2) var(--av-space-4);
  background: var(--av-surface-sunken);
  border: 1px solid var(--av-border-subtle);
  border-radius: var(--av-radius-pill);
  font-size: var(--av-fs-sm);
  color: var(--av-text-secondary);
}


/* ── Feedback panels (speaking + writing results) ───────────────── */

.av-feedback-card {
  background: var(--av-surface-card);
  border: 1px solid var(--av-border-subtle);
  border-radius: var(--av-radius-lg);
  padding: var(--av-space-6);
  margin-bottom: var(--av-space-4);
}

.av-feedback-criterion {
  font-size: var(--av-fs-xs);
  font-weight: var(--av-fw-semibold);
  letter-spacing: var(--av-tracking-widest);
  text-transform: uppercase;
  color: var(--av-text-faint);
}

.av-feedback-band {
  font-family: var(--av-font-mono);
  font-size: var(--av-fs-3xl);
  font-weight: var(--av-fw-medium);
  color: var(--av-primary);
  letter-spacing: var(--av-tracking-tight);
  line-height: var(--av-lh-tight);
}

.av-correction {
  border-left: 3px solid var(--av-primary);
  background: var(--av-primary-soft);
  border-radius: 0 var(--av-radius-md) var(--av-radius-md) 0;
  padding: var(--av-space-3) var(--av-space-4);
  margin-block: var(--av-space-3);
}

.av-correction-original {
  color: var(--av-text-muted);
  font-style: italic;
  text-decoration: line-through;
  text-decoration-color: var(--av-error);
}

.av-correction-corrected {
  color: var(--av-text-primary);
  font-weight: var(--av-fw-medium);
  margin-top: var(--av-space-2);
}

.av-correction-explanation {
  color: var(--av-text-secondary);
  font-size: var(--av-fs-sm);
  margin-top: var(--av-space-2);
  line-height: var(--av-lh-relaxed);
}

.av-sample-answer {
  background: var(--av-info-soft);
  border-left: 3px solid var(--av-info);
  border-radius: 0 var(--av-radius-md) var(--av-radius-md) 0;
  padding: var(--av-space-4) var(--av-space-6);
  color: var(--av-text-primary);
  line-height: var(--av-lh-relaxed);
}


/* ── Toast ──────────────────────────────────────────────────────── */

.av-toast {
  position: fixed;
  bottom: var(--av-space-8);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: var(--av-z-toast);
  display: inline-flex;
  align-items: center;
  gap: var(--av-space-2);
  padding: var(--av-space-3) var(--av-space-6);
  background: var(--av-surface-elevated);
  border: 1px solid var(--av-border-subtle);
  border-radius: var(--av-radius-pill);
  box-shadow: var(--av-shadow-lg);
  font-size: var(--av-fs-sm);
  color: var(--av-text-primary);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--av-duration-base) var(--av-easing-default),
    transform var(--av-duration-base) var(--av-easing-default);
}
.av-toast.is-shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ─────────────────────────────────────────────────────────────────────
   Canonical chrome (Sprint 6.17) — shell + topnav + nav-links + user-menu
   Extracted from home.css so all Cat 2 student pages can adopt full nav
   from components.css without duplicating per-page CSS. Page-specific
   stylesheets (home.css, vocabulary.css, etc.) may still override.
   ──────────────────────────────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--av-space-6) var(--av-space-8) var(--av-space-24);
}

/* Sprint 7.14 — canonical chrome rules retired from this file. All 18
   canonical chrome pages now consume <aver-chrome> Web Component
   (frontend/js/components/aver-chrome.js); the markup + its rules live
   inside the component's Shadow DOM. The block previously here covered
   .topnav-wrap / .topnav / .brand / .nav-links / .topnav-right /
   .user-pill / .user-menu / .user-menu-dropdown / .user-menu-item plus
   the chrome portion of @media (max-width: 720px). The .shell rule
   above stays — it's a page container (home.html / vocabulary.html
   still wrap content in <div class="shell">), not chrome.
   See aver-chrome.js STYLE constant for the new source of truth. */

@media (max-width: 720px) {
  .shell { padding: var(--av-space-4) var(--av-space-4) var(--av-space-16); }
}


/* ── Animations ─────────────────────────────────────────────────── */

@keyframes av-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes av-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes av-pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
  50%      { box-shadow: 0 0 0 12px rgba(248, 113, 113, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .av-button,
  .av-card,
  .av-tab,
  .av-recorder,
  .av-toast {
    transition: none !important;
  }
  .av-recorder.is-recording {
    animation: none !important;
  }
}


/* ── Subpage header (Sprint 9.1) ───────────────────────────────────
   The "Vocabulary | {title}" anchor row at the top of a module-mount
   sub-page (my-vocabulary / flashcards / exercises). Sprint 9.0
   discovery surfaced 3 byte-identical .{prefix}-header rule sets;
   Sprint 9.1 lifts the primitive here. Integrates with main flow
   (no separate background/border bar) so chrome-to-content stays
   tight (~110px, matching sibling pages).

   Markup contract (Sprint 9.2 — eyebrow promoted to back-button):
     <header class="subpage-header">
       <div class="subpage-header__lhs">
         <button type="button" class="subpage-header__back"
                 data-action="back-to-dashboard"
                 aria-label="Quay về dashboard {Skill}">
           <i data-lucide="arrow-left"></i>
           <span>{Skill}</span>
         </button>
         <span class="subpage-header__sep">|</span>
         <h1 class="subpage-header__title">{title}</h1>
       </div>
       {optional action button}
     </header>

   Pre-Sprint-9.2, the LHS used <p class="eyebrow">{Skill}</p> as a
   passive breadcrumb. Sprint 9.2 promotes it to an interactive button
   that returns the user to the parent dashboard view without a full
   page reload (vocab uses hash-routing + history.pushState; speaking
   uses internal switchMainTab('dashboard')).
*/
.subpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--av-space-4);
  margin-bottom: var(--av-space-4);
}
.subpage-header__lhs {
  display: flex;
  align-items: center;
  gap: var(--av-space-3);
}
.subpage-header__sep {
  color: var(--av-text-faint);
}
.subpage-header__title {
  font-family: var(--av-font-sans);
  font-size: var(--av-fs-lg);
  font-weight: var(--av-fw-semibold);
  letter-spacing: var(--av-tracking-tight);
  color: var(--av-text-primary);
  margin: 0;
}

/* Sprint 9.2 — interactive back-link button. Visual treatment matches
   the pre-9.2 .eyebrow it replaces (uppercase, semibold, primary
   color, --av-fs-xs) plus an inline arrow-left icon and a 2px
   horizontal translate-back on hover for affordance. */
.subpage-header__back {
  display: inline-flex;
  align-items: center;
  gap: var(--av-space-2);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--av-fs-xs);
  font-weight: var(--av-fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--av-tracking-wide);
  color: var(--av-primary);
  transition:
    color var(--av-duration-fast) var(--av-easing-default),
    transform var(--av-duration-fast) var(--av-easing-default);
}
.subpage-header__back:hover {
  color: var(--av-primary-hover);
  transform: translateX(-2px);
}
.subpage-header__back:focus-visible {
  outline: none;
  box-shadow: var(--av-shadow-focus);
  border-radius: var(--av-radius-sm);
}
.subpage-header__back svg {
  width: 14px;
  height: 14px;
}


/* ── Mode-card primitive (Sprint 9.1) ──────────────────────────────
   Lifted from speaking.css (Sprint 8.1) + vocabulary.css (Sprint 8.2)
   after a 3rd adopter (vocab sub-pages — Sprint 9.1) fired the rule-
   of-three lift trigger flagged in the Sprint 8.2 ledger. Single
   primitive consumed by:
     - speaking.html dashboard (3 cards)
     - vocabulary.html dashboard (4 cards)
     - flashcards.html stack list (N stacks — auto + manual; Sprint 9.3
       retired the .stack-card / .stack-icon / .pill-auto / .pill-manual
       inner classes in favor of the canonical .head > .icon + .arrow,
       h3 (+ optional .mode-card__badge), .lede skeleton)
     - exercises.html drill hub (2 cards post-Sprint-9.1 D3 removal)

   Inner skeleton: .head > .icon + .arrow, h3, .lede. Optional badges
   may slot inside h3 via .lock-tag (muted "Soon" affordance) or
   .mode-card__badge (active state, e.g. "Tự động" for auto stacks).

   `--av-text-muted` (not --av-text-faint) per speaking.css's § 17.6
   cap discipline; home.css uses faint for the same arrow since it
   has no equivalent cap.
*/
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--av-space-4);
}

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--av-space-3);
  background: var(--av-surface-card);
  border: 1px solid var(--av-border-subtle);
  border-radius: var(--av-radius-lg);
  padding: var(--av-space-6);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition:
    transform var(--av-duration-base) var(--av-easing-default),
    border-color var(--av-duration-base) var(--av-easing-default),
    box-shadow var(--av-duration-base) var(--av-easing-default);
}
.mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--av-primary-border);
  box-shadow: var(--av-shadow-md);
}
.mode-card:focus-visible {
  outline: none;
  box-shadow: var(--av-shadow-focus);
}
.mode-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mode-card.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--av-border-subtle);
}

.mode-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--av-space-3);
}
.mode-card .icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--av-radius-md);
  background: var(--av-primary-soft);
  color: var(--av-primary);
  border: 1px solid var(--av-primary-border);
}
.mode-card .icon svg {
  width: 20px;
  height: 20px;
}
.mode-card .arrow {
  font-size: 1.1rem;
  color: var(--av-text-muted);
  transition:
    color var(--av-duration-fast) var(--av-easing-default),
    transform var(--av-duration-fast) var(--av-easing-default);
}
.mode-card:hover .arrow {
  color: var(--av-primary);
  transform: translateX(4px);
}
.mode-card h3 {
  font-family: var(--av-font-sans);
  font-size: var(--av-fs-xl);
  font-weight: var(--av-fw-semibold);
  letter-spacing: var(--av-tracking-tight);
  color: var(--av-text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--av-space-2);
}
.mode-card .lede {
  font-size: var(--av-fs-sm);
  color: var(--av-text-muted);
  margin: 0;
  line-height: var(--av-lh-relaxed);
}
.mode-card .lock-tag {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px var(--av-space-2);
  border: 1px solid var(--av-border-default);
  border-radius: var(--av-radius-sm);
  opacity: 0.7;
  color: var(--av-text-muted);
  font-weight: var(--av-fw-medium);
}

/* Sprint 9.3 — inline status badge for the .mode-card title row.
   Distinct from .lock-tag (muted "Soon" affordance) — .mode-card__badge
   carries an active semantic state (e.g. "Tự động" for auto-generated
   flashcard stacks vs the unbadged manual stacks). Reuses --av-info
   family to visually echo the pre-9.3 .pill-auto styling so the auto-
   vs-manual signal stays consistent across the redesign. */
.mode-card h3 { flex-wrap: wrap; }
.mode-card__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--av-space-2);
  border-radius: var(--av-radius-pill);
  background: var(--av-info-soft);
  color: var(--av-info);
  border: 1px solid var(--av-info);
  font-size: 0.625rem;
  font-weight: var(--av-fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--av-tracking-wide);
  line-height: 1.4;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .mode-card { transition: none !important; }
  .mode-card .arrow { transition: none !important; }
}
