/* ==========================================================================
   TerraCognita Global Styles & Architectural Design Theme
   Inspired by design_inspiration.png (Right-angle corners & deep drop shadows)
   ========================================================================== */

:root {
  --bg-color: #f6f4f0;
  --bg-white: #ffffff;
  --text-dark: #161616;
  --text-muted: #737373;
  --surface-border: #e2dfd7;
  --accent-color: #2563eb;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-tile: 0px;
  --transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-dark);
  font-family: var(--font-family);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Site Header & Brand Navigation (Used across all pages)
   ========================================================================== */

.site-header {
  padding: 2.75rem 2.5rem 1.5rem;
  width: 100%;
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-spacer {
  width: 32px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-dark);
  text-decoration: none;
  text-transform: uppercase;
}

.brand-title:hover {
  opacity: 0.85;
}

/* Hamburger Menu Button */
.nav-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 28px;
  padding: 0;
}

.nav-toggle .bar {
  display: block;
  height: 2px;
  background-color: var(--text-dark);
  border-radius: 0;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle .bar-1 { width: 24px; }
.nav-toggle .bar-2 { width: 24px; }
.nav-toggle .bar-3 { width: 17px; }

.nav-toggle:hover .bar {
  background-color: #000000;
}

/* ==========================================================================
   Slide-Out Navigation Drawer
   ========================================================================== */

.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.nav-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 85vw;
  background-color: #ffffff;
  z-index: 510;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 35px rgba(0, 0, 0, 0.15);
  padding: 2.25rem 2rem;
  border-radius: 0;
}

.nav-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #eae7e1;
}

.drawer-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 0.02em;
}

.drawer-close {
  background: transparent;
  border: none;
  font-size: 2.25rem;
  line-height: 1;
  color: var(--text-dark);
  cursor: pointer;
  padding: 0.25rem;
  transition: opacity var(--transition);
}

.drawer-close:hover {
  opacity: 0.6;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 1rem;
  overflow-y: auto;
}

.drawer-section {
  border-bottom: 1px solid #eae7e1;
}

.drawer-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.25rem;
  border: 0;
  background: transparent;
  color: var(--text-dark);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.drawer-section-toggle:hover {
  color: var(--text-muted);
}

.drawer-chevron {
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.25rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-0.15rem);
  transition: transform 0.2s ease;
}

.drawer-section-toggle[aria-expanded="true"] .drawer-chevron {
  transform: rotate(225deg) translate(-0.1rem, -0.1rem);
}

.drawer-section-panel {
  padding: 0 0 0.85rem;
}

.drawer-album-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 0.65rem;
  border-left: 1px solid #eae7e1;
}

.drawer-about-panel {
  color: var(--text-dark);
  font-size: 0.84rem;
  line-height: 1.6;
}

.drawer-about-panel p {
  margin: 0 0 0.9rem;
}

.drawer-about-panel h2 {
  margin: 1.15rem 0 0.45rem;
  color: var(--text-dark);
  font-size: 0.9rem;
  font-weight: 700;
}

.drawer-about-panel .about-pronunciation {
  font-size: 1rem;
  line-height: 1.55;
}

.about-pronunciation span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.drawer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: 0;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.drawer-link:hover {
  background-color: var(--bg-color);
}

.drawer-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: #eeebe3;
  padding: 0.2rem 0.55rem;
  border-radius: 0;
}

/* ==========================================================================
   Page Layout & Section Title
   ========================================================================== */

.gallery-wrapper,
.album-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1rem 2.5rem 4rem;
  width: 100%;
  flex: 1;
}

.section-title-wrap,
.album-header-wrap {
  margin-bottom: 2rem;
}

.gallery-title {
  font-size: 2.15rem;
  font-weight: 350;
  letter-spacing: 0.05em;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  line-height: 1;
}

.album-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  transition: opacity var(--transition);
  opacity: 0.75;
}

.nav-back:hover {
  opacity: 1;
}

/* ==========================================================================
   Asymmetrical Tile Grid (Landing Page - design_inspiration.png)
   ========================================================================== */

.gallery-grid {
  display: grid;
  gap: 1.5rem;
  width: 100%;
}

/* Desktop 24-Column Asymmetric Spans */
@media (min-width: 901px) {
  .gallery-grid {
    grid-template-columns: repeat(24, 1fr);
    grid-auto-rows: 255px;
  }

  /* Row 1 Pattern: 7 cols (29%) + 10 cols (42%) + 7 cols (29%) = 24 cols */
  .gallery-tile:nth-child(6n + 1) { grid-column: span 7; }
  .gallery-tile:nth-child(6n + 2) { grid-column: span 10; }
  .gallery-tile:nth-child(6n + 3) { grid-column: span 7; }

  /* Row 2 Pattern: 10 cols (42%) + 8 cols (33%) + 6 cols (25%) = 24 cols */
  .gallery-tile:nth-child(6n + 4) { grid-column: span 10; }
  .gallery-tile:nth-child(6n + 5) { grid-column: span 8; }
  .gallery-tile:nth-child(6n + 6) { grid-column: span 6; }

  /* Balanced 2-row layout when exactly 5 tiles are present */
  .gallery-tile:nth-child(4):nth-last-child(2) { grid-column: span 13; }
  .gallery-tile:nth-child(5):last-child { grid-column: span 11; }
}

