body {
  overflow-y: auto;
}

.projects-grid {
  margin-top: 4vh;
  padding: 0 6vw;
  width: 100%;
  box-sizing: border-box;
  column-count: 3;
  column-gap: 1.5rem;
  align-items: start;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.6s;
}

@media (max-width: 900px) {
  .projects-grid {
    column-count: 2;
  }
}

@media (max-width: 560px) {
  .projects-grid {
    column-count: 1;
  }
}

@media (max-width: 700px) {
  .projects-grid {
    margin-top: 1.75rem;
    padding: 0 5vw;
    column-gap: 0;
  }

  .project-card {
    margin-bottom: 1.3rem;
  }

  .project-tag {
    font-size: 0.64rem;
  }

  .project-title {
    font-size: 1rem;
    line-height: 1.2;
  }
}

.project-card {
  cursor: pointer;
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 1.5rem;
  vertical-align: top;
  text-decoration: none;
}

.project-thumb {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #111;
}

.project-thumb img {
  width: 100%;
  height: auto;
  display: block;
  filter: brightness(0.75) saturate(0.8);
  transition: filter 0.3s ease, transform 0.4s ease;
}

.project-card:hover .project-thumb img {
  filter: brightness(0.9) saturate(1);
  transform: scale(1.03);
}

.play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-bright);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.play-icon svg {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 0 12px rgba(240, 180, 41, 0.5));
}

.project-card:hover .play-icon {
  opacity: 1;
}

.project-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  transition: border-color 0.3s ease;
  pointer-events: none;
}

.project-card:hover .project-thumb::after {
  border-color: var(--gold-muted);
}

.project-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.project-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
}

.project-tag {
  font-family: var(--ui-font);
  font-weight: 600;
  font-size: clamp(0.6rem, 0.8vw, 0.7rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-muted);
}

.project-industry-tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.2rem 0.52rem;
  border: 1px solid rgba(160, 120, 16, 0.36);
  border-radius: 999px;
  font-family: var(--ui-font);
  font-weight: 700;
  font-size: clamp(0.56rem, 0.75vw, 0.64rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-bright);
  background: rgba(255, 255, 255, 0.02);
}

.project-title {
  font-family: var(--ui-font);
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: -0.01em;
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  backdrop-filter: blur(4px);
  overflow-y: auto;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.image-mode {
  align-items: flex-start;
}

.modal-box {
  position: relative;
  width: 90vw;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: auto;
}

.modal-close {
  position: absolute;
  top: -2.4rem;
  right: 0;
  background: transparent;
  border: none;
  color: var(--gold-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--ui-font);
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--gold-bright);
}

