/*
 * Brochure mode - the popup on the page: bar with Print and Download, the frame,
 * the wait message; and the hidden frame used to print straight away.
 */

.brochure-dialog {
  width: min(1000px, 100vw);
  height: min(96vh, 100%);
  max-width: 100vw;
  max-height: 100vh;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  background: #525659;
  box-shadow: 0 12px 48px rgb(0 0 0 / 0.4);
}

/* Phones and small tablets: the whole screen, no rounded corners or margins.
   dvh follows the browser's own bars as they come and go. */
@media (max-width: 760px) {
  .brochure-dialog {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

.brochure-dialog[open] {
  display: flex;
}

.brochure-dialog::backdrop {
  background: rgb(0 0 0 / 0.55);
}

/* One line, also on phones: the status gives way and ends in an ellipsis if it must */
.brochure-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #FFFFFF;
  color: #292F36;
  font: 14px/1.4 system-ui, sans-serif;
}

.brochure-status {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #636363;
}

.brochure-bar button {
  flex: none;
}

.brochure-bar button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #C9CCC5;
  border-radius: 8px;
  cursor: pointer;
  background: #FFFFFF;
  color: inherit;
  font: 500 14px system-ui, sans-serif;
}

.brochure-bar button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Download only when the brochure button asked for it (.has-download); the last button is the blue one */
.brochure-dialog:not(.has-download) .brochure-bar-download {
  display: none;
}

.brochure-dialog:not(.has-download) .brochure-bar-print:not(:disabled),
.brochure-bar .brochure-bar-download:not(:disabled) {
  background: #00B1E2;
  border-color: #00B1E2;
}

.brochure-bar .brochure-close {
  min-width: 36px;
  padding: 0;
  border-color: transparent;
  font-size: 16px;
}

.brochure-stage {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
}

.brochure-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #525659;
}

/* While the page in the frame turns into the brochure, it's covered: no flicker */
.brochure-wait {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: #525659;
  color: #FFFFFF;
  font: 16px/1.5 system-ui, sans-serif;
  text-align: center;
}

.brochure-wait p {
  margin: 0;
  max-width: 36em;
}

.brochure-dialog.is-waiting .brochure-wait {
  display: flex;
}

.brochure-dialog.is-waiting .brochure-frame {
  visibility: hidden;
}

.brochure-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 3px solid rgb(255 255 255 / 0.3);
  border-top-color: #FFFFFF;
  animation: brochure-spin 0.9s linear infinite;
}

.brochure-spinner[hidden] {
  display: none;
}

@keyframes brochure-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brochure-spinner {
    animation-duration: 3s;
  }
}

/* Print straight away (brochure-print): the brochure is laid out out of sight, at a real width */
.brochure-hidden-frame {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1000px;
  height: 800px;
  border: 0;
}

[aria-busy="true"].brochure-button,
.brochure-button [aria-busy="true"] {
  cursor: progress;
}
