/* ==========================================================================
   akira-redesign-v3.css — Phase 1 redesign layer (akirabenkyou.my.id)
   --------------------------------------------------------------------------
   Shared design layer for the homepage (resources/views/welcome.blade.php)
   and the dashboard (resources/views/user/dashboard.blade.php).
   Loaded AFTER css/base.css on both pages via a one-line <link> (?v=1).
   Nothing here replaces the existing inline styles or tokens.css /
   base.css — it refines and animates them.

   Structure:
     0. Shared tokens (:root) + dark-mode overrides  [this header]
     1. Homepage partial  (work/homepage/redesign-home.css)
     2. Coordinator additions — homepage (CTA classes, bento-row layout,
        structural tile polish for live markup)
     3. Dashboard partial (work/dashboard/redesign-dash.css)

   Rules: every rule is scoped under an existing page selector; new
   classes are rd- prefixed; prefers-reduced-motion is respected.
   To disable the whole layer, remove the two <link> lines (no blade
   markup depends on it) and optionally delete this file + the JS file.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. SHARED TOKENS — defined ONCE here, never redefined in the partials.
   Dark overrides cover every theme mechanism plausibly in use on the
   site: Tailwind's `html.dark` class (dashboard, darkMode 'class') and
   a `data-theme="dark"` attribute, on <html> or <body>. Extra selectors
   that don't match are harmless.
   -------------------------------------------------------------------------- */
:root {
  --rd-crimson: #be123c;
  --rd-crimson-deep: #9f1239;
  --rd-crimson-soft: #fff1f2;
  --rd-ink: #1c1917;
  --rd-muted: #78716c;
  --rd-line: rgba(28, 25, 23, 0.10);
  --rd-radius: 16px;
  --rd-radius-lg: 20px;
  --rd-shadow: 0 10px 30px rgba(190, 18, 60, 0.08);
  --rd-shadow-lg: 0 18px 45px rgba(28, 25, 23, 0.14);
  --rd-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rd-font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --rd-font-jp: 'Noto Sans JP', sans-serif;
}

html.dark,
html[data-theme="dark"],
body.dark,
body[data-theme="dark"] {
  --rd-ink: #fafaf9;
  --rd-muted: #a8a29e;
  --rd-line: rgba(255, 255, 255, 0.12);
  --rd-crimson-soft: rgba(190, 18, 60, 0.16);
  --rd-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --rd-shadow-lg: 0 18px 45px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   redesign-home.css — Homepage partial, Phase 1 redesign (akirabenkyou.my.id)
   --------------------------------------------------------------------------
   SCOPE: homepage ONLY (resources/views/welcome.blade.php).
   - Uses the shared contract custom properties defined by the coordinator
     in the merged file header (public/css/akira-redesign-v3.css).
     DO NOT redefine --rd-* vars here.
   - Every new class is prefixed rd-.
   - Every rule is scoped under an existing homepage selector
     (.hero-stage, .sec-figures, #fitur, #kelas, #inspirasi, .site-nav,
     [data-reveal], .cbt-workbench, .apk-only is NEVER touched).
   - No unscoped global selectors. No edits to tokens.css / base.css.
   - Existing Hallmark v2.0.0 inline <style> (lines 82-958) stays untouched;
     these rules refine / override it with equal-or-higher specificity
     inside the homepage scope only.
   - Accent crimson #be123c via --rd-crimson. Fonts via --rd-font-*.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HERO — tighten rhythm, strengthen hierarchy
   -------------------------------------------------------------------------- */

.hero-stage {
  /* Tighter, more deliberate vertical rhythm than the v2.0.0 default. */
  padding-top: clamp(1.25rem, 3vw, 2.5rem);
  padding-bottom: clamp(2rem, 4vw, 3.5rem);
}

.hero-stage h1,
.hero-stage .rd-hero-title {
  font-family: var(--rd-font-sans);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
}

.hero-stage p,
.hero-stage .rd-hero-lead {
  font-family: var(--rd-font-sans);
  line-height: 1.65;
  text-wrap: pretty;
}

/* Eyebrow / kicker above the hero title, if present in markup. */
.hero-stage .rd-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--rd-font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rd-crimson);
  background: var(--rd-crimson-soft);
  border: 1px solid var(--rd-line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  margin-bottom: 1rem;
}

.hero-stage .rd-eyebrow::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--rd-crimson);
  flex: none;
}

