/* Certificates (v8, 2026-11-30).
   cs-*  the studio page          cp-*  student portal / verify page bits
   cd-*  the sheet itself: a fixed canvas per format (a4 1123×794, square
         1080×1080, story 1080×1920) that is only ever scaled as a whole, so
         the export and the print match the preview exactly. */

/* ═════════════════════════ Studio page ═════════════════════════ */

html body { background: #FAF8FF; }

.cs-page {
    --cs-ink: #1F1147; --cs-soft: #5A5378; --cs-line: #DDD6F3; --cs-purple: #7C3AED;
    max-width: 1320px; margin: 0 auto; padding: 104px 20px 72px; color: var(--cs-ink);
}
.cs-page ::selection { background: #DDD0FF; color: var(--cs-ink); }
.cs-page [hidden] { display: none !important; }

.cs-page .cs-head { margin-bottom: 20px; }
.cs-page .cs-head h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); font-weight: 900; margin: 0 0 8px; color: var(--cs-ink); }
.cs-page .cs-head p { margin: 0; color: var(--cs-soft); font-size: 1.05rem; line-height: 1.8; max-width: 62ch; }

.cs-page .cs-studio { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; align-items: start; }
.cs-page .cs-stage { position: sticky; top: 92px; min-width: 0; }

/* suggestions */
.cs-page .cs-sugg { margin-bottom: 20px; padding: 16px 18px; border-radius: 16px; background: #FFFBEB; border: 1px solid #FDE68A; }
.cs-page .cs-sugg h2 { font-size: 1rem; font-weight: 800; margin: 0 0 10px; color: #78350F; display: flex; align-items: center; gap: 8px; }
.cs-page .cs-sugg h2 svg { width: 20px; height: 20px; color: #D97706; }
.cs-page .cs-sugg ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cs-page .cs-sugg li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; background: #fff; border-radius: 10px; border: 1px solid #FEF3C7; }
.cs-page .cs-sugg .who { font-weight: 800; color: var(--cs-ink); }
.cs-page .cs-sugg .what { color: #5B4A2E; flex: 1 1 160px; min-width: 0; }
.cs-page .cs-sugg button { font: inherit; font-size: .85rem; font-weight: 700; border-radius: 9999px; padding: 6px 14px; cursor: pointer; min-height: 36px; }
.cs-page .cs-sugg .use { background: #7C3AED; color: #fff; border: 0; }
.cs-page .cs-sugg .use:hover { background: #6D28D9; }
.cs-page .cs-sugg .skip { background: none; border: 1px solid #E5D9B6; color: #6B5B3A; }

/* tabs */
.cs-page .cs-tabs { display: inline-flex; gap: 4px; padding: 4px; background: #EDE9FB; border-radius: 12px; margin-bottom: 16px; }
.cs-page .cs-tabs button { font: inherit; font-weight: 800; font-size: .95rem; border: 0; background: none; color: #4B4468; padding: 8px 18px; border-radius: 9px; cursor: pointer; min-height: 40px; }
.cs-page .cs-tabs button[aria-selected="true"] { background: #fff; color: var(--cs-purple); box-shadow: 0 1px 3px rgba(31, 17, 71, .14); }
.cs-page .cs-tabs button:focus-visible { outline: 2px solid var(--cs-ink); outline-offset: 1px; }

/* design picker */
.cs-page .cs-designs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 10px; margin-bottom: 16px; }
.cs-page .cs-design { display: block; padding: 0; border: 0; background: none; cursor: pointer; text-align: center; font: inherit; color: var(--cs-soft); min-width: 0; }
.cs-page .cs-thumb {
    display: block; position: relative; overflow: hidden; border-radius: 6px; outline: 1px solid var(--cs-line); background: #fff;
    aspect-ratio: 1123 / 794; max-height: 132px; margin-inline: auto;
    transition: outline-color .15s ease-out, transform .2s cubic-bezier(.16, 1, .3, 1);
}
.cs-page .cs-design:hover .cs-thumb { outline-color: #B9A6F2; transform: translateY(-2px); }
.cs-page .cs-design[aria-checked="true"] .cs-thumb { outline: 3px solid var(--cs-purple); outline-offset: 2px; }
.cs-page .cs-design:focus-visible { outline: none; }
.cs-page .cs-design:focus-visible .cs-thumb { outline: 3px solid var(--cs-ink); outline-offset: 2px; }
.cs-page .cs-design-name { display: block; margin-top: 6px; font-size: .82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-page .cs-design[aria-checked="true"] .cs-design-name { color: var(--cs-purple); }
.cs-page .cs-design.is-season .cs-design-name::before { content: '✦ '; color: #D97706; }

/* preview */
.cs-page .cs-preview {
    position: relative; overflow: hidden; background: #fff; border-radius: 4px; margin-inline: auto;
    box-shadow: 0 1px 2px rgba(31, 17, 71, .1), 0 18px 44px -18px rgba(31, 17, 71, .38);
}
.cs-page .cs-preview.is-square { max-width: 620px; }
.cs-page .cs-preview.is-story { max-width: 380px; }
.cs-page .cs-preview .cd, .cs-page .cs-thumb .cd, .cp-sheet .cd { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.cs-page .cs-thumb .cd { pointer-events: none; }
.cs-page .cs-preview-hint { text-align: center; color: var(--cs-soft); font-size: .88rem; margin: 10px 0 0; }

/* actions */
.cs-page .cs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.cs-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border-radius: 9999px;
    font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; border: 1.5px solid transparent; text-decoration: none;
    transition: background-color .15s ease-out, box-shadow .2s ease-out, transform .2s cubic-bezier(.16, 1, .3, 1);
}
.cs-btn svg { width: 20px; height: 20px; flex: none; }
.cs-btn--primary { background: #7C3AED; color: #fff; }
.cs-btn--primary:hover { background: #6D28D9; color: #fff; box-shadow: 0 8px 22px -8px rgba(124, 58, 237, .7); transform: translateY(-1px); }
.cs-btn--ghost { background: #fff; color: #7C3AED; border-color: #DDD6F3; }
.cs-btn--ghost:hover { border-color: #7C3AED; color: #7C3AED; }
.cs-btn:focus-visible { outline: 3px solid #1F1147; outline-offset: 2px; }
.cs-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.cs-page .cs-status { margin: 0; font-size: .95rem; font-weight: 600; color: var(--cs-soft); flex: 1 1 200px; }
.cs-page .cs-status.is-ok { color: #047857; }
.cs-page .cs-status.is-warn { color: #9A4B00; }
.cs-page .cs-status.is-error { color: #B91C1C; }
.cs-page .cs-status a { color: var(--cs-purple); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* issued list */
.cs-page .cs-issued { margin-top: 28px; border-top: 1px solid var(--cs-line); padding-top: 16px; }
.cs-page .cs-issued summary { cursor: pointer; font-weight: 800; font-size: 1rem; list-style-position: inside; }
.cs-page .cs-issued summary:focus-visible { outline: 2px solid var(--cs-ink); outline-offset: 2px; }
.cs-page .cs-issued ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.cs-page .cs-issued li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid #EEE9FB; font-size: .92rem; }
.cs-page .cs-issued .nm { font-weight: 800; }
.cs-page .cs-issued .tt { color: var(--cs-soft); flex: 1 1 140px; min-width: 0; }
.cs-page .cs-issued .cd8 { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; color: #6B6788; }
.cs-page .cs-issued a, .cs-page .cs-issued button { font: inherit; font-size: .85rem; font-weight: 700; color: var(--cs-purple); background: none; border: 0; padding: 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cs-page .cs-issued form { margin: 0; }
.cs-page .cs-issued li.is-revoked .nm, .cs-page .cs-issued li.is-revoked .tt { text-decoration: line-through; opacity: .6; }
.cs-page .cs-badge { font-size: .75rem; font-weight: 800; padding: 2px 8px; border-radius: 9999px; background: #FEE2E2; color: #991B1B; }
.cs-page .cs-empty { color: var(--cs-soft); margin: 10px 0 0; }

/* form */
.cs-page .cs-form { background: #fff; border: 1px solid var(--cs-line); border-radius: 20px; padding: 24px; display: grid; gap: 24px; min-width: 0; }
.cs-page .cs-group { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 16px; }
.cs-page .cs-group legend { float: none; width: 100%; margin: 0 0 4px; padding: 16px 0 0; border-top: 1px solid #EEE9FB; font-size: 1.05rem; font-weight: 800; color: var(--cs-ink); }
.cs-page .cs-field { display: grid; gap: 8px; min-width: 0; }
.cs-page .cs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cs-page .cs-label { font-size: .9rem; font-weight: 700; color: #3B3260; }
.cs-page .cs-hint { font-size: .82rem; color: var(--cs-soft); margin: 0; line-height: 1.6; }

.cs-page .cs-form input[type="text"], .cs-page .cs-form input[type="date"], .cs-page .cs-form select {
    width: 100%; min-height: 46px; padding: 8px 14px; border: 1px solid #CFC7EA; border-radius: 10px; background: #fff;
    color: var(--cs-ink); font: inherit; font-size: 1rem; caret-color: var(--cs-purple); transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.cs-page .cs-form input::placeholder { color: #6B6788; opacity: 1; }
.cs-page .cs-form input[type="text"]:focus, .cs-page .cs-form input[type="date"]:focus, .cs-page .cs-form select:focus { outline: none; border-color: var(--cs-purple); box-shadow: 0 0 0 3px rgba(124, 58, 237, .16); }

.cs-page .cs-seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: #F3EFFC; border-radius: 10px; }
.cs-page .cs-seg label { flex: 1 1 0; margin: 0; cursor: pointer; }
.cs-page .cs-seg input { position: absolute; opacity: 0; pointer-events: none; }
.cs-page .cs-seg span { display: block; text-align: center; padding: 8px 10px; border-radius: 8px; font-size: .9rem; font-weight: 700; color: #4B4468; white-space: nowrap; transition: background-color .15s ease-out, color .15s ease-out; }
.cs-page .cs-seg input:checked + span { background: #fff; color: var(--cs-purple); box-shadow: 0 1px 3px rgba(31, 17, 71, .14); }
.cs-page .cs-seg input:focus-visible + span { outline: 2px solid var(--cs-ink); outline-offset: 1px; }
.cs-page .cs-seg input:disabled + span { opacity: .4; cursor: not-allowed; }

.cs-page .cs-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cs-page input[type="file"] { flex: 1 1 180px; min-width: 0; font: inherit; font-size: .9rem; color: var(--cs-soft); }
.cs-page input[type="file"]::file-selector-button { font: inherit; font-weight: 700; padding: 8px 14px; margin-inline-end: 10px; border-radius: 9999px; border: 1px solid var(--cs-line); background: #fff; color: var(--cs-purple); cursor: pointer; }
.cs-page .cs-link { border: 0; background: none; padding: 4px 0; font: inherit; font-size: .9rem; font-weight: 700; color: #B91C1C; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cs-page .cs-check { display: flex; align-items: center; gap: 10px; margin: 0; font-size: .95rem; font-weight: 600; cursor: pointer; }
.cs-page .cs-check input { width: 20px; height: 20px; accent-color: var(--cs-purple); flex: none; }

/* bulk list */
.cs-page .cs-bulk-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cs-page .cs-bulk-tools select { flex: 1 1 160px; }
.cs-page .cs-bulk-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow: auto; border: 1px solid #EEE9FB; border-radius: 12px; }
.cs-page .cs-bulk-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #F3EFFC; }
.cs-page .cs-bulk-list li:last-child { border-bottom: 0; }
.cs-page .cs-bulk-list .cs-check { flex: 1 1 auto; min-width: 0; }
.cs-page .cs-bulk-list .cs-check span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-page .cs-bulk-list .cs-seg { flex: none; padding: 3px; }
.cs-page .cs-bulk-list .cs-seg span { padding: 4px 10px; font-size: .82rem; }
.cs-page .cs-bulk-list li.needs-gender .cs-seg { outline: 2px solid #F59E0B; }
.cs-page .cs-bulk-count { font-size: .9rem; font-weight: 700; color: var(--cs-soft); }

/* branding */
.cs-page .cs-brand-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cs-page .cs-brand-img { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; border: 1px solid var(--cs-line); background: #fff; }
.cs-page .cs-sign-img { height: 52px; max-width: 200px; object-fit: contain; border-bottom: 1px solid var(--cs-line); }
.cs-page .cs-pad { width: 100%; height: 150px; border: 1.5px dashed #CFC7EA; border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.cs-page .cs-pad-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cs-page .cs-small-btn { font: inherit; font-size: .88rem; font-weight: 700; border-radius: 9999px; padding: 6px 16px; min-height: 38px; cursor: pointer; border: 1px solid var(--cs-line); background: #fff; color: var(--cs-purple); }
.cs-page .cs-small-btn.primary { background: var(--cs-purple); color: #fff; border-color: transparent; }

.cd-offscreen { position: fixed; top: 0; left: -30000px; pointer-events: none; }
#cdPrintRoot { display: none; }

@media (max-width: 1100px) {
    .cs-page .cs-studio { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .cs-page .cs-stage { position: static; }
}
@media (max-width: 640px) {
    .cs-page { padding: 88px 14px 56px; }
    .cs-page .cs-designs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cs-page .cs-form { padding: 18px 16px; border-radius: 16px; }
    .cs-page .cs-actions .cs-btn { flex: 1 1 0; padding: 0 12px; font-size: .95rem; white-space: nowrap; }
    .cs-page .cs-actions { position: sticky; bottom: 0; z-index: 5; margin: 16px -14px 0; padding: 12px 14px; background: rgba(250, 248, 255, .96); border-top: 1px solid var(--cs-line); }
    .cs-page .cs-status { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .cs-page *, .cp-page * { transition: none !important; } }

/* ═════════════════════════ Portal + verify ═════════════════════════ */

.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.cp-card { background: #fff; border: 1px solid #EDE9FE; border-radius: 16px; padding: 14px; display: grid; gap: 10px; }
.cp-sheet { position: relative; overflow: hidden; border-radius: 6px; background: #fff; box-shadow: 0 1px 2px rgba(31, 17, 71, .1), 0 10px 28px -14px rgba(31, 17, 71, .35); }
.cp-sheet.is-story { max-width: 220px; margin-inline: auto; width: 100%; }
.cp-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cp-meta .t { font-weight: 800; color: #1F1147; }
.cp-meta .s { font-size: .82rem; color: #5A5378; }
.cp-verify { max-width: 980px; margin: 0 auto; padding: 110px 20px 64px; }
.cp-verify .cp-ok, .cp-verify .cp-bad { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: 14px; margin-bottom: 20px; }
.cp-verify .cp-ok { background: #ECFDF5; border: 1px solid #A7F3D0; color: #064E3B; }
.cp-verify .cp-bad { background: #FEF2F2; border: 1px solid #FECACA; color: #7F1D1D; }
.cp-verify .cp-ok svg, .cp-verify .cp-bad svg { width: 28px; height: 28px; flex: none; }
.cp-verify h1 { font-size: 1.15rem; font-weight: 900; margin: 0 0 4px; }
.cp-verify p { margin: 0; line-height: 1.7; }
.cp-verify .cp-note { font-size: .88rem; opacity: .85; margin-top: 6px; }
.cp-verify .cp-sheet { margin-inline: auto; }
.cp-verify .cp-sheet.is-square { max-width: 560px; }
.cp-verify .cp-sheet.is-story { max-width: 360px; }

/* ═════════════════════════ Print ═════════════════════════ */

@media print {
    @page { size: A4 landscape; margin: 0; }
    html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
    body.cd-printing > *:not(#cdPrintRoot) { display: none !important; }
    body.cd-printing #cdPrintRoot { display: block; }
    body.cd-printing .cd-print-page { position: relative; width: 297mm; height: 209.5mm; overflow: hidden; break-after: page; page-break-after: always; }
    body.cd-printing .cd-print-page:last-child { break-after: auto; page-break-after: auto; }
    body.cd-printing .cd-print-page .cd { transform: scale(.994); transform-origin: 0 0; }
    .cd, .cd * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ═════════════════════════ The sheet ═════════════════════════ */

.cd {
    --k: 1;                                 /* fit() lowers this when the wording is long */
    --fs: 1;                                /* format scale */
    --ink: #2B2B2B; --title: #111; --name: #111; --soft: #555; --rule: #999;
    --pad-top: 86px; --pad-x: 132px; --foot-bottom: 84px; --foot-h: 104px;
    --display: 'Amiri', 'Scheherazade New', 'Times New Roman', serif;
    --text: 'Cairo', 'Noto Sans Arabic', system-ui, sans-serif;
    position: relative; width: 1123px; height: 794px; overflow: hidden; box-sizing: border-box;
    background: #fff; color: var(--ink); font-family: var(--text); text-align: center; line-height: 1.5;
    font-kerning: normal; -webkit-font-smoothing: antialiased;
}
.cd *, .cd *::before, .cd *::after { box-sizing: border-box; }
.cd-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.cd.cd--fmt-square { --fs: 1.02; --pad-top: 116px; --pad-x: 112px; --foot-bottom: 100px; }
.cd.cd--fmt-story { --fs: 1.2; --pad-top: 240px; --pad-x: 100px; --foot-bottom: 210px; --foot-h: 120px; }
.cd.has-sign { --foot-h: 128px; }
.cd.cd--fmt-story.has-sign { --foot-h: 140px; }

.cd-body {
    position: absolute; top: var(--pad-top); left: var(--pad-x); right: var(--pad-x);
    bottom: calc(var(--foot-bottom) + var(--foot-h) + 8px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.cd-body > * { margin: 0; max-width: 100%; flex: none; }

.cd-top { height: calc(86px * var(--k) * var(--fs)); margin-bottom: calc(6px * var(--k)); display: flex; gap: 14px; align-items: center; justify-content: center; }
.cd-top svg { height: 100%; width: auto; display: block; }
.cd-logo { height: 100%; max-width: 220px; object-fit: contain; display: block; }
.cd-photo { height: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; display: block; border: 3px solid var(--rule); }

.cd-issuer { font-size: calc(17px * var(--k) * var(--fs)); font-weight: 700; color: var(--soft); line-height: 1.4; }
.cd-title { font-family: var(--display); font-weight: 700; color: var(--title); line-height: 1.3; width: 100%; padding: 0; }
.cd-title span { display: inline-block; white-space: nowrap; font-size: calc(68px * var(--k) * var(--fs)); }
.cd[dir="ltr"] .cd-title span { font-size: calc(54px * var(--k) * var(--fs)); letter-spacing: .01em; }
.cd-present { font-size: calc(21px * var(--k) * var(--fs)); color: var(--soft); margin-top: calc(4px * var(--k)); }
.cd-name { font-family: var(--display); font-weight: 700; color: var(--name); width: 100%; white-space: nowrap; overflow: hidden; font-size: calc(64px * var(--k) * var(--fs)); line-height: 1.45; }
.cd[dir="ltr"] .cd-name { font-size: calc(58px * var(--k) * var(--fs)); }
.cd-rule { color: var(--rule); width: calc(320px * var(--k)); height: calc(16px * var(--k)); margin-bottom: calc(8px * var(--k)); }
.cd-rule svg { width: 100%; height: 100%; display: block; }
.cd-reason { font-size: calc(28px * var(--k) * var(--fs)); font-weight: 700; color: var(--ink); line-height: 1.5; text-wrap: balance; }
.cd-note { font-size: calc(20.5px * var(--k) * var(--fs)); color: var(--soft); margin-top: calc(2px * var(--k)); }
.cd-quote { margin-top: calc(12px * var(--k)); display: flex; flex-direction: column; align-items: center; }
.cd-quote-text { font-family: var(--display); font-size: calc(27px * var(--k) * var(--fs)); line-height: 1.7; color: var(--title); text-wrap: balance; }
.cd-quote-text--ayah { font-family: 'KFGQPC Hafs', 'Amiri Quran', var(--display); font-size: calc(29px * var(--k) * var(--fs)); line-height: 1.8; }
.cd-quote-ref { font-size: calc(12.5px * var(--k) * var(--fs)); color: var(--soft); font-weight: 600; }
.cd-quote--own { font-family: var(--display); font-size: calc(24px * var(--k) * var(--fs)); color: var(--title); text-wrap: balance; }

/* encouragement card: the phrase is the headline */
.cd--card .cd-title span { font-size: calc(80px * var(--k) * var(--fs)); }
.cd--card[dir="ltr"] .cd-title span { font-size: calc(64px * var(--k) * var(--fs)); }
.cd--card .cd-present { margin-top: calc(10px * var(--k)); }
.cd--card .cd-reason { font-weight: 600; }

.cd-foot {
    position: absolute; left: var(--pad-x); right: var(--pad-x); bottom: var(--foot-bottom); height: var(--foot-h);
    display: grid; grid-template-columns: 1fr 104px 1fr; gap: 36px; align-items: end;
}
.cd-foot-col { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.cd-foot-val {
    width: 100%; max-width: 290px; padding-bottom: 6px; border-bottom: 1.5px solid var(--rule);
    font-size: calc(18px * var(--fs)); font-weight: 700; color: var(--ink); line-height: 1.35;
    display: flex; flex-direction: column; align-items: center; white-space: nowrap; overflow: hidden;
}
.cd-foot-sub { font-size: 13.5px; font-weight: 600; color: var(--soft); }
.cd-foot-label { margin-top: 5px; font-size: calc(13.5px * var(--fs)); font-weight: 600; color: var(--soft); }
.cd-sign { height: 46px; max-width: 220px; object-fit: contain; margin-bottom: -6px; display: block; }
.cd-seal { width: 96px; height: 96px; justify-self: center; }
.cd-seal svg { width: 100%; height: 100%; display: block; }
.cd-qr { display: flex; flex-direction: column; align-items: center; gap: 3px; justify-self: center; width: 104px; }
.cd-qr-tile { width: 82px; height: 82px; padding: 3px; background: #fff; border-radius: 6px; box-shadow: 0 0 0 1.5px var(--rule); }
.cd-qr-tile svg { width: 100%; height: 100%; display: block; }
.cd-qr-code { font-family: var(--text); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--soft); white-space: nowrap; direction: ltr; }
.cd--fmt-story .cd-qr-tile { width: 100px; height: 100px; }
.cd--fmt-story .cd-qr { width: 120px; }
.cd--fmt-story .cd-foot { grid-template-columns: 1fr 120px 1fr; }

/* ── themes ── */
.cd--mihrab { --ink: #23362F; --title: #0F4C3A; --name: #8A5A0B; --soft: #55675F; --rule: #C9A24B; }

.cd--manuscript { --ink: #2A2F45; --title: #1E3A6E; --name: #1E3A6E; --soft: #6A6250; --rule: #C9A24B; }
.cd--manuscript.cd--fmt-a4 { --pad-top: 88px; --pad-x: 136px; --foot-bottom: 88px; }
.cd--manuscript .cd-title { width: auto; margin: calc(6px * var(--k)) 0; padding: 3px; background: #C9A24B; clip-path: polygon(30px 0, calc(100% - 30px) 0, 100% 50%, calc(100% - 30px) 100%, 30px 100%, 0 50%); }
.cd--manuscript .cd-title span { display: block; padding: 2px 70px 4px; background: #1E3A6E; color: #F6E3A6; font-size: calc(54px * var(--k) * var(--fs)); clip-path: polygon(29px 0, calc(100% - 29px) 0, 100% 50%, calc(100% - 29px) 100%, 29px 100%, 0 50%); }
.cd--manuscript[dir="ltr"] .cd-title span { font-size: calc(44px * var(--k) * var(--fs)); }
.cd--manuscript.cd--card .cd-title span { font-size: calc(62px * var(--k) * var(--fs)); }

.cd--night { --ink: #EEE9D6; --title: #F1D58A; --name: #FFFFFF; --soft: #C3CAE8; --rule: #E6C36A; }
.cd--night.cd--fmt-a4 { --pad-x: 190px; --pad-top: 70px; --foot-bottom: 76px; }
.cd--night.cd--fmt-square { --pad-top: 210px; --foot-bottom: 150px; }
.cd--night.cd--fmt-story { --pad-top: 300px; --foot-bottom: 240px; }

.cd--zellige { --ink: #3B3226; --title: #0E5E5D; --name: #B4472F; --soft: #6B5F50; --rule: #E3A72F; }

.cd--garden { --ink: #2E2550; --title: #6D28D9; --name: #DB2777; --soft: #5B5380; --rule: #FBBF24; }
.cd--garden.cd--fmt-a4 { --pad-top: 70px; --pad-x: 170px; --foot-bottom: 104px; }
.cd--garden.cd--fmt-square { --pad-top: 150px; --foot-bottom: 190px; }
.cd--garden.cd--fmt-story { --pad-top: 320px; --foot-bottom: 220px; }
.cd--garden .cd-title, .cd--garden .cd-name { font-family: var(--text); }
.cd--garden .cd-title span { font-size: calc(58px * var(--k) * var(--fs)); }
.cd--garden[dir="ltr"] .cd-title span { font-size: calc(46px * var(--k) * var(--fs)); }
.cd--garden.cd--card .cd-title span { font-size: calc(70px * var(--k) * var(--fs)); }
.cd--garden .cd-name { font-size: calc(56px * var(--k) * var(--fs)); }
.cd--garden .cd-foot-val { border-bottom-style: dashed; border-bottom-color: #7C3AED; }

.cd--rose { --ink: #4A2B45; --title: #6B2A5B; --name: #B83268; --soft: #7A5C75; --rule: #C9A24B; }
.cd--rose.cd--fmt-a4 { --pad-x: 170px; --pad-top: 78px; }
.cd--rose.cd--fmt-square { --pad-top: 200px; --foot-bottom: 170px; }

.cd--ramadan { --ink: #F3E6D3; --title: #F2C46D; --name: #FFFFFF; --soft: #D6C1E4; --rule: #E8B85C; }
.cd--ramadan.cd--fmt-a4 { --pad-top: 150px; --pad-x: 150px; --foot-bottom: 70px; }
.cd--ramadan.cd--fmt-square { --pad-top: 280px; --foot-bottom: 90px; --pad-x: 120px; }
.cd--ramadan.cd--fmt-story { --pad-top: 520px; --foot-bottom: 130px; }

.cd--eid { --ink: #2F3B3D; --title: #0E6C74; --name: #C2410C; --soft: #5C6B6D; --rule: #E9C46A; }
.cd--eid.cd--fmt-a4 { --pad-top: 140px; --pad-x: 150px; --foot-bottom: 64px; }
.cd--eid.cd--fmt-square { --pad-top: 170px; --pad-x: 140px; }
.cd--eid.cd--fmt-story { --pad-top: 240px; --pad-x: 140px; }

.cd--khatm { --ink: #EADFC3; --title: #E9C77B; --name: #FFFFFF; --soft: #B9CBBF; --rule: #D4AF37; }
.cd--khatm.cd--fmt-a4 { --pad-top: 96px; --pad-x: 150px; --foot-bottom: 80px; }
.cd--khatm.cd--fmt-square { --pad-top: 140px; --pad-x: 130px; --foot-bottom: 120px; }

.cd--graduation { --ink: #2C3350; --title: #1B2A55; --name: #8A6412; --soft: #5D6480; --rule: #C9A24B; }
.cd--graduation.cd--fmt-a4 { --pad-x: 170px; --pad-top: 80px; --foot-bottom: 78px; }
.cd--graduation.cd--fmt-square { --pad-x: 150px; }
.cd--graduation.cd--fmt-story { --pad-x: 150px; }

/* cards carry little text: let it fill the sharing sizes */
.cd--card.cd--fmt-square { --fs: 1.14; }
.cd--card.cd--fmt-story { --fs: 1.5; }
