@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Cinzel:wght@400;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --bg: #07070f;
    --bg2: #0d0d1a;
    --surface: rgba(255, 255, 255, 0.03);
    --surface2: rgba(255, 255, 255, 0.06);
    --glass: rgba(20, 20, 40, 0.7);
    --border: rgba(255, 255, 255, 0.07);
    --text: #e8e8f5;
    --text2: #7878a8;
    --muted: #404060;

    /* Card type colors */
    --character: #a78bfa;
    --character-dim: rgba(167, 139, 250, 0.1);
    --faction: #34d399;
    --faction-dim: rgba(52, 211, 153, 0.1);
    --location: #60a5fa;
    --location-dim: rgba(96, 165, 250, 0.1);
    --timeline: #f472b6;
    --timeline-dim: rgba(244, 114, 182, 0.1);
    --rule: #fb923c;
    --rule-dim: rgba(251, 146, 60, 0.1);
    --fact: #facc15;
    --fact-dim: rgba(250, 204, 21, 0.1);

    /* Confidence */
    --canon: #10b981;
    --soft-canon: #f59e0b;
    --unverified: #6b7280;

    --r: 12px;
    --rx: 20px;
    --t: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    scroll-behavior: smooth
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden
}

/* AMBIENT */
.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.07;
    animation: pulse 20s ease-in-out infinite
}

.o1 {
    width: 800px;
    height: 800px;
    background: #7c3aed;
    top: -300px;
    left: -200px;
    animation-delay: 0s
}

.o2 {
    width: 600px;
    height: 600px;
    background: #2563eb;
    bottom: -200px;
    right: -100px;
    animation-delay: -8s
}

.o3 {
    width: 500px;
    height: 500px;
    background: #a78bfa;
    top: 40%;
    right: 25%;
    animation-delay: -15s
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.15)
    }
}

/* LAYOUT */
.app {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto auto 1fr;
    min-height: 100vh
}

/* HERO */
.hero {
    padding: 52px 48px 36px;
    text-align: center;
    border-bottom: 1px solid var(--border)
}

.hero-eyebrow {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--character);
    opacity: 0.7;
    margin-bottom: 10px
}

.hero-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.8rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    background: linear-gradient(135deg, #a78bfa, #60a5fa 50%, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    line-height: 1
}

.hero-sub {
    color: var(--text2);
    font-size: 0.95rem;
    margin-bottom: 28px
}

.stat-bar {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text2)
}

.stat-n {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text)
}

/* CONTROLS */
.controls {
    padding: 20px 48px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 7, 15, 0.8);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px
}

.search-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4
}

#search {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--t)
}

#search:focus {
    border-color: rgba(167, 139, 250, 0.4);
    background: var(--surface)
}

.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.filter-btn {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--t);
    letter-spacing: 0.04em
}

.filter-btn:hover {
    background: var(--surface2);
    color: var(--text)
}

.filter-btn.active {
    color: var(--text)
}

.filter-btn[data-type="character"].active {
    background: var(--character-dim);
    border-color: var(--character);
    color: var(--character)
}

.filter-btn[data-type="faction"].active {
    background: var(--faction-dim);
    border-color: var(--faction);
    color: var(--faction)
}

.filter-btn[data-type="location"].active {
    background: var(--location-dim);
    border-color: var(--location);
    color: var(--location)
}

.filter-btn[data-type="timeline_event"].active {
    background: var(--timeline-dim);
    border-color: var(--timeline);
    color: var(--timeline)
}

.filter-btn[data-type="rule"].active {
    background: var(--rule-dim);
    border-color: var(--rule);
    color: var(--rule)
}

.filter-btn[data-type="fact"].active {
    background: var(--fact-dim);
    border-color: var(--fact);
    color: var(--fact)
}

.filter-btn[data-conf="canon"].active {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--canon);
    color: var(--canon)
}

.filter-btn[data-conf="soft-canon"].active {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--soft-canon);
    color: var(--soft-canon)
}

.filter-sep {
    width: 1px;
    height: 28px;
    background: var(--border);
    flex-shrink: 0
}

.results-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.8rem
}

/* GRID */
.grid-area {
    padding: 32px 48px 60px
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px
}

.empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--muted)
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4
}

/* CARD */
.card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 20px;
    cursor: pointer;
    transition: var(--t);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px)
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: var(--r) var(--r) 0 0;
    opacity: 0.8
}

.card[data-type="character"]::before {
    background: var(--character)
}

.card[data-type="faction"]::before {
    background: var(--faction)
}

.card[data-type="location"]::before {
    background: var(--location)
}

.card[data-type="timeline_event"]::before {
    background: var(--timeline)
}

.card[data-type="rule"]::before {
    background: var(--rule)
}

.card[data-type="fact"]::before {
    background: var(--fact)
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow)
}

.card:hover.card[data-type="character"] {
    box-shadow: 0 8px 40px rgba(167, 139, 250, 0.15)
}

.card:hover.card[data-type="faction"] {
    box-shadow: 0 8px 40px rgba(52, 211, 153, 0.12)
}

.card:hover.card[data-type="location"] {
    box-shadow: 0 8px 40px rgba(96, 165, 250, 0.12)
}

