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

@font-family {
  font-family: "Apple Garamond Light";
  src: url("assets/fonts/AppleGaramond-Light.ttf");
}

@font-family {
  font-family: "Apple Garamond Light";
  src: url("assets/fonts/AppleGaramond-LightItalic.ttf");
  font-style: italic;
}

body {
  font-family: "Times New Roman", serif;
  /* background-image: url("assets/foggy-birds.png"); */
  background-attachment: fixed;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }
}

a {
  color: blue;
}

/* Header styles */
.site-header {
  position: fixed;
  top: 0px;
  padding: 2rem;
  margin-bottom: 1rem;
  max-width: 950px;
  width: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.header-content {
  margin: 0 auto;
}

.bio-section {
  display: flex;
  align-items: center;
  gap: 3rem;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.bio-text h1 {
  font-family: "Apple Garamond Light";
  letter-spacing: 3px;
  font-size: 3.5rem;
  color: #2c3e50;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.bio-text .title {
  font-family: "Apple Garamond Light";
  font-style: italic;
  font-size: 2rem;
  color: #7f8c8d;
  line-height: 1.3;
}

.bio-text .description {
  font-size: 1.25rem;
  line-height: 1.5;
  color: #34495e;
}

.bio-image {
  flex-shrink: 0;
}

.bio-image img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 16px;
  filter: sepia(0.1);
}

@media (max-width: 768px) {
  .site-header {
    padding: 0;
    left: 0;
    transform: none;
    width: 100vw;
    max-width: none;
  }

  .bio-section {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border-radius: 0;
  }

  .bio-text h1 {
    font-size: 2.5rem;
    line-height: 0.9;
  }

  .bio-text .title {
    font-size: 1.5rem;
  }

  .bio-text .description {
    font-size: 1.1rem;
  }

  .bio-image img {
    width: 150px;
    height: 150px;
  }
}

@media (max-width: 480px) {
  .bio-text h1 {
    font-size: 2rem;
  }

  .bio-text .title {
    font-size: 1.2rem;
  }

  .bio-section {
    padding: 1rem;
    border-radius: 0;
  }
}

/* Category navigation */
.category-nav {
  position: fixed;
  top: 315px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 950px;
  z-index: 200;
  padding: 0 2rem;
}

.category-scroll-container {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 0.5rem 0;
}

.category-scroll-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 12px 0 0 12px;
}

.category-scroll-container::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 0 12px 12px 0;
}

.category-scroll-container.show-left-fade::before {
  opacity: 1;
}

.category-scroll-container.show-right-fade::after {
  opacity: 1;
}

.category-list {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.5rem 40px;
  gap: 1rem;
}

.category-list::-webkit-scrollbar {
  display: none;
}

.category-button {
  font-family: "Helvetica", sans-serif;
  flex-shrink: 0;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 500;
  color: #2c3e50;
  background: rgba(225, 225, 225, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  border-radius: 20px;
  transition: all 0.2s ease;
  white-space: nowrap;
  /* text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); */
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
}

.category-button:hover {
  background: rgba(230, 230, 230, 1);
  transform: translateY(-5px);
  /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); */
  color: #1a252f;
}

.category-button.active {
  background: rgba(44, 62, 80, 1);
  color: white;
  text-shadow: none;

  /* backdrop-filter: blur(12px); */
  /* -webkit-backdrop-filter: blur(12px); */
  /* box-shadow: 0 4px 16px rgba(44, 62, 80, 0.3); */
}

.category-button.active:hover {
  /* transform: none; */
  /* background: rgba(44, 62, 80, 0.95); */
  /* color: white; */
}

@media (max-width: 768px) {
  .category-nav {
    padding: 0;
    top: 340px;
    left: 0;
    transform: none;
    width: 100vw;
    max-width: none;
  }

  .category-scroll-container {
    border-radius: 0;
  }

  .category-scroll-container::before,
  .category-scroll-container::after {
    width: 30px;
    border-radius: 0;
  }

  .category-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  .category-list {
    padding: 0.5rem 30px;
  }
}

