.pp-preview img {
  object-fit: contain;
}

.pp-brand-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 40px;
}

.pp-brand-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: 5px;
}

.pp-brand-copy {
  flex: 1;
  min-width: 0;
}

.pp-brand-open {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--orange-border);
  border-radius: 6px;
  background: var(--orange-dim);
  color: var(--orange);
  font: 700 12px/1.5 'Montserrat', sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}

.pp-brand-open img {
  width: 16px;
  height: 16px;
  filter: invert(1);
}

body.pp-gallery-open {
  overflow: hidden;
}

.pp-gallery-open #cursor,
.pp-gallery-open #cursor-ring {
  visibility: hidden;
}

/* Native dialogs sit above the site's custom cursor in the browser top layer. */
.pp-dialog,
.pp-dialog::backdrop {
  cursor: default;
}

.pp-dialog {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(1120px, calc(100vw - 32px));
  height: min(920px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--frost-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--white);
  box-shadow: 0 24px 100px rgba(0, 0, 0, .7);
}

.pp-dialog[open] {
  display: flex;
  flex-direction: column;
}

.pp-dialog::backdrop {
  background: rgba(0, 0, 0, .88);
}

.pp-dialog-top {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--frost-border);
}

.pp-dialog-top > div:first-child {
  min-width: 0;
}

.pp-dialog-top h2 {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0;
}

.pp-dialog-top p {
  margin-top: 4px;
  color: var(--white-dim);
  font-size: 12px;
  line-height: 1.5;
}

.pp-dialog-tools {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.pp-dialog-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--frost-border);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--white);
  cursor: pointer;
}

.pp-dialog-icon img {
  display: block;
  width: 22px;
  height: 22px;
  max-height: none;
  background: none;
  filter: invert(1);
}

.pp-dialog-icon:hover,
.pp-brand-open:hover {
  border-color: var(--orange);
}

.pp-dialog-stage {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 16px;
  flex: 1 1 0;
  min-height: 0;
  padding: 16px;
  touch-action: pan-y pinch-zoom;
}

.pp-dialog-image-wrap {
  position: relative;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

#pp-dialog-img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
}

#pp-dialog-img[hidden] {
  display: none;
}

.pp-dialog-image-wrap[aria-busy='true'] #pp-dialog-img {
  opacity: 0;
}

.pp-dialog-loader:not([hidden]) {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid var(--frost-border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: pp-image-loading .8s linear infinite;
}

.pp-dialog-error:not([hidden]) {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  text-align: center;
}

.pp-dialog-error a {
  color: var(--orange);
  cursor: pointer;
}

.pp-dialog-bottom {
  flex: 0 0 auto;
  min-width: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--frost-border);
}

.pp-dialog-thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--orange) var(--bg3);
}

.pp-dialog-thumbnail {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 3px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--bg3);
  cursor: pointer;
}

.pp-dialog-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.pp-dialog-thumbnail[aria-current='true'] {
  border-color: var(--orange);
}

.pp-page :is(a, button):focus-visible,
.pp-dialog :is(a, button):focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

@keyframes pp-image-loading {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .pp-brand-head {
    flex-wrap: wrap;
  }

  .pp-brand-copy {
    flex: 1 0 calc(100% - 54px);
  }

  .pp-brand-open {
    margin-left: 54px;
  }

  .pp-dialog {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
  }

  .pp-dialog-top {
    padding: 12px;
  }

  .pp-dialog-top h2 {
    font-size: 16px;
  }

  .pp-dialog-stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 44px;
    gap: 12px;
    padding: 12px;
  }

  .pp-dialog-image-wrap {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .pp-dialog-prev {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
  }

  .pp-dialog-next {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .pp-dialog-bottom {
    padding: 8px;
  }

  .pp-dialog-thumbnail {
    flex-basis: 54px;
    width: 54px;
    height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp-dialog-loader:not([hidden]) {
    animation: none;
  }
}
