/* Keep print view off-screen in normal browsing — rendered at real width so SVG
   layout is computed and position:absolute token overlays have correct dimensions. */
@media screen {
  .bb-print-view {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 277mm;
    pointer-events: none;
    z-index: -1;
  }
}

/* Print layout — single landscape page */
@media print {
  @page {
    size: landscape;
    margin: 5mm;
  }

  /* Hide the app root — targets only #root, not portal siblings */
  body > #root {
    display: none !important;
  }

  /* Flex column — pitch has fixed max-height, notes flow below naturally */
  body > .bb-print-view {
    position: static !important;
    left: auto !important;
    width: 100% !important;
    padding: 0;
    box-sizing: border-box;
    background: white;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    z-index: auto;
  }

  /* ── Header ─────────────────────────────────────── */

  .bb-print-view .bb-print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
    padding: 3mm 4mm 2mm;
  }

  .bb-print-view .bb-print-header-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1mm;
  }

  .bb-print-view .bb-print-header-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    margin-left: 4mm;
  }

  .bb-print-view .bb-print-logo {
    height: 10mm;
    width: auto;
    display: block;
    object-fit: contain;
  }

  .bb-print-view .bb-print-name {
    font-family: 'Anton', Impact, sans-serif;
    font-size: 16pt;
    letter-spacing: 0.05em;
    color: #1a1714;
    margin: 0;
    line-height: 1.1;
  }

  .bb-print-view .bb-print-qr {
    width: 22mm;
    height: 22mm;
    display: block;
  }

  .bb-print-view .bb-print-url {
    display: none;
  }

  /* ── Footer ─────────────────────────────────────── */

  .bb-print-view .bb-print-footer {
    font-family: 'Anton', Impact, sans-serif;
    font-size: 7pt;
    letter-spacing: 0.1em;
    color: #aaa;
    text-align: center;
    margin: 0;
    padding: 2mm 0 0;
    break-after: avoid;
  }

  /* ── Pitch — aspect-ratio container keeps SVG and HTML overlay aligned ──── */

  .bb-print-view .bb-print-pitch {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
  }

  /* bb-print-pitch-inner: fills the flex item, aspect-ratio kept by SVG viewBox.
     Width 100% ensures SVG fills the available width; HTML overlays align correctly. */
  .bb-print-view .bb-print-pitch-inner {
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
  }

  .bb-print-view .bb-print-pitch-inner svg {
    width: 100% !important;
    height: auto !important;
    display: block;
  }

  /* ── Coach notes ────────────────────────────────── */

  .bb-print-view .bb-print-notes-section {
    break-before: page; /* coach notes always start on a new page */
    padding-top: 6mm;
  }

  .bb-print-view .bb-print-notes-label {
    font-family: 'Anton', Impact, sans-serif;
    font-size: 7pt;
    letter-spacing: 0.12em;
    color: #888;
    margin: 0 0 1.5mm;
  }

  .bb-print-view .bb-print-notes-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 10pt;
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
    margin: 0;
  }
}