/* Hero CTA row: consistent gap + wrap, no layout shift on hover. */
.hero-stage .rd-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   2. SECTION TITLES — consistent hierarchy across roadmap / figures /
      bento / kelas / inspirasi
   -------------------------------------------------------------------------- */

#roadmap .rd-section-title,
#fitur .rd-section-title,
#kelas .rd-section-title,
#inspirasi .rd-section-title,
.sec-figures .rd-section-title {
  font-family: var(--rd-font-sans);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
  margin-bottom: 0.5rem;
}

#roadmap .rd-section-kicker,
#fitur .rd-section-kicker,
#kelas .rd-section-kicker,
#inspirasi .rd-section-kicker {
  font-family: var(--rd-font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rd-crimson);
  margin-bottom: 0.6rem;
}

#roadmap .rd-section-sub,
#fitur .rd-section-sub,
#kelas .rd-section-sub,
#inspirasi .rd-section-sub {
  font-family: var(--rd-font-sans);
  color: var(--rd-muted);
  line-height: 1.6;
  max-width: 44rem;
  margin-bottom: 1.75rem;
}

/* Crimson underline accent for section titles (decorative only). */
#fitur .rd-section-title::after,
#kelas .rd-section-title::after,
#inspirasi .rd-section-title::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  border-radius: 999px;
  background: var(--rd-crimson);
  margin-top: 0.75rem;
}

/* --------------------------------------------------------------------------
   3. BENTO (#fitur) — consistent radius, shadow, hover lift
   -------------------------------------------------------------------------- */

#fitur {
  scroll-margin-top: 5.5rem;
}

#fitur .rd-bento-card {
  background: var(--rd-crimson-soft);
  border: 1px solid var(--rd-line);
  border-radius: var(--rd-radius-lg);
  box-shadow: var(--rd-shadow);
  padding: 1.5rem;
  transition:
    transform 0.35s var(--rd-ease),
    box-shadow 0.35s var(--rd-ease),
    border-color 0.35s var(--rd-ease);
  will-change: transform;
}

#fitur .rd-bento-card:hover,
#fitur .rd-bento-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--rd-shadow-lg);
  border-color: rgba(190, 18, 60, 0.28);
}

#fitur .rd-bento-card .rd-bento-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: var(--rd-crimson);
  color: #fff;
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

#fitur .rd-bento-card h3,
#fitur .rd-bento-card .rd-bento-title {
  font-family: var(--rd-font-sans);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

#fitur .rd-bento-card p,
#fitur .rd-bento-card .rd-bento-text {
  font-family: var(--rd-font-sans);
  color: var(--rd-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Apply the same card polish to any existing bento tile inside #fitur,
   without requiring new markup — scoped, no global leak. */
#fitur [data-reveal] {
  border-radius: var(--rd-radius-lg);
}

/* --------------------------------------------------------------------------
   4. FIGURES (.sec-figures) — stats + animated counters
   -------------------------------------------------------------------------- */

.sec-figures {
  scroll-margin-top: 5.5rem;
}

/* Number: large, tabular so the count-up does not jitter horizontally. */
.sec-figures .rd-figure-num,
.sec-figures [data-count] {
  font-family: var(--rd-font-sans);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--rd-ink);
}

