/* General styles */

:root {
  --white: #fff;
  --grey: grey;
  --paragraph-text-color: #bbb;
  --pale-blue: #ADD8E6;
  --black: #111111;
}

a:not(header nav a) {
  color: var(--pale-blue); /* Pale blue */
}

body {
  font-family: Helvetica, sans-serif;
  padding: 0;
  background-color: var(--black);
  color: var(--paragraph-text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0 min(max(calc(5rem * ((100vw - 600px) / (1200 - 600))), 0rem), 5rem);
}

footer {
  margin-top: auto;
  margin: 40px 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0;
    font-family: 'Oswald', sans-serif;
}

.header__nav {
    width: 37%;
    text-align: left;
    align-items: center;
}

@media (min-width: 769px) {
    .header__nav {
        display: flex;
    }
}

.header__title {
    width: 26%;
    text-align: center;
    display: flex;
    flex-direction: column; /* Stack title and tagline vertically */
    align-items: center;
    justify-content: center;
}

.header__title h1 {
    margin: 0;
    padding: 0;
}

.header__tagline {
    font-size: 0.8em; /* Smaller than the main title */
    color: var(--grey); /* Grey text */
    margin-top: 5px; /* Space below the main title */
    display: block; /* Ensure it takes its own line if needed */
    text-transform: uppercase; /* Match h1 style */
    font-weight: 400; /* Match h1 style */
}

.header__title-link {
    text-decoration: none;
    color: inherit; /* Inherit color from parent h1 */
}

.header__empty {
    width: 37%;
}

h1, h2 {
    font-family: 'Oswald', sans-serif;
    color: var(--white);
    font-weight: 400;
    text-transform: uppercase;
    padding-top: 0rem;
}

h2 {
  font-size: 1.2em;
  padding-top: 1rem;
}

header nav a {
    color: #aaa;
    text-decoration: none;
    margin: 0 10px;
}

header nav a:hover {
    color: var(--white);
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: center;
        margin-bottom: 0;
    }

    .header__nav {
        width: 100%;
        order: 1; /* Ensure nav appears after title if header is column-flex */
    }

    #mobile-nav {
        /* display: none; */ /* Changed to flex to make it visible */
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding-top: 20px; /* Add some space above the nav items */
    }

    #album-viewer {
        --gallery-spacing: 4px; /* Mobile: results in 2px padding on items, 4px between rows */
    }

    .header__empty {
        display: none;
    }

    .header__title {
        width: auto;
        text-align: center;
        order: 0; /* Ensure title appears before nav if header is column-flex */
    }

    #mobile-nav a {
        display: block;
        margin: 5px 0; /* Reduced from 10px 0 for 50% more compact vertical spacing */
        text-align: center;
    }
}

.grid-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: 100%; /* Ensure the grid spans the entire page width */
}

.grid__item-container {
  /* padding: 5px; */ /* Replaced by CSS variable */
  padding: calc(var(--gallery-spacing, 10px) / 2); /* Default to 10px gap if variable not set */
  box-sizing: border-box;
}

.grid__item-container:hover {
    cursor: pointer;
}

.grid__item-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

#album-viewer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  --gallery-spacing: 10px; /* Default: results in 5px padding on items, 10px between rows */
}

#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.90);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none; /* Initially hide the lightbox */
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes wiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); } /* More pronounced */
  75% { transform: translateX(10px); }  /* More pronounced */
}

.lightbox-image-wiggle {
  animation: wiggle 0.5s ease-in-out;
  animation-delay: 0.5s; /* Added delay */
}

.lightbox-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: transparent;
}

#lightbox img,
.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    position: absolute;
    object-fit: contain;
}

.lightbox-next-image,
.lightbox-prev-image {
    opacity: 0;
    pointer-events: none;
}

.lightbox-next-image {
    transform: translateX(100vw);
}

.lightbox-prev-image {
    transform: translateX(-100vw);
}

