/* ==========================================================================
   MWRO - Pet Collection Stylesheet (Dark Fantasy Theme)
   ========================================================================== */

:root {
    --mw-gold: #fff4c4;
    --mw-orange: #d4af37;
    --mw-border: rgba(142, 108, 74, 0.45);
    --mw-bg: #0a0907;
    --mw-panel: rgba(18, 16, 13, 0.95);
    --mw-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
    --mw-text: #e4dfd5;
    --mw-muted: #a19e95;
    --mw-line: rgba(142, 108, 74, 0.2);
}

body {
    background-color: var(--mw-bg);
    color: var(--mw-text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
}

/* Page Background Setup */
.pet-bg {
    position: fixed;
    inset: 0;
    z-index: -3;
    background: url('../img/maps/Map003_Tiles/File0010.jpg') center center / cover no-repeat;
    filter: brightness(0.28) saturate(0.4);
}

.pet-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 0%, rgba(212, 175, 55, 0.05), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(142, 108, 74, 0.04), transparent 45%),
        linear-gradient(180deg, rgba(10, 9, 7, 0.85) 0%, rgba(0, 0, 0, 0.95) 100%);
}

.page-content {
    position: relative;
    z-index: 1;
}

/* Ornate Title Plates */
.section-title {
    color: var(--mw-gold);
    font-family: 'Cinzel', serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 2px 4px #000;
}

.section-divider {
    width: 90px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--mw-orange), var(--mw-gold), var(--mw-orange), transparent);
    margin: 12px auto 30px;
    border-radius: 999px;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* Hero Header Banner */
.pet-hero {
    position: relative;
    overflow: hidden;
    background: 
        radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.12), transparent 45%),
        linear-gradient(180deg, rgba(22, 18, 14, 0.95) 0%, rgba(10, 9, 7, 0.8) 100%);
    padding: 130px 0 50px;
    text-align: center;
    border-bottom: 2px solid var(--mw-border);
    margin-bottom: 30px;
    box-shadow: var(--mw-shadow);
}

.pet-hero::after {
    content: '';
    position: absolute;
    inset: auto 10% 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--mw-orange), var(--mw-gold), var(--mw-orange), transparent);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.pet-hero h1 {
    color: var(--mw-gold);
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 2.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px #000, 0 0 15px rgba(212, 175, 55, 0.2);
}