/* Label under each figure. */
.sec-figures .rd-figure-label {
  font-family: var(--rd-font-sans);
  color: var(--rd-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 0.4rem;
}

/* Individual figure tile: subtle lift on hover, consistent radius. */
.sec-figures .rd-figure {
  border-radius: var(--rd-radius);
  padding: 1.25rem 1rem;
  transition:
    transform 0.35s var(--rd-ease),
    box-shadow 0.35s var(--rd-ease);
}

.sec-figures .rd-figure:hover {
  transform: translateY(-3px);
  box-shadow: var(--rd-shadow);
}

/* While JS is counting, keep the number from reflowing the tile. */
.sec-figures .rd-counting {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   5. NAVBAR (.site-nav) — smooth scrolled state
   -------------------------------------------------------------------------- */

.site-nav {
  transition:
    box-shadow 0.35s var(--rd-ease),
    background-color 0.35s var(--rd-ease),
    backdrop-filter 0.35s var(--rd-ease);
}

/* Added by redesign-home.js once the page is scrolled past 8px.
   Deliberately subtle: shadow + slight backdrop, no layout shift
   (no padding / height change, so the hero never jumps). */
.site-nav.rd-nav-scrolled {
  box-shadow: 0 8px 30px rgba(28, 25, 23, 0.10);
  backdrop-filter: blur(8px);
}

.site-nav.rd-nav-scrolled a,
.site-nav.rd-nav-scrolled button {
  transition: color 0.25s var(--rd-ease);
}

.site-nav.rd-nav-scrolled a:hover,
.site-nav.rd-nav-scrolled button:hover {
  color: var(--rd-crimson);
}

/* --------------------------------------------------------------------------
   6. WORKBENCH (.cbt-workbench inside .hero-stage) — polish only
   -------------------------------------------------------------------------- */

.hero-stage .cbt-workbench {
  border-radius: var(--rd-radius-lg);
  border: 1px solid var(--rd-line);
  box-shadow: var(--rd-shadow);
  transition:
    box-shadow 0.35s var(--rd-ease),
    transform 0.35s var(--rd-ease);
}

.hero-stage .cbt-workbench:hover {
  box-shadow: var(--rd-shadow-lg);
}

.hero-stage .cbt-workbench button {
  transition:
    transform 0.2s var(--rd-ease),
    background-color 0.2s var(--rd-ease),
    color 0.2s var(--rd-ease),
    box-shadow 0.2s var(--rd-ease);
}

.hero-stage .cbt-workbench button:hover {
  transform: translateY(-1px);
}

.hero-stage .cbt-workbench button:active {
  transform: translateY(0) scale(0.98);
}

.hero-stage .cbt-workbench button:focus-visible {
  outline: 2px solid var(--rd-crimson);
  outline-offset: 2px;
}

/* Kanji card inside the workbench: gentle flip-friendly transition.
   Does NOT touch flipHeroKanji / HERO_KANJI_DECK logic. */
.hero-stage .cbt-workbench .rd-kanji-card {
  font-family: var(--rd-font-jp);
  border-radius: var(--rd-radius);
  transition: transform 0.35s var(--rd-ease);
}

/* --------------------------------------------------------------------------
   7. KELAS / SENSEI + PRICING (#kelas) — card polish, no price changes
   -------------------------------------------------------------------------- */

#kelas {
  scroll-margin-top: 5.5rem;
}

#kelas .rd-kelas-card {
  border: 1px solid var(--rd-line);
  border-radius: var(--rd-radius-lg);
  box-shadow: var(--rd-shadow);
  transition:
    transform 0.35s var(--rd-ease),
    box-shadow 0.35s var(--rd-ease),
    border-color 0.35s var(--rd-ease);
}

#kelas .rd-kelas-card:hover,
#kelas .rd-kelas-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--rd-shadow-lg);
  border-color: rgba(190, 18, 60, 0.28);
}

#kelas .rd-price {
  font-family: var(--rd-font-sans);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

#kelas .rd-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--rd-font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rd-crimson);
  background: var(--rd-crimson-soft);
  border: 1px solid var(--rd-line);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

/* --------------------------------------------------------------------------
   8. INSPIRASI / JAPAN (#inspirasi)
   -------------------------------------------------------------------------- */

#inspirasi {
  scroll-margin-top: 5.5rem;
}

#inspirasi .rd-inspirasi-card {
  border-radius: var(--rd-radius-lg);
  overflow: hidden;
  box-shadow: var(--rd-shadow);
  transition:
    transform 0.35s var(--rd-ease),
    box-shadow 0.35s var(--rd-ease);
}

#inspirasi .rd-inspirasi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--rd-shadow-lg);
}

/* --------------------------------------------------------------------------
   9. ROADMAP (#roadmap) — step polish
   -------------------------------------------------------------------------- */

#roadmap {
  scroll-margin-top: 5.5rem;
}

#roadmap .rd-step {
  border-radius: var(--rd-radius);
  transition:
    transform 0.35s var(--rd-ease),
    box-shadow 0.35s var(--rd-ease);
}

#roadmap .rd-step:hover {
  transform: translateY(-3px);
  box-shadow: var(--rd-shadow);
}

/* --------------------------------------------------------------------------
   10. STAGGERED REVEAL — builds on existing [data-reveal] -> .is-in
   -------------------------------------------------------------------------- */

