/* ==========================================================================
   BASE STYLES
   ========================================================================== */

body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background-color: white;
  color: #000;
}

h1, h2 {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #000;
}

h2 {
  font-weight: 300; /* Lighter font weight */
}

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */

.site-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  border-bottom: 1px solid #000;
}

.logo a,
.menu a {
  text-decoration: none;
  font-family: Arial, Helvetica, sans-serif;
  color: black;
  font-weight: bold;
}

.logo a {
  font-size: 14px;
}

.menu a:hover {
  color: black;
}

/* ==========================================================================
   SNAIL ANIMATION
   ========================================================================== */

.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  overflow: visible;
}

.snail-container {
  position: relative;
  top: 2px;
  width: 100%;
  pointer-events: none;
}

.snail {
  position: absolute;
  width: 40px;
  height: auto;
  animation: snail-loop 200s linear infinite;
  pointer-events: auto;
}

.snail:hover {
  animation-play-state: paused;
}

@keyframes snail-loop {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw - 40px)); }
}

/* ==========================================================================
   LAYOUT WRAPPERS
   ========================================================================== */

.wrapper {
  padding: 0.4rem;
  box-sizing: border-box;
}

.main {
  min-height: calc(100vh - 200px);
}

.divider {
  height: 1px;
  background: black;
  margin: 1rem 0;
}

/* ==========================================================================
   FILTER BAR (ARCHIVE PAGE)
   ========================================================================== */

.filter-bar {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
  position: relative;
  padding: 0;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-bar ul {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
  white-space: nowrap;
}

.filter-bar li {
  flex: 0 0 auto;
}

.filter-bar a {
  display: inline-block;
  padding: 0px;
  border-radius: 999px;
  background-color: #fff;
  text-decoration: none;
  color: #333;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-bar a:hover {
  background-color: #fff;
  font-weight: bold;
}

.filter-bar a.active {
  background-color: #fff;
  color: #000;
  font-weight: bold;
}

/* ==========================================================================
   PROJECT GRID (ARCHIVE PAGE)
   ========================================================================== */

.p-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
  margin: 0 auto;
  list-style: none;
  max-width: 1400px;
}

.p-item {
  flex: 0 0 280px;
}

.p-item a {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.2s ease;
}

.p-item a:hover {
  transform: translateY(-2px);
}

.p-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 0;
}

.p-figure img {
  border: 1px solid #ddd;
  width: 100%;
  height: auto;
  aspect-ratio: 4/3;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.p-figure:hover img {
  border-color: black;
  filter: grayscale(0%);
}

.p-figure figcaption {
  text-align: center;
  font-size: 12px;
  padding-top: 10px;
  color: #000;
  line-height: 1.5;
}

/* Project type badge styling */
figcaption .project-type {
  display: inline-block !important;
  margin-left: 8px !important;
  padding: 2px 8px !important;
  background: #f0f0f0 !important;
  border: 1px solid #ddd !important;
  border-radius: 12px !important;
  font-size: 0.75rem !important;
  color: #666 !important;
  font-weight: normal !important;
  vertical-align: middle !important;
  line-height: 1.2 !important;
  text-transform: none !important;
}

.no-image {
  width: 100%;
  aspect-ratio: 4/3;
  background: #f5f5f5;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 0.8rem;
}

/* ==========================================================================
   PROJECT DETAIL PAGE
   ========================================================================== */

.project-detail {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.project-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-meta {
  max-width: 800px;
  margin: 0;
  padding: 1.5rem;
  background: #f8f8f8;
  border-radius: 8px;
  line-height: 1.5;
  font-size: 14px;
}

.project-meta .meta-row {
  display: flex;
  padding: 0.5rem 0;
  align-items: flex-start;
  border-bottom: 1px solid #eee;
}

.project-meta .meta-row:last-child {
  border-bottom: none;
}

.project-meta dt {
  flex: 0 0 120px;
  font-weight: 600;
  margin: 0;
  color: #666;
}

.project-meta dd {
  flex: 1;
  margin: 0;
  color: #333;
}

.project-links {
  margin-top: 2rem;
}

.project-links h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: #333;
}

.project-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-links li {
  margin-bottom: 0.5rem;
}

.project-links a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 500;
}

.project-links a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   CONTENT BLOCKS
   ========================================================================== */

.content-blocks {
  max-width: 1000px;
  margin: 1rem 0;
}

.content-block {
  margin-bottom: 2rem;
}

/* Text Block */
.content-block--text {
  max-width: 800px;
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
  font-family: Georgia, 'Times New Roman', Times, serif;
}

.content-block--text p {
  margin-bottom: 1rem;
}

.content-block--text h2,
.content-block--text h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #222;
}

/* Image Block */
.content-block--image {
  margin: 1rem 0;
}

.block-image {
  width: 100%;
  max-width: 800px;
  height: auto;
  cursor: pointer;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: border-color 0.2s, transform 0.2s;
}

.block-image:hover {
  border-color: #999;
  transform: scale(1.01);
}

.block-caption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
}

