/* ════════════════════════════════════════════════════════════════
   CARD v4 — the exported card, laid out at its real export size.
   Horizontal 1920×1080 (16:9) · Vertical 1200×1500 (4:5).
   The on-page preview is this same element scaled with a CSS transform
   (js/card.js scalePreview), so preview and export are identical.
   Values match the approved design canvas (Direction C + A-style vertical).
   html2canvas-safe: no filters, no blend modes, images as backgrounds.
   ════════════════════════════════════════════════════════════════ */

.cd-scaler { position: relative; width: 100%; overflow: hidden; }

.cd-card {
    position: absolute; top: 0; left: 0;
    transform-origin: top left;
    box-sizing: border-box;
    overflow: hidden;
    background: #0e1014;
    color: #f2f4ee;
    font-family: 'Handjet', 'JetBrains Mono', monospace;
    direction: rtl;
    text-align: right;
    letter-spacing: normal;
}
.cd-card *, .cd-card *::before, .cd-card *::after { box-sizing: border-box; }
.cd-card .hidden { display: none !important; }

.cd-h { width: 1920px; height: 1080px; display: flex; flex-direction: row; }
.cd-v { width: 1200px; height: 1500px; display: flex; flex-direction: column; }

/* ── Media: H = full-height cover, V-wide = wide band, V-tall = not shown ── */
.cd-media { position: relative; flex: none; background: #161a21; }
.cd-h .cd-media { width: 760px; height: 1080px; }
.cd-wide .cd-media { width: 1200px; height: 680px; }
.cd-tall .cd-media { display: none; }
.cd-media-img, .cd-tall-poster {
    background-color: #161a21;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.cd-media-img { position: absolute; inset: 0; }

/* Classifier pill on the cover / band */
.cd-classifier {
    display: inline-flex; align-items: center; gap: 14px;
    font-size: 34px; font-weight: 600; white-space: nowrap; line-height: 1.2;
}
.cd-classifier .cd-cl-label { color: #c8ff5e; }
.cd-wide .cd-media .cd-classifier { background: rgba(10, 11, 14, 0.88); }
.cd-classifier .cd-cl-sep { width: 2px; height: 30px; background: rgba(255, 255, 255, 0.2); flex: none; }
.cd-classifier .cd-cl-rating { font-family: 'Silkscreen', monospace; font-size: 30px; color: #c8ff5e; white-space: nowrap; direction: ltr; }
.cd-classifier .cd-cl-den { font-size: 20px; }
.cd-media .cd-cl-wrap { position: absolute; display: flex; justify-content: center; }
.cd-h .cd-media .cd-cl-wrap { left: 40px; right: 40px; bottom: 40px; }
.cd-wide .cd-media .cd-cl-wrap { left: 64px; right: 64px; bottom: 32px; }
.cd-media .cd-classifier {
    background: rgba(10, 11, 14, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 10px 34px 14px;
    max-width: 100%;
}

/* ── Body ── */
.cd-body { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cd-h .cd-body { flex: 1; padding: 64px 80px 64px 72px; gap: 20px; }
.cd-wide .cd-body { flex: 1; padding: 40px 64px 44px; gap: 18px; }
.cd-tall .cd-body { flex: 1; padding: 56px 64px 0; gap: 20px; }

/* Brand row: logo · label · MUHAFID.COM (H + V-wide); label only, centred (V-tall) */
.cd-brand { display: flex; align-items: center; gap: 18px; flex: none; }
.cd-wide .cd-brand { gap: 16px; }
.cd-brand-logo { height: 38px; width: auto; display: block; }
.cd-wide .cd-brand-logo { height: 34px; }
.cd-brand-label { font-size: 30px; font-weight: 600; color: #9aa093; }
.cd-brand-url { margin-right: auto; font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700; letter-spacing: 0.1em; color: #9aa093; direction: ltr; }
.cd-wide .cd-brand-url { font-size: 20px; }
.cd-tall .cd-brand { justify-content: center; height: 36px; }
.cd-tall .cd-brand-logo, .cd-tall .cd-brand-url { display: none; }

/* Title — size set by js/card.js fitTitle (one line large, two lines smaller, then "…") */
.cd-title {
    margin: 0; flex: none;
    font-weight: 700; line-height: 0.95;   /* site's own Handjet-Bold: Arabic at 800 (Google copy) broke letter joins on iOS */
    color: #f2f4ee;
    overflow-wrap: anywhere;
    unicode-bidi: plaintext;
    text-wrap: balance;   /* two-line titles split evenly, never one word alone */
}
.cd-h .cd-title { margin-top: 10px; font-size: 156px; }   /* defaults before js/card.js fits it */
.cd-wide .cd-title { font-size: 118px; }
.cd-tall .cd-title { font-size: 124px; }
.cd-h .cd-title.cd-one-line { margin-top: 18px; line-height: 0.92; }
.cd-tall .cd-title { text-align: center; line-height: 1; }
.cd-title[dir="ltr"] { text-align: right; }
.cd-tall .cd-title[dir="ltr"] { text-align: center; }

/* Pills — one row; js/card.js fitPills turns overflow into "+N" */
.cd-pills { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; height: 56px; overflow: hidden; flex: none; }
.cd-tall .cd-pills { justify-content: center; }
.cd-genres { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; flex: none; outline: none; }
.cd-score {
    font-family: 'Silkscreen', monospace; font-size: 28px; line-height: 1.2;
    color: #0e1014; background: #f5c827; border-radius: 8px; padding: 6px 12px;
    white-space: nowrap; direction: ltr; flex: none;
}
.cd-tall .cd-score { font-size: 26px; }
.cd-pill { font-size: 36px; font-weight: 600; line-height: 1.2; border-radius: 8px; white-space: nowrap; flex: none; }
.cd-pill-stat { color: #0e1014; background: #6fb4ff; padding: 2px 14px 6px; }
.cd-pill-genre { color: #c8ff5e; border: 2px solid rgba(200, 255, 94, 0.7); padding: 0 14px 4px; }

/* Row: synopsis (all layouts) + tall poster (V-tall) */
.cd-row { display: flex; gap: 40px; min-height: 0; flex: 1; }
.cd-tall .cd-row { padding-top: 8px; }
/* No box-shadow: html2canvas paints shadows over the image, which greys out the poster */
.cd-tall-poster { display: none; flex: none; border-radius: 10px; position: relative; }
.cd-tall .cd-tall-poster { display: block; }
.cd-tall .cd-tall-poster.cd-no-img { display: none; }   /* no image: no empty box (js/card.js fitTallPoster) */
.cd-tall .cd-row { position: relative; }
.cd-tall .cd-tall-poster { z-index: 1; }
.cd-tall.cd-no-syn .cd-row { justify-content: center; }
.cd-tall.cd-no-syn .cd-synopsis { position: absolute; inset: 0; }
.cd-tall.cd-no-syn .cd-synopsis-text { height: 100%; cursor: text; }
.cd-synopsis { flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
.cd-synopsis-text {
    margin: 0; outline: none;
    line-height: 1.24; color: #d7dad2;
    white-space: pre-wrap; overflow-wrap: break-word;
    /* Arabic paragraphs stay right-aligned even when one starts with an English name */
    direction: rtl; text-align: right;
}
.cd-wide .cd-synopsis-text { line-height: 1.25; }
.cd-tall .cd-synopsis-text { line-height: 1.25; color: #e6e8e1; }
.cd-h .cd-synopsis { margin-top: 2px; }

/* Stickers panel: warnings ("يحتوي على") and exceptions ("يخلو من"),
   each label attached to its own group; sizes set by js/card.js fitStickers */
.cd-stickers {
    flex: none; display: flex; justify-content: center; align-items: flex-start; gap: 28px;
    background: #161a21; border-radius: 18px; padding: 22px 28px 26px;
}
/* Landscape: badges start at the reading edge (right in Arabic, left in English)
   instead of floating in the middle; the portrait layouts stay centred */
.cd-h .cd-stickers { justify-content: flex-start; }
.cd-wide .cd-stickers { padding: 22px 28px; }
.cd-tall .cd-stickers { padding: 20px 28px 24px; }
.cd-tall .cd-stickers-wrap { padding: 8px 0 0; }
.cd-group { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.cd-tall .cd-group, .cd-wide .cd-group { gap: 10px; }
.cd-group-label { font-size: 28px; font-weight: 600; color: #9aa093; line-height: 1.2; }
.cd-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.cd-sticker { display: block; width: 150px; height: 150px; }
.cd-divider { width: 2px; align-self: stretch; background: rgba(255, 255, 255, 0.12); flex: none; }

/* Footer band (V-tall only): classifier + MUHAFID.COM + logo */
.cd-footer { display: none; }
.cd-tall .cd-footer {
    display: flex; flex: none; margin-top: 28px; height: 96px;
    padding: 0 64px; align-items: center; justify-content: space-between;
    background: #161a21; border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.cd-tall .cd-media .cd-cl-wrap { display: none; }
.cd-footer-brand { display: flex; align-items: center; gap: 16px; }
.cd-footer-brand span { font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 700; letter-spacing: 0.08em; color: #d9dcd3; direction: ltr; }
.cd-footer-brand img { height: 36px; width: auto; display: block; }

/* Manual mode: click-to-upload hint (never exported) */
.cd-card .upload-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 40px; font-weight: 600; color: rgba(242, 244, 238, 0.7);
    background: repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 16px, transparent 16px 32px);
    cursor: pointer;
}
.cd-card .manual-mode { cursor: pointer; }

/* Controls: label on its own line, then classifier name + rating side by side
   at the panel's full width (beside the label, the name box was ~23px wide) */
.classifier-row { gap: 8px; }
.classifier-row .control-label { flex-basis: 100%; }
.classifier-inputs { display: flex; gap: 8px; flex: 1 1 100%; min-width: 0; align-items: flex-end; }
.cl-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cl-name { flex: 1; }
.cl-rating { flex: none; width: 118px; }
.cl-label { font-family: var(--font-ar); font-size: 14px; font-weight: 600; color: var(--text-1); line-height: 1.2; }
.cl-label em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--text-2); margin-right: 4px; }
.cl-field .search-wrapper { width: 100%; box-sizing: border-box; }
#reviewer-rating-input {
    width: 100%; min-width: 0; flex: 1;
    background: transparent; border: none; outline: none;
    font-family: var(--font-ar); font-size: 16px; color: var(--text-0);
    text-align: center;
}
#reviewer-rating-input::placeholder { color: var(--text-3); }
/* Reads "8.5 /10" like the card: the number on the left, "/10" after it (an RTL
   row put the number on the right, so it read "/10 8.5") */
.classifier-inputs .rating-input { direction: ltr; }
.classifier-inputs .rating-input .search-hint { margin-right: 0; margin-left: 0; direction: ltr; unicode-bidi: isolate; }

/* Share button inside the phone export popup */
.share-btn {
    width: 100%;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--acc);
    color: #0e1014;
    font-family: var(--font-ar);
    font-size: 20px;
    font-weight: 700;   /* the site's own Handjet-Bold; weight 800 broke Arabic joins on iOS Safari */
    cursor: pointer;
}
.share-btn:active { transform: translateY(1px); }

/* ── Manual mode ── */
/* Preview-only hints in empty manual fields (removed from exports) */
.cd-card .cd-ph { opacity: 0.38; }
.cd-card .cd-score.cd-ph { opacity: 0.45; }
/* Image position chosen in the manual form */
.cd-card[data-img-pos="top"] .cd-media-img, .cd-card[data-img-pos="top"] .cd-tall-poster { background-position: center top; }
.cd-card[data-img-pos="bottom"] .cd-media-img, .cd-card[data-img-pos="bottom"] .cd-tall-poster { background-position: center bottom; }

/* Manual form in the side panel */
.manual-panel { display: flex; flex-direction: column; gap: 12px; }
.manual-panel.hidden { display: none; }
.mf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mf-label { font-family: var(--font-ar); font-size: 15px; font-weight: 600; color: var(--text-1); }
.mf-label em { font-style: normal; font-weight: 400; font-size: 13px; color: var(--text-2); margin-right: 6px; }
.mf-input {
    width: 100%; min-width: 0; box-sizing: border-box;
    background: var(--ink-3); border: 1px solid var(--line-bright); border-radius: 4px;
    color: var(--text-0); font-family: var(--font-ar); font-size: 16px;   /* 16px: iOS doesn't zoom in on focus */
    height: 40px; padding: 0 12px; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.mf-input::placeholder { color: var(--text-3); }
.mf-input:focus { border-color: var(--acc-dim); box-shadow: 0 0 0 3px rgba(200, 255, 94, 0.08); }
.mf-textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.mf-image-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mf-btn {
    height: 36px; padding: 0 14px; border-radius: 4px; cursor: pointer;
    font-family: var(--font-ar); font-size: 15px; font-weight: 600;
    background: var(--ink-3); color: var(--acc); border: 1px solid var(--line-bright);
}
.mf-btn:hover { border-color: var(--acc-dim); }
.mf-btn-quiet { color: var(--text-1); }
.mf-btn.hidden, .mf-seg.hidden { display: none; }
.mf-seg { display: inline-flex; background: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 3px; gap: 2px; margin-right: auto; }
.mf-seg button {
    background: transparent; border: none; color: var(--text-1); cursor: pointer;
    font-family: var(--font-ar); font-size: 14px; font-weight: 600; padding: 6px 10px; border-radius: 3px; line-height: 1;
}
.mf-seg button.active { background: var(--ink-1); color: var(--acc); box-shadow: inset 0 0 0 1px var(--line-bright); }

/* About links: the guide's opening line and the header link (about.html) */
.guide-intro {
    margin: 0 0 22px; padding: 12px 14px;
    background: var(--ink-3); border: 1px solid var(--line); border-radius: 6px;
    font-family: var(--font-body); font-size: 15px; line-height: 1.7; color: var(--text-1);
}
.guide-intro a { color: var(--acc); white-space: nowrap; }
.status-about { color: var(--acc); text-decoration: none; font-family: var(--font-ar); font-size: 14px; font-weight: 600; letter-spacing: normal; }
.status-about:hover { text-decoration: underline; }
.phone-about-link { display: none; }

/* ── Start panel: the card before a work is picked (js/card.js isIntro) ──
   The cover shows the logo over a faint field of the icons; the synopsis area
   shows three steps; the stickers panel shows the level legend. */
.cd-intro-art, .cd-intro-steps, .cd-intro-legend { display: none; }
/* The cover already shows the big logo; the small one in the brand row would repeat it */
.cd-intro .cd-brand-logo { display: none; }
.cd-intro .cd-pills, .cd-intro .cd-synopsis-text, .cd-intro .cd-stickers { display: none !important; }
.cd-intro .cd-intro-art {
    display: flex; position: absolute; inset: 0; overflow: hidden; border-radius: inherit;
    align-items: center; justify-content: center; background: #12151b;
}
.cd-intro-mosaic {
    position: absolute; top: -8%; left: -18%; width: 136%;
    display: flex; flex-wrap: wrap; gap: 18px; transform: rotate(-8deg); opacity: 0.2;
}
.cd-intro-mosaic img { width: 132px; height: 132px; display: block; }
.cd-intro-art::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(62% 52% at 50% 50%, rgba(14, 16, 20, 0.94) 0%, rgba(14, 16, 20, 0.6) 62%, rgba(14, 16, 20, 0.2) 100%);
}
.cd-intro-brand { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 28px; text-align: center; padding: 0 24px; }
.cd-intro-brand img { height: 130px; width: auto; display: block; }
.cd-intro-brand span { font-size: 40px; font-weight: 600; line-height: 1.25; color: #c9cec2; }
.cd-tall .cd-intro-brand { gap: 22px; }
.cd-tall .cd-intro-brand img { height: 92px; }
.cd-tall .cd-intro-brand span { font-size: 30px; }

.cd-intro .cd-intro-steps { display: flex; flex-direction: column; gap: 36px; margin: 34px 0 0; padding: 0; list-style: none; }
.cd-intro-steps li { display: flex; align-items: center; gap: 26px; }
.cd-intro-num {
    flex: none; width: 74px; height: 74px; border-radius: 16px; box-sizing: border-box;
    display: flex; align-items: center; justify-content: center;
    background: #1b2029; border: 2px solid #c8ff5e; color: #c8ff5e;
    font-family: 'Silkscreen', monospace; font-size: 30px; direction: ltr;
}
.cd-intro-steps b { display: block; font-size: 46px; font-weight: 700; line-height: 1.05; color: #f2f4ee; }
.cd-intro-steps small { display: block; margin-top: 6px; font-size: 30px; font-weight: 600; color: #8a917f; }
.cd-tall .cd-intro-steps { gap: 30px; margin-top: 10px; justify-content: center; height: 100%; }
.cd-tall .cd-intro-steps li { gap: 20px; }
.cd-tall .cd-intro-num { width: 60px; height: 60px; font-size: 24px; border-radius: 13px; }
.cd-tall .cd-intro-steps b { font-size: 38px; }
.cd-tall .cd-intro-steps small { font-size: 26px; }

.cd-intro .cd-intro-legend {
    display: flex; align-items: center; gap: 30px;
    background: #161a21; border-radius: 18px; padding: 26px 32px;
}
.cd-tall.cd-intro .cd-intro-legend { justify-content: center; }
.cd-intro-legend-label { font-size: 30px; font-weight: 600; color: #9aa093; }
.cd-intro-lvl { display: inline-flex; align-items: center; gap: 12px; font-size: 32px; font-weight: 700; }
.cd-intro-lvl i { width: 26px; height: 26px; border-radius: 6px; display: inline-block; }
.cd-intro-lvl.lvl-1 { color: #ff8a8a; } .cd-intro-lvl.lvl-1 i { background: #ff5a5a; }
.cd-intro-lvl.lvl-2 { color: #ffb874; } .cd-intro-lvl.lvl-2 i { background: #ff9a3c; }
.cd-intro-lvl.lvl-3 { color: #ffe68a; } .cd-intro-lvl.lvl-3 i { background: #ffd84a; }
