/* Header styles to match index page on vertical screens */
.site-header {
  transition: transform 180ms ease;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #d0cae7;
  border-radius: 0 0 2rem 2rem;
  padding: 1.5rem 0 2rem;
}
.site-header.site-header--hidden { transform: translateY(-100%); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.logo { color: #66b8e4; font-weight: bold; font-size: 2rem; text-decoration: none; letter-spacing: 2px; }
.nav-toggle { background: none; border: none; font-size: 2rem; color: #66b8e4; display: none; }
.nav-menu ul { list-style: none; display: flex; gap: 2rem; align-items: center; }
.nav-menu a { text-decoration: none; color: #1f2225; font-weight: 600; font-size: 1.25rem; border-radius: 1rem; padding: 0.5rem 1rem; transition: background 0.25s, color 0.25s; }
.nav-menu a:hover { color: #fff; background: #66b8e4; }
@media (max-width: 600px) {
  .nav-toggle { display: inline-block; }
  .nav-menu { position: relative; }
  .nav-menu ul { display: none; }
  .site-header { --header-height: 72px; }
  .nav-menu.nav-menu--open ul {
    display: flex; position: fixed; top: calc(var(--header-height) + 8px); left: 0; right: 0;
    flex-direction: column; gap: 0.5rem; background: rgba(255,255,255,0.95); backdrop-filter: blur(8px);
    border: 1px solid #d0cae7; border-radius: 1rem; padding: 0.75rem; box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    z-index: 1001; width: min(560px, 94vw); margin: 0 auto;
  }
  .nav-menu.nav-menu--open ul li a { display: block; padding: 0.6rem 0.8rem; border-radius: 0.8rem; font-size: 1.05rem; }
  .nav-menu.nav-menu--open ul li a:hover { background: #f5f1ff; color: #66b8e4; }
}

/* Match index header/dropdown behavior on tablets as well */
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .nav-menu { position: relative; }
  .nav-menu ul { display: none; }
  .site-header { --header-height: 72px; }
  .nav-menu.nav-menu--open ul {
    display: flex; position: fixed; top: calc(var(--header-height) + 8px); left: 0; right: 0;
    flex-direction: column; gap: 0.5rem; background: rgba(255,255,255,0.95); backdrop-filter: blur(8px);
    border: 1px solid #d0cae7; border-radius: 1rem; padding: 0.75rem; box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    z-index: 1001; width: min(560px, 94vw); margin: 0 auto;
  }
}
/* Responsive container & prevent horizontal overflow */
html { overflow-x: hidden; }
body { max-width: 100vw; overflow-x: hidden; }
.container { width: min(92%, 1100px); margin: 0 auto; max-width: 100%; }
@media (max-width: 900px) { .container { width: 94%; max-width: 100vw; } }
@media (max-width: 600px) { .container { width: 96%; max-width: 100vw; } }

/* Grid responsiveness */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
/* Hide site header when scrolling down */
.site-header.site-header--hidden {
  transform: translateY(-100%);
  transition: transform 180ms ease;
}
.site-header {
  transition: transform 180ms ease;
  position: sticky;
  top: 0;
  z-index: 1000;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Ubuntu web font loaded via Google Fonts in HTML */

:root {
  --color-bg: #f2f0f8;
  --color-bg-alt: #e9e6f3;
  --color-surface: #ffffff;
  --color-surface-alt: #f5f1ff;
  --color-text: #1f2225;
  --color-text-muted: #5f6670;
  --color-accent: #66b8e4;      /* darker primary blue */
  --color-accent-alt: #7fcfae;  /* darker secondary green */
  --color-accent-warm: #ffd569;
  --color-accent-cool: #66b8e4; /* align cool variant */
  --color-border: #d0cae7;      /* adjusted border */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.12);
  --grid-row-height: 18px; /* implicit row height used for masonry span calculations */
  --grid-gap: 48px; /* explicit grid gap in px for JS span calculations - more spacious preset */
}

body {
  font-family: 'Ubuntu', Arial, sans-serif;
  font-weight: bold;
  color: var(--color-text);
  background: linear-gradient(to bottom, var(--color-bg) 0%, var(--color-bg-alt) 50%, var(--color-bg) 100%);
  background-attachment: fixed;
  line-height: 1.6;
  letter-spacing: 1.5px;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(102, 184, 228, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(127, 207, 174, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(102, 184, 228, 0.03) 0%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: bold;
}

p {
  font-size: 1.25rem;
}

.container {
  width: min(90%, 1100px);
  margin: 0 auto;
}

.site-header {
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  border-radius: 0 0 2rem 2rem;
  padding: 1.5rem 0 2rem;
  margin-bottom: 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  color: var(--color-accent);
  font-weight: bold;
  font-size: 2rem;
  text-decoration: none;
  letter-spacing: 2px;
}
.nav-toggle {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-accent);
  display: none;
}
.nav-menu ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  align-items: center;
}
.nav-menu a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
  font-size: 1.25rem;
  transition: background 0.25s, color 0.25s;
  border-radius: 1rem;
  padding: 0.5rem 1rem;
}
.nav-menu a:hover {
  color: #fff;
  background: var(--color-accent);
}

h2 {
  color: var(--color-accent);
  margin-top: 3rem;
  margin-bottom: 2rem;
  text-align: center;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 2.5rem;
}

.gallery {
  margin-top: 0;
  padding: 0 0 4rem;
}

.gallery h2 {
  margin-top: 0;
  /* Move some bottom space above the title so it sits higher visually */
  padding: 1.75rem 0 0.75rem; /* more space above, less below */
  margin-bottom: 1.75rem;
  /* Larger heading for gallery page */
  font-size: 3rem;
  line-height: 1.05;
}

/* Increase overall text on the gallery page for readability */
.gallery {
  font-size: 1.15rem;
}
.gallery p {
  font-size: 1.45rem;
  line-height: 1.6;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--grid-gap);
  /* Reduce the gap between the title and the grid so content is closer to the header */
  margin-top: 0.75rem;
  /* Keep natural row order so JS sequencing controls adjacency */
  grid-auto-flow: row;
  /* Implicit row height used for span calculations in JS. Tweak --grid-row-height if small gaps appear. */
  grid-auto-rows: var(--grid-row-height, 12px);
}

.gallery-grid img,
.gallery-grid video {
  width: 100%;
  height: auto;
  display: block;
  /* Center media within their computed grid area vertically and horizontally when smaller than the cell */
  align-self: center;
  justify-self: center;
}

/* When items are wrapped by JS, the wrapper becomes the grid item. Style it for alignment and sizing. */
.gallery-grid .gallery-item {
  width: 100%;
  display: block;
  align-self: center;
  justify-self: center;
}

.gallery-grid .gallery-item img,
.gallery-grid .gallery-item video {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 1.5rem;
}

/* Justified rows layout styles */
.gallery-grid.justified {
  display: block; /* we'll populate with row containers */
}
.gallery-grid.justified .justified-row {
  display: flex;
  gap: var(--grid-gap);
  align-items: stretch;
  margin-bottom: calc(var(--grid-gap));
}
.gallery-grid.justified .justified-row img {
  display: block;
  height: auto; /* set via inline style from JS */
  width: auto;  /* set via inline style from JS */
  max-width: none;
  border-radius: 1.5rem;
}
.gallery-grid.justified .justified-row:last-child {
  margin-bottom: 0;
}

.gallery-grid .gallery-item[data-span="2"] {
  grid-column: span 2;
}

/* Place selected landscape items on the right while keeping them wide (2 cols) */
@media (min-width: 901px) {
  .gallery-grid .gallery-item.right-landscape[data-span="2"] {
    grid-column: -3 / -1; /* last two columns */
  }
  /* Mirror: place some landscape items on the left and keep them wide */
  .gallery-grid .gallery-item.left-landscape[data-span="2"] {
    grid-column: 1 / 3; /* first two columns */
  }
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--grid-gap);
  }
  .gallery-grid .gallery-item[data-span="2"] {
    grid-column: span 1;
  }
}

.gallery-grid img,
.gallery-grid video {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 1.5rem;
  box-shadow: 
    0 4px 16px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255,255,255,0.3);
  background: var(--color-surface);
  border: 2px solid rgba(255,255,255,0.5);
  margin-bottom: 0;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.gallery-grid img::before,
.gallery-grid video::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(102, 184, 228, 0.2) 0%, rgba(127, 207, 174, 0.2) 100%);
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 1.5rem;
  pointer-events: none;
}

