/* Printable worksheets on the main site: the paper itself (/worksheets/{key}/print and the preview on each sheet's
   landing page). Pages are real paper sizes (A4 210x297mm, US Letter 8.5x11in) so "Print" and "Save as PDF" match
   what is on screen. Paper stays white with dark ink in every theme; logical properties mirror the sheet in Arabic
   and Urdu. The same look as the kids site's grown-ups' corner, so a sheet prints the same from either site. */

/* ---------- The printed page ---------- */
.ws-print {
    --paper-w: 210mm; --paper-h: 297mm; --pad: 13mm;
    --ws-ink: #1F1A3D; --ws-soft: #5B5480; --ws-line: #CFC6E6; --ws-a: #1f7a63; --ws-ad: #10503a; --ws-as: #e3f4ec;
    display: grid; gap: 28px; justify-items: center; margin-bottom: 30px;
}
/* Paper colours are fixed: a printed sheet looks the same whatever the screen's theme. */
.ws-print.c-grape { --ws-a: #7C5CFF; --ws-ad: #5B3FE0; --ws-as: #EFEBFF; }
.ws-print.c-mint { --ws-a: #22B8A9; --ws-ad: #11786E; --ws-as: #DCF6F2; }
.ws-print.c-sun { --ws-a: #E39E00; --ws-ad: #9A6400; --ws-as: #FFF3CF; }
.ws-print.c-coral { --ws-a: #FF7A6B; --ws-ad: #C2412F; --ws-as: #FFE7E3; }
.ws-print.c-sky { --ws-a: #46B3EE; --ws-ad: #1A6FA3; --ws-as: #E0F3FF; }
.ws-print.c-leaf { --ws-a: #62BE62; --ws-ad: #2E7D3E; --ws-as: #E4F6E2; }
.ws-print.c-rose { --ws-a: #FF8FAE; --ws-ad: #C23E66; --ws-as: #FFE9F0; }
.ws-paper-letter { --paper-w: 215.9mm; --paper-h: 279.4mm; --pad: 12.5mm; }
.ws-print.ws-ink-bw { --ws-a: #333; --ws-ad: #000; --ws-as: #F1F1F1; }
:root[data-theme="dark"] .ws-print, .ws-print { color-scheme: light; }

.ws-page {
    position: relative; display: flex; flex-direction: column; box-sizing: border-box;
    width: var(--paper-w); max-width: 100%; min-height: var(--paper-h); padding: var(--pad);
    background: #fff; color: var(--ws-ink); border-radius: 4px; box-shadow: 0 18px 50px rgba(20, 16, 50, .22);
    font-family: "Andika", "Baloo 2", system-ui, sans-serif; font-size: 11.5pt; line-height: 1.4;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
[dir="rtl"] .ws-page { font-family: "Baloo Bhaijaan 2", "Noto Naskh Arabic", "Andika", system-ui, sans-serif; }
.ws-page::before {
    content: ""; position: absolute; inset: 6mm; border: 1.2pt solid var(--ws-as); border-radius: 6mm; pointer-events: none;
}
.ws-page > * { position: relative; }

.ws-sheet-head { margin-bottom: 6mm; }
.ws-sheet-brand { display: flex; align-items: center; gap: 2mm; font-size: 9pt; font-weight: 700; color: var(--ws-soft); }
.ws-sheet-brand b { color: var(--ws-ad); }
.ws-sheet-star { width: 5mm; height: 5mm; fill: var(--ws-a); }
.ws-sheet-age { margin-inline-start: auto; padding: .6mm 2.5mm; border-radius: 99px; background: var(--ws-as); color: var(--ws-ink); }
.ws-sheet-fields { display: flex; gap: 8mm; margin: 4mm 0 3mm; font-size: 10.5pt; color: var(--ws-soft); }
.ws-sheet-fields span { display: flex; flex: 1; align-items: flex-end; gap: 2mm; }
.ws-sheet-fields span:last-child { flex: .55; }
.ws-sheet-fields i { flex: 1; border-bottom: 1pt solid var(--ws-line); height: 5mm; }
.ws-sheet-title {
    display: flex; align-items: center; gap: 3mm; flex-wrap: wrap;
    font-family: "Baloo 2", "Baloo Bhaijaan 2", system-ui, sans-serif; font-size: 22pt; font-weight: 800; line-height: 1.15;
    margin: 2mm 0 1.5mm; color: var(--ws-ad);
}
[dir="rtl"] .ws-sheet-title { font-family: "Baloo Bhaijaan 2", "Baloo 2", system-ui, sans-serif; }
.ws-page-num { margin-inline-start: auto; font-size: 10pt; font-weight: 700; color: var(--ws-soft); }
.ws-key-badge { padding: .5mm 3mm; border-radius: 2mm; background: var(--ws-ad); color: #fff; font-size: 11pt; }
.ws-sheet-do { margin: 0; font-size: 11.5pt; color: var(--ws-ink); }
.ws-sheet-set { margin: 1mm 0 0; font-weight: 700; color: var(--ws-soft); }
.ws-sheet-body { flex: 1; }
.ws-sheet-foot { margin-top: 6mm; padding-top: 2.5mm; border-top: .8pt solid var(--ws-line); font-size: 7.5pt; color: var(--ws-soft); line-height: 1.35; }
.ws-sheet-foot p { margin: 0 0 .8mm; }
.ws-sheet-id { opacity: .8; }
.ws-ar { font-family: "Amiri", "Noto Naskh Arabic", serif; }
.ws-num {
    display: inline-grid; place-items: center; flex: none; width: 7.5mm; height: 7.5mm; border-radius: 50%;
    background: var(--ws-a); color: #fff; font-weight: 800; font-size: 10.5pt; font-family: "Baloo 2", system-ui, sans-serif;
}
.ws-num--letter { background: #fff; color: var(--ws-ad); border: 1.2pt solid var(--ws-a); }
.ws-ink-bw .ws-num { background: #fff; color: #000; border: 1.2pt solid #000; }

/* word search */
.ws-wordsearch { display: grid; grid-template-columns: 1fr; gap: 6mm; justify-items: center; }
.ws-grid { border-collapse: separate; border-spacing: 0; border: 1.4pt solid var(--ws-a); border-radius: 3mm; overflow: hidden; }
.ws-grid td {
    width: var(--cell); height: var(--cell); padding: 0; text-align: center; vertical-align: middle;
    font-family: "Andika", "Baloo 2", monospace; font-weight: 700; font-size: var(--cell-font); color: var(--ws-ink);
    border-inline-end: .5pt solid var(--ws-line); border-bottom: .5pt solid var(--ws-line);
}
.ws-grid tr td:last-child { border-inline-end: 0; }
.ws-grid tr:last-child td { border-bottom: 0; }
.ws-grid-8 { --cell: 15mm; --cell-font: 20pt; }
.ws-grid-10 { --cell: 13.2mm; --cell-font: 17pt; }
.ws-grid-12 { --cell: 11.2mm; --cell-font: 14pt; }
.ws-grid--key td.is-answer { background: var(--ws-as); color: var(--ws-ad); font-weight: 800; box-shadow: inset 0 0 0 .8mm color-mix(in srgb, var(--ws-a) 45%, transparent); }
.ws-ink-bw .ws-grid--key td.is-answer { background: #DADADA; color: #000; }
.ws-wordlist { justify-self: stretch; }
.ws-wordlist h3 { margin: 0 0 2mm; font-size: 12pt; color: var(--ws-ad); }
.ws-wordlist ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2.5mm 5mm; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ws-key .ws-wordlist ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ws-key .ws-wordlist li { align-items: baseline; flex-wrap: wrap; }
.ws-wordlist li { display: flex; gap: 2mm; align-items: flex-start; }
.ws-wordlist b { font-size: 12.5pt; letter-spacing: .02em; }
.ws-wordlist small { display: block; font-size: 9pt; color: var(--ws-soft); line-height: 1.25; }
.ws-tick { flex: none; width: 4.5mm; height: 4.5mm; margin-top: 1mm; border: 1pt solid var(--ws-a); border-radius: 1mm; }
.ws-grid-8 .ws-wordlist b { font-size: 15pt; }

/* matching */
.ws-matching { display: grid; gap: 4.5mm; margin-top: 2mm; }
.ws-match-row { display: grid; grid-template-columns: minmax(0, 1fr) 24mm minmax(0, 1.25fr); align-items: center; min-height: 14mm; }
.ws-match-left, .ws-match-right {
    display: flex; align-items: center; gap: 2.5mm; min-height: 14mm; padding: 2mm 3mm; border-radius: 3mm;
    border: 1pt solid var(--ws-line); background: #fff;
}
.ws-match-left { background: var(--ws-as); border-color: transparent; }
.ws-match-text { flex: 1; display: flex; flex-direction: column; gap: .5mm; font-size: 11pt; line-height: 1.25; }
.ws-match-text .ws-ar { font-size: 17pt; line-height: 1.3; }
.ws-match-text .ws-ar--big { font-size: 26pt; line-height: 1.2; }
.ws-dot { flex: none; width: 3.6mm; height: 3.6mm; border-radius: 50%; background: var(--ws-ad); }
.ws-age-0 .ws-match-text { font-size: 13pt; }

/* fill in the blank */
.ws-bank { margin: 1mm 0 6mm; padding: 3mm 4mm; border: 1.2pt dashed var(--ws-a); border-radius: 3mm; }
.ws-bank h3 { margin: 0 0 2mm; font-size: 11pt; color: var(--ws-ad); }
.ws-bank ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2mm 3mm; }
.ws-bank li { padding: 1mm 3.5mm; border-radius: 99px; background: var(--ws-as); font-weight: 700; }
.ws-blanks { margin: 0; padding-inline-start: 7mm; display: grid; gap: 5.5mm; font-size: 12pt; }
.ws-blanks li::marker { font-weight: 800; color: var(--ws-ad); }
.ws-blank-ar { font-size: 14pt; line-height: 1; color: var(--ws-ad); margin-inline: 1mm; }
.ws-blanks li { line-height: 1.6; }
.ws-line { display: inline-block; width: 42mm; border-bottom: 1.2pt solid var(--ws-ink); margin-inline: 1mm; vertical-align: baseline; }

/* sequencing */
.ws-steps { list-style: none; margin: 2mm 0 0; padding: 0; display: grid; gap: 4mm; }
.ws-step { display: flex; align-items: center; gap: 4mm; padding: 3mm 4mm; border: 1pt solid var(--ws-line); border-radius: 3.5mm; break-inside: avoid; }
.ws-step-box { flex: none; width: 13mm; height: 13mm; border: 1.6pt solid var(--ws-a); border-radius: 3mm; background: #fff; }
.ws-step-text { display: flex; flex-direction: column; font-size: 12.5pt; }
.ws-step-text small { font-size: 9.5pt; color: var(--ws-soft); }

/* quiz */
.ws-quiz { margin: 1mm 0 0; padding-inline-start: 7mm; display: grid; gap: 5mm; }
.ws-quiz > li::marker { font-weight: 800; color: var(--ws-ad); font-size: 12pt; }
.ws-q { break-inside: avoid; }
.ws-q p { margin: 0 0 2mm; font-weight: 700; font-size: 12pt; }
.ws-q-options { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2mm 6mm; }
.ws-q-options.is-stacked { display: grid; gap: 1.5mm; }
.ws-q-options.is-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.8mm 6mm; }
.ws-q-options li { display: flex; align-items: center; gap: 2mm; font-size: 11pt; }
.ws-circle {
    display: inline-grid; place-items: center; flex: none; width: 6.5mm; height: 6.5mm; border-radius: 50%;
    border: 1.2pt solid var(--ws-a); font-weight: 800; font-size: 9.5pt; color: var(--ws-ad);
}
.ws-circle.is-on { background: var(--ws-ad); color: #fff; border-color: var(--ws-ad); }

/* tracing */
.ws-tracing { display: grid; gap: 3.5mm; }
.ws-age-1 .ws-tracing, .ws-age-2 .ws-tracing { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3mm; }
.ws-age-1 .ws-trace-boxes, .ws-age-2 .ws-trace-boxes { grid-template-columns: repeat(4, 1fr); gap: 1.5mm; }
.ws-age-1 .ws-trace-row header, .ws-age-2 .ws-trace-row header { font-size: 10pt; }
.ws-age-1 .ws-trace-example, .ws-age-2 .ws-trace-example { font-size: 8.5pt; }
.ws-trace-row { padding: 2mm 3mm 3mm; border: 1pt solid var(--ws-line); border-radius: 3mm; break-inside: avoid; }
.ws-trace-row header { display: flex; align-items: center; gap: 3mm; margin-bottom: 1.5mm; font-size: 11pt; }
.ws-trace-glyph { font-size: 20pt; line-height: 1.1; color: var(--ws-ad); }
.ws-trace-example { margin-inline-start: auto; font-size: 10pt; color: var(--ws-soft); }
.ws-trace-example [lang="ar"] { font-family: "Amiri", serif; font-size: 14pt; color: var(--ws-ink); }
.ws-trace-boxes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2mm; }
.ws-trace-boxes svg { width: 100%; aspect-ratio: 1; display: block; border-radius: 2mm; background: #FFFDF7; border: .5pt solid #EEE7DA; }
.ws-trace-boxes .t path { fill: none; stroke: color-mix(in srgb, var(--ws-a) 30%, #fff); stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; }
.ws-trace-boxes .t circle { fill: color-mix(in srgb, var(--ws-a) 30%, #fff); }
.ws-trace-boxes .c path { fill: none; stroke: var(--ws-ad); stroke-width: 2; stroke-dasharray: 3 6; stroke-linecap: round; }
.ws-trace-boxes .c circle { fill: none; stroke: var(--ws-ad); stroke-width: 2; stroke-dasharray: 2 3; }
.ws-trace-boxes .b { stroke: #D8C39A; stroke-dasharray: 4 4; stroke-width: 1.2; }
.ws-trace-boxes .s { fill: #22B8A9; }
.ws-ink-bw .ws-trace-boxes .s { fill: #000; }
.ws-ink-bw .ws-trace-boxes .t path { stroke: #DDD; }
.ws-ink-bw .ws-trace-boxes .t circle { fill: #DDD; }

/* copywork */
.ws-copywork { display: grid; gap: 6mm; }
.ws-copy { padding: 3mm 5mm 4mm; border: 1pt solid var(--ws-line); border-radius: 3.5mm; break-inside: avoid; }
.ws-copy header { display: flex; justify-content: space-between; align-items: baseline; gap: 3mm; font-size: 11pt; color: var(--ws-ad); }
.ws-copy header small { color: var(--ws-soft); font-size: 8.5pt; }
.ws-copy-trace {
    margin: 2mm 0 1mm; font-size: 30pt; line-height: 1.9; text-align: center;
    color: transparent; -webkit-text-stroke: .9pt color-mix(in srgb, var(--ws-ad) 55%, #fff);
}
.ws-age-0 .ws-copy-trace { font-size: 36pt; }
.ws-age-2 .ws-copy-trace { font-size: 24pt; }
.ws-ink-bw .ws-copy-trace { -webkit-text-stroke-color: #888; }
.ws-copy-lines { display: grid; gap: 9mm; margin: 2mm 0 3mm; }
.ws-copy-lines i { display: block; height: 0; border-bottom: 1pt dashed var(--ws-line); }
.ws-copy-lines--short { gap: 7mm; }
.ws-copy-lines span { font-size: 10pt; color: var(--ws-soft); }
.ws-copy-translit, .ws-copy-meaning { margin: 0 0 1mm; font-size: 10.5pt; }

/* colouring */
.ws-colouring { margin: 0; display: flex; flex-direction: column; gap: 4mm; }
.ws-colouring img { display: block; width: 100%; max-height: 176mm; object-fit: contain; }
.ws-paper-letter .ws-colouring img { max-height: 158mm; }
.ws-colouring figcaption p { margin: 0; font-size: 12pt; text-align: center; }

/* answer key */
.ws-key-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 3mm; font-size: 11.5pt; counter-reset: k; }
.ws-key-list > li { display: flex; align-items: flex-start; gap: 2.5mm; }
.ws-key-list:not(.ws-key-list--pairs):not(.ws-key-list--steps) > li::before {
    counter-increment: k; content: counter(k) "."; min-width: 6mm; font-weight: 800; color: var(--ws-ad);
}
.ws-key-list small { display: block; color: var(--ws-soft); font-size: 9.5pt; }
.ws-key-list--pairs .ws-key-text { display: flex; flex-wrap: wrap; gap: 1.5mm; align-items: baseline; }
.ws-key-list--pairs .ws-ar { font-size: 15pt; }
.ws-key-arrow { color: var(--ws-soft); }
[dir="rtl"] .ws-key-arrow { transform: scaleX(-1); }
.ws-key-answer { padding: 0 2mm; border-bottom: 1.4pt solid var(--ws-ad); color: var(--ws-ad); }
.ws-key-note { margin: 4mm 0 0; color: var(--ws-soft); font-size: 10pt; }
.ws-key .ws-wordlist small { display: inline; }


/* ---------- Phones: the page reflows on screen; printing still uses the paper size ---------- */
@media screen and (max-width: 860px) {
    .wsp-sheets .ws-page { width: 100%; min-height: 0; padding: 7vw 6vw; font-size: 10.5pt; }
    .wsp-sheets .ws-page::before { inset: 2.5vw; }
    .wsp-sheets .ws-grid-8 { --cell: min(10.5vw, 12.5mm); --cell-font: 15pt; }
    .wsp-sheets .ws-grid-10 { --cell: min(8.4vw, 10.8mm); --cell-font: 12.5pt; }
    .wsp-sheets .ws-grid-12 { --cell: min(7vw, 9.6mm); --cell-font: 11pt; }
    .wsp-sheets .ws-wordlist ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wsp-sheets .ws-match-row { grid-template-columns: minmax(0, 1fr) 7vw minmax(0, 1.2fr); }
    .wsp-sheets .ws-match-text { font-size: 9.5pt; }
    .wsp-sheets .ws-sheet-title { font-size: 18pt; }
}
@media screen and (max-width: 560px) {
    .wsp-sheets .ws-trace-boxes { gap: 1mm; }
    .wsp-sheets .ws-copy-trace { font-size: 22pt; }
    .wsp-sheets .ws-q-options { display: grid; gap: 1.5mm; }
}

/* ---------- Printing: only the paper ---------- */
@media print {
    html, body { background: #fff !important; }
    body > :not(main), main > :not(.wsp), .wsp > :not(.wsp-sheets) { display: none !important; }
    main, .wsp, .wsp-sheets { padding: 0 !important; margin: 0 !important; max-width: none !important; }
    .ws-print { display: block; margin: 0; }
    .ws-page {
        width: 100%; max-width: var(--paper-w); min-height: calc(var(--paper-h) - 1mm); margin: 0; padding: var(--pad);
        border-radius: 0; box-shadow: none; break-after: page; page-break-after: always;
    }
    .ws-page:last-child { break-after: auto; page-break-after: auto; }
}
