/* =========================================================
   characters.css — Arkyos character page
   Restyled to match style.css: same pill shapes, pastel
   rainbow gradient, BadComic font, pink glow, float/rainbow
   keyframes, and the custom cursor used everywhere else on
   the site. Your HTML and characters.js are untouched.
   ========================================================= */

/* ---------------- PAGE-ONLY LAYOUT OVERRIDE ---------------- */
/* characters.css is only linked from this page, so redeclaring
   these here (rather than in style.css) makes the wider body /
   narrower sidebar apply ONLY to the characters page — every
   other page keeps style.css's original 200px sidebar / 1000px
   layout untouched. */

:root{
    --sidebar-width: 150px;
}

.layout{
    width: 1200px;
}

@media (max-width: 800px){
    .layout{
        width: 100%;
    }
}

.character-page{
    max-width: 1350px;
    margin: 0 auto;
    padding: 1rem 1rem 4rem;
}

/* ---------------- TABS ---------------- */
/* styled like your .menu-links / .chapter-title pills */

.tabs-bar{
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 2.5rem;
}

.character-tabs{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

/* ---------------- SECRET HEART ---------------- */
/* one heart beside the tabs is actually a link to a hidden
   image — this keeps it indistinguishable from its plain
   siblings by overriding the site-wide link/hover styling
   (rainbow text-fill, underline, hop) that would otherwise
   give it away. Only this specific link is affected. */

.secret-heart-link,
.secret-heart-link:visited{
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

.secret-heart-link:hover,
.secret-heart-link:focus{
    text-decoration: none;
    color: inherit;
    background: none;
    -webkit-text-fill-color: currentColor;
    animation: none;
    transform: none;
    font-weight: normal;
}

.secret-heart-link span{
    animation-delay: .15s;
}

.tab{
    font-family: var(--heading-font);
    font-size: 1rem;
    background: rgba(255,255,255,.85);
    color: var(--link-color);
    border: 2px solid #ffd6eb;
    border-radius: 999px;
    padding: 8px 22px;
    cursor: url('https://file.garden/aTr8t_0tyznNb_DW/cursor(1).cur'), pointer;
    box-shadow: 0 0 12px rgba(255,182,219,.3);
    transition: all .2s ease;
}

.tab:hover{
    transform: translateY(-3px);
    box-shadow: 0 0 18px rgba(255,182,219,.5);
}

.tab:focus-visible{
    outline: 3px solid var(--link-color);
    outline-offset: 3px;
}

.tab.active{
    color: #ff2d75;
    background: linear-gradient(
        90deg,
        #f3d7ef, #ffd8d8, #fee8c9, #fffdd9, #dff1cb, #d6e7fc
    );
    background-size: 300% 100%;
    animation: char-rainbow-shift 8s linear infinite;
    box-shadow:
        0 0 10px rgba(255,255,255,.7),
        0 0 15px rgba(227,139,218,.3);
}

@keyframes char-rainbow-shift{
    from{ background-position: 0% 50%; }
    to{ background-position: 300% 50%; }
}

/* ---------------- LAYOUT ---------------- */

.character-layout{
    display: flex;
    align-items: flex-start;
    gap: 50px;
}

.character-list{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 24px;
    width: 100%;
}

.character-viewer{
    display: none;
    flex: 1;
    min-width: 0;
}

/* once a card is picked, the list "makes way": it collapses into a
   vertical sidebar and the profile appears in the freed space */
.character-layout.has-selection .character-list{
    flex-direction: column;
    flex-wrap: nowrap;
    width: 420px;
}

.character-layout.has-selection .character-viewer{
    display: block;
}

/* ---------------- CARDS ---------------- */

.character-card{
    position: relative;
    width: 240px;
    background: transparent;
    border: none;
    border-radius: 24px;
    padding: 12px;
    cursor: url('https://file.garden/aTr8t_0tyznNb_DW/cursor(1).cur'), pointer;
    transition: .25s;
    box-shadow: none;
    animation: card-sway 2.6s ease-in-out infinite;
}

.character-card:nth-child(2n){
    animation-delay: -1.1s;
}

.character-card:nth-child(3n){
    animation-delay: -.5s;
}

.character-card:hover{
    animation-play-state: paused;
}

.character-card.active{
    animation: none;
}

@keyframes card-sway{
    0%, 100%{ transform: translate(0, 0) rotate(-2deg); }
    50%{ transform: translate(5px, -4px) rotate(2deg); }
}

.character-layout.has-selection .character-list .character-card{
    width: 100%;
}

.character-card:hover{
    transform: translateY(-8px) rotate(-2deg) scale(1.04);
    filter:
        drop-shadow(0 0 15px rgba(255,255,255,.8))
        drop-shadow(0 0 25px rgba(227,139,218,.35));
}

.character-card:focus-visible{
    outline: 3px solid var(--link-color);
    outline-offset: 3px;
}

/* selected card stays marked once you stop hovering */
.character-card.active{
    box-shadow:
        0 0 0 3px #ff9ad1,
        0 0 18px rgba(227,139,218,.4);
}

.character-card img{
    width: 100%;
    display: block;
    border-radius: 16px;
}

.character-card span{
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translate(-50%, 8px);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    background: rgba(255,255,255,.95);
    color: var(--link-color);
    font-family: var(--heading-font);
    font-size: .95rem;
    padding: 6px 20px;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    transition: opacity .2s ease, transform .2s ease;
    z-index: 2;
}

/* shown on hover/keyboard-focus, and pinned for whichever card is selected
   (so tap-only devices, which have no hover, still see the chosen name) */
.character-card:hover span,
.character-card:focus-visible span,
.character-card.active span{
    opacity: 1;
    transform: translate(-50%, 0);
}

/* not-yet-revealed characters — softly fogged, gently floating */
.character-card.secret{
    animation: float 4s ease-in-out infinite;
}

.character-card.secret img{
    filter: grayscale(.6) brightness(.8) sepia(.15);
}

.character-card.secret span{
    color: #c98fb0;
    letter-spacing: .12em;
}

.character-card.secret:hover{
    filter: drop-shadow(0 0 10px rgba(227,139,218,.3));
}

/* ---------------- PROFILE ---------------- */
/* styled like your .about-box: soft white panel with corner glow */

.character-profile{
    display: none;
    gap: 40px;
    align-items: flex-start;
}

.character-profile.active{
    display: flex;
    gap: 45px;
    position: relative;
    background: transparent;
    padding: 10px 0;
    overflow: visible;
    animation: profile-in .45s cubic-bezier(.22,1,.36,1);
}

@keyframes profile-in{
    0%{
        opacity: 0;
        transform: translateX(60px) scale(.92) rotate(-2deg);
    }
    60%{
        opacity: 1;
        transform: translateX(-10px) scale(1.015) rotate(.5deg);
    }
    100%{
        opacity: 1;
        transform: translateX(0) scale(1) rotate(0deg);
    }
}

.profile-image,
.profile-info{
    position: relative;
    z-index: 1;
}

.profile-image{
    flex: 1;
    max-width: 1200px;
}

.profile-image img{
    width: 100%;
    max-width: none;
    display: block;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.profile-info{
    display: none;
}

/* ---------------- EXTRA ART LINK (beside tabs) ---------------- */

.extra-art-link{
    align-self: center;
    text-decoration: none;
    font-family: var(--heading-font);
    font-size: 1rem;
    background: rgba(255,255,255,.9);
    color: var(--link-color);
    border: 2px solid #ffd6eb;
    border-radius: 999px;
    padding: 8px 22px;
    cursor: url('https://file.garden/aTr8t_0tyznNb_DW/cursor(1).cur'), pointer;
    box-shadow: 0 0 12px rgba(255,182,219,.3);
    transition: transform .2s ease, box-shadow .2s ease;
    animation:
        extra-art-glow 2.4s ease-in-out infinite,
        extra-art-shake 4s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes extra-art-glow{
    0%, 100%{ box-shadow: 0 0 10px rgba(255,182,219,.3); }
    50%{ box-shadow: 0 0 22px rgba(255,182,219,.65); }
}

@keyframes extra-art-shake{
    0%, 88%, 100%{ transform: translateX(0) rotate(0deg); }
    90%{ transform: translateX(-4px) rotate(-2deg); }
    92%{ transform: translateX(4px) rotate(2deg); }
    94%{ transform: translateX(-3px) rotate(-1deg); }
    96%{ transform: translateX(3px) rotate(1deg); }
    98%{ transform: translateX(0) rotate(0deg); }
}

.extra-art-link:hover{
    animation-play-state: paused;
    transform: translateY(-3px);
    box-shadow: 0 0 18px rgba(255,182,219,.5);
    color: var(--link-color);
}

.extra-art-link:focus-visible{
    outline: 3px solid var(--link-color);
    outline-offset: 3px;
}

/* ---------------- SECTIONS / TABS SWITCHING ---------------- */

.character-section{
    display: none;
}

.character-section.active{
    display: block;
}

.character-section h2{
    margin-top: 0;
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 800px){
    .character-layout{
        flex-direction: column;
    }

    .character-list{
        flex-direction: row;
        width: auto;
        overflow-x: auto;
        padding-bottom: 6px;
    }

    .character-layout.has-selection .character-list{
        flex-direction: row;
        flex-wrap: nowrap;
        width: auto;
        overflow-x: auto;
    }

    .character-layout.has-selection .character-list .character-card{
        width: 260px;
    }

    .character-card{
        width: 260px;
        flex: 0 0 auto;
        padding: 0;
        background: none;
        box-shadow: none;
    }

    .character-card img{
        display: block;
        width: 260px;
        height: auto;
        border-radius: 20px;
    }

    .character-profile.active{
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
        padding: 20px;
    }

    .profile-image{
        display: flex;
        justify-content: center;
        width: 100%;
        max-width: 440px;
    }

    .profile-image img{
        width: 100%;
        height: auto;
    }

    .profile-info h1{
        font-size: 1.9rem;
    }

    .profile-info p{
        font-size: 1.05rem;
    }
}

@media (prefers-reduced-motion: reduce){
    .character-card, .tab, .character-profile, .character-card.secret, .extra-art-link{
        transition: none;
        animation: none;
    }
}