/* ============================================================================
   Temples and More — Mantra/Sloka listing card (Phase 1C)

   Shared component, single implementation, loaded by TWO pages:
     - mantras-slokas.php (the real listing — card HTML is generated in its
       own PHP `fetch=1` branch, but the CSS lives here so it is never
       duplicated)
     - design-system-preview.php ("AA. Devotional Card Family" — a static
       demo using the exact same classes/markup shape)

   Not scoped under body.tam-ds: mantras-slokas.php is not a .tam-ds page,
   so every selector here is written to work with or without that scope.
   --tam-font-display/--tam-font-indic-serif are referenced with a plain
   fallback (var(--x, Georgia, serif)) for the same reason — they resolve
   to the real token on the .tam-ds preview page and fall back gracefully
   on the real listing page.

   Classes:
     .sm-card / .sm-card-inner / .sm-card-header / .sm-card-title /
     .sm-bookmark / .sm-chips / .sm-chip / .chip-deity / .sm-card-body /
     .sm-card-footer / .sm-action-btn / .sm-btn-view / .sm-btn-chant /
     .sm-btn-audio / .sm-btn-plan
       — pre-existing names kept exactly as-is; mantras-slokas.php's own
         JS (bookmark toggle, view-density switch) and other markup still
         reference these directly, so renaming them was avoided.
     .tam-mantra-card / .tam-mantra-card-inner / .tam-mantra-card-header /
     .tam-mantra-card-title / .tam-mantra-bookmark / .tam-mantra-chips /
     .tam-mantra-chip / .tam-mantra-scripture / .tam-mantra-meta /
     .tam-mantra-actions / .tam-mantra-action(-primary/-secondary/-plan/
     -audio)
       — new, added alongside the classes above on the same elements.

   Old design removed: gradient conic border, gradient buttons, and a
   4-colour "rainbow" chip row (one saturated pill per deity/type/
   occasion/source) are replaced with: a warm parchment surface, one
   thin saffron/brass top accent, ONE primary chip (deity), and a single
   muted meta line for type/occasion/source.
   ============================================================================ */
.sm-card {
    border-radius: 16px;
    position: relative;
    background: #fffdf8;
    border: 1px solid #ede4d3;
    box-shadow: 0 1px 2px rgba(36,18,7,.05), 0 4px 14px rgba(36,18,7,.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    animation: smFadeIn 0.35s ease both;
    overflow: hidden;
}
@keyframes smFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.sm-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f58020, #d9a441 60%, #b98232);
    opacity: .85;
    pointer-events: none;
}
.sm-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(36,18,7,.07), 0 14px 30px rgba(245,128,32,.14);
    border-color: rgba(245,128,32,.3);
}
.sm-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px 16px 14px;
}
.sm-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.sm-card-title {
    flex: 1;
    font-family: var(--tam-font-display, Georgia, serif);
    font-size: 18px;
    font-weight: 700;
    color: #3d2600;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Bookmark — small ghost circular icon button, 44px touch target
   (visual circle stays compact; the extra hit-area comes from padding,
   not a bigger visible circle). */
.sm-bookmark {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    min-width: 44px;
    min-height: 44px;
    margin: -6px -8px 0 0;
    background: transparent;
    border: 1.5px solid #e8d8ba;
    border-radius: 50%;
    cursor: pointer;
    color: #b0946a;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sm-bookmark:hover {
    background: #fdf6e9;
    border-color: #f58020;
    color: #f58020;
}
.sm-bookmark:focus-visible {
    outline: 2.5px solid #f58020;
    outline-offset: 2px;
}
.sm-bookmark.bookmarked {
    background: rgba(245,128,32,.12);
    border-color: #f58020;
    color: #f58020;
}
.sm-bookmark.bookmarked svg { fill: currentColor; }

/* One primary accent chip (deity) — everything else moves to a muted
   meta line below, so the card no longer shows a rainbow of saturated
   pills. */
.sm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.sm-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 50px;
    line-height: 1.5;
    letter-spacing: 0.01em;
}
.chip-deity {
    background: #F5E8D3;
    color: #7b3c00;
    border: 1px solid rgba(185,130,50,.35);
}
/* Old chip-type/-occ/-src/-audio colour rules intentionally removed —
   those categories now render as plain text in .tam-mantra-meta instead
   of separate coloured pills (spec: "avoid rainbow colouring across
   every card"). */

/* Scripture preview — calm serif, generous line-height, 3-line clamp. */
.sm-card-body,
.tam-mantra-scripture {
    flex: 1;
    font-family: var(--tam-font-indic-serif, Georgia, serif);
    font-size: 14.5px;
    line-height: 1.7;
    color: #3d2e22;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    margin-bottom: 4px;
}
.sm-card-body p { margin: 0; }

.tam-mantra-meta {
    font-size: 12px;
    color: #9a8a70;
    margin-bottom: 10px;
    line-height: 1.4;
}

.sm-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0e8d8;
}
.sm-action-btn {
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 12px;
    min-height: 44px;
    box-sizing: border-box;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.sm-btn-view {
    background: #f58020;
    color: #fff;
    border: 1px solid #f58020;
}
.sm-btn-view:hover { background: #d96c10; color: #fff; }
.sm-btn-view:focus-visible { outline: 2.5px solid #b98232; outline-offset: 2px; }
.sm-btn-chant {
    background: transparent;
    color: #7b3c00;
    border: 1px solid #e8d8ba;
}
.sm-btn-chant:hover { background: #fdf6e9; border-color: #f58020; color: #c15a00; }
.sm-btn-chant:focus-visible { outline: 2.5px solid #f58020; outline-offset: 2px; }
.sm-btn-audio {
    background: transparent;
    color: #7b3c00;
    border: 1px solid #e8d8ba;
}
.sm-btn-audio:hover { background: #fdf6e9; border-color: #f58020; color: #c15a00; }
.sm-btn-plan {
    background: rgba(46,125,50,.1);
    color: #1b5e20;
    border: 1px solid rgba(46,125,50,.3);
    position: relative;
}
.sm-btn-plan:hover { background: rgba(46,125,50,.16); }
.sm-btn-plan::after {
    content: 'Sadhana';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1b5e20;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
}
.sm-btn-plan:hover::after { opacity: 1; }
.sm-action-btn svg { flex-shrink: 0; }

/* ── List view overrides (mantras-slokas.php's view-2/-3/-4/-list
   grid-density toggle; harmless if never triggered, as on the static
   design-system preview) ─────────────────────────────────────────── */
.sm-grid.view-list .sm-card-inner {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
}
.sm-grid.view-list .sm-card-header {
    flex-direction: column;
    min-width: 200px;
    max-width: 200px;
    border-bottom: none;
    border-right: 1px solid #f0e8d8;
    padding-bottom: 0;
    padding-right: 16px;
    margin-bottom: 0;
}
.sm-grid.view-list .sm-card-body,
.sm-grid.view-list .tam-mantra-scripture { -webkit-line-clamp: unset; }
.sm-grid.view-list .sm-chips { margin-top: 6px; margin-bottom: 0; }
.sm-grid.view-list .sm-card-footer {
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    min-width: 110px;
    border-top: none;
    border-left: 1px solid #f0e8d8;
    padding-top: 0;
    padding-left: 12px;
    margin-top: 0;
}
