/* ==========================================================================
   CV paper + 6 templates. A4 at 96dpi = 794 x 1123 px.
   Logical properties everywhere so every template works in RTL and LTR.
   ========================================================================== */

.cv {
  --ink: #191b26;
  --soft-ink: #4a4e60;
  --rule: #d9dbe4;
  --tint: color-mix(in srgb, var(--accent) 9%, #fff);
  width: 794px;
  min-height: 1123px;
  padding: 52px 58px;
  background: #fff;
  color: var(--ink);
  font-family: var(--cv-font);
  font-size: 13.5px;
  line-height: 1.5;
  text-align: start;
  overflow-wrap: break-word;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.cv[lang="ar"] { font-size: 14px; line-height: 1.7; }
.cv * { margin: 0; padding: 0; box-sizing: border-box; }
.cv ul { list-style: none; }
.cv a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Header */
.cv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.cv-id { flex: 1 1 320px; min-width: 0; }
.cv h1 { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.cv[lang="ar"] h1 { letter-spacing: 0; line-height: 1.35; }
.cv-headline { margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--accent); }
.cv-photo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; }
.cv-contact { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 12.5px; color: var(--soft-ink); }

/* Sections */
.cv-sec { margin-top: 20px; }
.cv h2 { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.cv h3 { font-size: 14px; font-weight: 700; }
.cv h4 { font-size: 12px; font-weight: 700; color: var(--soft-ink); margin-bottom: 4px; }
.cv-main > .cv-sec:first-child { margin-top: 22px; }

.cv-sec ul:not(.cv-tags):not(.cv-links):not(.cv-langs):not(.cv-contact) li {
  position: relative; padding-inline-start: 16px; margin-bottom: 3px;
}
.cv-sec ul:not(.cv-tags):not(.cv-links):not(.cv-langs):not(.cv-contact) li::before {
  content: ""; position: absolute; inset-inline-start: 2px; top: 0.68em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}

.cv-job { margin-bottom: 12px; break-inside: avoid; }
.cv-job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cv-dates { font-size: 12.5px; color: var(--soft-ink); white-space: nowrap; font-weight: 500; }
.cv-where { color: var(--soft-ink); font-size: 13px; margin: 1px 0 4px; }
.cv-details { font-size: 13px; }

.cv-skill-group + .cv-skill-group { margin-top: 8px; }
.cv-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.cv-tags li { background: var(--tint); color: var(--ink); border-radius: 4px; padding: 2px 8px; font-size: 12.5px; }

.cv-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }
.cv-link { display: flex; align-items: center; gap: 10px; break-inside: avoid; }
.cv-link small { display: block; color: var(--soft-ink); font-size: 12px; line-height: 1.4; }
.cv .qr { width: 54px; height: 54px; flex: none; }
.cv .qr svg { width: 100%; height: 100%; display: block; }
.cv .qr:empty { display: none; }

.cv-langs { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.cv-langs span { color: var(--soft-ink); }

/* Editing affordances (builder only) */
.cv [data-edit] { border-radius: 3px; outline: 1px dashed transparent; outline-offset: 2px; transition: outline-color .15s, background .15s; }
.cv.is-editable [data-edit]:hover { outline-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.cv.is-editable [data-edit]:focus { outline: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 5%, #fff); }

/* ---------- 1. Classic (ATS) ---------- */
.t-ats h2 { border-bottom: 1.5px solid var(--ink); padding-bottom: 3px; }
.t-ats .cv-contact li:not(:last-child)::after { content: "|"; margin-inline-start: 16px; color: var(--rule); }
.t-ats .cv-contact { gap: 2px 0; }
.t-ats .cv-contact li { margin-inline-end: 16px; }
.t-ats .cv-tags, .t-minimal .cv-tags, .t-executive .cv-tags { display: block; }
.t-ats .cv-tags li, .t-minimal .cv-tags li, .t-executive .cv-tags li { display: inline; background: none; padding: 0; font-size: inherit; }
.t-ats .cv-tags li:not(:last-child)::after, .t-minimal .cv-tags li:not(:last-child)::after, .t-executive .cv-tags li:not(:last-child)::after { content: ", "; }
.cv[lang="ar"].t-ats .cv-tags li:not(:last-child)::after,
.cv[lang="ar"].t-minimal .cv-tags li:not(:last-child)::after,
.cv[lang="ar"].t-executive .cv-tags li:not(:last-child)::after { content: "، "; }
.t-ats .cv-skill-group { display: flex; gap: 8px; }
.t-ats .cv-skill-group h4 { flex: none; color: var(--ink); font-size: 13px; margin: 0; }
.t-ats .cv-skill-group h4::after { content: ":"; }

/* ---------- 2. Modern (sidebar) ---------- */
.t-modern { padding: 0; display: flex; flex-direction: column; }
.t-modern .cv-head { padding: 44px 48px 26px; border-bottom: 4px solid var(--accent); }
.t-modern .cv-body { display: grid; grid-template-columns: 240px 1fr; flex: 1; }
.t-modern .cv-side { background: var(--tint); padding: 8px 26px 36px; }
.t-modern .cv-main { padding: 0 44px 36px 36px; }
.t-modern[dir="rtl"] .cv-main { padding: 0 36px 36px 44px; }
.t-modern .cv-side .cv-sec { margin-top: 22px; }
.t-modern .cv-side .cv-contact { flex-direction: column; gap: 6px; font-size: 12px; }
.t-modern .cv-side .cv-tags li { background: #fff; }
.t-modern .cv-side .cv-links { grid-template-columns: 1fr; }
.t-modern .cv-side .cv-langs { flex-direction: column; }
.t-modern h2 { color: var(--accent); }

/* ---------- 3. Minimal ---------- */
.t-minimal { padding: 64px 70px; }
.t-minimal h1 { font-weight: 300; font-size: 36px; }
.t-minimal .cv-headline { color: var(--soft-ink); font-weight: 500; }
.t-minimal h2 { color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.t-minimal .cv-sec { margin-top: 28px; }
.t-minimal .cv-sec ul:not(.cv-tags):not(.cv-links):not(.cv-langs):not(.cv-contact) li::before { width: 8px; height: 1.5px; border-radius: 0; background: var(--soft-ink); top: 0.75em; }

/* ---------- 4. Executive ---------- */
.t-executive .cv-head { flex-direction: column; text-align: center; border-bottom: 3px double var(--ink); padding-bottom: 16px; }
.t-executive .cv-id { flex: none; }
.t-executive h1 { font-size: 32px; font-weight: 600; }
.t-executive .cv-headline { color: var(--soft-ink); font-style: italic; font-weight: 400; }
.cv[lang="ar"].t-executive .cv-headline { font-style: normal; }
.t-executive .cv-contact { justify-content: center; }
.t-executive h2 { display: flex; align-items: center; gap: 12px; color: var(--accent); font-weight: 600; font-size: 15px; letter-spacing: .02em; }
.t-executive h2::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.t-executive .cv-sec ul:not(.cv-tags):not(.cv-links):not(.cv-langs):not(.cv-contact) li::before { border-radius: 0; transform: rotate(45deg); width: 4px; height: 4px; }

/* ---------- 5. Creative ---------- */
.t-creative { padding: 0; display: flex; flex-direction: column; }
.t-creative .cv-head { background: var(--accent); color: #fff; padding: 40px 48px; }
.t-creative .cv-headline { color: #fff; opacity: .88; }
.t-creative .cv-photo { border: 3px solid #fff; width: 104px; height: 104px; }
.t-creative .cv-body { display: grid; grid-template-columns: 1fr 236px; flex: 1; }
.t-creative .cv-main { padding: 6px 34px 36px 48px; }
.t-creative[dir="rtl"] .cv-main { padding: 6px 48px 36px 34px; }
.t-creative .cv-side { order: 2; padding: 6px 28px 36px; border-inline-start: 1px solid var(--rule); }
.t-creative .cv-side .cv-sec { margin-top: 22px; }
.t-creative .cv-side .cv-contact { flex-direction: column; gap: 6px; font-size: 12px; }
.t-creative .cv-side .cv-links { grid-template-columns: 1fr; }
.t-creative .cv-side .cv-langs { flex-direction: column; }
.t-creative h2 { display: inline-block; background: var(--tint); color: var(--accent); padding: 2px 10px; border-radius: 4px; font-size: 13px; }
.t-creative .cv-tags li { border-radius: 999px; padding: 2px 10px; }

/* ---------- 6. Timeline ---------- */
.t-timeline .cv-head { border-inline-start: 6px solid var(--accent); padding-inline-start: 18px; }
.t-timeline h2 { display: flex; align-items: center; gap: 10px; }
.t-timeline h2::before { content: ""; width: 10px; height: 10px; background: var(--accent); border-radius: 2px; }
.t-timeline .cv-sec-exp .cv-job, .t-timeline .cv-sec-edu .cv-job {
  position: relative; padding-inline-start: 22px; padding-bottom: 6px; margin-bottom: 6px; border-inline-start: 2px solid var(--rule); margin-inline-start: 4px;
}
.t-timeline .cv-sec-exp .cv-job::before, .t-timeline .cv-sec-edu .cv-job::before {
  content: ""; position: absolute; inset-inline-start: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent);
}
.t-timeline .cv-dates { color: var(--accent); font-weight: 600; }

/* ---------- Cover letter ---------- */
.letter .cv-head { border-bottom: 2px solid var(--accent); padding-bottom: 18px; }
.letter.t-modern .cv-head, .letter.t-creative .cv-head { border-bottom-width: 4px; }
.letter-body { padding-top: 28px; font-size: 14px; line-height: 1.75; }
.t-modern .letter-body, .t-creative .letter-body { padding: 28px 48px 40px; }
.letter-body p { margin-bottom: 14px; max-width: 64ch; }
.letter-sign { margin-top: 26px; }
.letter-sign b { display: block; margin-top: 4px; }

/* Locked (pre-payment) text */
.cv .redact { filter: blur(4.5px); color: #6b7280; user-select: none; -webkit-user-select: none; }
.cv[lang="ar"] .redact { letter-spacing: .02em; }
