/*
 * Dedicated print stylesheet for szkolenie / konferencja / studia pages.
 * The .print-sheet element (rendered once, right before </body> — see
 * functions/print_sheet.php) is a self-contained, minimalist document.
 * On print (incl. Ctrl+P) it's the only thing shown — every other
 * on-screen element is suppressed below. This file is enqueued with
 * media="print" so none of it applies on screen; the base
 * `.print-sheet { display: none }` for screen lives in
 * single-szkolenie.css instead, which loads unconditionally.
 */

@media print {

    @page {
        size: A4;
        margin: 10mm 14mm 16mm;
    }

    html, body {
        background: #fff !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* .print-sheet is a direct child of <body> (sibling of header/main/footer).
       Belt-and-suspenders: also name the usual suspects explicitly, in case
       a plugin/admin-bar print rule elsewhere has higher specificity than
       the blanket body>* rule and would otherwise leave a blank block of
       reserved space (e.g. a fixed-header offset) above the print sheet. */
    body > *:not(.print-sheet),
    #wpadminbar,
    .site-header,
    .nav-top,
    main,
    #main-content,
    .site-footer {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-sheet {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #1A1A25;
        background: #fff;
        font-family: var(--wp--preset--font-family--text, 'EYInterstate', Arial, sans-serif);
        font-size: 10.5pt;
        line-height: 1.5;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-sheet * {
        box-sizing: border-box;
    }

    /* ---------- Header ---------- */

    .print-sheet__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding-bottom: 12px;
        border-bottom: 2px solid #1A1A25;
        margin-bottom: 20px;
    }

    .print-sheet__logo {
        width: 120px;
        height: auto;
    }

    .print-sheet__logo-text {
        font-weight: 700;
        font-size: 13pt;
        letter-spacing: 0.02em;
    }

    .print-sheet__badge {
        font-size: 8.5pt;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #430B8E;
        border: 1px solid #430B8E;
        border-radius: 999px;
        padding: 4px 12px;
    }

    /* ---------- Title / lead ---------- */

    .print-sheet__title {
        font-size: 20pt;
        line-height: 1.25;
        font-weight: 700;
        margin: 0 0 8px;
        color: #1A1A25;
    }

    .print-sheet__lead {
        font-size: 11pt;
        color: #2E2E39;
        margin: 0 0 18px;
        max-width: 90%;
    }

    .print-sheet__cta {
        margin: 0 0 22px;
        break-inside: avoid;
    }

    .print-sheet__cta-btn {
        background: #430B8E;
        border-radius: 4px;
        padding: 0;
    }

    .print-sheet__cta-btn a {
        display: inline-block;
        padding: 10px 20px;
        font-size: 10pt;
        font-weight: 700;
        color: #ffffff !important;
        text-decoration: none !important;
    }

    /* ---------- Meta facts ---------- */

    .print-sheet__meta {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px 24px;
        margin: 0 0 24px;
        padding: 14px 16px;
        background: #F5F5FC;
        border-radius: 4px;
        break-inside: avoid;
    }

    .print-sheet__meta-item {
        margin: 0;
    }

    .print-sheet__meta-item dt {
        font-size: 7.5pt;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #747481;
        margin: 0 0 2px;
    }

    .print-sheet__meta-item dd {
        font-size: 10.5pt;
        font-weight: 600;
        color: #1A1A25;
        margin: 0;
    }

    /* ---------- Sections ---------- */

    .print-sheet__section {
        margin: 0 0 22px;
    }

    /* Trenerzy/Prelegenci i Kontakt zaczynają nową stronę tylko gdy i tak by
       się nie zmieściły na bieżącej — unika pustych stron przy krótkiej
       treści, a i tak nigdy nie łamie się w środku sekcji. */
    .print-sheet__section--people,
    .print-sheet__section--contacts {
        break-inside: avoid-page;
        page-break-inside: avoid;
    }

    /* Program: same "keep together" treatment - a lone "Program" heading
       stranded at the bottom of a page with the actual list pushed to the
       next one (reported case) means break-after: avoid-page on the title
       alone wasn't enough. Forcing the whole section to move as one unit
       fixes it whenever it fits on a fresh page; if the program itself is
       longer than a full page, the engine still overrides this and breaks
       inside as a last resort. */
    .print-sheet__section--program,
    .print-sheet__section--harmonogram {
        break-inside: avoid-page;
        page-break-inside: avoid;
    }

    .print-sheet__section-title {
        font-size: 12.5pt;
        font-weight: 700;
        color: #1A1A25;
        margin: 0 0 10px;
        padding-bottom: 6px;
        border-bottom: 1px solid #C5C5CD;
        /* Never let a section title land alone at the bottom of a page with
           its content pushed to the next one ("Program" orphaned on its own
           line was the reported case) — force the break above the heading
           instead, not after it. */
        break-after: avoid-page;
        page-break-after: avoid;
    }

    /* ---------- Dates (edycje szkolenia) ---------- */

    .print-sheet__section--dates {
        margin: 0 0 22px;
    }

    .print-sheet__dates {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px 24px;
    }

    .print-sheet__date-item {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        padding: 6px 10px;
        background: #F5F5FC;
        border-radius: 4px;
        break-inside: avoid;
    }

    .print-sheet__date-label {
        font-size: 9pt;
        color: #747481;
    }

    .print-sheet__date-value {
        font-size: 9.5pt;
        font-weight: 700;
        color: #1A1A25;
        font-variant-numeric: tabular-nums;
    }

    /* Never let this drift alone onto a fresh page when the harmonogram
       list itself barely fit the previous one — keep it glued to whatever
       came right before it. Also keep the note itself from splitting mid-
       way (it's one paragraph with several <br>-separated lines - e.g.
       exam/schedule remarks followed by the "łączenie edycji" remark -
       and without break-inside a page break could land between two of
       those lines). */
    .print-sheet__harmonogram-note {
        break-before: avoid-page;
        page-break-before: avoid;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* ---------- Content (Opis tab) ---------- */

    .print-sheet__section--content {
        margin: 0 0 22px;
    }

    .print-sheet__content-block {
        margin: 0 0 16px;
        break-inside: avoid;
    }

    .print-sheet__content-title {
        font-size: 11.5pt;
        font-weight: 700;
        color: #1A1A25;
        margin: 0 0 5px;
    }

    .print-sheet__content-lead {
        font-size: 9.5pt;
        color: #2E2E39;
        margin: 0 0 6px;
        white-space: pre-line;
    }

    /* Rich WYSIWYG blocks (e.g. "Cele i korzyści") keep their real
       paragraph/bullet structure instead of being flattened into one
       run-on line of text. */
    .print-sheet__content-lead--rich {
        font-size: 9.5pt;
        color: #2E2E39;
        margin: 0 0 6px;
    }

    .print-sheet__content-lead--rich p {
        margin: 0 0 8px;
    }

    .print-sheet__content-lead--rich p:last-child {
        margin-bottom: 0;
    }

    .print-sheet__content-lead--rich ul,
    .print-sheet__content-lead--rich ol {
        list-style: disc;
        margin: 0 0 10px;
        padding: 0 0 0 16px;
    }

    .print-sheet__content-lead--rich ol {
        list-style: decimal;
    }

    .print-sheet__content-lead--rich ul:last-child,
    .print-sheet__content-lead--rich ol:last-child {
        margin-bottom: 0;
    }

    .print-sheet__content-lead--rich li {
        padding: 2px 0;
        break-inside: avoid;
    }

    .print-sheet__content-lead--rich strong,
    .print-sheet__content-lead--rich b {
        color: #1A1A25;
    }

    /* Highlighted note box (ACF "Ramka informacyjna") — same purple-tint
       treatment as the on-screen .sp-info-box. */
    .print-sheet__content-note {
        margin: 0 0 10px;
        padding: 10px 12px;
        background: #FAF8FF;
        border: 1px solid #E7E2F3;
        border-radius: 4px;
        font-size: 9pt;
        color: #430B8E;
        break-inside: avoid;
    }

    .print-sheet__content-items {
        list-style: disc;
        margin: 0;
        padding: 0 0 0 16px;
    }

    .print-sheet__content-items li {
        font-size: 9.5pt;
        padding: 2px 0;
    }

    .print-sheet__content-items li strong {
        color: #1A1A25;
    }

    .print-sheet__content-items li span {
        display: block;
        color: #747481;
        font-size: 9pt;
    }

    /* ---------- Reviews ---------- */

    .print-sheet__review-item {
        margin: 0 0 10px;
        break-inside: avoid;
    }

    .print-sheet__review-stars {
        display: block;
        color: #DF006E;
        font-size: 10pt;
        letter-spacing: 1px;
        margin: 0 0 2px;
    }

    .print-sheet__review-text {
        font-size: 9.5pt;
        font-style: italic;
        color: #2E2E39;
        margin: 0 0 2px;
    }

    .print-sheet__review-name {
        font-size: 9pt;
        font-weight: 600;
        color: #1A1A25;
        margin: 0;
    }

    /* ---------- FAQ ---------- */

    .print-sheet__faq-item {
        margin: 0 0 10px;
        break-inside: avoid;
    }

    .print-sheet__faq-q {
        font-weight: 700;
        font-size: 9.5pt;
        color: #1A1A25;
        margin: 0 0 2px;
        /* Long answers can make the whole .print-sheet__faq-item too tall to
           keep together (its own break-inside: avoid then gets overridden
           by the engine) — protect the question itself so a forced break
           always lands before it or after the answer, never mid-question
           or right between question and answer. */
        break-inside: avoid;
        break-after: avoid;
    }

    .print-sheet__faq-a {
        font-size: 9pt;
        color: #2E2E39;
        margin: 0;
    }

    /* ---------- Program ---------- */

    .print-sheet__program-group {
        margin: 0 0 14px;
    }

    /* Individual items (below) each have their own break-inside: avoid, which
       is enough to stop a single module's text splitting across pages —
       avoiding a break inside the whole GROUP too would force the entire
       module list to jump to a page as one atomic block whenever it doesn't
       fit the space left under the heading, stranding "Program" alone with a
       long blank gap before it (reported case). Letting the list itself
       paginate freely between items fixes that. */

    .print-sheet__program-group-label {
        font-size: 10pt;
        font-weight: 700;
        color: #DF006E;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin: 0 0 6px;
        break-after: avoid-page;
        page-break-after: avoid;
    }

    .print-sheet__program-list {
        list-style: none;
        margin: 0;
        padding: 0;
        counter-reset: sp-program;
    }

    .print-sheet__program-item {
        counter-increment: sp-program;
        padding: 7px 0 7px 26px;
        border-top: 1px solid #E7E2F3;
        position: relative;
        break-inside: avoid;
    }

    .print-sheet__program-item:first-child {
        border-top: none;
    }

    .print-sheet__program-item::before {
        content: counter(sp-program) ".";
        position: absolute;
        left: 0;
        top: 7px;
        font-weight: 700;
        color: #430B8E;
        font-size: 9.5pt;
    }

    .print-sheet__program-item-row {
        display: flex;
        align-items: baseline;
        gap: 10px;
    }

    /* "Ostatnie miejsca" / "Brak miejsc" — same yellow-tag convention as the
       on-screen harmonogram (.sp-harm-tag), pushed flush right on the row. */
    .print-sheet__slots-badge {
        margin-left: auto;
        flex: 0 0 auto;
        font-size: 8pt;
        font-weight: 700;
        border-radius: 4px;
        padding: 2px 7px;
        white-space: nowrap;
    }

    .print-sheet__slots-badge--last {
        background: #FFE500;
        color: #1A1A25;
    }

    .print-sheet__slots-badge--full {
        background: #ECECEF;
        color: #747481;
    }

    .print-sheet__program-item-meta {
        flex: 0 0 95px;
        font-size: 8.5pt;
        font-weight: 600;
        color: #747481;
        font-variant-numeric: tabular-nums;
    }

    .print-sheet__program-item-title {
        font-weight: 600;
        color: #1A1A25;
    }

    .print-sheet__program-item-desc {
        margin: 3px 0 0;
        font-size: 9pt;
        color: #2E2E39;
    }

    /* ---------- People ---------- */

    .print-sheet__people-group {
        margin: 0 0 14px;
    }

    .print-sheet__people-group-label {
        font-size: 10pt;
        font-weight: 700;
        color: #DF006E;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin: 0 0 6px;
    }

    .print-sheet__people {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .print-sheet__person {
        padding: 7px 0;
        border-top: 1px solid #E7E2F3;
        break-inside: avoid;
    }

    .print-sheet__person:first-child {
        border-top: none;
    }

    .print-sheet__person-head {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: space-between;
        gap: 2px 10px;
    }

    .print-sheet__person-name {
        font-weight: 600;
        flex-shrink: 0;
    }

    .print-sheet__person-role {
        color: #747481;
        font-size: 9pt;
        flex: 1 1 auto;
        min-width: 200px;
        text-align: right;
    }

    .print-sheet__person-bio {
        margin: 3px 0 0;
        font-size: 9pt;
        color: #2E2E39;
    }

    /* ---------- Contacts ---------- */

    .print-sheet__contacts {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px 24px;
    }

    .print-sheet__contact {
        display: flex;
        flex-direction: column;
        gap: 1px;
        padding: 8px 10px;
        background: #FBDDEC;
        border-radius: 4px;
        break-inside: avoid;
    }

    .print-sheet__contact-name {
        font-weight: 700;
        font-size: 9.5pt;
    }

    .print-sheet__contact-line {
        font-size: 9pt;
        color: #2E2E39;
    }

    /* ---------- Footer ---------- */

    .print-sheet__footer {
        margin-top: 28px;
        padding-top: 10px;
        border-top: 1px solid #C5C5CD;
        display: flex;
        justify-content: space-between;
        font-size: 8pt;
        color: #747481;
    }

    /* Running page number, bottom-right of every printed page */
    @page {
        @bottom-right {
            content: "Strona " counter(page) " / " counter(pages);
            font-size: 8pt;
            color: #747481;
        }
    }
}