.modal-carousel {
  position: relative;
  width: 100%;
  min-height: 0;
  height: min(76vh, 920px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.modal-backdrop.image-mode .modal-box {
  margin: 1.5rem auto;
}

.modal-backdrop.image-mode .modal-carousel {
  height: auto;
  max-height: none;
  overflow: visible;
  align-items: flex-start;
}

.carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.modal-backdrop.image-mode .carousel-track {
  height: auto;
  min-height: min(72vh, 860px);
  align-items: flex-start;
}

.carousel-item {
  position: absolute;
  transition:
    transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 0.45s ease,
    filter 0.45s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-item img {
  display: block;
  max-height: min(72vh, 860px);
  max-width: min(78vw, 980px);
  width: auto;
  height: auto;
}

.modal-backdrop.image-mode .carousel-item.pos-active {
  position: relative;
  padding-top: 0.5rem;
}

.modal-backdrop.image-mode .carousel-item.pos-active img {
  max-height: none;
}

.carousel-item iframe {
  display: block;
  width: min(78vw, 1100px);
  aspect-ratio: 16 / 9;
  max-height: min(72vh, 860px);
  border: none;
}

.carousel-item video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(78vw, 1100px);
  max-height: min(72vh, 860px);
  background: #000;
}

.carousel-item.pos-active {
  transform: translateX(0) scale(1);
  opacity: 1;
  filter: brightness(1);
  z-index: 3;
}

.carousel-item.pos-prev {
  transform: translateX(-68%) scale(0.65);
  opacity: 0.35;
  filter: brightness(0.4);
  z-index: 2;
}

.carousel-item.pos-next {
  transform: translateX(68%) scale(0.65);
  opacity: 0.35;
  filter: brightness(0.4);
  z-index: 2;
}

.carousel-item.pos-far {
  transform: translateX(0) scale(0.4);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.modal-backdrop.image-mode .carousel-item.pos-prev,
.modal-backdrop.image-mode .carousel-item.pos-next,
.modal-backdrop.image-mode .carousel-item.pos-far {
  opacity: 0;
  pointer-events: none;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid var(--gold-muted);
  color: var(--gold-bright);
  font-family: var(--ui-font);
  font-weight: 600;
  font-size: 1.2rem;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    0 8px 20px rgba(0, 0, 0, 0.16);
  transition: border-color 0.2s, color 0.2s, opacity 0.2s, box-shadow 0.2s ease;
}

.carousel-btn:hover {
  border-color: var(--gold-bright);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    0 10px 24px rgba(0, 0, 0, 0.2);
}

.carousel-btn.prev {
  left: 1rem;
}

.carousel-btn.next {
  right: 1rem;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.carousel-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-muted);
  transition: background 0.2s, transform 0.2s;
  cursor: pointer;
}

.carousel-dot.active {
  background: var(--gold-bright);
  transform: scale(1.3);
}

.modal-details {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.modal-details-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4.5rem;
  margin-bottom: 0.9rem;
}

.modal-heading-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  min-width: 0;
}

.modal-tag {
  font-family: var(--ui-font);
  font-weight: 600;
  font-size: clamp(0.6rem, 0.8vw, 0.7rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-muted);
}

.modal-title {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 400;
  color: var(--gold-bright);
  margin: 0;
}

.modal-desc {
  font-family: Arial, sans-serif;
  font-size: clamp(0.8rem, 1vw, 0.9rem);
  color: var(--gold-muted);
  line-height: 1.6;
  width: min(100%, 760px);
  margin: 0;
  margin-top: 0.15rem;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.project-case-study {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 72ch;
}

.project-case-intro,
.project-case-use,
.project-case-process p {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.project-case-use a {
  color: var(--gold-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(240, 180, 41, 0.35);
}

.project-case-use a:hover {
  color: #fff;
  border-bottom-color: var(--gold-bright);
}

.project-case-process {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.project-case-study h3,
.project-case-process h3 {
  margin-left: 0;
  margin-right: 0;
}

.project-case-process h3 {
  font-family: var(--ui-font);
  font-size: clamp(0.86rem, 1vw, 0.96rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-top: 0.4rem;
}

.modal-link {
  font-family: var(--ui-font);
  font-weight: 700;
  font-size: clamp(0.7rem, 0.9vw, 0.82rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.modal-link:hover {
  color: #fff;
  border-color: var(--gold-bright);
}

@media (max-width: 1280px) {
  .modal-details {
    width: min(100%, 760px);
  }

  .modal-details-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
  }

  .modal-link {
    display: inline-block;
  }
}

@media (max-width: 700px) {
  .modal-backdrop {
    padding: 1rem;
  }

  .modal-carousel {
    height: 54vh;
  }

  .carousel-item img {
    max-width: 100%;
  }

  .carousel-item iframe {
    width: 100%;
    max-width: 100%;
  }

  .carousel-item video {
    max-width: 100%;
  }

  .carousel-item.pos-prev,
  .carousel-item.pos-next {
    transform: translateX(0) scale(0.85);
    opacity: 0;
    pointer-events: none;
  }

  .carousel-btn.prev {
    left: 0;
  }

  .carousel-btn.next {
    right: 0;
  }

  .modal-details {
    width: 100%;
  }

  .modal-desc {
    width: 100%;
  }

  .modal-link {
    margin-top: 0.8rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