@media (max-width: 480px) {
  .category-nav {
    padding: 0;
    top: 300px;
    left: 0;
    transform: none;
    width: 100vw;
    max-width: none;
  }

  .category-scroll-container {
    border-radius: 0;
  }

  .category-scroll-container::before,
  .category-scroll-container::after {
    border-radius: 0;
  }

  .category-button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
}

/* Main content */
.main-content {
  max-width: 1000px;
  margin: 400px auto;
  padding: 0 2rem;
}

.category-title {
  display: none !important;
  margin-bottom: 2rem;
}

.category-title h2 {
  font-family: "Apple Garamond Light";
  font-size: 2.5rem;
  color: #2c3e50;
  text-align: center;
  margin: 0;
}

/* Gallery container */
.gallery-container {
  padding: 0;
}

/* Loading message */
.loading-message {
  text-align: center;
  color: #999;
  font-size: 1.1rem;
  font-style: italic;
  padding: 3rem 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

@media (max-width: 768px) {
  .main-content {
    padding: 0 1rem;
  }

  .category-title h2 {
    font-size: 2rem;
  }

  .loading-message {
    font-size: 1rem;
    padding: 2rem 0;
  }
}

/* Gallery grid - optimized for landscape images */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Gallery item */
.gallery-item {
  background: white;
  border-radius: 12px;
  transition:
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.gallery-item:hover {
  /* transform: translateY(-8px) scale(1.02); */
  /* box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15); */
}

/* Image placeholder - optimized for landscape aspect ratio */
.image-placeholder {
  width: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite linear;
  border-radius: 8px;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
  position: relative;
  display: none !important;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.image-placeholder.error {
  background: #ffebee;
  border: 2px dashed #f44336;
  animation: none;
}

.error-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #f44336;
  font-size: 14px;
  text-align: center;
}

.error-placeholder span:first-child {
  font-size: 24px;
}

/* Gallery image - optimized for landscape images */
.gallery-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  transition: opacity 0.2s ease;
  position: absolute;
  top: 0;
  left: 0;
  object-fit: cover;
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  aspect-ratio: 4/3;
}

.gallery-item.loaded .gallery-image {
  position: relative;
  aspect-ratio: auto;
}

/* Prevent image dragging */
.gallery-image {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, visibility;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  cursor: default;
  user-select: text;
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale3d(0.8, 0.8, 1) translateZ(0);
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  backface-visibility: hidden;
  contain: layout style paint;
}

.modal.active .modal-content {
  transform: scale3d(1, 1, 1) translateZ(0);
}

.modal-close {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
  z-index: 1001;
  backdrop-filter: blur(10px);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.modal img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  transform: translateZ(0);
  backface-visibility: hidden;
  image-rendering: -webkit-optimize-contrast;
}

.modal-caption {
  display: none !important;
  text-align: center;
  margin-top: 15px;
  font-size: 28px;
  font-style: italic;
  color: #333;
  font-weight: 500;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Loading animation improvements */
@media (prefers-reduced-motion: reduce) {
  .gallery-item {
    transition: none;
  }

  .image-placeholder {
    animation: none;
    background: #f0f0f0;
  }

  .modal {
    transition: none;
  }

  .modal-content {
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Focus styles for accessibility */
.gallery-item:focus {
  outline: 2px solid #007acc;
  outline-offset: 2px;
}

.modal-close:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gallery-item {
    border: 2px solid #000;
  }

  .image-placeholder {
    border: 2px solid #000;
  }
}

/* Print styles */
@media print {
  .bio-card {
    position: static;
    width: 100%;
    max-width: none;
    height: auto;
    background: white;
    box-shadow: none;
    page-break-after: always;
  }

  .gallery-container {
    margin-left: 0;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .modal {
    display: none;
  }
}
