/* ==========================================================================================================
   Print styles (certificates, class lists, progress tables). Linked on every page; screen rules are limited to the
   certificate frame and `.print-only`.

   Helpers:   .no-print    hidden on paper          .print-only  visible on paper only
              .print-break  page break before        .print-avoid  keep together (cards, rows)
   Certificate markup (student UI, `#/certificate/:sectionId`):
     <article class="certificate">
       <div class="certificate-seal" aria-hidden="true">🏆</div>
       <h1 class="certificate-title">Oklevél</h1>
       <p class="certificate-lead">Ezt az oklevelet kapja:</p>
       <p class="certificate-name">Kiss Anna</p>
       <p class="certificate-text">a „Mozgás” pályák sikeres teljesítéséért.</p>
       <div class="certificate-meta"><span>4.A osztály</span><span>2026. október 5.</span><span>Iskola neve</span></div>
     </article>
   ========================================================================================================== */

.print-only { display: none; }

.certificate {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5em;
  width: 100%; max-width: 1040px; aspect-ratio: 297 / 210; margin: 0 auto; padding: 5% 6%;
  text-align: center; color: #2b2110;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 214, 120, 0.35), transparent 22%),
    radial-gradient(circle at 88% 86%, rgba(255, 214, 120, 0.35), transparent 22%),
    #fffdf5;
  border: 16px double #c28a00; border-radius: 18px; box-shadow: var(--sh-3);
}
.certificate::before {
  content: ""; position: absolute; inset: 14px; border: 3px solid #e8c25a; border-radius: 6px; pointer-events: none;
}
.certificate-seal { font-size: clamp(2.4rem, 7vw, 5rem); line-height: 1; }
.certificate-title { margin: 0; font-size: clamp(1.8rem, 6vw, 4rem); font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: #9a6a00; }
.certificate-lead { margin: 0; font-size: clamp(0.9rem, 2.2vw, 1.5rem); color: #5c4a1e; }
.certificate-name { margin: 0.1em 0; padding: 0 0.8em 0.1em; font-size: clamp(1.8rem, 6.5vw, 4.4rem); font-weight: 900; border-bottom: 4px solid #e0b64a; line-height: 1.15; overflow-wrap: anywhere; }
.certificate-text { margin: 0; max-width: 34em; font-size: clamp(1rem, 2.6vw, 1.8rem); line-height: 1.4; }
.certificate-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4em 2em; margin-top: 1em; font-weight: 800; color: #5c4a1e; font-size: clamp(0.8rem, 1.8vw, 1.2rem); }

@page certificate { size: A4 landscape; margin: 0; }

@media print {
  @page { size: A4 portrait; margin: 14mm; }

  html, body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  body::before, .topbar, .nav, .offline-banner, .toast-root, .modal-root, .boot, .skip-link, .no-print, .tabs, .btn, .pagination { display: none !important; }
  .app-main { padding: 0 !important; }
  .page { max-width: none; padding: 0; }
  .print-only { display: block !important; }
  .print-break { break-before: page; }
  .print-avoid, .card, .stat-tile, tr { break-inside: avoid; }
  .card { box-shadow: none !important; border: 1px solid #999 !important; }
  a { color: inherit; text-decoration: none; }
  h1, h2, h3 { break-after: avoid; }

  .table-wrap { overflow: visible; border: 1px solid #888; border-radius: 0; }
  .table { font-size: 10pt; }
  .table th { position: static; background: #eee !important; color: #000; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .table th, .table td { border-bottom: 1px solid #bbb; }
  .progress { border: 1px solid #888; background: #fff; }
  .progress-bar { background: #555 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .chip { border: 1px solid #888; background: #fff !important; color: #000 !important; }

  .certificate {
    page: certificate; width: 100vw; max-width: none; height: 100vh; aspect-ratio: auto; margin: 0; border-radius: 0; box-shadow: none;
    border-width: 18px; print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
}

/* ------------------------------------------------------------------------------------------ certificate */
.cert-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.cert-bar-title { margin: 0; font-size: var(--fs-xl); flex: 1; text-align: center; }
.cert-bar .flip { transform: rotate(180deg); }
.cert-tip { margin: 0; text-align: center; font-size: var(--fs-sm); max-width: 62ch; align-self: center; }
/* room for the signature row at the bottom of the (absolutely positioned) foot */
.certificate { padding-bottom: 15%; }
.certificate-stars { margin: 0; font-weight: 900; color: #9a6a00; font-size: clamp(0.95rem, 2.2vw, 1.5rem); }
.certificate-foot { position: absolute; left: 7%; right: 7%; bottom: 6%; display: flex; align-items: flex-end; justify-content: space-between; pointer-events: none; }
.certificate-robi svg.robot { width: clamp(44px, 8vw, 84px); height: auto; display: block; }
.certificate-sign { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-style: italic; color: #5c4a1e; font-size: clamp(0.7rem, 1.5vw, 1.05rem); }
.certificate-sign i { display: block; width: clamp(110px, 20vw, 240px); border-top: 2px solid #c28a00; }
@media screen and (max-width: 700px) {
  .certificate { aspect-ratio: auto; padding: 28px 16px 20px; border-width: 10px; gap: 0.6em; }
  .certificate::before { inset: 8px; }
  .certificate-foot { position: static; width: 100%; margin-top: 0.6em; }
}

/* teacher view of a pupil's certificate: the menu and the page header stay off the paper */
@media print {
  body.t-cert-print .t-nav, body.t-cert-print .t-crumb-host, body.t-cert-print .t-header-host { display: none !important; }
  body.t-cert-print .t-page, body.t-cert-print .t-body { display: block; padding: 0; margin: 0; }
}
