/*
 * MeowTarot — Phase 3: Visual Redesign (Global Chrome + Card-Slot Fallback)
 * css/phase-3-redesign.css
 * ─────────────────────────────────────────────────────────────────────────
 *
 * RISK LEVEL: Medium
 * SCOPE: Global chrome (header, bottom-nav, footer) re-skinned with --mt-*
 *        tokens, plus card-slot gradient fallback scoped to
 *        body[data-page='daily'] and body[data-page='question-draw'].
 *
 * REFERENCES the --mt-* token namespace added in css/theme-tokens.css.
 *
 * SPECIFICITY NOTE (Phase 3.3):
 *   Chrome selectors here use a `body[data-page]` prefix — attribute-only,
 *   no value — to match every page that exposes data-page (all of them).
 *   This raises specificity to (0,2,1), tying or beating the pre-existing
 *   `body[data-page='home']` scoped rules in phase-1-home.css §2 and
 *   phase-2-1-logo.css §2. Combined with phase-3-redesign loading LAST in
 *   the stylesheet stack (after phase-1-home), source order resolves ties
 *   in phase-3's favor.
 *
 * WHAT THIS FILE DOES NOT TOUCH:
 *   - Page backgrounds (per-page; later phases)
 *   - .card .front (the art face)
 *   - .card-back PNG assets (asset task, filed separately)
 *   - Result pages, profile, share poster
 *   - css/styles.css flip block (edited separately in Phase 3)
 *
 * LINK ORDER: must load LAST. After phase-1-home.css on the homepage.
 * ─────────────────────────────────────────────────────────────────────────
 */


/* §1 — Site header (overrides phase-2-header.css and phase-1-home.css §2) */
body[data-page] .site-header {
  background: var(--mt-nav-bg);
  border-bottom: 1px solid var(--mt-nav-border);
  box-shadow: var(--mt-shadow-panel);
}

@media (max-width: 768px) {
  body[data-page].has-bottom-nav .site-header {
    background: var(--mt-nav-bg);
    border-bottom-color: var(--mt-nav-border);
  }
}


/* §1 — Bottom nav (overrides phase-2-1-logo.css §2 homepage scope) */
body[data-page] .bottom-nav {
  background: var(--mt-nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--mt-nav-border);
  box-shadow: 0 -4px 24px rgba(61, 26, 92, 0.08);
}

body[data-page] .bottom-nav__item {
  color: var(--mt-nav-icon-inactive);
}

body[data-page] .bottom-nav__item.is-active {
  color: var(--mt-nav-icon-active);
}

/*
 * Center 'Draw' CTA intentionally NOT overridden — keeps gold accent
 * from styles.css / phase-2-1.
 */


/* §1 — Site footer (overrides phase-1-home.css §7 homepage scope) */
body[data-page] .site-footer {
  background: rgba(255, 255, 255, 0.55);
  color: var(--mt-plum-muted);
  border-top: 1px solid var(--mt-nav-border);
}


/* §2 — Card-slot fallback gradient (daily + question-draw selection only)
 *
 * The card-back visual on these pages is actually an <img class="card-back">
 * loaded from a per-deck PNG asset (see js/main.js applyCardBackBackground).
 * The real visual identity lives in those assets, not in CSS.
 *
 * This rule paints the parent .card-slot with the new plum-to-rose
 * gradient as a graceful FALLBACK — visible only if the PNG fails to
 * load (e.g. CDN miss, offline). When the asset loads, the opaque <img>
 * covers this layer entirely.
 *
 * The headline card-back redesign is an asset task tracked separately
 * (generate new plum-to-rose card-back PNGs for all decks, upload to R2).
 *
 * Selectors already have body[data-page='...'] specificity (0,2,1), so
 * the Phase 3.3 prefix uplift does not need to apply here.
 */
body[data-page='daily']         .card-slot,
body[data-page='question-draw'] .card-slot {
  background: var(--mt-card-back-bg);
  border-radius: var(--mt-radius-card);
}


/* ─────────────────────────────────────────────────────────────────────────
 * §2 — Phase 5 floating-pill bottom-nav (overrides §1 + styles.css base)
 * Matches design doc's BottomNav: 4 tabs, no center button, floating
 * 28px-radius pill 10px from edges/bottom, translucent white with
 * backdrop-blur, pastel plum tints. Inline SVG cat glyphs ride on
 * currentColor so active/inactive tint is one rule.
 * ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  body[data-page] .bottom-nav--phase5 {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 110;
    height: auto;
    padding: 10px 8px 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 28px;
    box-shadow:
      0 -2px 16px -6px rgba(61, 26, 92, 0.12),
      inset 0 0 0 1px rgba(255, 255, 255, 0.6),
      0 12px 28px -12px rgba(61, 26, 92, 0.18);
  }

  body[data-page] .bottom-nav--phase5 .bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--mt-plum-pale, #a487c4);
    font-family: var(--mt-font-body, "DM Sans", sans-serif);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1;
    text-decoration: none;
    padding: 6px 4px;
    border-radius: 14px;
    transition: color 160ms ease, transform 140ms ease;
    -webkit-tap-highlight-color: transparent;
  }

  body[data-page] .bottom-nav--phase5 .bottom-nav__item:active {
    transform: scale(0.96);
  }

  body[data-page] .bottom-nav--phase5 .bottom-nav__item.is-active {
    color: var(--mt-plum, #3d1a5c);
    font-weight: 600;
  }

  body[data-page] .bottom-nav--phase5 .bottom-nav__icon {
    height: 24px;
    width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 160ms ease;
  }

  body[data-page] .bottom-nav--phase5 .bottom-nav__item.is-active .bottom-nav__icon {
    opacity: 1;
  }

  body[data-page] .bottom-nav--phase5 .bottom-nav__icon svg {
    display: block;
    width: 22px;
    height: 22px;
  }

  body[data-page] .bottom-nav--phase5 .bottom-nav__label {
    font-size: 10.5px;
    letter-spacing: 0.02em;
  }

  /* Body padding accommodates the floating pill height + bottom inset
   * + small breathing room. Phase 4 used --bottom-nav-height (64px);
   * the Phase 5 pill is ~64px tall with the floating offset so the
   * existing token still fits, but we add a tad more space so the
   * page content doesn't crowd the pill's top edge. */
  body.has-bottom-nav {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}
