/* ============================================================
   المعاينة الكبيرة اللي تنفتح تحت القالب المختار — مشتركة بين الصفحة الرئيسية وصفحة القوالب بعد الدخول
   Owner 2026-11-21: one template preview for both galleries.
   ============================================================ */
/* The open preview, right under the chosen card's row. */
.tpl-viewer { --notch-x: 50%; position: relative; grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 44px; align-items: start; padding: 30px; border: 1px solid #e2dccb; border-radius: 18px; background: #f6f2e7; scroll-margin-top: 90px; }
.tpl-viewer::before { content: ''; position: absolute; top: -10px; left: var(--notch-x); width: 18px; height: 18px; border-top: 1px solid #e2dccb; border-left: 1px solid #e2dccb; background: #f6f2e7; transform: translateX(-50%) rotate(45deg); }
.tv-close { position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #ddd6c3; border-radius: 50%; background: #fff; color: var(--ink); font-size: 21px; cursor: pointer; }
.tv-close:hover { border-color: var(--g-700); }
.tv-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; min-width: 0; }
.tv-paper { position: relative; width: min(100%, 470px); aspect-ratio: 210 / 297; overflow: hidden; border-radius: 2px; background: #fff; direction: ltr; box-shadow: 0 34px 60px -38px rgba(4, 35, 27, .55), 0 0 0 1px rgba(4, 35, 27, .06); }
.tv-page { position: absolute; top: 0; left: 0; width: 794px; transform: scale(var(--tv-scale, .6)); transform-origin: top left; }
.tv-page .cv-page { margin: 0; box-shadow: none; }
.tv-page > .cv-page ~ .cv-page { display: none; }
.tv-designs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; width: min(100%, 470px); }
.tv-design { position: relative; aspect-ratio: 210 / 297; overflow: hidden; padding: 0; border: 1px solid #ddd6c3; border-radius: 4px; background: #fff; direction: ltr; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.tv-design[aria-pressed="true"] { border-color: var(--g-900); box-shadow: 0 0 0 2px var(--g-900); }
.tv-design-page { position: absolute; top: 0; left: 0; width: 794px; transform: scale(var(--tv-design-scale, .08)); transform-origin: top left; pointer-events: none; }
.tv-design-page .cv-page { margin: 0; box-shadow: none; }
.tv-info { min-width: 0; padding-top: 6px; padding-inline-end: 40px; }
.tv-type { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 4px 10px; border-radius: 6px; background: #ebe3cd; color: #6f5c2c; font-size: 12.5px; font-weight: 700; }
.tv-type.is-free { background: #e2efe7; color: #2f6a4c; }
.tv-name { margin: 12px 0 8px; font-size: clamp(32px, 3.4vw, 44px); font-weight: 900; line-height: 1.2; }
.tv-desc { margin: 0 0 20px; max-width: 32em; color: var(--muted); font-size: 16px; line-height: 1.8; }
.tv-options { display: grid; gap: 16px; margin: 0 0 22px; padding: 18px; border: 1px solid #e2dccb; border-radius: 14px; background: #fffdf8; }
.tv-option { display: grid; gap: 9px; }
.tv-option-label { color: var(--ink-2); font-size: 14px; font-weight: 800; }
.tv-lang { display: inline-flex; justify-self: start; overflow: hidden; border: 1px solid #d9d3c2; border-radius: 10px; background: #fff; }
.tv-lang button { min-width: 92px; min-height: 42px; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 14.5px; font-weight: 800; cursor: pointer; transition: background .2s, color .2s; }
.tv-lang button[aria-pressed="true"] { background: var(--g-900); color: #fff; }
.tv-colors { display: flex; flex-wrap: wrap; gap: 7px; }
.tv-swatch { display: grid; place-items: center; width: 33px; height: 33px; padding: 0; border: 3px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px rgba(4, 35, 27, .18); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.tv-swatch:hover { transform: scale(1.06); }
.tv-swatch.is-original { background: radial-gradient(circle, #fff 0 3.5px, var(--swatch) 4px); }
/* Same as My Canvas: a light green circle with a palette. */
.tv-swatch.is-custom { border: 0; background: var(--g-50); color: var(--g-800); box-shadow: 0 0 0 1px #b8cfc2; font-size: 17px; }
.tv-swatch.is-custom[aria-expanded="true"] { background: var(--g-100); outline: 2px solid var(--g-700); outline-offset: 2px; }
.tv-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--g-900); }
.tv-custom { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.tv-custom[hidden] { display: none; }
.tv-custom label { display: grid; gap: 5px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.tv-custom input[type="color"] { width: 58px; height: 40px; padding: 2px; border: 1px solid #d9d3c2; border-radius: 8px; background: #fff; cursor: pointer; }
.tv-custom input[data-viewer-hex] { width: 112px; height: 40px; padding: 0 10px; border: 1px solid #d9d3c2; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.tv-custom input[aria-invalid="true"] { border-color: var(--danger); }
.tv-features { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 18px; }
.tv-features li { display: flex; gap: 8px; align-items: baseline; font-size: 14px; line-height: 1.55; }
.tv-features li::before { content: '✓'; flex: none; color: #047857; font-weight: 800; }
.tv-info .template-offer { margin: 0 0 16px; }
.tv-info .ats-learn-link { margin: 0 0 16px; }
.tv-buy { padding-top: 18px; border-top: 1px solid #e2dccb; }
.tv-buy .template-price { padding: 0; border: 0; background: none; column-gap: 10px; }
.tv-buy .template-price strong { font-size: 32px; }
.tv-buy .badge-free { padding: 0; border: 0; background: none; color: var(--g-900); font-size: 30px; font-weight: 900; }
.tv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 16px; }
.tv-cta { min-height: 50px; padding: 0 26px; gap: 8px; font-size: 16px; }
.tv-cta i { font-size: 19px; }
.tv-full { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--g-700); font: inherit; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
:is(.tv-close, .tv-lang button, .tv-swatch, .tv-design, .tv-full, .tv-custom input):focus-visible { outline: 3px solid #d6b25e; outline-offset: 2px; }


@media (max-width: 1020px) {
  .tpl-viewer { gap: 28px; padding: 22px; }
}
@media (max-width: 860px) {
  /* The close button sits above the sheet, not on it. */
  .tpl-viewer { grid-template-columns: minmax(0, 1fr); padding-top: 64px; }
  .tv-close { top: 12px; }
  .tv-info { padding-top: 0; padding-inline-end: 0; }
}
@media (max-width: 560px) {
  .tpl-viewer { padding: 16px; border-radius: 14px; }
  .tv-features { grid-template-columns: minmax(0, 1fr); }
  .tv-actions .tv-cta { flex: 1 1 100%; justify-content: center; }
  .tv-lang button { min-width: 0; flex: 1; }
  .tv-lang { justify-self: stretch; display: flex; }
}
