/* these are the main colors and header image
   replace them with anything you want! */
:root {
    --site-bg: url('images/Space-bg.png');
    --main-bg: url('images/nothing.png');
    --gradient-bg: linear-gradient(0deg, #0000 0%, #1c246288 33%, #18084388 90%);
    --accent-color: violet;
    --link-color: mediumpurple;
    --bg-color: black;
    --text-color: #D0DCEB;
    --text-color2:#D0CBEB;
    --favorite-color: darkslateblue;
    --box-bg: rgba(10, 10, 20, 0.85);
}
/* this theme mostly uses default css colors, but you can get hex codes from sites like this:
   https://palettes.shecodes.io/
   i just looked up "css color templates" to find that link! */

/* this applies to all the content */
* {
    color: var(--text-color);
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    text-shadow: 2px 2px 5px var(--bg-color);
/* custom scrollbars don't appear for all browsers, but i like setting them anyway */
    scrollbar-color: var(--favorite-color) var(--bg-color);
    scrollbar-width: thin;
}
/* this is for when you select text on the page */
::selection {
    background: var(--favorite-color);
    color: var(--bg-color);
}

html {scroll-behavior: smooth;}

body {
    margin: 0;
    background-color: var(--bg-color);
    
    /* Layer 1 (Top): CRT Scanlines */
    /* Layer 2 (Middle): Left-to-Right Shadow */
    /* Layer 3 (Bottom): Space Background */
    background-image: 
        repeating-linear-gradient(rgba(0, 0, 0, 0.20) 0px, rgba(0, 0, 0, 0.20) 2px, transparent 2px, transparent 4px),
        linear-gradient(to right, rgba(5, 5, 16, 0.95) 0%, rgba(5, 5, 16, 0.4) 100%), 
        var(--site-bg);
    
    background-size: cover;       
    background-position: center;  
    background-attachment: fixed; 
    background-repeat: no-repeat;
}
/* i think having better line spacing helps text to be more readable, but you can remove it if you want */
p {line-height: 1.5em;}

/* this is your site title displayed at the top of the page */
header > h1 {
    max-width: 960px;
    padding-left: 1em;
/* you can change the text-align to center or right if you want it placed differently */
    text-align: left;
    color: var(--text-color2);
}

/* Make header a flex row so the title and webring widget sit side by side */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    max-width: 960px;
    margin: 0 auto;
    padding-right: 1em;
    margin-bottom: 1em;

}

/* Small webring widget, sized to sit in the header */
.chatbots-webring-widget-small {
    display: flex;
    align-items: center;
    gap: 0.4em;
    flex-shrink: 0;
    max-width: 280px;
}

.chatbots-webring-widget-buttons-small1,
.chatbots-webring-widget-buttons-small2 {
    display: flex;
    align-items: center;
    gap: 0.3em;
}

.chatbots-webring-widget-small img {
    max-height: 40px;
    width: auto;
}

/* On narrow screens, let the widget drop below the title instead of squishing it */
@media only screen and (max-width: 500px) {
    header {
        justify-content: center;
        text-align: center;
    }
    header > h1 {
        padding-left: 0;
    }
}

nav {
    padding: 0 1em 1em 1em;
    font-weight: bold;
}

nav ul {
    max-width: 960px;
    margin: auto;
    line-height: 3rem;
/* this stuff makes it wrap around on mobile */
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
/* this line takes away the dot in front of the list items */
    list-style-type: none;
/* list items have default padding but we don't need it for these */
    padding-left: 0;
/* and this spaces out the buttons so they're not touching */
    justify-content: space-evenly;
}
nav li a {
    background-color: var(--bg-color);
    border: 1px solid var(--favorite-color);
    padding: .5em 3em;
/* this takes away the link underline */
    text-decoration: none;
/* and this part is animation! */
    transition: color 400ms ease-out, border-color 400ms ease-out;
}

nav li a:hover {
    border: 1px solid var(--accent-color);
}

/* Keep nav buttons a consistent color regardless of visited history */
nav li a, nav li a:visited {
    color: var(--link-color);
}

a {
    color: var(--link-color);
    transition: color 400ms ease-out;
}
a:visited {
    color: var(--favorite-color);
}
a:hover {
    color: var(--text-color2);
}

/* you can change this to lots of things. i picked a star! */
ul { list-style-type: "✦ "; }

#sidebar {
    background-image: var(--main-bg);
    border: 1px solid var(--favorite-color);
    min-width: 220px;
}

