/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Apply retro styles */
html {
    overscroll-behavior: none; /* Prevent overscroll bounce on the html element */
}

body {
  margin: 0;
  font-family: "Press Start 2P", "Courier New", Courier, monospace;
  font-style: normal;
  background-color: #000000; /* Fallback color */
  background-image: url("img/BG_desktop.jpg"); /* Default background for desktop */
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed; /* Keeps the background fixed during scroll on desktop */
  color: #FFFFFF;
  line-height: 1.6;
  min-height: 100vh;
  overscroll-behavior: none;
  font-smooth: never;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: 90px; /* Account for fixed footer height */
  position: relative; /* Needed for z-index stacking of the gradient overlay */
}

/* --- START: White Gradient Overlay Style --- */
#top-gradient-overlay {
    position: fixed; /* Fixed position to stay at the top */
    top: 0;
    left: 0;
    width: 100%;
    height: 500px; /* Adjust this height as needed. This is how far the gradient extends. */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 100%);
    z-index: 0; /* Sits above body background but below other content (which should have z-index >= 1 or be in a higher stacking context) */
    pointer-events: none; /* Allows clicks to pass through to elements underneath */
}
/* --- END: White Gradient Overlay Style --- */


/* --- START: Small Pre-Header Logo Styles (Updated) --- */
#pre-header-logo-container {
    text-align: center;
    padding: 25px 0 5px 0; /* More top padding, less bottom padding */
    position: relative; /* Ensure it's above the gradient overlay */
    z-index: 1;         /* Ensure it's above the gradient overlay */
}

#small-pre-logo {
    max-height: 30px; /* Made smaller by half (was 60px) */
    width: auto;
    max-width: 100%;
    display: inline-block;
}
/* --- END: Small Pre-Header Logo Styles --- */


/* Basic Layout Elements */
header, main {
    max-width: 960px;
    margin: 20px auto;
    padding: 1rem 1.5rem;
    position: relative; /* Already relative */
    z-index: 1;         /* Already z-index 1 */
}

main {
    margin: 5px auto 20px auto;
}

header {
    padding: 1rem 0;
    margin-bottom: 0.5rem;
    border-bottom: none;
    width: 100%;
    /* The margin-top on header (from "header, main" rule) will create space below pre-header-logo-container's bottom padding */
}

#header-logo {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 80%;
    max-width: 850px;
    height: auto;
    transition: transform 0.3s ease-in-out;
}

@keyframes bobbing {
    0% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

#header-logo:hover {
    animation: bobbing 0.5s ease-in-out infinite;
}

h1, h2, h3 {
    color: #000000;
    margin-bottom: 1em;
    text-align: center;
    font-weight: normal;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2rem;
    margin-top: 0.25em;
}

h3 {
    font-size: 1.5rem;
    margin-top: 0.5em;
    margin-bottom: 2em;
}

section {
    margin-bottom: 1.5rem;
    padding: 1rem;
}

a {
  color: #0000FF;
  text-decoration: underline;
}

a:visited {
  color: #800080;
}

a:hover {
  text-decoration: none;
}

.download-galleries {
  max-width: 960px;
  margin: 0px auto 30px auto;
  padding: 10px 0;
  text-align: center;
  border-radius: 8px;
}

.gallery-container {
  margin-bottom: 50px;
  border: none;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  justify-items: center;
  margin-top: 15px;
}

.gallery-item {
  padding: 0;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s ease-out;
}

.gallery-item:hover {
    transform: scale(1.03);
}