/* Base: keep the existing IntersectionObserver behaviour untouched.
   These rules only add the transition timing that makes the stagger
   feel deliberate. The JS sets an inline transition-delay per sibling;
   the CSS classes below are a no-JS fallback for the first 6 items. */
.hero-stage [data-reveal],
.sec-figures [data-reveal],
#roadmap [data-reveal],
#fitur [data-reveal],
#kelas [data-reveal],
#inspirasi [data-reveal] {
  transition-timing-function: var(--rd-ease);
  will-change: transform, opacity;
}

.sec-figures [data-reveal]:nth-child(2),
#roadmap [data-reveal]:nth-child(2),
#fitur [data-reveal]:nth-child(2),
#kelas [data-reveal]:nth-child(2),
#inspirasi [data-reveal]:nth-child(2) {
  transition-delay: 0.08s;
}

.sec-figures [data-reveal]:nth-child(3),
#roadmap [data-reveal]:nth-child(3),
#fitur [data-reveal]:nth-child(3),
#kelas [data-reveal]:nth-child(3),
#inspirasi [data-reveal]:nth-child(3) {
  transition-delay: 0.16s;
}

.sec-figures [data-reveal]:nth-child(4),
#roadmap [data-reveal]:nth-child(4),
#fitur [data-reveal]:nth-child(4),
#kelas [data-reveal]:nth-child(4),
#inspirasi [data-reveal]:nth-child(4) {
  transition-delay: 0.24s;
}

.sec-figures [data-reveal]:nth-child(5),
#fitur [data-reveal]:nth-child(5),
#kelas [data-reveal]:nth-child(5) {
  transition-delay: 0.32s;
}

.sec-figures [data-reveal]:nth-child(6),
#fitur [data-reveal]:nth-child(6),
#kelas [data-reveal]:nth-child(6) {
  transition-delay: 0.4s;
}

/* Once revealed, the delay must not linger on hover transitions. */
.hero-stage [data-reveal].is-in,
.sec-figures [data-reveal].is-in,
#roadmap [data-reveal].is-in,
#fitur [data-reveal].is-in,
#kelas [data-reveal].is-in,
#inspirasi [data-reveal].is-in {
  transition-delay: 0s;
}

/* --------------------------------------------------------------------------
   11. RESPONSIVE TWEAKS (homepage scope only)
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .hero-stage {
    padding-top: 1rem;
    padding-bottom: 1.75rem;
  }

  #fitur .rd-bento-card {
    padding: 1.25rem;
  }

  .sec-figures .rd-figure {
    padding: 1rem 0.75rem;
  }

  #kelas .rd-kelas-card {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  .hero-stage .rd-hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-stage .rd-hero-cta a,
  .hero-stage .rd-hero-cta button {
    text-align: center;
  }
}

/* --------------------------------------------------------------------------
   12. REDUCED MOTION — non-negotiable
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .hero-stage *,
  .sec-figures *,
  #roadmap *,
  #fitur *,
  #kelas *,
  #inspirasi *,
  .site-nav * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }

  .hero-stage .cbt-workbench:hover,
  .hero-stage .cbt-workbench button:hover,
  #fitur .rd-bento-card:hover,
  #fitur .rd-bento-card:focus-within,
  #kelas .rd-kelas-card:hover,
  #kelas .rd-kelas-card:focus-within,
  #inspirasi .rd-inspirasi-card:hover,
  #roadmap .rd-step:hover,
  .sec-figures .rd-figure:hover {
    transform: none !important;
  }

  .hero-stage [data-reveal],
  .sec-figures [data-reveal],
  #roadmap [data-reveal],
  #fitur [data-reveal],
  #kelas [data-reveal],
  #inspirasi [data-reveal] {
    transition-delay: 0s !important;
  }
}

/* ==========================================================================
   COORDINATOR ADDITIONS — homepage (Phase 1 merge)
   --------------------------------------------------------------------------
   (a) CTA button classes used by preview-home.html (.rd-cta-primary /
       .rd-cta-secondary). The homepage partial styles the .rd-hero-cta
       container only; these two classes were missing, so preview CTAs
       would have rendered unstyled.
   (b) .rd-bento-row grid layout used by the preview (the live page has
       its own layout; this rule only affects elements carrying the
       rd-bento-row class, i.e. the preview).
   (c) STRUCTURAL tile polish for LIVE markup. The homepage partial
       styles rd-* classes that exist only in the preview fragment, so
       without this block the live bento / kelas / inspirasi / roadmap /
       figures tiles would get no card treatment at all. These rules give
       the same treatment to the live tiles, which carry [data-reveal]
       (no markup change needed). Background is deliberately NOT
       overridden here, so the Hallmark v2.0.0 tile colours stay intact —
       radius, shadow and hover lift only.
       DEPLOYER: eyeball every section after deploy. If any non-tile
       [data-reveal] element (e.g. a heading wrapper) picks up a shadow,
       comment out block (c) only — everything else keeps working.
   ========================================================================== */

