/* =====================================================
   ===== STRYV4 LUCKY TICKETS · SHOP CSS · CARDS    =====
   ===== Phase C3 · file 2 / 4                      =====
   ===== Tag: STR · file: shop_cards_STR.css        =====
   ===================================================== */

/*
 * The 129 portrait shop cards. Each card:
 *  - Has a 256×256 icon slot (the painted JRPG-style icon)
 *  - Shows the carnival name and one-line description
 *  - Has a unique 3-colour gradient sourced from its family
 *  - Glows family-colour on hover
 *  - Glows brighter when selected
 *  - Bursts sparks when first selected (animation in shop_animations_STR.css)
 *  - Optionally shows a small star/Ω/family badge
 *
 * Cards are placed in .shop-grid (defined in shop_frame_STR.css).
 *
 * Family palette colours are injected per-card via inline CSS variables:
 *   --card-c1, --card-c2, --card-c3
 * These come from family_palettes_STR.json.
 *
 * House conventions: CAPS headers with ===== wrappers, CodeNumber X.Y
 * block labels, British English.
 */





/* =====================================================
   ===== SECTION 1: CARD CONTAINER                  =====
   ===================================================== */

/* CodeNumber 1.1 — The card itself.
   Portrait orientation, taller than wide. ~240px wide on desktop, scales
   down on mobile. Icon slot is square (256×256-capable). Below: name,
   then description. */

.ticket-card {
    --card-c1: #4a4a55;
    --card-c2: #9aa0b0;
    --card-c3: #cab07a;
    position: relative;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--card-c1) 40%, var(--velvet-deep) 60%) 0%,
            color-mix(in srgb, var(--card-c1) 18%, var(--velvet-ink) 82%) 100%);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition:
        transform var(--t-med) var(--ease-soft),
        box-shadow var(--t-med) var(--ease-soft),
        filter var(--t-med) var(--ease-soft);
    /* Layered border: outer gold, inner glow from card colour */
    border: 1px solid var(--gold-deep);
}

.ticket-card:hover {
    transform: translateY(-4px);
    box-shadow:
        var(--shadow-card-hover),
        0 0 24px color-mix(in srgb, var(--card-c2) 50%, transparent);
}

/* CodeNumber 1.2 — Subtle border glow pseudo-element.
   Sits just inside the card edge; glows the family colour. */
.ticket-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card-c2) 30%, transparent);
    transition: box-shadow var(--t-med) var(--ease-soft);
}
.ticket-card:hover::before {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card-c2) 70%, transparent),
                inset 0 0 12px color-mix(in srgb, var(--card-c2) 40%, transparent);
}

/* CodeNumber 1.3 — Selected state. Brighter, with a persistent breathing glow. */
.ticket-card.is-selected {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.65),
        0 0 0 2px var(--card-c3),
        0 0 28px color-mix(in srgb, var(--card-c3) 60%, transparent);
}
.ticket-card.is-selected::before {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--card-c3) 80%, transparent),
                inset 0 0 18px color-mix(in srgb, var(--card-c3) 35%, transparent);
}

/* CodeNumber 1.4 — Disabled / unavailable state (e.g. custom-mix tickets with no data yet).
   The "hidden" rule from the spec uses display:none, but we keep an opt-in
   "show greyed" rule for admin force-show. */
.ticket-card.is-disabled {
    filter: grayscale(0.75) brightness(0.6);
    cursor: not-allowed;
    pointer-events: none;
}
.ticket-card.is-disabled::after {
    content: 'no data yet';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-12deg);
    font-family: var(--font-display);
    font-style: italic;
    color: var(--paper-warm);
    font-size: 12px;
    letter-spacing: 0.1em;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border: 1px dashed var(--paper-warm);
    pointer-events: none;
}

/* CodeNumber 1.5 — When the card can't produce a result for a real reason
   (e.g. Custom Mix "Hot Streak" with no current streaks), hide it entirely. */
.ticket-card.is-hidden-because-no-data {
    display: none;
}





/* =====================================================
   ===== SECTION 2: ICON SLOT                       =====
   ===================================================== */

/* CodeNumber 2.1 — The 256×256 icon slot.
   Slot is responsive — it fills the card width, and stays square. */

.ticket-card__icon-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    background:
        radial-gradient(circle at 50% 40%,
            color-mix(in srgb, var(--card-c2) 30%, transparent) 0%,
            transparent 65%),
        linear-gradient(135deg,
            color-mix(in srgb, var(--card-c1) 65%, transparent) 0%,
            color-mix(in srgb, var(--card-c1) 35%, transparent) 100%);
    overflow: hidden;
    border-bottom: 1px solid var(--gold-deep);
}

