/* Projects page styles */
.projects-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
}

.projects-header .header-details {
  width: 100%;
}

.project-page {
  --project-nav-offset: 4.7rem;
  padding-top: var(--project-nav-offset);
}

.project-nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(180deg, rgba(49, 64, 44, 0.98), rgba(49, 64, 44, 0.92));
  border-bottom: 1px solid rgba(226, 179, 95, 0.45);
  box-shadow: 0 8px 18px rgba(15, 24, 13, 0.2);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.project-nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0.5rem;
  margin: 0;
  padding: 0.55rem 0;
}

.project-nav::-webkit-scrollbar {
  display: none;
}

.project-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-height: 2.2rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(226, 179, 95, 0.7);
  background: rgba(54, 97, 57, 0.9);
  color: #dffcd3;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.project-nav-link:hover {
  background: rgba(230, 144, 24, 0.92);
  border-color: rgb(230, 144, 24);
  color: #fff6d8;
}

.project-nav-link.is-active {
  background: rgba(230, 144, 24, 0.92);
  border-color: rgb(230, 144, 24);
  color: #fff6d8;
  box-shadow: inset 0 0 0 1px rgba(255, 246, 216, 0.4);
}

.project-nav-link-back {
  margin-left: auto;
  background: linear-gradient(160deg, rgba(247, 236, 153, 0.96), rgba(236, 220, 113, 0.92));
  border-color: rgba(53, 66, 46, 0.45);
  color: #1f281d;
  box-shadow: inset 0 0 0 1px rgba(255, 249, 210, 0.45);
}

.project-nav-link-back:hover,
.project-nav-link-back:active {
  background: linear-gradient(160deg, rgba(250, 241, 172, 0.98), rgba(240, 225, 126, 0.94));
  border-color: rgba(53, 66, 46, 0.5);
  color: #1f281d;
}

.project-nav-link:focus-visible {
  outline: 2px solid rgba(255, 246, 216, 0.9);
  outline-offset: 2px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.35rem;
  padding: 0.52rem 0.9rem;
  border-radius: 8px;
  background: rgba(245, 231, 131, 0.92);
  color: #1f281d;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(16, 24, 13, 0.18);
}

.back-link:hover {
  background: rgba(255, 242, 172, 0.98);
}

.projects-main {
  padding-top: 1.5rem;
}

.projects-intro {
  background: rgba(249, 237, 156, 0.8);
  border-left: 4px solid #24301f;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  color: #20291b;
  box-shadow: inset 0 0 0 1px rgba(77, 93, 64, 0.2);
  margin-bottom: 1rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.project-card {
  background: linear-gradient(160deg, rgba(247, 236, 153, 0.96), rgba(236, 220, 113, 0.92));
  border: 1px solid rgba(53, 66, 46, 0.45);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: inset 0 0 0 1px rgba(255, 249, 210, 0.5), 0 10px 22px rgba(15, 24, 13, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.project-card-image {
  width: min(100%, 210px);
  aspect-ratio: 1 / 1;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(53, 66, 46, 0.42);
  background: rgba(255, 251, 227, 0.9);
}

.project-card-flip {
  perspective: 1200px;
}

.project-card-flip-toggle {
  position: relative;
  width: min(100%, 210px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
}

.project-card-flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  transition: transform 0.6s ease, opacity 0.6s ease;
}

.project-card-flip-front {
  transform: rotateY(0deg);
}

.project-card-flip-back {
  transform: rotateY(180deg);
}

.project-card-flip:hover .project-card-flip-front,
.project-card-flip:focus-within .project-card-flip-front {
  transform: rotateY(-180deg);
}

.project-card-flip:hover .project-card-flip-back,
.project-card-flip:focus-within .project-card-flip-back {
  transform: rotateY(0deg);
}

.project-card-flip .project-card-image {
  width: 100%;
  height: 100%;
}

.project-card-flip-toggle:focus-visible {
  outline: 2px solid rgba(230, 144, 24, 0.95);
  outline-offset: 4px;
  border-radius: 10px;
}

.mini-gallery {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mini-gallery-track {
  position: relative;
}

.mini-slide {
  display: none;
}

.mini-slide.is-active {
  display: block;
}

.mini-slide-combo .project-card-image {
  height: 160px;
}

.mini-gallery-combo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.mini-gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.mini-gallery-arrow {
  border: 1px solid rgba(230, 144, 24, 0.95);
  background: rgba(49, 64, 44, 0.94);
  color: #dffcd3;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.mini-gallery-arrow:hover {
  background: rgba(230, 144, 24, 0.92);
  color: #fff6d8;
}

.mini-gallery-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.mini-gallery-dot {
  width: 0.44rem;
  height: 0.44rem;
  border-radius: 999px;
  background: rgba(49, 64, 44, 0.42);
  border: 1px solid rgba(49, 64, 44, 0.5);
}

.mini-gallery-dot.is-active {
  background: rgba(230, 144, 24, 0.95);
  border-color: rgba(230, 144, 24, 0.95);
}

.project-image-slot {
  min-height: 210px;
  border-radius: 10px;
  border: 2px dashed rgba(36, 48, 31, 0.45);
  background: linear-gradient(135deg, rgba(255, 251, 227, 0.9), rgba(241, 224, 110, 0.72));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #44513a;
  font-weight: 600;
  margin-bottom: 0.85rem;
  padding: 1rem;
}

.project-card h2 {
  margin: 0;
  color: #20291b;
  font-size: 1.35rem;
  text-align: center;
}

.project-card p {
  margin: 0;
  color: #263120;
}

.project-more-text {
  display: none;
}

.project-card.expanded .project-more-text {
  display: inline;
}

.project-card.expanded {
  box-shadow: inset 0 0 0 1px rgba(255, 249, 210, 0.6), 0 14px 28px rgba(15, 24, 13, 0.24);
}

.read-more-btn {
  align-self: flex-start;
  margin-top: 0.25rem;
  border: 1px solid rgba(230, 144, 24, 0.95);
  background: rgba(49, 64, 44, 0.94);
  color: #dffcd3;
  border-radius: 8px;
  padding: 0.42rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.read-more-btn:hover {
  background: rgba(230, 144, 24, 0.92);
  color: #fff6d8;
  border-color: rgb(230, 144, 24);
}

@media (max-width: 640px) {
  .project-page {
    --project-nav-offset: 0;
    padding-top: var(--project-nav-offset);
  }

  .project-nav-bar {
    position: sticky;
    top: 0;
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
  }

  .projects-main {
    padding-top: 1.1rem;
  }

  .project-nav {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
    overflow-x: visible;
    gap: 0.5rem;
    padding: 0.55rem 0;
    scroll-snap-type: none;
  }

  .project-nav-link {
    width: 100%;
    min-height: 3.25rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.84rem;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
    scroll-snap-align: none;
  }

  .project-nav-link-back {
    margin-left: 0;
  }

  .project-nav-link:hover,
  .project-nav-link:active,
  .project-nav-link.is-active {
    background: rgba(230, 144, 24, 0.92);
    border-color: rgb(230, 144, 24);
    color: #fff6d8;
  }

  .projects-grid {
    gap: 0.8rem;
  }

  .project-image-slot {
    min-height: 180px;
  }

  .project-card-image {
    width: min(100%, 180px);
  }

  .project-card-flip-toggle {
    width: min(100%, 180px);
  }

  .mini-slide-combo .project-card-image {
    height: 130px;
  }
}