/* =========================================
   CHARACTERS DIRECTORY
========================================= */


/* =========================================
   HERO
========================================= */

.characters-hero {
    position: relative;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 90px var(--page-padding) 55px;
    text-align: center;
    background: linear-gradient( rgba(8,14,24,.35), rgba(8,14,24,.58) ), url("../images/banners/characters.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 4px solid var(--gold);
}

.characters-hero-content {
    position: relative;
    z-index: 2;
    width: min(850px, 100%);
}

.characters-hero h1 {
    margin: 0 0 15px;
    font-family: var(--title-font);
    font-size: clamp(48px, 7vw, 82px);
    color: var(--gold-light);
    text-shadow: 0 4px 18px rgba(0,0,0,.8);
}

.characters-hero p {
    max-width: 720px;
    margin: 0 auto;
    font-size: clamp(19px, 2.2vw, 23px);
    line-height: 1.55;
    color: rgba(255,255,255,.94);
    text-shadow: 0 2px 9px rgba(0,0,0,.8);
}


/* =========================================
   DIRECTORY PAGE
========================================= */

.character-directory-page {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: radial-gradient( circle at 50% 5%, rgba(244,212,124,.10), transparent 38% ), linear-gradient( 180deg, #101827 0%, #182235 50%, #101827 100% );
    color: white;
}

.character-directory-content {
    position: relative;
    z-index: 2;
    width: min( calc(100% - (var(--page-padding) * 2)), 1200px );
    margin-inline: auto;
    padding: clamp(38px, 5vw, 60px) 0 clamp(80px, 9vw, 120px);
}


/* =========================================
   PAGE PARTICLES
========================================= */

.character-page-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.character-page-particles span {
    position: absolute;
    bottom: -30px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f4d47c;
    opacity: .55;
    box-shadow: 0 0 10px #f4d47c, 0 0 22px rgba(244,212,124,.72);
    animation: characterParticleFloat linear infinite;
}

.character-page-particles span:nth-child(1) { left:4%; width:5px; height:5px; animation-duration:17s; animation-delay:1s; }
.character-page-particles span:nth-child(2) { left:13%; width:9px; height:9px; animation-duration:21s; animation-delay:5s; }
.character-page-particles span:nth-child(3) { left:22%; animation-duration:18s; animation-delay:8s; }
.character-page-particles span:nth-child(4) { left:31%; width:5px; height:5px; animation-duration:23s; animation-delay:3s; }
.character-page-particles span:nth-child(5) { left:40%; width:10px; height:10px; animation-duration:20s; animation-delay:11s; }
.character-page-particles span:nth-child(6) { left:49%; animation-duration:24s; animation-delay:6s; }
.character-page-particles span:nth-child(7) { left:58%; width:6px; height:6px; animation-duration:19s; animation-delay:2s; }
.character-page-particles span:nth-child(8) { left:67%; width:9px; height:9px; animation-duration:22s; animation-delay:9s; }
.character-page-particles span:nth-child(9) { left:76%; animation-duration:18s; animation-delay:4s; }
.character-page-particles span:nth-child(10) { left:85%; width:5px; height:5px; animation-duration:25s; animation-delay:12s; }
.character-page-particles span:nth-child(11) { left:92%; width:8px; height:8px; animation-duration:20s; animation-delay:7s; }
.character-page-particles span:nth-child(12) { left:97%; width:6px; height:6px; animation-duration:23s; animation-delay:14s; }

@keyframes characterParticleFloat {
    0% { transform:translateY(30px) scale(.5); opacity:0; }
    12% { opacity:.65; }
    82% { opacity:.4; }
    100% { transform:translateY(-120vh) scale(1.15); opacity:0; }
}


/* =========================================
   TOOLBAR: BACK + SEARCH
========================================= */

.character-directory-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 45px;
}

.character-back-navigation {
    margin: 0;
}

.character-back-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 19px;
    border: 1px solid rgba(244,212,124,.45);
    border-radius: 30px;
    background: rgba(255,255,255,.055);
    color: var(--gold-light);
    font-family: var(--title-font);
    font-size: 13px;
    text-decoration: none;
    transition: transform .25s ease, background .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.character-back-button:hover {
    transform: translateX(-4px);
    background: rgba(244,212,124,.11);
    border-color: var(--gold-light);
    box-shadow: 0 0 14px rgba(244,212,124,.10);
}

.character-search-wrap {
    position: relative;
    width: min(420px, 48vw);
}

.character-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    color: #f4d47c;
    font-family: var(--title-font);
    font-size: 23px;
    line-height: 1;
    pointer-events: none;
    text-shadow: 0 0 9px rgba(244,212,124,.3);
}