.window-frame {
    background-color: #C0C0C0;
    border-top: 2px solid #FFFFFF;
    border-left: 2px solid #FFFFFF;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    box-shadow: 2px 2px 0px #808080;
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.title-bar {
    background: linear-gradient(to right, #000080, #1084d0);
    color: white;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 28px;
    border-bottom: 1px solid #000000;
}

.title-text {
    font-family: "Pixelated MS Sans Serif", "Tahoma", "Arial", sans-serif;
    font-style: normal;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.window-controls {
    display: flex;
    align-items: center;
}

.window-button {
    width: 18px;
    height: 18px;
    background-color: #C0C0C0;
    border-top: 1px solid #FFFFFF;
    border-left: 1px solid #FFFFFF;
    border-right: 1px solid #000000;
    border-bottom: 1px solid #000000;
    margin-left: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    color: #000000;
    cursor: default;
    padding: 2px;
    transition: background-color 0.1s linear;
}

.window-button:active {
    background-color: #A0A0A0;
    border-top: 1px solid #000000;
    border-left: 1px solid #000000;
    border-right: 1px solid #FFFFFF;
    border-bottom: 1px solid #FFFFFF;
}

.window-button.minimize::before {
    content: '';
    display: block;
    width: 10px;
    height: 2px;
    background-color: #000000;
    border-bottom: 1px solid #000000;
}

.window-button.maximize::before {
    content: '';
    display: block;
    width: 9px;
    height: 9px;
    border: 1px solid #000000;
    border-top: 2px solid #000000;
}

.window-button.close::before {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10"><line x1="1" y1="1" x2="9" y2="9" stroke="%23000000" stroke-width="1.5"/><line x1="9" y1="1" x2="1" y2="9" stroke="%23000000" stroke-width="1.5"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.window-content {
    padding: 10px;
    background-color: #FFFFFF;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item .window-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border: 1px solid #808080;
}

#mobile-gallery .gallery-item .window-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}


.download-button {
  display: inline-block;
  padding: 5px 10px;
  color: #0000FF;
  font-family: "Press Start 2P", "Courier New", Courier, monospace !important;
  font-style: normal !important;
  text-decoration: underline;
  border-radius: 0;
  border: none;
  font-size: 1.2rem;
  text-transform: none;
  margin-top: 0;
  transition: color 0.2s, transform 0.1s ease-in-out;
}

@keyframes jiggle {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-1px); }
    50% { transform: translateX(1px); }
    75% { transform: translateX(-1px); }
}

.download-button:hover {
  text-decoration: none;
  color: #FFFF00 !important;
  animation: jiggle 0.2s linear 2;
}

footer {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.5rem 1.5rem;
    color: #000000;
    border-top: none;
    background-color: rgba(255, 255, 255, 0.85);
    z-index: 1000;
}

#footer-logo {
    max-height: 90px;
    width: auto;
    display: block;
}

.footer-copyright {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.footer-copyright p {
    font-size: 0.6rem;
    color: #000000;
    margin: 0;
}

#loader {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #0000FF;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #FFFFFF;
    text-align: center;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #000000;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loader p {
    font-size: 1.5rem;
    color: #FFFFFF;
}

body.loading #top-gradient-overlay, /* Also hide gradient during loading */
body.loading header,
body.loading main,
body.loading footer,
body.loading #pre-header-logo-container {
    display: none;
}

/* --- Media Queries --- */

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
    body {
        background-image: url("img/BG_mobile.jpg");
        background-attachment: scroll;
        background-size: 100% auto;
        background-position: top center;
        background-repeat: repeat-y;
    }

    #top-gradient-overlay {
        height: 350px; /* Shorter gradient for mobile */
    }

    #header-logo {
        width: 85%;
        max-width: 480px;
    }

     .gallery-item { max-width: 320px; }

    #mobile-gallery .gallery-item {
        max-width: 80%;
    }
    #mobile-gallery .gallery-item .window-content {
        height: 400px;
    }

     .title-bar { height: 24px; padding: 3px 6px; }
     .title-text { font-size: 12px; }
     .window-button { width: 16px; height: 16px; font-size: 10px; padding: 1px; }
     .window-button.minimize::before { width: 8px; height: 1px; }
     .window-button.maximize::before { width: 7px; height: 7px; }
     .window-button.close::before { width: 8px; height: 8px; }
     .window-content { padding: 8px; }


     h1 { font-size: 1.9rem; }
     h2 { font-size: 1.8rem; }
     h3 { font-size: 1.3rem; }
     .download-button { font-size: 1rem; }

     footer {
        padding: 0.75rem 1rem;
     }
     #footer-logo {
        max-height: 55px;
     }
     .footer-copyright p {
        font-size: 0.5rem;
     }
     .footer-copyright {
        right: 1rem;
     }
}

@media (max-width: 480px) {
    #header-logo {
        width: 90%;
    }

    #top-gradient-overlay {
        height: 250px; /* Even shorter gradient for small mobile */
    }

    #small-pre-logo {
        max-height: 25px; /* Slightly smaller pre-logo for small screens */
    }
    #pre-header-logo-container {
        padding: 15px 0 3px 0; /* Adjusted padding for smaller screens */
    }


    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.1rem; }

     .gallery-item { max-width: 90%; }

    #mobile-gallery .gallery-item {
        max-width: 85%;
    }
    #mobile-gallery .gallery-item .window-content {
        height: 380px;
    }

    .download-button { font-size: 0.9rem; }

    footer {
        padding: 0.6rem 0.75rem;
    }
    #footer-logo {
        max-height: 50px;
    }
    .footer-copyright p {
        font-size: 0.45rem;
    }
    .footer-copyright {
        right: 0.75rem;
    }
}

/* --- Glitch Icon Styles --- */
.glitch-icon {
    position: absolute;
    height: auto;
    pointer-events: none;
    opacity: 0;
    z-index: 1001;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}