.gallery-grid img:hover,
.gallery-grid video:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    0 12px 32px rgba(0,0,0,0.18),
    0 0 0 3px var(--color-accent),
    inset 0 1px 0 rgba(255,255,255,0.5);
  border-color: var(--color-accent);
  z-index: 10;
}

.gallery-grid video {
  background: var(--color-bg-alt);
  border: 3px solid transparent;
  background: linear-gradient(var(--color-bg-alt), var(--color-bg-alt)) padding-box,
              linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-alt) 100%) border-box;
}

.site-footer {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  border-radius: 2rem 2rem 0 0;
}
.site-footer a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer a:hover {
  color: var(--color-accent-alt);
}
.flex-between {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.social a {
  margin-right: 1rem;
  font-weight: bold;
  letter-spacing: 1px;
  font-size: 1.2rem;
  display: inline-block;
}
.social a img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  vertical-align: middle;
}
@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--grid-gap);
  }
  .gallery-grid img,
  .gallery-grid video {
    height: auto;
  }
}

@media (max-width: 600px) {
  /* tighter gaps and single-column flow on phones */
  :root { --grid-gap: 24px; }
  body { font-size: 14px; letter-spacing: 0.5px; }
  .container { width: 95%; }
  .logo { font-size: 1.6rem; }
  .nav-toggle { display: inline-block; }
  /* Define a mobile header height for positioning the dropdown just below */
  .site-header { --header-height: 72px; }
  /* Mobile nav: hidden by default */
  .nav-menu { position: relative; }
  .nav-menu ul { display: none; }
  /* When open, show a styled dropdown */
  .nav-menu.nav-menu--open ul {
    display: flex;
    position: fixed; /* detach from header box and place under it */
    top: calc(var(--header-height) + 8px);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    width: min(560px, 94vw);
    margin: 0 auto; /* center under header */
  }
  .nav-menu.nav-menu--open ul li a {
    display: block;
    padding: 0.6rem 0.8rem;
    border-radius: 0.8rem;
    font-size: 1.05rem;
    color: var(--color-text);
    background: transparent;
  }
  .nav-menu.nav-menu--open ul li a:hover {
    background: var(--color-surface-alt);
    color: var(--color-accent);
  }
  .gallery h2 { font-size: 2rem; }
  .gallery-grid { grid-template-columns: 1fr; gap: 1.25rem; max-width: 85%; margin-left: auto; margin-right: auto; }
  .gallery-grid img, .gallery-grid video { border-radius: 1rem; }
  .gallery-grid.justified .justified-row { gap: 1rem; }
}