.card:hover.card[data-type="timeline_event"] {
    box-shadow: 0 8px 40px rgba(244, 114, 182, 0.12)
}

.card:hover.card[data-type="rule"] {
    box-shadow: 0 8px 40px rgba(251, 146, 60, 0.12)
}

.card:hover.card[data-type="fact"] {
    box-shadow: 0 8px 40px rgba(250, 204, 21, 0.1)
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px
}

.card-type-icon {
    font-size: 1.4rem;
    flex-shrink: 0
}

.card-badges {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end
}

.badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase
}

.badge-type {
    background: var(--surface2)
}

.badge.character {
    background: var(--character-dim);
    color: var(--character)
}

.badge.faction {
    background: var(--faction-dim);
    color: var(--faction)
}

.badge.location {
    background: var(--location-dim);
    color: var(--location)
}

.badge.timeline_event {
    background: var(--timeline-dim);
    color: var(--timeline)
}

.badge.rule {
    background: var(--rule-dim);
    color: var(--rule)
}

.badge.fact {
    background: var(--fact-dim);
    color: var(--fact)
}

.badge-conf.canon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--canon)
}

.badge-conf.soft-canon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--soft-canon)
}

.badge-conf.unverified {
    background: rgba(107, 114, 128, 0.1);
    color: var(--unverified)
}

/* Wavyverse Tiers */
.badge-tier.wave-1 {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.15), rgba(250, 204, 21, 0.15));
    border: 1px solid rgba(250, 204, 21, 0.3);
    color: #ffd700;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.1);
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.card-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.01em
}

.card-project {
    font-size: 0.72rem;
    color: var(--text2);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text2);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.card-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 12px
}

.tag {
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.65rem;
    background: var(--surface2);
    color: var(--muted)
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all
}

.modal {
    background: #10101e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--rx);
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1)
}

.modal-header {
    padding: 28px 28px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #10101e;
    z-index: 1;
    border-radius: var(--rx) var(--rx) 0 0
}

.modal-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px
}

.modal-icon {
    font-size: 2rem
}

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text2);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--t);
    flex-shrink: 0
}

.modal-close:hover {
    background: var(--surface);
    color: var(--text)
}

.modal-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    flex: 1
}

.modal-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center
}

.modal-body {
    padding: 24px 28px 32px
}

.modal-section {
    margin-bottom: 24px
}

.modal-section:last-child {
    margin-bottom: 0
}

.modal-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px
}

.modal-text {
    font-size: 0.88rem;
    color: var(--text2);
    line-height: 1.65
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.modal-field {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px
}

.modal-field-key {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 4px
}

.modal-field-val {
    font-size: 0.83rem;
    color: var(--text)
}

.modal-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.modal-tag {
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 0.75rem;
    background: var(--surface2);
    color: var(--text2)
}

.rel-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem
}

.rel-type {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted)
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px
}

/* RESPONSIVE */
@media(max-width:768px) {
    .hero {
        padding: 36px 20px 28px
    }

    .controls {
        padding: 16px 20px
    }

    .grid-area {
        padding: 20px 20px 40px
    }
}

/* PROJECT SELECT */
.project-select {
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
    transition: var(--t);
    letter-spacing: 0.03em;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237878a8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px
}

.project-select:hover {
    background-color: var(--surface2);
    color: var(--text)
}

.project-select:focus {
    border-color: rgba(167, 139, 250, 0.4)
}

.project-select option {
    background: #10101e;
    color: var(--text)
}

/* CARD ROLE & ALIASES */
.card-role {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-left: 8px;
    vertical-align: middle
}

.card-aliases {
    font-size: 0.7rem;
    color: var(--muted);
}

/* ────────────────────────────────────────────────────────────
   LANDING VIEW & IMPRINT CARDS
   ──────────────────────────────────────────────────────────── */
.landing-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    z-index: 10;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.landing-hero {
    text-align: center;
    margin-bottom: 60px;
}

.landing-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.5));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin-bottom: 12px;
}

.landing-sub {
    color: var(--text2);
    font-size: 1.2rem;
    letter-spacing: 0.04em;
}

.imprint-cards {
    display: flex;
    gap: 24px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.imprint-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--rx);
    padding: 40px 30px;
    flex: 1;
    min-width: 280px;
    max-width: 360px;
    text-align: left;
    cursor: pointer;
    transition: var(--t);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.imprint-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    opacity: 0.6;
    transition: var(--t);
}