/* Medium Screens (Tablets) */
@media (max-width: 900px) and (min-width: 601px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 230px;
    gap: 1.25rem;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile Screens */
@media (max-width: 600px) {
  .site-header {
    padding: 2rem 1.5rem 1rem;
  }
  .gallery-wrapper,
  .album-wrapper {
    padding: 0.75rem 1.5rem 3rem;
  }
  .gallery-title {
    font-size: 1.75rem;
  }
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 210px;
    gap: 1.15rem;
  }
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
}

/* ==========================================================================
   Tile Styling: Right Angles & Deep Drop Shadow
   ========================================================================== */

.gallery-tile {
  position: relative;
  border-radius: 0; /* Right angles */
  overflow: hidden;
  text-decoration: none;
  color: #ffffff;
  background-color: #2b2b2b;
  /* Deep, soft diffused architectural drop shadow */
  box-shadow: 0 2px 6px -4px rgba(0, 0, 0, 0.08), 0 1px 3px -2px rgba(0, 0, 0, 0.05);
  transition: transform var(--transition), box-shadow var(--transition);
  display: block;
}

.gallery-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 52px -4px rgba(0, 0, 0, 0.40), 0 12px 22px -2px rgba(0, 0, 0, 0.22);
}

.gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gallery-tile:hover img {
  transform: scale(1.035);
}

/* Vignette / Gradient Overlay */
.tile-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 35%,
    rgba(0, 0, 0, 0.25) 65%,
    rgba(0, 0, 0, 0.75) 100%
  );
  display: flex;
  align-items: flex-end;
  padding: 1.35rem 1.5rem;
  pointer-events: none;
}

.tile-title {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.015em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  margin: 0;
  line-height: 1.3;
}

/* Placeholder Tile for albums without photos */
.placeholder-tile {
  background: linear-gradient(135deg, #2c3036 0%, #1a1c21 100%);
  border-radius: 0;
}

.tile-placeholder-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.35);
  gap: 0.4rem;
}

.placeholder-icon {
  font-size: 2.25rem;
}

.placeholder-text {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ==========================================================================
   Photo Gallery Grid (Album View) - Right Angles & Deep Shadows
   ========================================================================== */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 8px;
  grid-auto-flow: row;
  gap: 0.9rem;
}

.photo-item {
  position: relative;
  min-width: 0;
  background-color: #ddd9d0;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition);
}

.photo-item:hover {
  transform: translateY(-4px);
  z-index: 2;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.photo-item:hover img {
  transform: scale(1.035);
}

.photo-item .unsupported-format {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  background-color: #ffffff;
}

/* ==========================================================================
   Lightbox Modal - Architectural Fullscreen
   ========================================================================== */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 15, 29, 0.94);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  user-select: none;
}

.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 2.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0;
  transition: color var(--transition), transform var(--transition);
  z-index: 1020;
}

.lightbox-close:hover {
  color: #ffffff;
  transform: scale(1.1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 1.75rem;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0; /* Right angle controls */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
  z-index: 1010;
}

.lightbox-nav:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.08);
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

.lightbox-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
}

.lightbox-filmstrip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(88vw, 1100px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.45rem max(0.45rem, calc(50% - 2.25rem));
  margin-bottom: 0.85rem;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
}

.lightbox-filmstrip::-webkit-scrollbar { display: none; }

.filmstrip-thumb {
  flex: 0 0 5rem;
  height: 3.8rem;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0.58;
  cursor: pointer;
  scroll-snap-align: center;
  transition: opacity var(--transition), border-color var(--transition), transform var(--transition);
}

.filmstrip-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.filmstrip-thumb:hover { opacity: 1; transform: scale(1.24); z-index: 1; }

.filmstrip-thumb.selected {
  opacity: 1;
  transform: scale(1.24);
}

.lightbox-filmstrip.has-hover .filmstrip-thumb.selected:not(:hover) {
  transform: none;
}

.lightbox-image-wrapper {
  touch-action: pan-y;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 88vw;
  max-height: 68vh;
  object-fit: contain;
  border-radius: 0; /* Right angles */
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  transition: opacity 0.2s ease;
  display: block;
}

@media (max-width: 600px) {
  .lightbox-container { max-width: 96vw; max-height: 94vh; }
  .lightbox-filmstrip { width: 94vw; margin-bottom: 0.55rem; }
  .filmstrip-thumb { flex-basis: 4.2rem; height: 3.2rem; }
  .lightbox-img { max-width: 94vw; max-height: 62vh; }
}

.lightbox-img.loading {
  opacity: 0.3;
}

.lightbox-caption {
  margin-top: 0.85rem;
  color: #cbd5e1;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  max-width: 90vw;
}

.lightbox-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.lightbox-counter {
  color: #94a3b8;
  font-size: 0.85rem;
}

.lightbox-exif {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 0.6rem;
  font-size: 0.825rem;
  color: #94a3b8;
}

.lightbox-exif:empty {
  display: none;
}

.lightbox-exif-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 0; /* Right angles */
  color: #e2e8f0;
}

/* Lightbox Spinner */
.lightbox-spinner {
  position: absolute;
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.lightbox-spinner.visible {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  text-align: center;
  padding: 3rem 1.5rem 2.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