/* (a) Hero CTA buttons */
.hero-stage .rd-cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--rd-font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: var(--rd-crimson);
  border: 1px solid var(--rd-crimson);
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  text-decoration: none;
  box-shadow: var(--rd-shadow);
  transition: transform 0.25s var(--rd-ease), box-shadow 0.25s var(--rd-ease), background-color 0.25s var(--rd-ease);
}

.hero-stage .rd-cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--rd-shadow-lg);
  background: var(--rd-crimson-deep);
}

.hero-stage .rd-cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--rd-font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--rd-crimson);
  background: transparent;
  border: 1px solid var(--rd-crimson);
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  text-decoration: none;
  transition: transform 0.25s var(--rd-ease), background-color 0.25s var(--rd-ease);
}

.hero-stage .rd-cta-secondary:hover {
  transform: translateY(-2px);
  background: var(--rd-crimson-soft);
}

/* (b) Bento row layout (preview) */
#fitur .rd-bento-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

/* (c) Structural tile polish for live markup (see header comment) */
#fitur [data-reveal],
#kelas [data-reveal],
#inspirasi [data-reveal],
#roadmap [data-reveal],
.sec-figures [data-reveal] {
  border-radius: var(--rd-radius-lg);
  box-shadow: var(--rd-shadow);
  transition: transform 0.35s var(--rd-ease), box-shadow 0.35s var(--rd-ease), border-color 0.35s var(--rd-ease);
}

#fitur [data-reveal]:hover,
#kelas [data-reveal]:hover,
#inspirasi [data-reveal]:hover,
#roadmap [data-reveal]:hover,
.sec-figures [data-reveal]:hover {
  transform: translateY(-3px);
  box-shadow: var(--rd-shadow-lg);
}

/* ==========================================================================
   redesign-dash.css — Dashboard partial, Phase 1 redesign (akirabenkyou.my.id)
   --------------------------------------------------------------------------
   CONTRACT:
   - Custom properties (--rd-*) are defined by the coordinator in the merged
     file header (public/css/akira-redesign-v3.css). They are USED here,
     NEVER redefined.
   - Every rule is scoped under an existing dashboard selector
     (.app-sidebar / .app-shell-main / .akira-dash-header /
     #learningTrackerSection / #learning-mode-wrapper / #program-referral /
     #dashQuickSearchDesktop). No unscoped global selectors, no resets,
     no edits to shared css/tokens.css or css/base.css.
   - New classes are prefixed rd- and are used by preview-dash.html and by
     the JS hook (.rd-loaded on .app-shell-main). The live page needs NO
     blade class additions: the structural rules below style the existing
     markup as-is.
   - Dark mode: the page uses Tailwind dark: classes (darkMode 'class').
     Light-only solid backgrounds are avoided on elements that also render
     in dark mode; overlays use color-mix() / semi-transparent rgba so both
     themes stay readable. Dark overrides live at the bottom under
     `html.dark ...` and are still dashboard-scoped.
   - Motion: all new animation respects prefers-reduced-motion (see bottom).
   ========================================================================== */

/* ------------------------------------------------------------------
   1. CARD SYSTEM — consistent padding / radius / shadow / hover
   The main cards grid (~lines 831–1100) has no single verbatim card
   class in recon, so cards are styled structurally: direct children of
   a grid inside .app-shell-main. Additive properties only (radius,
   shadow, border, transition) — no fighting Tailwind layout utilities.
   ------------------------------------------------------------------ */
.app-shell-main .grid > * {
  border-radius: var(--rd-radius-lg);
  border: 1px solid var(--rd-line);
  box-shadow: var(--rd-shadow);
  transition: transform .35s var(--rd-ease),
    box-shadow .35s var(--rd-ease),
    border-color .35s var(--rd-ease);
  overflow: hidden;
}