#lightbox .close-button,
#lightbox .nav-button {
    position: absolute;
    color: var(--white);
    font-size: 36px;
    cursor: pointer;
    pointer-events: auto;
    background-color: rgba(128, 128, 128, 0.5);
    border-radius: 50%;
    padding: 3px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001; /* Ensure buttons are above the image */
}

#lightbox .close-button {
    top: 18px;
    right: 20px;
    transform: none; /* Override translateY for close button */
}

#lightbox .left-button {
    left: 20px;
}

#lightbox .right-button {
    right: 20px;
}

.grid__row {
  display: flex;
  width: 100%;
}

.top-links {
  position: absolute;
  top: 10px;
  left: 10px;
}

.top-links a {
  color: var(--white);
  text-decoration: none;
  margin-right: 10px;
}

article {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.sub-title {
    font-size: 1.2em;
    margin-top: 20px;
}

.main-text {
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 10px;
}

footer .copyright {
  text-align: center;
  color: var(--grey);
}

/* Fallback for No-JS Gallery */
/* Styles for the main container when JS is disabled */
#image-gallery-container { /* Simplified selector */
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start; /* Aligns images to the start */
  /* Container padding can be adjusted if needed, e.g., to remove side padding if items handle it all */
  padding: 1rem 0; /* Current padding, review if 4px on items is enough */
}

/* Styles for individual images when JS is disabled */
#image-gallery-container > .gallery-image-source {
  flex-grow: 1; /* Allow images to grow to fill space */
  flex-shrink: 1; /* Allow images to shrink if needed */
  flex-basis: 33.333%; /* Default: 3 images per row */
  max-width: 33.333%;   /* Default: 3 images per row */
  height: auto; /* Maintain aspect ratio */
  object-fit: cover;
  display: block;
  box-sizing: border-box;
  padding: 4px; /* Creates 8px gap between items (4px on each side) */
  /* background-color: #222; */ /* Removed to prevent grey outline effect with padding */
}

/* Responsive adjustments for the No-JS fallback */
@media (max-width: 900px) { /* 2 images per row */
  #image-gallery-container > .gallery-image-source {
    flex-basis: 50%;
    max-width: 50%;
  }
}

@media (max-width: 600px) { /* 1 image per row */
  #image-gallery-container > .gallery-image-source {
    flex-basis: 100%;
    max-width: 100%;
    /* Padding still applies, giving a 4px space around the full-width image */
  }
}

/* Hide lightbox navigation buttons on narrow screens in portrait orientation */
@media (max-width: 600px) and (orientation: portrait) {
    #lightbox .left-button,
    #lightbox .right-button {
        display: none;
    }
}

/* Styles for private gallery image overlay */
.image-container {
    position: relative;
    display: inline-block; /* Or 'block', depending on layout */
}

.filename-label {
  font-family: 'Oswald', sans-serif;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  position: absolute;
  padding: 0.25rem;
  pointer-events: auto;
  user-select: all;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.filename-overlay {
  top: 0.5rem;
  left: 0.5rem;
  font-size: 12px;
  max-width: calc(100% - 1rem);
}

#lightbox-filename {
  position: absolute;
  font-size: 12px;
  z-index: 1001;
  font-family: 'Oswald', sans-serif;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 0.25rem;
  pointer-events: auto;
  user-select: all;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

/* Button Styles */
button,
input[type="submit"],
input[type="button"] {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    font-size: 1em;
    color: var(--black);
    background-color: var(--pale-blue);
    border: 1px solid var(--pale-blue);
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    background-color: var(--white);
    border-color: var(--white);
    color: var(--black);
}

/* Form Styles */
#album-name-form {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

#album-name-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--grey);
    background-color: var(--black);
    color: var(--white);
    font-family: Helvetica, sans-serif;
    font-size: 1em;
}

#album-name-form button {
    flex-shrink: 0; /* Prevent button from shrinking */
}

/* Pricing Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    color: var(--paragraph-text-color);
}

table td, table th {
    border: 1px solid var(--grey);
    padding: 10px;
    text-align: left;
}

table th {
    background-color: #333;
    color: var(--white);
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    font-weight: 400;
}

table tr:nth-child(even) {
    background-color: #222;
}
