/* ══════════════════════════════════════════════════════════════════════════
   TALLAPATRA — LEGACY TOKEN COMPATIBILITY SHIM   ⚠ DEPRECATED / TEMPORARY

   Maps the previous "Spashta" token names onto Tallapatra semantic tokens so
   that the ~20 not-yet-migrated routes render in the correct visual language
   during the migration instead of sitting in a half-old/half-new state.

   THIS FILE IS SCHEDULED FOR DELETION IN PHASE 5.

   Rules while it exists:
     · Do NOT add new names here. New code uses --tp-* tokens directly.
     · As each route is migrated, delete the legacy rules it used from
       site.css. When a name here reaches zero references, delete the name.
     · 63 further legacy tokens were already unreferenced at audit time and
       have been dropped outright rather than carried over.

   Every mapping below resolves to a contrast-verified Tallapatra token; see
   tools/verify-palette.py.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    /* ── Former Spashta canonical names ───────────────────────────────── */
    --paper:        var(--tp-surface-page);
    --card:         var(--tp-surface-card);
    --indigo:       var(--tp-text-primary);
    --indigo-deep:  var(--tp-text-primary);
    --slate:        var(--tp-text-secondary);
    --line:         var(--tp-border-color-subtle);
    --sindoor:      var(--tp-action-primary);
    --sindoor-soft: var(--tp-status-error-bg);
    --indigo-soft:  rgba(58, 43, 22, 0.10);
    --focus-ring:   var(--tp-focus-ring-color);

    /* ── Brand accent aliases ─────────────────────────────────────────── */
    /* Pasupu is a border/fill accent. It is NOT a text colour on light
       surfaces — only 2.58:1 on card. Legacy page CSS used one name for both,
       so the text uses are split out into --accent-gold-text, which is the
       deep turmeric from the status scale (6.92:1 on card, 5.88:1 on leaf)
       and reads as the same family. */
    --accent-gold:        var(--tp-palette-pasupu);
    --accent-gold-text:   var(--tp-status-warning);
    --accent-gold-rgb:    192, 138, 30;
    --accent-gold-light:  var(--tp-text-secondary);
    --accent-soft:        var(--tp-palette-pasupu);
    --accent-soft-rgb:    192, 138, 30;
    --accent-pdf-gold-rgb: 192, 138, 30;

    /* ── Page / surface ───────────────────────────────────────────────── */
    --bg-deep:        var(--tp-surface-page);
    --bg-deep-rgb:    231, 218, 180;
    --bg-secondary:   var(--tp-surface-page);
    --bg-card:        var(--tp-surface-card);
    --bg-hover:       var(--tp-surface-sunken);
    --card-bg:        var(--tp-surface-card);
    --card-bg-rgb:    244, 236, 210;
    --surface-white:  var(--tp-surface-card);
    --surface-white-rgb: 244, 236, 210;
    --surface-cream:  var(--tp-surface-page);
    --prasna-hero-bg: var(--tp-surface-page);
    --cream-1-rgb:    244, 236, 210;
    --cream-2-rgb:    231, 218, 180;
    --cream-3-rgb:    216, 196, 143;

    /* ── Borders ──────────────────────────────────────────────────────── */
    --border-color:     var(--tp-border-color-subtle);
    --chart-border:     var(--tp-border-color-strong);
    --chart-border-rgb: 58, 43, 22;

    /* ── Text ─────────────────────────────────────────────────────────── */
    --text-primary:        var(--tp-text-primary);
    --text-secondary:      var(--tp-text-secondary);
    --text-muted:          var(--tp-text-secondary);
    --text-taupe:          var(--tp-text-secondary);
    --text-brand:          var(--tp-text-primary);
    --text-brand-deep:     var(--tp-text-primary);
    /* NOTE: the name is a leftover from the era when the page background was
       dark. Every remaining consumer (nav links, dropdown items) now sits on a
       LIGHT card surface, so mapping this to leaf produced 1.18:1 text. It must
       resolve to primary ink. Renamed away entirely in Phase 5. */
    --text-on-dark:        var(--tp-text-primary);
    --text-on-dark-rgb:    58, 43, 22;
    --chart-symbol-color:  var(--tp-chart-planet);
    --nav-link-hover-text: var(--tp-action-primary);
    --search-placeholder:  var(--tp-text-secondary);

    /* ── Typography ───────────────────────────────────────────────────── */
    --font-telugu: var(--tp-font-body);
    --fs-xs:   var(--tp-type-caption-size);
    --fs-sm:   var(--tp-type-label-size);
    --fs-base: var(--tp-type-body-size);
    --fs-md:   var(--tp-type-body-lg-size);
    --fs-lg:   var(--tp-type-h3-size);
    --fs-xl:   var(--tp-type-h1-size);
    --fs-icon: var(--tp-type-display-size);
    --lh-tight:   1.3;
    --lh-snug:    1.4;
    --lh-normal:  1.6;
    --lh-relaxed: 1.7;
    --lh-loose:   1.9;

    /* ── Spacing / radius ─────────────────────────────────────────────── */
    --space-1: var(--tp-space-1);
    --space-2: var(--tp-space-2);
    --space-3: var(--tp-space-3);
    --space-4: var(--tp-space-4);
    --radius-sm:   var(--tp-radius-sm);
    --radius-md:   var(--tp-radius-md);
    --radius-pill: var(--tp-radius-pill);

    /* ── Elevation / motion ───────────────────────────────────────────── */
    --shadow-color-rgb:       58, 43, 22;
    --shadow-brown-deep-rgb:  58, 43, 22;
    --shadow-gold-rgb:        192, 138, 30;
    --shadow-sm:              var(--tp-elevation-1);
    --transition-base:        var(--tp-motion-standard) var(--tp-ease);

    /* ── Status ───────────────────────────────────────────────────────── */
    --status-success:        var(--tp-status-success);
    --status-success-bg:     var(--tp-status-success-bg);
    --status-success-bright: var(--tp-status-success);
    --status-danger:         var(--tp-status-error);
    --status-danger-bg:      var(--tp-status-error-bg);
    --status-info:           var(--tp-status-info);
    --status-info-rgb:       30, 78, 121;
    --status-warning-soft-bg: var(--tp-status-warning-bg);
    --glow-success-rgb:      31, 107, 59;
    --glow-danger-rgb:       140, 29, 24;
    --info-blue-rgb:         30, 78, 121;

    /* Attention/relevance affordance — distinct from status.warning (§3) */
    --highlight-amber:           var(--tp-palette-pasupu);
    --highlight-amber-rgb:       192, 138, 30;
    --highlight-amber-deep:      var(--tp-status-warning);
    --highlight-amber-deep-rgb:  110, 71, 7;

    /* ── Planet symbols ───────────────────────────────────────────────────
       Restrained Tallapatra-compatible set replacing the previous saturated
       rainbow (deepskyblue/#ff4040/...). All verified ≥4.5:1 on card and leaf.
       Colour is never the sole cue — every planet also renders its Telugu
       abbreviation (§16 colour independence).
       ─────────────────────────────────────────────────────────────────── */
    --planet-su:   #A8232B;
    --planet-mo:   #3F5A7A;
    --planet-ma:   #8C1D18;
    --planet-me:   var(--tp-status-success);
    --planet-ju:   #6E4707;
    --planet-ve:   #8A2D5C;
    --planet-sa:   #2E3A5F;
    --planet-ra:   #55504A;
    --planet-ke-2: #5A5326;
    --planet-ke-3: var(--tp-text-secondary);
    --planet-asc:  var(--tp-text-primary);
    --planet-meta-text:  var(--tp-text-secondary);
    --planet-symbol-bg:  var(--tp-surface-card);

    /* ── Chart / lagna ────────────────────────────────────────────────── */
    --lagna-border-rgb: 168, 35, 43;
    --tab-active-border: var(--tp-border-color-strong);
    --btn-warm-hover-bg:     var(--tp-action-primary-hover);
    --btn-warm-hover-border: var(--tp-action-primary-hover);

    /* ── Badges (paksha / dosha / dasha) ──────────────────────────────── */
    /* Vishnu lagna = golden yellow + brown; Shiva lagna = blue (§ lagna classification) */
    --badge-vishnu-bg:      var(--tp-status-warning-bg);
    --badge-vishnu-text:    var(--tp-status-warning);
    --badge-vishnu-border:  var(--tp-status-warning);
    --badge-shiva-bg:       var(--tp-status-info-bg);
    --badge-shiva-text:     var(--tp-status-info);
    --badge-shiva-border:   var(--tp-status-info);
    --paksha-krishna:       var(--tp-text-secondary);
    --sign-badge-muted:     var(--tp-text-secondary);
    --dosha-warning-grad-1: var(--tp-status-warning-bg);
    --dosha-warning-grad-2: var(--tp-status-warning-bg);
    --dosha-danger-grad-1:  var(--tp-status-error-bg);
    --dosha-danger-grad-2:  var(--tp-status-error-bg);
    --dosha-success-grad-1: var(--tp-status-success-bg);
    --dosha-success-grad-2: var(--tp-status-success-bg);
    --dosha-badge-dark-text: var(--tp-text-primary);

    /* ── Verdict card trio (Panchang day quality) ─────────────────────── */
    --verdict-good-bg2:      var(--tp-status-success-bg);
    --verdict-good-border:   var(--tp-status-success);
    --verdict-good-text:     var(--tp-status-success);
    --verdict-caution-bg1:   var(--tp-status-warning-bg);
    --verdict-caution-bg2:   var(--tp-status-warning-bg);
    --verdict-caution-border: var(--tp-status-warning);
    --verdict-caution-text:  var(--tp-status-warning);
    --verdict-avoid-bg1:     var(--tp-status-error-bg);
    --verdict-avoid-bg2:     var(--tp-status-error-bg);
    --verdict-avoid-border:  var(--tp-status-error);
    --verdict-avoid-text:    var(--tp-status-error);

    /* ── Admin dashboard ──────────────────────────────────────────────── */
    --admin-tab-muted:        var(--tp-text-secondary);
    --admin-table-text:       var(--tp-text-primary);
    --text-danger-light:      var(--tp-status-error);
    --badge-ok-bright-text:   var(--tp-status-success);
    --badge-warn-bright-text: var(--tp-status-warning);
    --badge-err-bright-text:  var(--tp-status-error);

    /* ── Share / icon buttons ─────────────────────────────────────────── */
    --color-whatsapp:                var(--tp-status-success);
    --color-whatsapp-hover:          var(--tp-status-success);
    --color-icon-btn-secondary:       var(--tp-text-secondary);
    --color-icon-btn-secondary-hover: var(--tp-text-primary);

    /* ── Kundli / Matchmaking result extras ───────────────────────────── */
    --dasha-table-header-bg:         var(--tp-surface-sunken);
    --dasha-table-header-border-rgb: 216, 196, 143;
    --dasha-level-title:             var(--tp-text-primary);
    --dasha-level2-text:             var(--tp-text-secondary);
    --detail-header-text:            var(--tp-text-secondary);

    /* ── Transits ─────────────────────────────────────────────────────── */
    --trn-title:        var(--tp-text-primary);
    --trn-sub:          var(--tp-text-secondary);
    --trn-name:         var(--tp-text-primary);
    --trn-retro-bg:     var(--tp-status-info-bg);
    --trn-rashi-symbol: var(--tp-text-secondary);
    --trn-rashi-name:   var(--tp-text-primary);
    --trn-nakshatra:    var(--tp-text-secondary);
    --trn-nakshatra-2:  var(--tp-text-secondary);
    --transit-name-purple:     var(--tp-text-primary);
    --transit-entry-bg-rgb:     31, 107, 59;
    --transit-entry-border-rgb: 31, 107, 59;
    --transit-exit-bg-rgb:      110, 71, 7;
    --transit-exit-border-rgb:  110, 71, 7;

    /* ── Telugu calendar / Panchang ───────────────────────────────────── */
    --cal-hover-bg:     var(--tp-surface-sunken);
    --cal-today-bg:     var(--tp-status-warning-bg);
    --cal-today-text:   var(--tp-status-warning);
    --cal-festival-bg:  var(--tp-status-warning-bg);
    --progress-track:   var(--tp-surface-sunken);
    --skeleton-cream-1: var(--tp-surface-sunken);
    --skeleton-cream-2: var(--tp-surface-card);
    --pnc-sun-arc:   var(--tp-surface-sunken);
    --pnc-sun-dot:   var(--tp-palette-pasupu);
    --pnc-sun-icon:  var(--tp-status-warning);
    --pnc-moon-arc:  var(--tp-surface-sunken);
    --pnc-moon-dot:  var(--tp-text-secondary);
    --pnc-moon-icon: var(--tp-status-info);

    /* ── Accordion (Swabhav) ──────────────────────────────────────────── */
    --accordion-bg:        var(--tp-surface-card);
    --accordion-active-bg: var(--tp-surface-sunken);
    --accordion-text:      var(--tp-text-primary);

    /* ── Prasna intent highlight + dedicated page ─────────────────────── */
    --highlight-primary-bg:    var(--tp-status-warning-bg);
    --highlight-secondary-bg1: var(--tp-surface-card);
    --highlight-secondary-bg2: var(--tp-status-warning-bg);
    --alert-cosmic-bg1:    var(--tp-surface-card);
    --alert-cosmic-bg2:    var(--tp-surface-card);
    --alert-cosmic-border: var(--tp-palette-pasupu);
    --alert-cosmic-text:   var(--tp-text-secondary);
    --prasna-title:          var(--tp-text-primary);
    --prasna-input-border:   var(--tp-border-color-subtle);
    --prasna-placeholder:    var(--tp-text-secondary);
    --prasna-footer-border:  var(--tp-border-color-subtle);
    --prasna-footer-bg:      var(--tp-surface-page);
    --prasna-counter:        var(--tp-text-secondary);
    --prasna-muted-gold:     var(--tp-text-secondary);
    --prasna-label-en:       var(--tp-text-secondary);
    --prasna-chip-text:      var(--tp-text-primary);
    --prasna-chip-hover-bg:  var(--tp-surface-sunken);
    --prasna-chip-en-hover:  var(--tp-text-secondary);
    --prasna-info-title:     var(--tp-text-inverse);
    --list-hover-border:     var(--tp-border-color-subtle);
    --list-item-accent:      var(--tp-text-secondary);
    --privacy-highlight-rgb: 192, 138, 30;

    /* ── Gochar Phalalu ───────────────────────────────────────────────── */
    --gph-en-text:          var(--tp-text-secondary);
    --gph-meta-text:        var(--tp-text-secondary);
    --gph-empty-text:       var(--tp-text-secondary);
    --gph-info-blue:        var(--tp-status-info);
    --gph-topic-text:       var(--tp-text-primary);
    --gph-reason-text:      var(--tp-text-secondary);
    --gph-restatement-text: var(--tp-text-secondary);
    --gph-val-text:         var(--tp-text-primary);

    /* ── PDF / printable report sub-palette (monochrome-safe, §20) ────── */
    --pdf-body-bg:      var(--tp-surface-page);
    --pdf-page-bg:      var(--tp-surface-card);
    --pdf-ink-soft:     var(--tp-text-secondary);
    --pdf-heading:      var(--tp-text-primary);
    --pdf-subtitle:     var(--tp-text-secondary);
    --pdf-label:        var(--tp-text-secondary);
    --pdf-label-deep:   var(--tp-text-primary);
    --pdf-kicker:       var(--tp-status-warning);
    --pdf-accent-text:  var(--tp-status-warning);
    --pdf-accent-bright: var(--tp-palette-pasupu);
    --pdf-surface-alt:  var(--tp-surface-card);
    --pdf-chip-bg:      var(--tp-surface-sunken);
    --pdf-seal-bg:      var(--tp-surface-sunken);
    --pdf-seal-border-rgb: 192, 138, 30;
    --pdf-stat-small:   var(--tp-text-secondary);
    --pdf-join-text:    var(--tp-text-secondary);
    --pdf-join-strong:  var(--tp-text-primary);
    --pdf-join-span:    var(--tp-text-secondary);
    --pdf-status-good-text:  var(--tp-status-success);
    --pdf-status-warn-text:  var(--tp-status-warning);
    --pdf-status-warn-small: var(--tp-status-warning);
    --pdf-bride: #8A2D5C;
    --pdf-groom: #2E3A5F;
}