@media (max-width: 1200px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .gallery h2 { font-size: 2.5rem; }
}

/* CSS-only masonry fallback for grids that do NOT opt into JS layouts
   This keeps images flowing in-place as they load (no absolute positioning)
   Use `data-layout` attribute to opt into JS-driven justified/masonry. */
.gallery-grid:not([data-layout]) {
  display: block;
  column-gap: var(--grid-gap);
}
.gallery-grid:not([data-layout]) .gallery-item,
.gallery-grid:not([data-layout]) img,
.gallery-grid:not([data-layout]) video {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin-bottom: calc(var(--grid-gap) / 2);
  display: inline-block;
  width: 100%;
}
/* Responsive column counts */
@media (min-width: 1200px) {
  .gallery-grid:not([data-layout]) { column-count: 3; }
}
@media (min-width: 800px) and (max-width: 1199px) {
  .gallery-grid:not([data-layout]) { column-count: 2; }
}
@media (max-width: 799px) {
  .gallery-grid:not([data-layout]) { column-count: 1; }
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none; /* toggled via .is-open */
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lightbox-overlay.is-open {
  display: flex;
}

.lightbox-content {
  max-width: 92vw;
  max-height: 90vh;
  position: relative;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 1rem;
  box-shadow: 0 8px 48px rgba(127,216,255,0.35);
}


/* Pin controls to viewport positions aligned with a centered 92vw/90vh image */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-surface-alt);
  color: var(--color-text);
  border: 2px solid var(--color-accent-alt);
  border-radius: 999px;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  z-index: 1001;
  font-size: 2rem;
  box-shadow: var(--shadow-sm);
}

.lightbox-close {
  top: calc(5vh + 0.5rem); /* near top edge of a 90vh-tall centered image */
  right: calc(4vw - 32px); /* align with 92vw container right edge */
  transform: none;
}

.lightbox-prev {
  left: calc(4vw - 32px); /* center of button aligns with image left edge */
}

.lightbox-next {
  right: calc(4vw - 32px); /* center of button aligns with image right edge */
}

@media (max-width: 900px) {
  .lightbox-prev,
  .lightbox-next {
    width: 56px;
    height: 56px;
    font-size: 1.8rem;
  }
  /* On small screens, keep controls near the viewport edges for safety */
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
  .lightbox-close { top: 0.5rem; right: 0.5rem; }
}