/* Colors and themes */
:root {
  --bg-light: #fdfdff;
  --color-light: #1C1C1D;
  --bg-dark: #393d3f;
  --color-dark: #fdfdff;
  --color-link-light: #ce645f;
  --color-link-dark: #e08f8b;
  --color-link-hover-light: #81403a;
  --color-link-hover-dark: #fdc7c4;
}

/* Theme classes */
.latex-light-auto {
  background-color: var(--bg-light);
  color: var(--color-light);
}
.latex-light-auto a {
  color: var(--color-link-light) !important;
}
@media (hover: hover) and (pointer: fine) {
  .latex-light-auto a:hover {
    color: var(--color-link-hover-light) !important;
  }
}
.latex-dark-auto {
  background-color: var(--bg-dark);
  color: var(--color-dark);
}
.latex-dark-auto a {
  color: var(--color-link-dark) !important;
}
@media (hover: hover) and (pointer: fine) {
  .latex-dark-auto a:hover {
    color: var(--color-link-hover-dark) !important;
  }
}

/* Construction banner */
.construction-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 8px 20px;
  font-size: 1.05em;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
  border-bottom: 1px solid;
}
.latex-light-auto .construction-banner {
  background-color: rgba(206, 100, 95, 0.1);
  color: var(--color-link-light);
  border-bottom-color: rgba(206, 100, 95, 0.2);
}
.latex-dark-auto .construction-banner {
  background-color: rgba(224, 143, 139, 0.15);
  color: var(--color-link-dark);
  border-bottom-color: rgba(224, 143, 139, 0.3);
}

/* Base reset + typography */
*:not(h1) {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  font-size: 0.975em;
  hyphens: manual;
}
h1 {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  margin: 0px;
}
body {
  margin-top: 50px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  line-height: 1.6;
}

/* Container to match homepage */
.container {
  display: flex;
  flex-direction: column;
  max-width: 900px;
  width: 100%;
  padding: 20px;
}

/* Header layout */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.header-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.back-link {
  text-decoration: none;
  font-weight: 500;
  color: var(--color-link-light) !important;
}
@media (hover: hover) and (pointer: fine) {
  .back-link:hover {
    color: var(--color-link-hover-light) !important;
  }
}

/* Theme toggling button */
.btn {
  position: fixed !important;
  border: none;
  border-radius: 100%;
  padding: 10px;
  box-shadow: none;
  height: 55px;
}
.btn:active {
  box-shadow: none;
  outline: none;
}
.btn-light {
  background-color: var(--bg-light);
  color: var(--color-light);
  transition: 0.15s ease-in background-color;
}
@media (hover: hover) and (pointer: fine) {
  .btn-light:hover {
    cursor: pointer;
    background-color: #dddcda;
  }
}
.btn-dark {
  background-color: var(--bg-dark);
  color: var(--color-dark);
  transition: 0.15s ease-in background-color;
}
@media (hover: hover) and (pointer: fine) {
  .btn-dark:hover {
    cursor: pointer;
    background-color: #54565a;
  }
}
#toggle-theme {
  position: absolute;
  /* Change to 10px after removing banner */
  top: 45px;
  right: 10px;
}

/* Responsive margin adjustments to match resume.css */
@media (max-width: 949px) {
  body {
    margin-top: 20px;
  }
}

/* Gallery specific styles */
.gallery-description {
  color: var(--color-light);
  margin-top: 5px;
}

.gallery-grid {
  columns: 3;
  column-gap: 20px;
}

/* Fallback for browsers that don't support CSS columns */
@supports not (columns: 3) {
  .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
  }
}

.photo-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease;
  background-color: #f0f0f0;
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: 20px;
}

@media (hover: hover) and (pointer: fine) {
  .photo-item:hover {
    transform: translateY(-4px);
  }
}

.photo-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .photo-item:hover img {
    transform: scale(1.05);
  }
}

/* Location tags */
.location-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* Show on hover for hoverable devices */
@media (hover: hover) and (pointer: fine) {
  .photo-item:hover .location-tag {
    opacity: 1;
  }
}

/* Always visible on non-hoverable devices (mobile/touch) */
@media (hover: none) and (pointer: coarse) {
  .location-tag {
    opacity: 1;
  }
}

/* Lightbox styles */
.lightbox {
  display: none;
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.lightbox-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

@media (hover: hover) and (pointer: fine) {
  .lightbox-close:hover {
    opacity: 0.7;
  }
}

.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  text-align: center;
  padding: 10px 20px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 5px;
  max-width: 80%;
}

/* Dark theme adjustments */
.latex-dark-auto .photo-item {
  background-color: #2a2a2a;
}

.latex-dark-auto .gallery-description {
  color: var(--color-dark);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .gallery-grid {
    columns: 1;
    column-gap: 15px;
  }
  
  /* Fallback for browsers that don't support CSS columns */
  @supports not (columns: 1) {
    .gallery-grid {
      grid-template-columns: 1fr;
      gap: 15px;
    }
  }
  
  .photo-item {
    margin-bottom: 15px;
  }
  
  .lightbox-content {
    max-width: 95%;
    max-height: 70%;
  }
  
  .lightbox-close {
    top: 10px;
    right: 20px;
    font-size: 30px;
  }
}

@media (max-width: 949px) and (min-width: 600px) {
  .gallery-grid {
    columns: 2;
  }
  
  /* Fallback for browsers that don't support CSS columns */
  @supports not (columns: 2) {
    .gallery-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
}