.character-search {
    width: 100%;
    height: 46px;
    padding: 0 45px 0 48px;
    border: 1px solid rgba(244,212,124,.5);
    border-radius: 30px;
    outline: none;
    background: linear-gradient(145deg, rgba(15,24,39,.94), rgba(27,39,58,.96));
    color: #fff0ad;
    font-family: var(--title-font);
    font-size: 15px;
    letter-spacing: .25px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 7px 18px rgba(0,0,0,.15);
    transition: border-color .25s ease, box-shadow .25s ease, background .25s ease, transform .25s ease;
}

.character-search::placeholder {
    color: rgba(255,240,173,.62);
}

.character-search:hover {
    border-color: rgba(244,212,124,.78);
}

.character-search:focus {
    border-color: #f4d47c;
    background: linear-gradient(145deg, rgba(18,28,45,.98), rgba(31,45,67,.98));
    box-shadow: 0 0 0 3px rgba(244,212,124,.09), 0 0 20px rgba(244,212,124,.14), 0 9px 22px rgba(0,0,0,.22);
    transform: translateY(-1px);
}

.character-search::-webkit-search-cancel-button {
    cursor: pointer;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.character-search-empty {
    margin: 36px auto 0;
    padding: 28px 30px;
    max-width: 620px;
    text-align: center;
    color: #fff0ad;
    font-size: 18px;
    border: 1px solid rgba(244,212,124,.38);
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
}


/* =========================================
   DIRECTORY HEADING
========================================= */

.character-directory-heading {
    max-width: 780px;
    margin: 0 auto 50px;
    text-align: center;
}

.character-directory-heading h2 {
    margin: 0 0 14px;
    font-family: var(--title-font);
    font-size: clamp(34px, 5vw, 50px);
    color: var(--gold-light);
    text-shadow: 0 3px 12px rgba(0,0,0,.45);
}

.character-directory-heading p {
    max-width: 650px;
    margin: 0 auto;
    font-size: 19px;
    line-height: 1.6;
    color: rgba(255,255,255,.80);
}


/* =========================================
   DIRECTORY GRID
========================================= */

.character-directory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
}


/* =========================================
   DIRECTORY CARD
========================================= */

.character-directory-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    text-decoration: none;
    color: #3b2618;
    background: linear-gradient( 145deg, rgba(255,250,232,.97), rgba(234,213,166,.96) );
    border: 2px solid rgba(198,156,74,.82);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,.25);
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}

.character-directory-card:hover,
.character-directory-card:focus-visible {
    transform: translateY(-6px);
    border-color: var(--gold-light);
    box-shadow: 0 20px 40px rgba(0,0,0,.34);
}

.character-directory-card:focus-visible {
    outline: 3px solid var(--gold-light);
    outline-offset: 4px;
}

.character-directory-image-wrap {
    position: relative;
    overflow: hidden;
    background: #d7c18e;
}

.character-directory-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: center top;
    transition: transform .45s ease;
}

.character-directory-card:hover .character-directory-image,
.character-directory-card:focus-visible .character-directory-image {
    transform: scale(1.035);
}

.character-directory-image-wrap::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 55px;
    pointer-events: none;
    background: linear-gradient( transparent, rgba(236,217,174,.82) );
}

.character-directory-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 23px 22px 25px;
    text-align: center;
}

.character-directory-info h3 {
    margin: 0 0 11px;
    font-family: var(--title-font);
    font-size: clamp(24px, 2.4vw, 30px);
    line-height: 1.2;
    color: #56351a;
}

.character-directory-info p {
    margin: 0 0 22px;
    font-size: 16px;
    line-height: 1.55;
    color: #65513d;
}

.character-directory-read {
    margin-top: auto;
    font-family: var(--title-font);
    font-size: 12px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #936421;
}

.character-directory-error {
    grid-column: 1 / -1;
    padding: 40px;
    text-align: center;
    color: rgba(255,255,255,.8);
}

@media(max-width: 1000px) {
    .character-directory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }
}

@media(max-width: 650px) {
    .characters-hero {
        min-height: 300px;
        padding: 105px 18px 45px;
    }

    .characters-hero h1 {
        font-size: clamp(42px, 13vw, 60px);
    }

    .characters-hero p {
        font-size: 18px;
    }

    .character-directory-content {
        width: calc(100% - 30px);
        padding: 28px 0 70px;
    }

    .character-directory-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 32px;
    }

    .character-search-wrap {
        width: 100%;
    }

    .character-search {
        height: 48px;
        font-size: 16px;
    }

    .character-directory-heading {
        margin-bottom: 32px;
    }

    .character-directory-heading p {
        font-size: 17px;
    }

    .character-directory-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .character-directory-card {
        border-radius: 12px;
    }

    .character-directory-image {
        aspect-ratio: 4 / 4.6;
    }

    .character-directory-info {
        padding: 21px 20px 23px;
    }

    .character-directory-info p {
        font-size: 15px;
    }
}

@media(prefers-reduced-motion: reduce) {
    .character-page-particles span {
        animation: none;
    }

    .character-directory-card,
    .character-directory-image,
    .character-back-button,
    .character-search {
        transition: none;
    }
}