.app-shell-main .grid > *:hover {
  transform: translateY(-3px);
  box-shadow: var(--rd-shadow-lg);
  border-color: color-mix(in srgb, var(--rd-crimson) 35%, transparent);
}

.app-shell-main .grid > *:focus-within {
  border-color: color-mix(in srgb, var(--rd-crimson) 55%, transparent);
  box-shadow: var(--rd-shadow-lg), 0 0 0 3px color-mix(in srgb, var(--rd-crimson) 18%, transparent);
}

/* Preview / reusable card class (same system, explicit opt-in). */
.app-shell-main .rd-card {
  border-radius: var(--rd-radius-lg);
  border: 1px solid var(--rd-line);
  box-shadow: var(--rd-shadow);
  background: color-mix(in srgb, var(--rd-crimson) 3%, transparent);
  padding: 1.25rem;
  transition: transform .35s var(--rd-ease),
    box-shadow .35s var(--rd-ease),
    border-color .35s var(--rd-ease);
}

.app-shell-main .rd-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--rd-shadow-lg);
  border-color: color-mix(in srgb, var(--rd-crimson) 35%, transparent);
}

.app-shell-main .rd-card__eyebrow {
  font-family: var(--rd-font-sans);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rd-crimson);
}

.app-shell-main .rd-card__title {
  font-family: var(--rd-font-sans);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--rd-ink);
  margin: .35rem 0 .3rem;
}

.app-shell-main .rd-card__jp {
  font-family: var(--rd-font-jp);
  font-size: .8rem;
  color: var(--rd-muted);
}

.app-shell-main .rd-card__desc {
  font-size: .875rem;
  line-height: 1.6;
  color: var(--rd-muted);
  margin: .5rem 0 0;
}

.app-shell-main .rd-card__badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: .2rem .55rem;
  border-radius: 999px;
  color: var(--rd-crimson);
  background: color-mix(in srgb, var(--rd-crimson) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rd-crimson) 22%, transparent);
}

.app-shell-main .rd-card__cta {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: .9rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--rd-crimson);
}

.app-shell-main .rd-card__cta::after {
  content: "→";
  transition: transform .3s var(--rd-ease);
}

.app-shell-main .rd-card:hover .rd-card__cta::after {
  transform: translateX(4px);
}

/* ------------------------------------------------------------------
   2. GREETING HIERARCHY — clearer first-screen order.
   The @php hour-based greeting sits at the top of .app-shell-main.
   Only typographic rhythm is touched (size/weight/spacing of the
   first headings); no text content is changed.
   ------------------------------------------------------------------ */
.app-shell-main h1 {
  font-family: var(--rd-font-sans);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.app-shell-main h1 + p,
.app-shell-main h2 + p {
  color: var(--rd-muted);
  line-height: 1.6;
}

.app-shell-main h2 {
  font-family: var(--rd-font-sans);
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ------------------------------------------------------------------
   3. SIDEBAR — hover / active states on menu items + wallet polish.
   data-dash-tab is JS-depended: it is only SELECTED here, never
   changed, renamed, or removed.
   ------------------------------------------------------------------ */
.app-sidebar [data-dash-tab] {
  border-radius: var(--rd-radius);
  transition: background-color .25s var(--rd-ease),
    color .25s var(--rd-ease),
    transform .25s var(--rd-ease),
    box-shadow .25s var(--rd-ease);
}

.app-sidebar [data-dash-tab]:hover {
  background: color-mix(in srgb, var(--rd-crimson) 7%, transparent);
  transform: translateX(2px);
}

.app-sidebar [data-dash-tab].active,
.app-sidebar [data-dash-tab][aria-current="page"],
.app-sidebar [data-dash-tab][aria-selected="true"] {
  background: color-mix(in srgb, var(--rd-crimson) 10%, transparent);
  color: var(--rd-crimson);
  box-shadow: inset 3px 0 0 var(--rd-crimson);
}

.app-sidebar [data-dash-tab]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--rd-crimson) 60%, transparent);
  outline-offset: 2px;
}

/* "Compact Wallet & Quick Tools" (sidebar wallet, lines 393–403). */
.app-sidebar .rd-wallet {
  border-radius: var(--rd-radius);
  border: 1px solid var(--rd-line);
  background: color-mix(in srgb, var(--rd-crimson) 5%, transparent);
  padding: .85rem .95rem;
}

