/* ============================================================
   Creamy Bite – printable documents
   (product catalogue, allergen & nutrition sheet, storage guide)

   Two jobs: make these readable on screen, and make them come out of a
   printer — or a "Save as PDF" — looking like a document rather than a
   web page with the navigation chopped off.

   Sizes are in mm/pt inside the print block on purpose. Browsers map
   physical units onto paper predictably; px does not, and a table sized in
   px is what produces a catalogue that runs off the right edge of an A4
   sheet on one machine and fits on another.
   ============================================================ */

.cbdoc-body {
    background: var(--bg-main);
    margin: 0;
}

/* ── Toolbar (screen only) ─────────────────────────────── */
.cbdoc-toolbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    padding: 14px 0 11px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.cbdoc-toolbar-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.cbdoc-toolbar-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.cbdoc-toolbar-back:hover { color: var(--color-primary); }
.cbdoc-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.cbdoc-toolbar-link {
    font-size: 14px;
    color: var(--color-primary);
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}
.cbdoc-toolbar-link:hover { background: var(--bg-main); }
.cbdoc-print-btn { display: inline-flex; align-items: center; gap: 8px; }
.cbdoc-toolbar-hint {
    max-width: 900px;
    margin: 9px auto 0;
    padding: 0 22px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* ── The sheet ─────────────────────────────────────────── */
.cbdoc-sheet {
    max-width: 900px;
    margin: 26px auto 60px;
    background: #fff;
    padding: 40px 44px 30px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.07);
    color: #1a1a1a;
}

.cbdoc-head {
    display: flex;
    align-items: flex-start;
    gap: 22px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--color-primary);
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.cbdoc-logo      { height: 52px; width: auto; }
.cbdoc-head-text { flex: 1 1 260px; }
.cbdoc-title     { font-size: 26px; margin: 0 0 3px; color: var(--color-primary); line-height: 1.2; }
.cbdoc-subtitle  { margin: 0; font-size: 14.5px; color: #555; }
.cbdoc-head-meta { text-align: right; font-size: 12.5px; color: #555; line-height: 1.6; }
.cbdoc-issued    { font-weight: 700; color: #1a1a1a; margin-bottom: 3px; }

.cbdoc-sheet h2 {
    font-size: 18px;
    margin: 30px 0 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid #e2e2e2;
    color: var(--color-primary);
}
.cbdoc-sheet h2:first-of-type { margin-top: 0; }
.cbdoc-sheet h3 { font-size: 15px; margin: 20px 0 8px; }
.cbdoc-sheet p  { font-size: 14px; line-height: 1.65; color: #333; }

.cbdoc-intro {
    background: #faf7f4;
    border-left: 3px solid var(--color-secondary);
    padding: 14px 18px;
    margin-bottom: 26px;
    font-size: 13.5px;
    line-height: 1.7;
}

/* ── Tables ────────────────────────────────────────────── */
.cbdoc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 26px;
    font-size: 13px;
}
.cbdoc-table th {
    background: var(--color-primary);
    color: #fff;
    text-align: left;
    padding: 9px 10px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}
.cbdoc-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #e6e6e6;
    vertical-align: top;
    line-height: 1.5;
}
.cbdoc-table tbody tr:nth-child(even) { background: #fafafa; }
.cbdoc-table .cbdoc-num   { text-align: right; white-space: nowrap; }
.cbdoc-table .cbdoc-prod  { font-weight: 600; }
.cbdoc-cat-row td {
    background: #f2ece7;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
}
.cbdoc-variant-name { color: #666; font-size: 12.5px; }
.cbdoc-muted        { color: #888; }

/* An unfilled figure. Deliberately not a dash that could read as "zero" or
   as "none" — it says what it means. */
.cbdoc-missing {
    color: #a04040;
    font-style: italic;
    font-size: 12px;
    white-space: nowrap;
}

/* ── Allergen presentation ─────────────────────────────── */
.cbdoc-allergen-list  { font-weight: 600; }
.cbdoc-allergen-none  { color: #1a7a4c; font-weight: 600; }
.cbdoc-allergen-unknown {
    color: #a04040;
    font-weight: 600;
}
.cbdoc-warning {
    border: 2px solid #a04040;
    background: #fdf5f5;
    padding: 15px 18px;
    margin: 0 0 26px;
    font-size: 13.5px;
    line-height: 1.65;
}
.cbdoc-warning strong { color: #a04040; }
.cbdoc-notice {
    background: #f7f7f7;
    border: 1px solid #ddd;
    padding: 13px 16px;
    font-size: 12.5px;
    line-height: 1.6;
    margin: 0 0 24px;
    color: #444;
}

/* ── Storage cards ─────────────────────────────────────── */
.cbdoc-storage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 15px;
    margin-bottom: 28px;
}
.cbdoc-storage-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px 18px;
}
.cbdoc-storage-card h3 { margin: 0 0 7px; font-size: 14px; color: var(--color-primary); }
.cbdoc-storage-card p  { margin: 0; font-size: 13px; line-height: 1.6; }
.cbdoc-temp {
    font-size: 27px;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: 5px;
}

.cbdoc-foot {
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 26px;
    flex-wrap: wrap;
    font-size: 11.5px;
    line-height: 1.6;
    color: #666;
}
.cbdoc-foot-block { flex: 1 1 165px; }
.cbdoc-foot-note  { flex: 2 1 290px; font-style: italic; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    /* The browser adds the page margin; the sheet must not add another,
       or the first page starts an inch and a half down. */
    @page {
        size: A4;
        margin: 12mm 10mm 14mm;
    }

    .cbdoc-noprint,
    .cbdoc-toolbar { display: none !important; }

    .cbdoc-body {
        background: #fff;
        font-size: 10pt;
    }

    .cbdoc-sheet {
        max-width: none;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
    }

    .cbdoc-title    { font-size: 19pt; }
    .cbdoc-subtitle { font-size: 10pt; }
    .cbdoc-sheet h2 { font-size: 13pt; margin: 16pt 0 7pt; }
    .cbdoc-sheet h3 { font-size: 11pt; }
    .cbdoc-sheet p  { font-size: 9.5pt; }
    .cbdoc-table    { font-size: 8.5pt; }
    .cbdoc-table th { font-size: 7.5pt; padding: 5pt 6pt; }
    .cbdoc-table td { padding: 4.5pt 6pt; }

    /* Backgrounds are how the allergen sheet distinguishes a warning from a
       note. Printers drop them by default, which would turn the one box a
       reader must not miss into plain text. */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Keep a heading with the table it introduces, and never split a row. */
    h2, h3            { break-after: avoid; page-break-after: avoid; }
    tr, .cbdoc-storage-card, .cbdoc-warning { break-inside: avoid; page-break-inside: avoid; }
    thead             { display: table-header-group; }
    .cbdoc-foot       { break-inside: avoid; page-break-inside: avoid; }

    a { color: inherit; text-decoration: none; }
}
