.gallery-page {
  color: #201e24;
  background:
    radial-gradient(circle at 10% 12%, rgba(183, 76, 110, 0.1), transparent 30rem),
    radial-gradient(circle at 86% 8%, rgba(69, 105, 177, 0.1), transparent 34rem),
    #e5e4e8;
}

.gallery-page #signal-canvas {
  opacity: 0.2;
}

.gallery-page .site-header-nav a[href="./about.html"]::after {
  transform: scaleX(1);
}

.gallery-main {
  position: relative;
  z-index: 2;
  width: calc(100% - 32px);
  max-width: 1540px;
  margin: 0 auto;
  padding-top: 116px;
}

.gallery-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(760px, 78svh);
  padding: 90px 28px 70px;
  border: 1px solid rgba(46, 41, 54, 0.12);
  border-radius: 34px;
  text-align: center;
  background:
    radial-gradient(circle at 8% 88%, rgba(198, 76, 108, 0.48), transparent 32%),
    radial-gradient(circle at 48% 106%, rgba(123, 78, 161, 0.46), transparent 36%),
    radial-gradient(circle at 88% 84%, rgba(67, 102, 177, 0.5), transparent 34%),
    linear-gradient(145deg, #dcdae0, #c7cad3);
  box-shadow: 0 28px 82px rgba(49, 43, 59, 0.13);
}

.gallery-kicker {
  margin: 0 0 20px;
  color: #5f5867;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.gallery-hero h1 {
  max-width: 1120px;
  margin: 0;
  color: #1e1c22;
  font-size: clamp(4rem, 8vw, 9.6rem);
  line-height: 0.84;
  letter-spacing: -0.078em;
  text-shadow: none;
}

.gallery-hero > p:not(.gallery-kicker) {
  max-width: 720px;
  margin: 34px auto 0;
  color: #554f5b;
  font-size: clamp(1rem, 1.25vw, 1.14rem);
  line-height: 1.65;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 38px;
}

.gallery-filters button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid rgba(40, 36, 47, 0.16);
  border-radius: 999px;
  color: #4e4854;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 820;
  background: rgba(246, 245, 248, 0.48);
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.gallery-filters button:hover,
.gallery-filters button:focus-visible,
.gallery-filters button.active {
  color: #fff;
  background: #25222a;
  transform: translateY(-2px);
}

.template-gallery {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  padding: 112px 0 18px;
  scroll-margin-top: 108px;
}

.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  grid-column: span 5;
  min-height: 690px;
  padding: 12px 12px 0;
  overflow: hidden;
  border: 1px solid rgba(43, 38, 50, 0.12);
  border-radius: 28px;
  background: rgba(244, 243, 246, 0.76);
  box-shadow: 0 24px 68px rgba(48, 42, 57, 0.12);
  transition: box-shadow 280ms ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.template-card-wide {
  grid-column: span 7;
}

.template-card-tall:nth-of-type(2),
.template-card-wide:nth-of-type(5) {
  min-height: 760px;
}

.template-card:hover,
.template-card:focus-within {
  box-shadow: 0 34px 88px rgba(48, 42, 57, 0.2);
  transform: translateY(-8px);
}

.template-card[hidden] {
  display: none;
}

.template-browser {
  position: relative;
  flex: 1;
  min-height: 520px;
  overflow: hidden;
  border-radius: 19px;
  background: #18161d;
}

.template-card-tall .template-browser {
  min-height: 590px;
}

.template-browser-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  background: #1d1b22;
}

.template-browser-bar span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ff747a;
}

.template-browser-bar span:nth-child(2) {
  background: #ffc35c;
}

.template-browser-bar span:nth-child(3) {
  background: #69d88a;
}

.template-browser-bar b {
  position: absolute;
  left: 50%;
  font-size: 0.6rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
}

.template-viewport {
  position: absolute;
  inset: 34px 0 0;
  overflow: hidden;
  background: #f0eff2;
}

.template-viewport iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 900px;
  border: 0;
  pointer-events: none;
  transform-origin: 0 0;
}

.template-card-copy {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.52fr);
  gap: 24px;
  align-items: end;
  padding: 26px 12px 28px;
}

.template-card-copy span {
  color: #77717e;
  font-size: 0.65rem;
  font-weight: 820;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.template-card-copy h2 {
  margin: 8px 0 0;
  color: #232027;
  font-size: clamp(1.9rem, 3vw, 3.8rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
  text-shadow: none;
}

.template-card-copy p {
  margin: 0;
  color: #625d68;
  font-size: 0.82rem;
  line-height: 1.55;
}

.template-open {
  position: absolute;
  inset: 0;
  z-index: 4;
  color: transparent;
}

.template-open span,
.template-open b {
  position: absolute;
  right: 24px;
  bottom: 26px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.template-open:focus-visible {
  outline: 4px solid #5ad9df;
  outline-offset: -6px;
}

.gallery-closing {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 32px;
  min-height: 420px;
  margin-top: 96px;
  padding: clamp(48px, 7vw, 102px);
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 10% 86%, rgba(201, 71, 103, 0.66), transparent 34%),
    radial-gradient(circle at 84% 82%, rgba(65, 101, 179, 0.7), transparent 36%),
    #2c2933;
  box-shadow: 0 28px 80px rgba(47, 40, 57, 0.18);
}

.gallery-closing p {
  max-width: 860px;
  margin: 0;
  color: #fff;
  font-size: clamp(2.6rem, 5vw, 6rem);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

.gallery-closing a {
  flex: 0 0 auto;
  padding: 15px 20px;
  border-radius: 999px;
  color: #28242e;
  font-size: 0.78rem;
  font-weight: 850;
  background: #fff;
}

.gallery-page .site-footer {
  width: min(1540px, calc(100% - 32px));
}

@media (max-width: 1080px) {
  .template-card,
  .template-card-wide {
    grid-column: span 6;
  }

  .template-card-copy {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 900px) {
  .gallery-main {
    width: calc(100% - 16px);
    padding-top: 86px;
  }

  .gallery-hero {
    min-height: 670px;
    padding: 80px 20px 64px;
    border-radius: 26px;
  }

  .gallery-hero h1 {
    font-size: clamp(4rem, 14vw, 7rem);
  }

  .template-gallery {
    padding-top: 78px;
  }

  .template-card,
  .template-card-wide {
    grid-column: 1 / -1;
    min-height: 680px;
  }

  .template-card-tall .template-browser,
  .template-browser {
    min-height: 540px;
  }

  .gallery-closing {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    border-radius: 26px;
  }
}

@media (max-width: 560px) {
  .gallery-hero {
    min-height: 620px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .gallery-hero h1 {
    font-size: clamp(3.65rem, 16vw, 5.4rem);
  }

  .gallery-filters {
    gap: 6px;
  }

  .gallery-filters button {
    padding: 0 13px;
  }

  .template-card,
  .template-card-wide {
    min-height: 610px;
    padding: 8px 8px 0;
    border-radius: 22px;
  }

  .template-card-tall .template-browser,
  .template-browser {
    min-height: 460px;
    border-radius: 16px;
  }

  .template-card-copy {
    padding: 22px 8px 24px;
  }

  .gallery-closing {
    min-height: 500px;
    padding: 38px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .template-card,
  .gallery-filters button {
    transition: none;
  }
}