.app-sidebar .rd-wallet a {
  transition: opacity .25s var(--rd-ease), transform .25s var(--rd-ease);
}

.app-sidebar .rd-wallet a:hover {
  opacity: .85;
  transform: translateY(-1px);
}

/* ------------------------------------------------------------------
   4. HEADER + SEARCH — sticky header depth, search input polish.
   #dashQuickSearchDesktop is JS-depended: styled, never renamed.
   ------------------------------------------------------------------ */
.akira-dash-header {
  box-shadow: 0 1px 0 var(--rd-line), 0 8px 24px rgba(28, 25, 23, .05);
  transition: box-shadow .35s var(--rd-ease);
}

.app-shell-main #dashQuickSearchDesktop {
  border-radius: 999px;
  border: 1px solid var(--rd-line);
  transition: border-color .25s var(--rd-ease),
    box-shadow .25s var(--rd-ease),
    background-color .25s var(--rd-ease);
}

.app-shell-main #dashQuickSearchDesktop:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--rd-crimson) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rd-crimson) 16%, transparent);
}

.app-shell-main #dashQuickSearchDesktop::placeholder {
  color: var(--rd-muted);
  opacity: .8;
}

/* ------------------------------------------------------------------
   5. TRACKER — polished steps + animated bars/rings.
   #learningTrackerSection (line 736), #lt-steps-grid, .tracker-bar-fill
   and .ring-progress are JS-depended: only visual properties are set.
   Widths are NOT set here — redesign-dash.js animates the existing
   inline width from 0 to its target on first view. If JS is absent or
   disabled, bars render at their inline target as before.
   ------------------------------------------------------------------ */
#learningTrackerSection {
  border-radius: var(--rd-radius-lg);
  border: 1px solid var(--rd-line);
  box-shadow: var(--rd-shadow);
  overflow: hidden;
}

#learning-mode-wrapper #learningTrackerSection {
  scroll-margin-top: 5.5rem;
}

#learningTrackerSection .tracker-bar-fill {
  transition: width .9s var(--rd-ease);
  border-radius: inherit;
}

#learningTrackerSection .ring-progress {
  transition: stroke-dashoffset .9s var(--rd-ease), width .9s var(--rd-ease);
}

/* Step cells inside #lt-steps-grid: pill, state ring, gentle lift. */
#learningTrackerSection #lt-steps-grid > * {
  border-radius: var(--rd-radius);
  border: 1px solid var(--rd-line);
  transition: transform .3s var(--rd-ease),
    border-color .3s var(--rd-ease),
    box-shadow .3s var(--rd-ease),
    background-color .3s var(--rd-ease);
}

#learningTrackerSection #lt-steps-grid > *:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--rd-crimson) 35%, transparent);
  box-shadow: var(--rd-shadow);
}

/* Completed / current step states — applied by existing JS classes only;
   these rules only give those states a crimson treatment if present. */
#learningTrackerSection #lt-steps-grid > *.is-done,
#learningTrackerSection #lt-steps-grid > *.done,
#learningTrackerSection #lt-steps-grid > *[data-done="true"] {
  border-color: color-mix(in srgb, var(--rd-crimson) 45%, transparent);
  background: color-mix(in srgb, var(--rd-crimson) 6%, transparent);
}

#learningTrackerSection #lt-steps-grid > *.is-current,
#learningTrackerSection #lt-steps-grid > *.current,
#learningTrackerSection #lt-steps-grid > *[data-current="true"] {
  border-color: var(--rd-crimson);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rd-crimson) 16%, transparent);
}

/* Preview tracker classes (used by preview-dash.html). */
#learningTrackerSection .rd-tracker-bar {
  height: .55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rd-ink) 10%, transparent);
  overflow: hidden;
}

#learningTrackerSection .rd-tracker-bar .tracker-bar-fill {
  display: block;
  height: 100%;
  background: var(--rd-crimson);
}

#learningTrackerSection .rd-step-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--rd-muted);
}

/* ------------------------------------------------------------------
   6. REFERRAL — subtle card lift, copy affordance.
   #program-referral is JS-depended (copyReferralText): styled only.
   ------------------------------------------------------------------ */
#program-referral {
  border-radius: var(--rd-radius-lg);
  border: 1px solid var(--rd-line);
  box-shadow: var(--rd-shadow);
  transition: box-shadow .35s var(--rd-ease), border-color .35s var(--rd-ease);
}

