/* ==========================================================================
   PDF POPUP
   Paired with assets/js/skagit-pdf-modal.js.

   Sized in viewport units because the useful thing in this dialog is the
   document itself: a letter-size form needs height above all else, so the
   panel takes most of the screen rather than sitting in a small box the guest
   then has to scroll twice.
   ========================================================================== */

.skagit-pdfm {
  width: min(60rem, 94vw);
  max-width: 94vw;
  height: min(90vh, 60rem);
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--sk-white, #fff);
  box-shadow:
    0 30px 80px rgba(6, 25, 43, 0.45),
    0 6px 18px rgba(6, 25, 43, 0.3);
  overflow: hidden;
}

/* The dialog is a flex column so the frame can take all remaining height. */
.skagit-pdfm[open] {
  display: flex;
  flex-direction: column;
}

.skagit-pdfm::backdrop {
  background: rgba(6, 25, 43, 0.62);
}

.skagit-pdfm__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(6, 25, 43, 0.12);
  background: var(--sk-navy-900, #04101c);
}

.skagit-pdfm__title {
  margin: 0;
  color: var(--sk-white, #fff);
  font-family: var(--sk-font-display, serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
}

.skagit-pdfm__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.skagit-pdfm__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 4px;
  background: transparent;
  color: var(--sk-gold-200, #f0dfa8);
  font-family: var(--sk-font-body, sans-serif);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.skagit-pdfm__btn:hover,
.skagit-pdfm__btn:focus-visible {
  background: var(--sk-gold-400, #e3c566);
  color: var(--sk-navy-900, #04101c);
}

.skagit-pdfm__btn--close {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--sk-white, #fff);
}

.skagit-pdfm__frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;          /* without this a flex child refuses to shrink */
  border: 0;
  background: #f3f5f7;
}

/* On a phone the chrome has to give way to the document. */
@media (max-width: 40em) {
  .skagit-pdfm {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .skagit-pdfm__bar {
    padding: 0.6rem 0.7rem;
  }

  .skagit-pdfm__title {
    flex: 1 0 100%;
    font-size: 0.95rem;
  }

  .skagit-pdfm__btn {
    flex: 1 1 auto;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
  }
}

/*
 * When the guest prints the PAGE (not the PDF), the dialog must not appear in
 * the output — the print button inside it prints the document itself.
 */
@media print {
  .skagit-pdfm,
  .skagit-pdfm::backdrop {
    display: none !important;
  }
}