/* Gallery Block */
.content-block--gallery {
  margin: 1rem 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.gallery-item {
  margin: 0;
}

.gallery-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: border-color 0.2s, transform 0.2s;
}

.gallery-image:hover {
  border-color: #999;
  transform: scale(1.02);
}

.gallery-caption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

/* Video Block */
.content-block--video {
  text-align: center;
  margin: 1rem 0;
}

.block-video {
  width: 100%;
  max-width: 800px;
  height: auto;
}

/* ==========================================================================
   ABOUT PAGE
   ========================================================================== */

.about-page {
  padding: 2rem 0;
}

.page-header {
  margin-bottom: 3rem;
  text-align: center;
}

.page-header h1 {
  font-size: 2.5rem;
  margin: 0;
}

.about-content {
  max-width: 800px;
  margin: 10px auto;
  padding: 0 1rem;
}

.about-content section {
  margin-bottom: 3rem;
  padding: 1rem;
}

.about-content h2 {
  font-size: 20px;
  margin-bottom: 1rem;
  border-bottom: 1px solid #333;
  padding-bottom: 0.5rem;
  text-decoration: none;
  font-weight: 300; /* Lighter weight */
}

.bio-text {
  line-height: 1.6;
  font-size: 14px;
}

.bio-text p {
  margin-bottom: 1rem;
}

.cv-category {
  margin-bottom: 2rem;
}

.cv-category h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.cv-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 14px;
}

.contact a {
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #333;
}

.contact a:hover {
  color: #666;
  border-color: #666;
}

.links-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.links-list li a {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #f5f5f5;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.links-list li a:hover {
  background: #e5e5e5;
}

/* ==========================================================================
   ENHANCED GALLERY MODAL NAVIGATION
   ========================================================================== */

/* Navigation Arrows */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  color: black;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1002;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.nav-arrow:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.1);
}

.nav-prev {
  left: 20px;
}

.nav-next {
  right: 20px;
}

.nav-arrow svg {
  width: 24px;
  height: 24px;
  stroke: black;
}

/* Image Counter */
.image-counter {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 14px;
  backdrop-filter: blur(10px);
  z-index: 1002;
}

/* Image Caption */
.image-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.6);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  text-align: center;
  max-width: 80%;
  backdrop-filter: blur(10px);
  z-index: 1002;
}

/* Mobile Responsive for Gallery Navigation */
@media (max-width: 768px) {
  .nav-prev {
    left: 10px;
  }
  
  .nav-next {
    right: 10px;
  }
  
  .nav-arrow {
    width: 40px;
    height: 40px;
  }
  
  .nav-arrow svg {
    width: 20px;
    height: 20px;
  }
  
  .image-counter {
    top: 10px;
    font-size: 12px;
    padding: 6px 10px;
  }
  
  .image-caption {
    bottom: 10px;
    font-size: 12px;
    padding: 8px 15px;
    max-width: 90%;
  }
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  z-index: 10;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.modal-close:hover {
  background-color: #f0f0f0;
  color: #000;
}

.modal-body {
  padding: 60px 40px 40px;
  overflow-y: auto;
  max-height: calc(90vh - 100px);
}

.loading,
.error {
  text-align: center;
  padding: 40px 20px;
  font-size: 16px;
}

.loading {
  color: #666;
}

.error {
  color: #d32f2f;
}

.image-view {
  padding: 20px;
  text-align: center;
  min-height: 200px;
}

.back-button {
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  margin-bottom: 20px;
  font-size: 14px;
  transition: background-color 0.2s ease;
  display: inline-block;
}

.back-button:hover {
  background: #e0e0e0;
}

.image-container {
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

.fullsize-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Image Modal (for project detail page) */
#imageModal {
  z-index: 2000;
}

#imageModal .modal-content {
  background: transparent;
  box-shadow: none;
  max-width: 95%;
  max-height: 95%;
  width: auto;
  height: auto;
}

#imageModal .modal-image {
  width: auto;
  height: auto;
  max-width: min(1200px, 95vw);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#imageModal .modal-image.full-size {
  max-width: min(1600px, 95vw);
  max-height: 95vh;
}

#imageModal .modal-content.scrollable {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 95vw;
}

#imageModal .modal-image.extra-large {
  max-width: none;
  width: 1200px;
  height: auto;
  max-height: 90vh;
}

#imageModal .close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#imageModal .close:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1024px) {
  .p-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    padding: 30px;
  }
}

@media (max-width: 768px) {
  .about-page {
    padding: 1rem 0;
  }
  
  .page-header h1 {
    font-size: 2rem;
  }
  
  .links-list {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .p-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }

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

  .gallery-image {
    height: 200px;
  }

  .project-detail {
    padding: 1rem;
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .modal-body {
    padding: 50px 20px 20px;
  }

  .modal-close {
    top: 10px;
    right: 15px;
  }
}

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

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-image {
    height: 250px;
  }

  .content-block--text {
    font-size: 1rem;
  }

  .project-meta {
    padding: 1rem;
    font-size: 13px;
  }

  .project-meta dt {
    flex: 0 0 100px;
  }
}