#program-referral:hover {
  box-shadow: var(--rd-shadow-lg);
  border-color: color-mix(in srgb, var(--rd-crimson) 30%, transparent);
}

#program-referral button {
  transition: transform .25s var(--rd-ease), opacity .25s var(--rd-ease);
}

#program-referral button:hover {
  transform: translateY(-1px);
}

#program-referral button:active {
  transform: translateY(0) scale(.98);
}

/* ------------------------------------------------------------------
   7. STAGGERED FADE-UP ON LOAD.
   redesign-dash.js adds .rd-loaded to .app-shell-main on
   DOMContentLoaded. Children animate once, in order. The base
   .animate-fade-up class is untouched; this only sequences the grid
   children and the tracker. Without JS, everything is visible
   (no hidden default state in CSS).
   ------------------------------------------------------------------ */
.app-shell-main.rd-loaded .grid > * {
  animation: rd-fade-up .55s var(--rd-ease) both;
}

.app-shell-main.rd-loaded .grid > *:nth-child(2) {
  animation-delay: .06s;
}

.app-shell-main.rd-loaded .grid > *:nth-child(3) {
  animation-delay: .12s;
}

.app-shell-main.rd-loaded .grid > *:nth-child(4) {
  animation-delay: .18s;
}

.app-shell-main.rd-loaded .grid > *:nth-child(5) {
  animation-delay: .24s;
}

.app-shell-main.rd-loaded .grid > *:nth-child(n+6) {
  animation-delay: .3s;
}

.app-shell-main.rd-loaded #learningTrackerSection {
  animation: rd-fade-up .55s var(--rd-ease) both;
  animation-delay: .08s;
}

@keyframes rd-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------------------------------------------------------------
   8. DARK MODE — same scopes, translucent overlays only.
   The page uses Tailwind dark: classes; these overrides use
   white-tinted translucency and color-mix so they cannot produce a
   light-only solid block in dark mode. No text color is forced to a
   light-theme ink here except through the shared vars, which the
   coordinator keeps theme-aware; card titles keep --rd-ink only in
   light mode (overridden below).
   ------------------------------------------------------------------ */
html.dark .app-shell-main .grid > * {
  border-color: rgba(255, 255, 255, .09);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

html.dark .app-shell-main .grid > *:hover {
  border-color: color-mix(in srgb, var(--rd-crimson) 55%, transparent);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .45);
}

html.dark .app-shell-main .rd-card {
  border-color: rgba(255, 255, 255, .09);
  background: color-mix(in srgb, var(--rd-crimson) 6%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

html.dark .app-shell-main .rd-card__title {
  color: #fafaf9;
}

html.dark .app-sidebar [data-dash-tab]:hover {
  background: color-mix(in srgb, var(--rd-crimson) 16%, transparent);
}

html.dark .app-sidebar [data-dash-tab].active,
html.dark .app-sidebar [data-dash-tab][aria-current="page"],
html.dark .app-sidebar [data-dash-tab][aria-selected="true"] {
  background: color-mix(in srgb, var(--rd-crimson) 22%, transparent);
}

html.dark .akira-dash-header {
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08), 0 8px 24px rgba(0, 0, 0, .35);
}

html.dark #learningTrackerSection {
  border-color: rgba(255, 255, 255, .09);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

html.dark #learningTrackerSection #lt-steps-grid > * {
  border-color: rgba(255, 255, 255, .09);
}

html.dark #learningTrackerSection .rd-tracker-bar {
  background: rgba(255, 255, 255, .12);
}

html.dark #program-referral {
  border-color: rgba(255, 255, 255, .09);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

/* ------------------------------------------------------------------
   9. REDUCED MOTION — honour the existing preference support
   (inline <style> lines 346–349) for every new animation.
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .app-shell-main .grid > *,
  .app-shell-main .rd-card,
  .app-sidebar [data-dash-tab],
  .app-shell-main #dashQuickSearchDesktop,
  #learningTrackerSection .tracker-bar-fill,
  #learningTrackerSection .ring-progress,
  #learningTrackerSection #lt-steps-grid > *,
  #program-referral,
  #program-referral button {
    animation: none !important;
    transition: none !important;
  }

  .app-shell-main .grid > *:hover,
  .app-shell-main .rd-card:hover,
  #learningTrackerSection #lt-steps-grid > *:hover {
    transform: none;
  }
}