/* ══════════════════════════════════════════════════════════════════════════
   BOOTSTRAP BRIDGE  ⚠ TEMPORARY

   Bootstrap 5 ships its own palette via --bs-* custom properties. Without this
   bridge its defaults (e.g. .text-muted → #6c757d at 3.97:1 on our card
   surface) leak through and fail contrast. Re-pointing the --bs-* variables
   makes every un-migrated Bootstrap utility and component inherit Tallapatra.

   Removed together with Bootstrap itself once all routes use the canonical
   components.
   ══════════════════════════════════════════════════════════════════════════ */
:root {
    --bs-body-bg:             var(--tp-surface-page);
    --bs-body-color:          var(--tp-text-primary);
    --bs-body-color-rgb:      58, 43, 22;
    --bs-body-font-family:    var(--tp-font-body);
    --bs-emphasis-color:      var(--tp-text-primary);
    --bs-secondary-color:     var(--tp-text-secondary);
    --bs-secondary-bg:        var(--tp-surface-sunken);
    --bs-tertiary-color:      var(--tp-text-secondary);
    --bs-tertiary-bg:         var(--tp-surface-card);

    --bs-border-color:        var(--tp-border-color-subtle);
    --bs-border-radius:       var(--tp-radius-sm);
    --bs-border-radius-sm:    var(--tp-radius-xs);
    --bs-border-radius-lg:    var(--tp-radius-md);
    --bs-border-radius-pill:  var(--tp-radius-pill);

    --bs-link-color:          var(--tp-text-link);
    --bs-link-color-rgb:      168, 35, 43;
    --bs-link-hover-color:    var(--tp-action-primary-hover);

    --bs-primary:             var(--tp-action-primary);
    --bs-primary-rgb:         168, 35, 43;
    --bs-secondary:           var(--tp-text-secondary);
    --bs-success:             var(--tp-status-success);
    --bs-danger:              var(--tp-status-error);
    --bs-warning:             var(--tp-status-warning);
    --bs-info:                var(--tp-status-info);

    --bs-focus-ring-color:    var(--tp-focus-ring-color);

    /* Bootstrap's default code/highlight pink (#d63384) is off-palette and
       fails contrast on leaf surfaces. */
    --bs-code-color:          var(--tp-action-primary);
    --bs-highlight-bg:        var(--tp-status-warning-bg);
}