.pet-hero p {
    color: var(--mw-muted);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    max-width: 740px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Summary Panel */
.pet-summary {
    background: linear-gradient(145deg, rgba(40, 29, 19, 0.4), rgba(22, 18, 14, 0.95));
    border: 2px solid var(--mw-border);
    border-radius: 8px;
    padding: 22px 28px;
    margin-bottom: 28px;
    box-shadow: var(--mw-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(180deg, #5c432d 0%, #3a2717 100%);
    color: var(--mw-gold);
    border: 1px solid var(--mw-orange);
    border-radius: 4px;
    padding: 6px 15px;
    font-family: 'Marcellus', serif;
    font-size: .8rem;
    font-weight: bold;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* Search & sort toolbar — mirrors the quest page's .filter-bar recipe: the
   panel and labels here, while the global cartoon theme styles the inputs. */
.pet-toolbar {
    background: var(--mw-panel);
    border: 2px solid var(--mw-border);
    border-radius: 8px;
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: var(--mw-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.pet-toolbar label {
    color: var(--mw-gold);
    font-family: 'Marcellus', serif;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    display: inline-block;
}

.pet-hidden {
    display: none !important;
}

/* Pet Cards */
.card-pet {
    background: linear-gradient(145deg, rgba(40, 29, 19, 0.4), rgba(22, 18, 14, 0.95));
    border: 2px solid var(--mw-border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: var(--mw-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card-pet:hover {
    border-color: var(--mw-orange);
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(212, 175, 55, 0.15);
}

.pet-img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    image-rendering: pixelated;
    background: radial-gradient(circle, rgba(142, 108, 74, 0.15), rgba(18, 16, 13, 0.95));
    border: 2px solid var(--mw-border);
    border-radius: 8px;
    padding: 10px;
    flex: 0 0 110px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.pet-name {
    color: var(--mw-gold) !important;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.15rem;
    text-shadow: 0 1px 2px #000;
}

.pet-id {
    display: inline-flex;
    align-items: center;
    color: var(--mw-gold);
    background: rgba(142, 108, 74, 0.15);
    border: 1px solid var(--mw-border);
    border-radius: 4px;
    padding: 3px 8px;
    font-family: 'Marcellus', serif;
    font-weight: bold;
    font-size: .75rem;
}

.pet-story {
    color: var(--mw-text);
    font-family: 'Inter', sans-serif;
    font-size: .85rem;
    margin-top: .75rem;
    line-height: 1.6;
}

.pet-skills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.pet-skills-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--mw-gold);
    font-family: 'Cinzel', serif;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pet-skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pet-skill-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid rgba(212, 175, 55, .45);
    border-radius: 4px;
    background: rgba(92, 67, 45, .35);
    color: var(--mw-text);
    font-size: .76rem;
    line-height: 1.2;
}

.pet-skill-badge small {
    color: var(--mw-gold);
    font-size: .68rem;
}

.pet-resists {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.pet-resist-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid rgba(120, 180, 220, .45);
    border-radius: 4px;
    background: rgba(38, 62, 84, .35);
    color: var(--mw-text);
    font-size: .76rem;
    line-height: 1.2;
}

.pet-resist-badge small {
    color: #9fd0ee;
    font-size: .68rem;
    font-weight: 700;
}

.pet-skill-empty {
    color: var(--mw-muted);
    font-size: .8rem;
    font-style: italic;
}

/* Custom Stat Table inside card */
.table-dark-custom {
    width: 100%;
    margin-top: 10px;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--mw-border);
}

.table-dark-custom th {
    background: linear-gradient(180deg, #5c432d 0%, #3a2717 100%) !important;
    font-family: 'Cinzel', serif;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mw-gold) !important;
    padding: 6px 12px;
    border-bottom: 2px solid var(--mw-orange);
    text-align: center;
}

.table-dark-custom td {
    background: rgba(10, 9, 7, 0.6) !important;
    color: var(--mw-text) !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: .88rem;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(142, 108, 74, 0.15);
    text-align: center;
}

.table-dark-custom tr:last-child td {
    border-bottom: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--mw-muted);
    background: var(--mw-panel);
    border: 2px solid var(--mw-border);
    border-radius: 8px;
    box-shadow: var(--mw-shadow);
}

/* Footer Styling */
footer {
    background: transparent;
    padding: 40px 0;
    text-align: center;
    color: var(--mw-muted);
    font-family: 'Inter', sans-serif;
    border-top: 1px solid rgba(142, 108, 74, 0.15);
    margin-top: 40px;
}

/* ── Clickable card + sprite animation viewer ───────────────────── */
.pet-card-playable {
    cursor: pointer;
}

.pet-card-playable:focus-visible {
    outline: 2px solid var(--mw-orange);
    outline-offset: 3px;
}

.pet-play-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid rgba(212, 175, 55, .35);
    border-radius: 999px;
    background: rgba(212, 175, 55, .1);
    color: var(--mw-orange);
    font-size: .68rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .75;
    transition: opacity .25s ease, background .25s ease;
}

.pet-card-playable:hover .pet-play-hint {
    opacity: 1;
    background: rgba(212, 175, 55, .2);
}

/*
 * site-menu.css raises .modal-backdrop to z-index 1060 and only lifts a
 * hardcoded list of modal ids above it. Without this the backdrop paints over
 * the viewer and swallows every click, including the close button.
 */
#petAnimModal {
    z-index: 1065;
}

.pet-anim-modal .modal-content {
    background: linear-gradient(145deg, rgba(40, 29, 19, .6), var(--mw-panel));
    border: 2px solid var(--mw-border);
    border-radius: 10px;
    box-shadow: var(--mw-shadow);
    color: var(--mw-text);
}

.pet-anim-modal .modal-header,
.pet-anim-modal .modal-footer {
    border-color: var(--mw-line);
}

.pet-anim-modal .modal-title {
    color: var(--mw-gold);
    font-family: 'Cinzel', serif;
    font-weight: 700;
    text-shadow: 0 1px 2px #000;
}

.pet-anim-modal .btn-close {
    filter: invert(1) grayscale(1) brightness(1.6);
}

.pet-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 12px;
    border: 2px solid var(--mw-border);
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 65%, rgba(142, 108, 74, .18), transparent 65%),
        repeating-conic-gradient(rgba(255, 255, 255, .022) 0% 25%, transparent 0% 50%) 0 0 / 24px 24px,
        rgba(10, 9, 7, .9);
    overflow: hidden;
}

.pet-stage img {
    /* JS sizes the sprite to a whole-number upscale; these only clamp it on
       very narrow screens, where contain keeps the aspect ratio intact. */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    visibility: hidden;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .45));
}