#avatar {
/* image size is 160px so i made its container a little bigger to fit the borders */
    margin: 1em auto;
    max-width: 164px;
    max-height: 164px;
}
#avatar img {
    background: var(--bg-color);
    max-width: 160px;
    border: 1px solid var(--favorite-color);
    box-shadow: var(--accent-color) 0 0 4px;
}

#bio {
    font-size: smaller;
    margin: 1em;
    background: var(--bg-color);
    border: 1px solid var(--favorite-color);
    box-shadow: var(--accent-color) 0 0 4px;
}
#bio p {
    margin: 1em;
    color: var(--text-color2);
}

#content {
    display: flex;
    max-width: 960px;
    margin: auto;
}

main {
    background-image: var(--main-bg);
    background-repeat: repeat;
    image-rendering: pixelated;
    max-width: 800px;
    margin: auto;
    border: 1px solid darkslateblue;
    color: var(--accent-color);
    max-height: 600px;
    overflow:auto;
}

.prose {
/* i couldn't put padding on main without it cutting off the background, so the padding is here... sorry if this extra class is a little inconvenient */
    background: var(--gradient-bg);
    margin: 0;
    padding: 1em;
}

/* box for listing resources at the end of a page */
.resource-box {
    background: var(--bg-color);
    border: 1px solid var(--favorite-color);
    box-shadow: var(--accent-color) 0 0 4px;
    margin: 1.5em 0;
    padding: 1em;
}
.resource-box h3 {
    margin-top: 0;
    color: var(--text-color2);
}
.resource-box ul {
    margin-bottom: 0;
}


/* made this a class so i can change it to be centered on mobile */
.img-right { float: right; }

/* ADD THIS NEW BLOCK: It forces the image to shrink down and fit nicely */
.img-right img {
    max-width: 250px; /* Adjust this number up or down if you want it bigger/smaller! */
    height: auto;
    margin-left: 15px; /* Adds a little breathing room between the text and the image */
}

footer {
    text-align: center;
    font-size: small;
    padding: 1em;
}

/* these are the mobile styles! */
@media only screen and (max-width: 800px) {
  nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5em;
        line-height: 1.4;
    }
    nav li a {
        display: block;
        box-sizing: border-box;
        text-align: center;
        padding: .6em 1em;
        font-size: clamp(0.75rem, 4vw, 1rem);
    }
    #content {
        flex-wrap: wrap;
    }
    #sidebar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        padding-top: 2em;
    }
    #avatar {margin: 0 1em;}
    #bio {width: 50%;}
    #sidebar ul {   
        margin: 0 1em;
        display: flex;
        flex-wrap: wrap;
        line-height: 2em;
        padding-left: 0;
    }
    #sidebar li {
        margin: .3em 1em;
    }
    main {
/* remove scrollbar for mobile */
        max-height: fit-content;
    }
    .img-right {
        float: none;
        text-align: center;
    }
}

/* This makes the active button look exactly like it's being hovered over */
nav li a.active {
    border: 1px solid var(--accent-color);
    box-shadow: 0px 0px 10px var(--accent-color);
    color: var(--text-color2); /* Optional: makes the text bright white so it pops */
}

.bookshelf-row {
    display: flex;
    gap: 1.5em;
    justify-content: center; /* Centers the cards nicely if a shelf isn't full */
    margin-top: 2em;
    margin-bottom: 4em; /* Adds vertical space between the wooden shelves */
    padding-bottom: 5px; 
    position: relative;  
}

/* This draws the physical 3D oak plank for EVERY row */
.bookshelf-row::after {
    content: "";
    position: absolute;
    bottom: -15px; 
    left: -2%;     
    width: 104%;   
    height: 25px;  
    z-index: 0;    
    
    background-color: #8B5A2B;
    background-image: repeating-linear-gradient(
        to right,
        #6b4226 0px,
        #8b5a2b 4px,
        #8b5a2b 12px,
        #6b4226 16px
    );
    
    border-top: 2px solid #b57a44;    
    border-bottom: 5px solid #4a2c17; 
    border-radius: 3px;
    box-shadow: 0px 10px 15px -3px rgba(0,0,0,0.9); 
}

.character-card {
    width: 160px;
    background-color: var(--box-bg);
    border: 1px solid var(--favorite-color);
    text-align: center;
    text-decoration: none;
    transition: transform 300ms ease-out, box-shadow 300ms ease-out, border-color 300ms;
    position: relative; /* Ensures the cards stay layered above the wooden shelf */
    z-index: 1; 
}