.ticket-card__icon-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12%;
    image-rendering: -webkit-optimize-contrast;
    /* Centred 256x256 icon with soft drop shadow */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
    transition: transform var(--t-slow) var(--ease-soft);
}

.ticket-card:hover .ticket-card__icon-img {
    transform: scale(1.06);
}

/* CodeNumber 2.2 — Placeholder when no icon has been generated yet.
   A simple carnival ticket-stub SVG inlined.
   This element is rendered by the JS when the <img> fails. */
.ticket-card__icon-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    color: var(--paper-warm);
    opacity: 0.55;
}
.ticket-card__icon-placeholder svg {
    width: 56%;
    height: 56%;
    fill: currentColor;
}
.ticket-card__icon-placeholder-text {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.7;
}





/* =====================================================
   ===== SECTION 3: NAME PLATE                      =====
   ===================================================== */

/* CodeNumber 3.1 — The name plate below the icon */
.ticket-card__name {
    padding: 14px 14px 6px;
    font-family: var(--font-display);
    font-size: 18px;
    font-style: italic;
    font-weight: 600;
    color: var(--gold-light);
    text-align: center;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* CodeNumber 3.2 — Tiny hair-thin gold divider below the name */
.ticket-card__name-divider {
    height: 1px;
    margin: 0 18%;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--card-c3) 30%,
        var(--card-c3) 70%,
        transparent 100%);
    opacity: 0.55;
}





/* =====================================================
   ===== SECTION 4: DESCRIPTION BODY                =====
   ===================================================== */

/* CodeNumber 4.1 — The flavour description.
   Two lines visible by default; on hover the card expands slightly and
   lets the description breathe. */

.ticket-card__description {
    padding: 10px 16px 18px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--paper-cream);
    text-align: center;
    line-height: 1.5;
    flex: 1 1 auto;
    /* Clamp to 4 lines to keep card heights consistent */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.85;
    transition: opacity var(--t-med) var(--ease-soft);
}
.ticket-card:hover .ticket-card__description {
    opacity: 1;
}

/* CodeNumber 4.2 — The shimmer effect on the name for carnival-named tickets.
   Animation defined in shop_animations_STR.css; this just declares the
   target hook. */
.ticket-card[data-named="true"] .ticket-card__name {
    background: linear-gradient(90deg,
        var(--gold-light) 0%,
        var(--gold-bright) 50%,
        var(--gold-light) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: name-shimmer 6s ease-in-out infinite;
    animation-delay: var(--shimmer-delay, 0s);
}





/* =====================================================
   ===== SECTION 5: CARD BADGES                     =====
   ===================================================== */

/* CodeNumber 5.1 — Tier badge in top-left corner.
   Subtle in v2 (since gating is by purchase-count-in-cycle, not by
   the ticket itself). Shown only when REVEAL_OMEGA or ADMIN view. */

.ticket-card__tier-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--tier-free);
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    display: none;   /* hidden by default in v2 */
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.18);
    z-index: 2;
}
.ticket-card[data-tier="2"] .ticket-card__tier-badge { background: var(--tier-survey); }
.ticket-card[data-tier="3"] .ticket-card__tier-badge { background: var(--tier-quiz); }

/* Reveal-cheat enables visibility */
body.stryv-cheat-reveal-tier .ticket-card__tier-badge { display: inline-flex; }

/* CodeNumber 5.2 — Star badge (★) for v1.0 starred tickets (real EV-edge ones). */
.ticket-card__star-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--star-gold);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
    z-index: 2;
}
.ticket-card[data-starred="true"] .ticket-card__star-badge {
    display: inline-flex;
}
.ticket-card__star-badge svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    animation: star-pulse 2.4s ease-in-out infinite;
}

/* CodeNumber 5.3 — Ω badge — only shown when REVEAL_OMEGA cheat is active. */
.ticket-card__omega-badge {
    position: absolute;
    top: 8px;
    right: 36px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 4px;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--card-c2) 60%, var(--gold-mid)) 0%,
            color-mix(in srgb, var(--card-c1) 60%, var(--gold-deep)) 100%);
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--gold-mid);
    z-index: 2;
}
body.stryv-cheat-reveal-omega .ticket-card[data-omega="true"] .ticket-card__omega-badge {
    display: inline-flex;
}