.pet-stage-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: var(--mw-muted);
    font-size: .85rem;
    font-style: italic;
    text-align: center;
}

/* .pet-dpad/.pet-anim-actions set display, which would beat the UA [hidden] rule. */
.pet-anim-controls [hidden] {
    display: none !important;
}

.pet-anim-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
}

.pet-anim-actions {
    display: flex;
    gap: 6px;
}

.pet-anim-btn {
    padding: 6px 14px;
    border: 1px solid var(--mw-border);
    border-radius: 4px;
    background: rgba(92, 67, 45, .3);
    color: var(--mw-text);
    font-family: 'Cinzel', serif;
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    transition: all .2s ease;
}

.pet-anim-btn:hover {
    border-color: var(--mw-orange);
    color: var(--mw-gold);
}

.pet-anim-btn.is-active {
    background: linear-gradient(180deg, #5c432d 0%, #3a2717 100%);
    border-color: var(--mw-orange);
    color: var(--mw-gold);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.pet-dpad {
    display: grid;
    grid-template-columns: repeat(3, 34px);
    grid-template-rows: repeat(3, 34px);
    gap: 4px;
}

.pet-dir-btn,
.pet-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mw-border);
    border-radius: 4px;
    background: rgba(92, 67, 45, .3);
    color: var(--mw-text);
    font-size: .95rem;
    line-height: 1;
    transition: all .2s ease;
}

.pet-dir-btn:hover,
.pet-play-btn:hover {
    border-color: var(--mw-orange);
    color: var(--mw-gold);
}

/* Directions the sprite set has no distinct anim for. Kept in the grid so the
   remaining buttons stay laid out as a cross. */
.pet-dir-btn.is-unavailable {
    visibility: hidden;
    pointer-events: none;
}

.pet-dir-btn.is-active {
    background: linear-gradient(180deg, #5c432d 0%, #3a2717 100%);
    border-color: var(--mw-orange);
    color: var(--mw-gold);
}

.pet-play-btn {
    border-color: rgba(212, 175, 55, .6);
    background: rgba(212, 175, 55, .14);
    color: var(--mw-gold);
    font-size: .8rem;
}

.pet-anim-speed {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--mw-gold);
    font-family: 'Cinzel', serif;
    font-size: .76rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pet-anim-speed .form-select {
    width: auto;
    border: 1px solid var(--mw-border);
    background-color: rgba(92, 67, 45, .3);
    color: var(--mw-text);
    font-family: inherit;
    text-transform: none;
}

.pet-anim-speed .form-select:focus {
    border-color: var(--mw-orange);
    box-shadow: none;
}

.pet-anim-meta {
    margin-top: 12px;
    min-height: 1.2em;
    color: var(--mw-muted);
    font-size: .76rem;
    letter-spacing: .06em;
    text-align: center;
    text-transform: uppercase;
}

@media (max-width: 480px) {
    .pet-anim-controls {
        justify-content: center;
    }
}

/* Pager: 10 pets per page */
.pet-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 24px 0 8px;
}
.pet-page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 6px;
    border: 2px solid var(--mw-border);
    background: linear-gradient(145deg, rgba(40, 29, 19, 0.6), rgba(22, 18, 14, 0.95));
    color: var(--mw-text);
    font-weight: 700;
    cursor: pointer;
}
.pet-page-btn:hover:not(:disabled) { border-color: var(--mw-gold); color: var(--mw-gold); }
.pet-page-btn.is-active { border-color: var(--mw-gold); color: #1a130b; background: var(--mw-gold); }
.pet-page-btn:disabled { opacity: .4; cursor: default; }
.pet-page-gap { color: var(--mw-text); padding: 0 4px; }
.pet-page-info { width: 100%; text-align: center; color: var(--mw-text); font-size: .85rem; margin-top: 4px; }
