@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Spectral:ital,wght@0,400;0,500;1,400&display=swap');

:root{
    --bg: #0c0e1c;
    --panel: #161a30;
    --panel2: #1d2340;
    --ink: #eceafb;
    --muted: #8d90b8;
    --star: #f4d58d;
    --glow: #b9a6f5;
    --line: rgba(236,234,251,0.15);

    /* changelog tag colors */
    --blue: #8fb8f0;
    --pink: #f0a8c4;
    --green: #8fe0c0;
    --purple: #c3ade8;
    --red: #f0a084;
}

*{
    box-sizing: border-box;
    font-family: 'Spectral', Georgia, serif;
    color: var(--ink);
}

html{
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce){
    html{ scroll-behavior: auto; }
}

body{
    background: var(--bg);
    margin: 0;
    min-height: 100vh;
    font-size: 16px;
    position: relative;
}

p{ line-height: 1.5em; }

/* ===== starfield background ===== */
body::before{
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20px 30px, rgba(236,234,251,0.55), transparent),
        radial-gradient(1px 1px at 90px 80px, rgba(236,234,251,0.35), transparent),
        radial-gradient(1.5px 1.5px at 150px 25px, rgba(236,234,251,0.45), transparent),
        radial-gradient(1px 1px at 205px 110px, rgba(236,234,251,0.3), transparent),
        radial-gradient(1.5px 1.5px at 60px 140px, rgba(244,213,141,0.4), transparent);
    background-repeat: repeat;
    background-size: 240px 220px;
    opacity: 0.6;
    pointer-events: none;
    z-index: 0;
}

@media (prefers-reduced-motion: no-preference){
    body::before{ animation: driftStars 120s linear infinite; }
}

@keyframes driftStars{
    from{ background-position: 0 0; }
    to{ background-position: -480px 440px; }
}

/* ===== links ===== */
a{
    color: var(--star);
    border-radius: .5em;
    text-shadow: none;
    font-weight: bold;
    transition: color 400ms ease-out, background-color 400ms ease-out, box-shadow 400ms ease-out;
}
a:visited{ color: var(--star); }
a:hover{ color: var(--glow); }

/* ===== top nav ===== */
nav{
    margin-top: 2em;
    font-weight: bold;
}
nav > ul{
    max-width: 960px;
    margin: auto;
    line-height: 3rem;
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    list-style-type: none;
    padding-left: 0;
    justify-content: space-evenly;
}
nav li{ text-align: center; }
nav li > a{
    background-color: var(--panel);
    color: var(--ink);
    padding: .5em 3em;
    text-decoration: none;
    text-shadow: none;
    box-shadow: var(--bg) 0 0 6px;
}
nav li > a:visited{ color: var(--ink); }
nav li > a:hover{
    background-color: var(--star);
    color: var(--bg);
    box-shadow: var(--panel) 0 0 6px;
}

/* ===== page layout ===== */
#content{
    display: flex;
    align-items: flex-start;
    gap: 32px;
    max-width: 1080px;
    margin: 40px auto 80px;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ===== sidebar ===== */
#sidebar{
    width: 260px;
    flex-shrink: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin: 0;
    padding: 28px 20px;
    text-align: center;
}

#avatar{
    width: 130px;
    height: 130px;
    max-width: 130px;
    max-height: 130px;
    margin: 0 auto 18px;
    border-radius: 50%;
}
#avatar img{
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    background: none;
    border: 2px solid var(--star);
    border-radius: 50%;
    box-shadow: 0 0 16px rgba(244, 213, 141, 0.35);
}

#bio{
    background: var(--panel2);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 0 0 20px;
}
#bio p{
    margin: 1em;
    color: var(--muted);
    font-style: italic;
    line-height: 1.6;
}

.button-container{
    text-align: center;
    margin: 0 0 10px;
}
.nav-button{
    display: block;
    width: 100%;
    padding: 9px 14px;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 20px;
    text-decoration: none;
    text-align: center;
    text-shadow: none;
    font-family: 'Fraunces', serif;
    font-size: 0.85rem;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.nav-button:visited{ color: var(--ink); }
.nav-button:hover{
    background: var(--glow);
    border-color: var(--glow);
    color: var(--bg);
}

/* ===== main content ===== */
main{
    flex: 1;
    min-width: 0;
}
main > p{
    font-size: 1rem;
    line-height: 1.5em;
    color: var(--ink);
}
main b{ color: var(--star); }
main small{
    display: block;
    margin: 18px 0 36px;
    color: var(--muted);
    font-style: italic;
    font-size: 0.85rem;
}

.page-title,
main > h2.character-name{
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 2.7rem);
    letter-spacing: 0.01em;
}
.page-title{
    margin: 0 0 14px;
}
main > h2.character-name{
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0 28px;
}

.section-title,
.realm-title,
main h3{
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Fraunces', serif;
    font-weight: 500;
    border-bottom: 1px solid var(--line);
}
.section-title::before,
.realm-title::before,
main h3::before{
    content: "✦";
    color: var(--star);
    font-size: 0.75em;
}
.section-title{
    font-size: clamp(1.3rem, 3.5vw, 1.7rem);
    margin: 48px 0 18px;
    padding: 0 0 8px;
}
.realm-title{
    font-size: clamp(1.4rem, 3.5vw, 1.9rem);
    margin: 52px 0 22px;
    padding: 0 0 10px;
}
main h3{
    font-size: clamp(1.2rem, 3.5vw, 1.5rem);
    margin: 40px 0 16px;
    padding: 0 0 8px;
}

summary{
    cursor: pointer;
    font-style: italic;
    color: var(--muted);
    transition: color 0.25s ease;
}
summary:hover{ color: var(--star); }

/* ===== changelog ===== */
.changelog{
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    overflow: hidden;
}
.changelog-body{
    max-height: 300px;
    overflow-y: auto;
    background: var(--panel);
}
.changelog-row{
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 0.92rem;
}
.changelog-row:last-child{ border-bottom: none; }
.changelog-date{
    font-family: 'Fraunces', serif;
    font-size: 0.78rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 3px 11px;
    color: var(--muted);
    flex-shrink: 0;
}
.changelog-names{ color: var(--ink); }
.changelog-names a{
    color: var(--star);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-shadow: none;
}
.changelog-names a:visited{ color: var(--star); }
.changelog-tag{
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    color: var(--bg);
    font-family: 'Fraunces', serif;
    white-space: nowrap;
}
.tag-blue   { background: var(--blue); }
.tag-pink   { background: var(--pink); }
.tag-green  { background: var(--green); }
.tag-purple { background: var(--purple); }
.tag-red    { background: var(--red); }

/* ===== footer ===== */
footer{
    text-align: center;
    font-size: small;
    margin: 1em auto 3em;
    max-width: 960px;
    color: var(--muted);
    text-shadow: none;
    position: relative;
    z-index: 1;
}

/* ===== mobile ===== */
@media only screen and (max-width: 800px){
    #content{ flex-direction: column; }
    #sidebar{ width: 100%; }
}