.character-card img {
    width: 95%;
    height: 160px;
    object-fit: cover;
    object-position: top; /* This shifts the "camera" up to their faces! */
    border-bottom: 1px solid var(--favorite-color);
}

.character-card h3 {
    margin: 0.5em 0;
    font-size: 1rem;
    color: var(--text-color2);
    text-shadow: 0px 0px 5px var(--accent-color);
}

.character-card p {
    font-size: 0.8rem;
    margin: 0 0.5em 0.5em 0.5em;
}

/* Hover effect: The card pops up and glows! */
.character-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0px 0px 15px 2px var(--accent-color);
}


.wiki-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2em;
    margin-top: 1em;
}

.wiki-sidebar {
    flex: 1;
    min-width: 200px;
    background-color: var(--box-bg);
    border: 1px solid var(--favorite-color);
    padding: 1em;
}

.wiki-sidebar img {
    width: 100%;
    height: auto;
    border: 1px solid var(--favorite-color);
    box-shadow: 0px 0px 8px var(--accent-color);
}

.wiki-stats {
    list-style-type: none;
    padding: 0;
    margin-top: 1em;
    font-size: 0.9rem;
}

.wiki-stats li {
    border-bottom: 1px dashed var(--favorite-color);
    padding: 0.5em 0;
}

.wiki-main {
    flex: 2;
    min-width: 300px;
}

/* =========================================
   FIXED GALLERY LAYOUT
   ========================================= */

/* Make the scrollable container expand to fill the available space */
.gallery-prose {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2em;
}

.concept-box {
    background-color: var(--box-bg);
    border: 1px solid var(--favorite-color);
    padding: 2em;
    margin-bottom: 2em;
    border-radius: 8px;
}

.concept-header {
    text-align: center;
    color: var(--accent-color);
    border-bottom: 2px dashed var(--favorite-color);
    padding-bottom: 1em;
    margin-top: 0;
    margin-bottom: 1.5em;
}

.gallery-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5em;
    align-items: start;   /* important: boxes won't stretch to match tallest neighbor */
}

figure.gallery-item {
    margin: 0;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--favorite-color);
    padding: 10px;
}

/* No fixed height, no aspect-ratio — the image just keeps its natural
   proportions, and the box wraps tightly around it */
figure.gallery-item img {
    width: 100%;
    max-height: 400px;   /* prevents an extreme-portrait image from towering too tall */
    object-fit: contain;
    background-color: #000;
    display: block;
}

figure.gallery-item figcaption {
    text-align: center;
    padding-top: 8px;
    font-size: 0.8rem;
    color: #B9E7FF;
    line-height: 1.3;
    font-style: italic;
}

.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border: 2px solid var(--favorite-color);
}

figure.gallery-item img {
    cursor: zoom-in;
}

/* =========================================
   EXPANDABLE GALLERY BOXES
   Each concept-box's gallery-row shows only its
   first 3 images. Rows with more than 3 get a
   chevron button (added by JS) that reveals the
   rest in full. Only one box can be expanded at
   a time (opening one closes any other that was
   open, handled in the JS below) so the page
   never has more than one fully-unrolled box's
   worth of extra height at once.
   ========================================= */

/* Collapsed state: hide every image past the 3rd */
.gallery-row.is-collapsible:not(.is-expanded) figure.gallery-item:nth-of-type(n + 4) {
    display: none;
}

@keyframes gallery-item-reveal {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.gallery-row.is-expanded figure.gallery-item:nth-of-type(n + 4) {
    animation: gallery-item-reveal 0.3s ease both;
}

.gallery-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    width: fit-content;
    margin: 1.4em auto 0;
    padding: 0.55em 1.3em;
    background-color: transparent;
    border: 1px solid var(--favorite-color);
    border-radius: 7px;
    color: var(--text-color2);
    font-size: 0.85rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    transition: border-color 250ms ease, box-shadow 250ms ease;
}

.gallery-toggle:hover,
.gallery-toggle:focus-visible {
    border-color: var(--accent-color);
    box-shadow: 0px 0px 10px var(--accent-color);
    outline: none;
}

.gallery-toggle .chevron-icon {
    flex-shrink: 0;
    transition: transform 250ms ease;
}

.gallery-toggle.is-open .chevron-icon {
    transform: rotate(180deg);
}

.back-to-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    width: fit-content;
    margin: 3em auto 0;
    color: var(--link-color);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 220ms ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    color: var(--accent-color);
    text-decoration: underline;
}

.back-to-top svg {
    flex-shrink: 0;
}