/* CodeNumber 5.4 — Success rate footer strip — only shown with REVEAL_SUCCESS cheat. */
.ticket-card__success-strip {
    display: none;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid color-mix(in srgb, var(--card-c2) 25%, transparent);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--paper-warm);
    letter-spacing: 0.04em;
}
body.stryv-cheat-reveal-success .ticket-card__success-strip {
    display: block;
}
.ticket-card__success-strip-bar {
    display: inline-block;
    height: 6px;
    background: linear-gradient(90deg, var(--card-c3) 0%, var(--gold-light) 100%);
    vertical-align: middle;
    margin-right: 6px;
    border-radius: 2px;
}

/* CodeNumber 5.5 — Source code peek — only shown with REVEAL_CODE cheat. */
.ticket-card__code-peek {
    display: none;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.45);
    color: var(--paper-warm);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    border-top: 1px solid rgba(176, 138, 46, 0.18);
    letter-spacing: 0.05em;
    word-break: break-all;
}
body.stryv-cheat-reveal-code .ticket-card__code-peek {
    display: block;
}





/* =====================================================
   ===== SECTION 6: SPARKLE BURST CONTAINER         =====
   ===================================================== */

/* CodeNumber 6.1 — When a card is clicked, JS injects a particle container
   into this element and triggers the burst animation.
   The container is full-card-overlay and pointer-events:none so it
   doesn't block subsequent interaction. */

.ticket-card__sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 3;
}





/* =====================================================
   ===== SECTION 7: CUSTOM MIX TICKET VARIANT       =====
   ===================================================== */

/* CodeNumber 7.1 — Custom Mix tickets get a slightly more dramatic look.
   They sit at the top of the grid (visually separated) and have a
   warmer, more jewelled gradient. */

.ticket-card[data-family="custom-mix"] {
    --card-c1: #3a1a4a;
    --card-c2: #9a5ac0;
    --card-c3: #e6c63a;
}
.ticket-card[data-family="custom-mix"] .ticket-card__name {
    color: var(--gold-bright);
}

/* CodeNumber 7.2 — A "meta-ticket" pip in the top-left of custom-mix cards */
.ticket-card[data-family="custom-mix"]::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        var(--gold-bright) 0%,
        var(--gold-mid) 60%,
        var(--gold-deep) 100%);
    box-shadow: 0 0 8px var(--card-c3);
    z-index: 4;
    pointer-events: none;
}





/* =====================================================
   ===== SECTION 8: TIER OVERLAY GATE               =====
   ===================================================== */

/* CodeNumber 8.1 — When the user tries to add a tier-gated 2nd or 3rd
   ticket, the card briefly shows a "complete survey to unlock" overlay
   before opening the survey/quiz module. Animations in shop_animations
   handle the appearance. */

.ticket-card__gate-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.8) 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
    z-index: 5;
}
.ticket-card.is-gated .ticket-card__gate-overlay {
    display: flex;
}
.ticket-card__gate-text {
    font-family: var(--font-display);
    color: var(--paper-cream);
    font-style: italic;
    font-size: 14px;
    line-height: 1.4;
}
.ticket-card__gate-icon {
    color: var(--gold-light);
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
}





/* =====================================================
   ===== SECTION 9: COMPACT / DENSE GRID VARIANT    =====
   ===================================================== */

/* CodeNumber 9.1 — A denser grid view, toggled via the sort-row "view"
   selector. Cards still readable, just smaller and arranged more
   tightly. Useful when the user wants to scan 129 tickets at once. */

.shop-grid.is-dense .ticket-card {
    --dense-shrink: 0.84;
}
.shop-grid.is-dense {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}
.shop-grid.is-dense .ticket-card__name {
    font-size: 15px;
    padding: 10px 10px 4px;
}
.shop-grid.is-dense .ticket-card__description {
    font-size: 11px;
    padding: 8px 12px 12px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}





/* =====================================================
   ===== SECTION 10: SECTION-HEADER ROW             =====
   ===================================================== */

/* CodeNumber 10.1 — When tickets are grouped (e.g. by family or by search
   group), each group gets a row-spanning header label. */

.shop-grid__group-header {
    grid-column: 1 / -1;
    margin: 14px 0 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 6px;
}
.shop-grid__group-header-title {
    font-family: var(--font-display);
    color: var(--gold-light);
    font-style: italic;
    font-size: 18px;
    letter-spacing: 0.03em;
}
.shop-grid__group-header-count {
    font-family: var(--font-body);
    color: var(--paper-warm);
    font-size: 12px;
    opacity: 0.6;
}
.shop-grid__group-header-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg,
        var(--gold-mid) 0%,
        transparent 100%);
    opacity: 0.4;
}