/* Bootstrap sets .text-muted with !important; match it so ours wins. */
.text-muted {
    color: var(--tp-text-secondary) !important;
}

/* Bootstrap 5.0 hardcodes code{color:#d63384} rather than reading a variable,
   so the --bs-code-color bridge above cannot reach it. 3.81:1 on card. */
code {
    color: var(--tp-action-primary);
}

/* Same story for the secondary utilities — Bootstrap 5.0 writes #6c757d
   literally (3.97:1 on card). Much of this text lives inside collapsed
   accordion bodies, so it only fails once the user expands a section. */
.text-secondary {
    color: var(--tp-text-secondary) !important;
}

.btn-outline-secondary {
    color: var(--tp-text-primary);
    border-color: var(--tp-border-color-strong);
    background-color: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
    color: var(--tp-text-primary);
    background-color: var(--tp-surface-sunken);
    border-color: var(--tp-border-color-strong);
}

/* Bootstrap's disabled rule is .btn-outline-secondary:disabled (0,2,0), which
   outranked the base override above and kept #6c757d at 3.97:1. Disabled must
   stay legible, not merely faded (§10) — this uses the verified disabled ink. */
/* ── Utilities the markup uses that this Bootstrap build does not ship ──
   Bootstrap here is 5.1.0. `fw-semibold` arrived in 5.2, `bg-secondary-subtle`
   in 5.3, and fractional spacing (`px-2.5`, `py-0.5`) is Tailwind syntax that
   Bootstrap has never had. Every element carrying one of these was silently
   getting nothing. Found by the unstyled-class sweep; all pre-existing, none
   introduced by the migration. Defined here in tokens so the affected
   elements finally render as intended. */
.fw-semibold { font-weight: var(--tp-weight-semibold); }

.bg-secondary-subtle { background-color: var(--tp-surface-sunken); }

.px-2\.5 { padding-inline: var(--tp-space-2); }
.py-0\.5 { padding-block: 2px; }

/* Bootstrap's mobile hamburger ships under the 44x44 minimum target (§16),
   and it is the primary navigation control on small screens. */
.navbar-toggler {
    min-width: var(--tp-target-min);
    min-height: var(--tp-target-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: var(--tp-border-color-subtle);
}

.btn-outline-secondary.disabled,
.btn-outline-secondary:disabled,
.btn.disabled,
.btn:disabled {
    color: var(--tp-text-disabled);
    border-color: var(--tp-border-color-subtle);
    background-color: var(--tp-action-disabled-bg);
    opacity: 1; /* never fade below legibility */
}