.imprint-icon {
    font-size: 2.8rem;
    margin-bottom: 20px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.imprint-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.imprint-desc {
    font-size: 0.9rem;
    color: var(--text2);
    line-height: 1.5;
}

/* Hover effects */
.imprint-card:hover {
    transform: translateY(-8px);
    background: var(--surface2);
    box-shadow: var(--shadow);
}

.imprint-card:hover .imprint-icon {
    transform: scale(1.15) translateY(-4px);
}

/* Specific Imprint Colors */
.imprint-ripple::before { background: #38bdf8; }
.imprint-wavy::before { background: #a78bfa; }
.imprint-studios::before { background: #fbbf24; }

.imprint-card:hover.imprint-ripple { border-color: rgba(56, 189, 248, 0.4); box-shadow: 0 16px 40px rgba(56, 189, 248, 0.15); }
.imprint-card:hover.imprint-wavy { border-color: rgba(167, 139, 250, 0.4); box-shadow: 0 16px 40px rgba(167, 139, 250, 0.15); }
.imprint-card:hover.imprint-studios { border-color: rgba(251, 191, 36, 0.4); box-shadow: 0 16px 40px rgba(251, 191, 36, 0.15); }

/* Breadcrumb nav */
.hero-top-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.back-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--t);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    background: var(--surface);
    color: var(--text);
    border-color: rgba(255,255,255,0.2);
}

/* ────────────────────────────────────────────────────────────
   THEMING (RIPPLE / WAVY / STUDIOS)
   ──────────────────────────────────────────────────────────── */

/* RIPPLE COMICS THEME (Kid friendly, vibrant) */
body.theme-ripple {
    --bg: #041224;
    --bg2: #081a36;
}
body.theme-ripple .o1 { background: #0ea5e9; } /* bright blue */
body.theme-ripple .o2 { background: #8b5cf6; } /* bright purple */
body.theme-ripple .o3 { background: #f43f5e; } /* bright pink */
body.theme-ripple .hero-title {
    background: linear-gradient(135deg, #0ea5e9, #8b5cf6 50%, #f43f5e);
    -webkit-background-clip: text;  background-clip: text;
}

/* WAVY COMICS THEME (Mature, cosmic darkness) */
body.theme-wavy {
    --bg: #07070f;
    --bg2: #0d0d1a;
}
body.theme-wavy .o1 { background: #7c3aed; }
body.theme-wavy .o2 { background: #2563eb; }
body.theme-wavy .o3 { background: #a78bfa; }
body.theme-wavy .hero-title {
    background: linear-gradient(135deg, #a78bfa, #60a5fa 50%, #f472b6);
    -webkit-background-clip: text; background-clip: text;
}

/* WAVY STUDIOS THEME (Cinematic, high contrast, elegant) */
body.theme-studios {
    --bg: #0a0a0a;
    --bg2: #141414;
}
body.theme-studios .o1 { background: #f59e0b; opacity: 0.05;} /* gold */
body.theme-studios .o2 { background: #1e40af; opacity: 0.06;} /* deep cinema blue */
body.theme-studios .o3 { background: #9ca3af; opacity: 0.05;} /* silver */
body.theme-studios .hero-title {
    background: linear-gradient(135deg, #fbbf24, #fcd34d 50%, #9ca3af);
    -webkit-background-clip: text; background-clip: text;
}
    margin-bottom: 6px;
    font-style: italic
}

/* MODAL ALIASES */
.modal-aliases {
    font-size: 0.75rem;
    color: var(--muted);
    font-style: italic
}

/* CLICKABLE CROSS-REFERENCE TAGS (Fix 2) */
.modal-tag.clickable,
.rel-card.clickable {
    cursor: pointer;
    transition: var(--t)
}

.modal-tag.clickable:hover {
    background: rgba(167, 139, 250, 0.15);
    color: var(--character);
    border-color: rgba(167, 139, 250, 0.3);
    outline: 1px solid rgba(167, 139, 250, 0.3)
}

.rel-card.clickable:hover {
    background: rgba(167, 139, 250, 0.08);
    border-color: rgba(167, 139, 250, 0.25);
    cursor: pointer
}

/* BROKEN REFERENCE INDICATOR (Fix 3) */
.modal-tag.ref-missing {
    opacity: 0.35;
    text-decoration: line-through;
    cursor: default;
    font-style: italic
}

.rel-card.ref-missing {
    opacity: 0.35;
    cursor: default
}

/* REL LIST flex layout */
.rel-list {
    display: flex;
    flex-direction: column;
    gap: 6px
}

/* ── IMAGE SUPPORT (spec: wavypedia-image-integration-spec.md) ────────────── */

/* Card image header */
.card-img-wrap {
    width: calc(100% + 40px);
    margin: -20px -20px 0;
    height: 160px;
    overflow: hidden;
    border-radius: var(--r) var(--r) 0 0;
    background: var(--surface2);
    position: relative
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: block
}

.card-img.loaded {
    opacity: 1
}

.card-img-wrap.img-error {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    opacity: 0.3
}

.card-img-wrap.img-error::after {
    content: '🖼️'
}

/* Badges below image (for cards with thumbnails) */
.card-badges-below {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px
}

/* Card body wrapper */
.card-has-img .card-body {
    padding-top: 12px
}

.card-body {
    padding: 0
}

/* Modal image (spec §5.2) */
.modal-img-wrap {
    width: calc(100% + 56px);
    margin: -24px -28px 24px;
    position: relative;
    background: var(--surface);
    max-height: 300px;
    overflow: hidden
}

.modal-img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block
}

/* Gallery nav buttons */
.modal-gallery {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    pointer-events: none
}

.gallery-btn {
    pointer-events: all;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px)
}

.gallery-btn:hover {
    background: rgba(167, 139, 250, 0.5)
}