/* Portfolio */

.portfolio-heading {
  max-width: 900px;
}

.portfolio-title {
  max-width: none;
}

.portfolio-intro {
  margin-top: 18px;
  max-width: 760px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

/* Project tiles */

.case-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-auto-rows: 260px;
  gap: 24px;
  margin-top: 56px;
}

.case-card {
  min-width: 0;
}

.case-card:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.case-card:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.case-card:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.case-card:nth-child(4) {
  grid-column: 3;
  grid-row: 1;
}

.case-card:nth-child(5) {
  grid-column: 3;
  grid-row: 2;
}

.case-card-button {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #0f172a;
  padding: 0;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--soft-shadow);
}

.case-card-button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(3, 7, 18, 0.42);
  transition: 0.25s ease;
}

.case-card-button:hover::after {
  background: rgba(3, 7, 18, 0.3);
}

.case-card-image {
  position: absolute;
  inset: 0;
}

.case-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.35s ease;
}

.case-card-button:hover .case-card-image img {
  transform: scale(1.04);
}

.case-card-content {
  position: relative;
  z-index: 2;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  color: var(--white);
}

.case-card-number {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.case-card-content h2 {
  max-width: 620px;
  color: var(--white);
  font-size: clamp(22px, 2vw, 34px);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.case-card-link {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

/* Portfolio testimonial */

.portfolio-testimonials {
  margin-top: 100px;
  padding: 0;
  text-align: center;
}

.testimonial-kicker {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.portfolio-testimonials h2 {
  margin-top: 12px;
  color: var(--text);
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.2;
}

.testimonial-card {
  max-width: 900px;
  margin: 28px auto 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #f8fafc;
  padding: 34px 38px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
  box-shadow: var(--soft-shadow);
}

.testimonial-card p + p {
  margin-top: 16px;
}

.testimonial-author {
  margin-top: 32px;
  display: grid;
  gap: 6px;
}

.testimonial-author strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.testimonial-author span {
  color: var(--muted);
  font-size: 15px;
}

/* Case study modal */

body.modal-open {
  overflow: hidden;
}

.case-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  padding: 24px;
}

.case-modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(5px);
  cursor: pointer;
}

.case-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  max-height: 88vh;
  overflow: auto;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 24px;
  background: var(--white);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.case-modal-close {
  position: sticky;
  top: 18px;
  float: right;
  z-index: 3;
  display: flex;
  width: 36px;
  height: 36px;
  margin: 18px 18px 0 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: 0.2s ease;
}

.case-modal-close:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.case-modal-content {
  padding: 44px;
}

.case-modal-kicker,
.case-modal-number,
.project-number,
.project-card-number {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.case-modal-content h2 {
  margin-top: 8px;
  color: var(--text);
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.05;
}

.case-modal-summary,
.project-summary,
.project-section-heading p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.case-modal-summary {
  margin-top: 18px;
  max-width: 820px;
}

.case-modal-image {
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #f8fafc;
}

.case-modal-image img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  background: #f8fafc;
}

.case-modal-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 32px;
}

.case-modal-info-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #f8fafc;
  padding: 20px;
}

.case-modal-info-card h3 {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.24em;
  line-height: 1.5;
  text-transform: uppercase;
}

.case-modal-info-card p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.project-sections {
  display: grid;
  gap: 48px;
  margin-top: 48px;
}

.project-section-heading {
  max-width: 820px;
}

.project-section-heading h3 {
  margin-top: 8px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.2;
}

.project-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.project-feature-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #f8fafc;
}

/* Popup gallery images */

.project-feature-image {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.project-feature-image img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: #f8fafc;
}

.gallery-btn {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  width: 38px;
  height: 38px;
  transform: translateY(-50%);
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  transition: 0.2s ease;
}

.gallery-btn:hover {
  background: var(--blue);
  color: var(--white);
}

.gallery-prev {
  left: 12px;
}

.gallery-next {
  right: 12px;
}

.gallery-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  border-radius: 999px;
  background: rgba(3, 7, 18, 0.84);
  padding: 4px 12px;
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.project-feature-card-content {
  padding: 18px;
}

.project-feature-card-content h4 {
  color: var(--text);
  font-size: 17px;
  line-height: 1.3;
}

.project-feature-card-content p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* Responsive */

@media (max-width: 980px) {
  .case-card-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 300px;
  }

  .case-card:nth-child(1),
  .case-card:nth-child(2),
  .case-card:nth-child(3),
  .case-card:nth-child(4),
  .case-card:nth-child(5) {
    grid-column: auto;
    grid-row: span 1;
  }

  .case-modal-info-grid,
  .project-feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .portfolio-intro {
    font-size: 15px;
  }

  .case-card-grid {
    grid-auto-rows: 260px;
    margin-top: 36px;
  }

  .case-card-content {
    padding: 24px;
  }

  .case-card-content h2 {
    font-size: 24px;
    letter-spacing: 0.1em;
  }

  .portfolio-testimonials {
    margin-top: 28px;
  }

  .portfolio-testimonials h2 {
    font-size: 24px;
  }

  .testimonial-card {
    margin-top: 22px;
    padding: 26px 22px;
    font-size: 16px;
  }

  .case-modal {
    padding: 16px;
  }

  .case-modal-panel {
    max-height: 90vh;
    border-radius: 22px;
  }

  .case-modal-content {
    padding: 32px 22px;
  }

  .case-modal-image img {
    height: 220px;
  }

  .project-feature-image img {
    height: 180px;
  }

  .gallery-btn {
    width: 34px;
    height: 34px;
    font-size: 28px;
  }
}