/* Sertifikat: A4 tik (210 × 297 mm), oltin qog'oz va oq girih. Hamma o'lcham mm da — ekranda ham, bosmada ham bir xil. */
.cert {
  --ink: #221e12; --label: #423c27; --rule: rgba(66, 56, 22, .34);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Arial, "Liberation Sans", Helvetica, sans-serif;
  position: relative; width: 210mm; height: 297mm; overflow: hidden; background: #e3d8a2; color: var(--ink);
  font-family: var(--sans); font-size: 3.6mm; line-height: 1.3; text-align: left; font-variant-numeric: lining-nums;
  box-shadow: 0 2px 6px rgba(58, 48, 18, .1), 0 24px 70px rgba(58, 48, 18, .2);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.cert-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cert-inner { position: absolute; inset: 14mm 20mm 19mm; display: flex; flex-direction: column; }
.cert b, .cert dd, .cert h1 { font-family: var(--serif); font-weight: 700; }

.cert-head { flex: none; text-align: center; padding-bottom: 3.6mm; border-bottom: .7mm solid #1d2a26; }
.cert-logo { display: block; width: 27mm; height: 27mm; margin: 0 auto; border-radius: 50%;
             box-shadow: 0 0 0 .5mm #fffcec, 0 0 0 .8mm rgba(150, 128, 62, .55), 0 1mm 3mm rgba(60, 46, 10, .25); }
.cert-issuer { display: flex; align-items: center; justify-content: center; max-height: 11mm; max-width: 160mm;
               margin: 4mm auto 0; overflow: hidden; font-family: var(--serif); font-weight: 700; font-size: 4.6mm;
               line-height: 1.15; letter-spacing: .04em; text-transform: uppercase; overflow-wrap: anywhere; }
/* Maqom: nom ostida, ikki yonida so'nib boruvchi oltin chiziq */
.cert-status { display: flex; align-items: center; justify-content: center; gap: 3mm; margin-top: 1.8mm; color: #6e5c24; }
.cert-status::before, .cert-status::after { content: ""; flex: 0 0 18mm; height: .3mm;
                                            background: linear-gradient(90deg, rgba(110, 92, 36, 0), currentColor); }
.cert-status::after { transform: scaleX(-1); }
.cert-status span { max-width: 124mm; overflow: hidden; white-space: nowrap; font-family: var(--serif); font-weight: 700;
                    font-size: 3.3mm; letter-spacing: .13em; text-transform: uppercase; }
.cert-title { flex: none; margin: 5mm 0 0; font-size: 5.5mm; line-height: 1.2; letter-spacing: .03em;
              text-align: center; text-transform: uppercase; }

/* Qatorlar: chapda yorliq (oddiy), o'ngda qiymat (qalin serif) — namunadagidek */
.cert-number, .cert-results > div { display: grid; grid-template-columns: 96mm minmax(0, 1fr); gap: 2mm; align-items: center; }
.cert-number { flex: none; margin-top: 7mm; }
.cert-number b { font-size: 4.6mm; letter-spacing: .06em; white-space: nowrap; }
.cert dt { color: var(--label); }
.cert dd { margin: 0; min-width: 0; }

.cert-person { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 33.5mm; gap: 6mm; align-items: center;
               margin-top: 3.5mm; }
.cert-names > div { display: grid; grid-template-columns: 42mm minmax(0, 1fr); gap: 2mm; align-items: center; height: 10mm; }
.cert-names dd { overflow: hidden; white-space: nowrap; font-size: 5mm; letter-spacing: .03em; text-transform: uppercase; }
.cert-photo { position: relative; width: 33.5mm; height: 44mm; margin: 0; padding: 1mm; background: #fffdf3;
              box-shadow: 0 0 0 .25mm rgba(140, 118, 52, .55), 0 .8mm 2.4mm rgba(70, 54, 10, .28);
              display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cert-photo img, .cert-photo canvas { display: block; width: 31.5mm; height: 42mm; object-fit: cover; }
.cert-photo svg { width: 15mm; height: 20mm; fill: #cdc39a; }
.cert-photo figcaption { margin-top: 2mm; font-size: 2.4mm; color: #8a815e; }

.cert-results { flex: none; margin: 4.5mm 0 0; padding-top: 2.5mm; border-top: .25mm solid var(--rule); }
.cert-results > div { min-height: 9mm; }
.cert-results dd { font-size: 4.6mm; }
.cert-results dd small { font-size: 3.4mm; font-weight: 700; color: var(--label); }
.cert-level { font-size: 5.6mm !important; letter-spacing: .04em; }
.cert-subject dd { max-height: 11.5mm; overflow: hidden; line-height: 1.2; overflow-wrap: anywhere; }

.cert-details { flex: none; margin-top: 4.5mm; }
.cert-details h2 { margin: 0 0 1.5mm; font-family: var(--sans); font-size: 3.6mm; font-weight: 700; color: var(--ink); }
.cert-details dl { margin: 0; padding-left: 1mm; }
.cert-details dl > div { display: flex; justify-content: space-between; gap: 4mm; height: 5.4mm; align-items: center;
                         font-size: 3.3mm; }
.cert-details dd { font-family: var(--sans); font-weight: 400; color: var(--label); }

.cert-statement { flex: none; margin: auto 4mm; max-height: 16mm; overflow: hidden; text-align: center;
                  font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 4.5mm; line-height: 1.35;
                  color: var(--label); }
.cert-statement b { font-style: normal; color: var(--ink); }
.cert-foot { flex: none; }
.cert-dates { display: flex; justify-content: space-between; gap: 4mm; padding-top: 3mm;
              border-top: .25mm solid var(--rule); color: var(--label); }
.cert-dates b { color: var(--ink); font-family: var(--sans); font-size: 3.6mm; }
.cert-sign { display: grid; grid-template-columns: minmax(0, 1fr) 28mm minmax(0, 1fr); gap: 7mm; align-items: center;
             margin-top: 6mm; }
.cert-role, .cert-signer { max-height: 12mm; overflow: hidden; font-size: 4.6mm; line-height: 1.25; overflow-wrap: anywhere; }
.cert-role { text-align: right; }
.cert-signer { text-transform: uppercase; letter-spacing: .03em; }
.cert-qr svg { display: block; width: 28mm; height: 28mm; padding: .8mm; background: #fff;
               box-shadow: 0 0 0 .25mm rgba(140, 118, 52, .45); }
.cert-verify { margin: 2.2mm 0 0; text-align: center; font-size: 2.4mm; color: var(--label); }
.cert-void { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-18deg);
             padding: 3mm 7mm; border: 1.2mm solid #b91c1c; border-radius: 2mm; color: #b91c1c;
             font-size: 12mm; font-weight: 700; text-align: center; text-transform: uppercase; background: rgba(255, 255, 255, .8); }

/* Ekrandagi maket kichraytiriladi, bosmada asl A4 o'lchami saqlanadi. */
.cert-stage { display: flex; justify-content: center; padding: 8px 8px 24px; min-width: 0; overflow: hidden; }
.cert-scaler { position: relative; flex: none; }
.cert-scaler > .cert { transform-origin: top left; }
body.cert-page { background: #ebe8df; }
.cert-toolbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
                gap: 1rem; padding: 10px 20px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
                border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.cert-hint { max-width: 720px; margin: 0 auto 24px; padding: 0 16px; text-align: center; color: var(--muted); font-size: .82rem; }
@media (max-width: 600px) {
  .cert-toolbar { position: relative; flex-wrap: wrap; gap: 8px; padding: 10px 12px; margin-bottom: 10px; }
  .cert-toolbar > .row { flex-wrap: wrap; gap: 8px; }
}

.verify-top { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 0; }
.verify-main { padding-top: 24px; padding-bottom: 40px; }
.verify-status { display: flex; gap: 1rem; align-items: center; padding: 22px 24px; border-radius: var(--radius);
                 border: 1px solid; margin-bottom: 20px; }
.verify-status h1 { margin: 0 0 .2rem; font-size: 1.6rem; }
.verify-status p { margin: 0; }
.verify-icon .icon { width: 52px; height: 52px; stroke-width: 1.8; }
.verify-ok { background: var(--success-soft); border-color: #86efac; color: #14532d; }
.verify-bad { background: var(--danger-soft); border-color: #fca5a5; color: #7f1d1d; }
.verify-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 24px; }
.verify-preview h3 { margin-bottom: .75rem; }
.lookup-card { max-width: 460px; width: 100%; padding: 36px; }
.lookup-input { font-size: 1.35rem !important; letter-spacing: .12em !important; text-transform: uppercase; padding-left: .5em !important; }
@media (max-width: 760px) { .verify-grid { grid-template-columns: minmax(0, 1fr); } }

/* Surat joylash: sertifikat tasdiqlangach o'quvchi o'z suratini 3×4 ramkaga qo'yadi */
.photo-steps { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: .84rem; color: var(--muted); }
.photo-steps li { display: flex; align-items: center; gap: 6px; }
.photo-steps li + li::before { content: ""; width: 22px; height: 1px; background: var(--border-2); margin-right: 2px; }
.photo-steps i, .photo-steps .icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
                                     font-style: normal; font-size: .74rem; font-weight: 700; border: 1px solid var(--border-2); }
.photo-steps .done { color: var(--success); }
.photo-steps .done .icon { padding: 4px; background: var(--success-soft); border-color: transparent; }
.photo-steps .current { color: var(--text); font-weight: 650; }
.photo-steps .current i { background: var(--primary); border-color: var(--primary); color: #fff; }

.photo-page { padding-bottom: 48px; }
.photo-intro { max-width: 760px; margin: 8px 0 24px; }
.photo-intro h1 { font-family: var(--serif); font-size: 2.3rem; font-weight: 700; line-height: 1.1; color: var(--navy); letter-spacing: 0; }
.photo-intro p { margin: 0; color: var(--text-2); }
.photo-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 28px; align-items: start; }
.photo-editor { display: grid; gap: 16px; padding: 20px; position: sticky; top: 72px; }

.photo-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 3 / 4;
              padding: 24px; border: 2px dashed var(--border-2); border-radius: 14px; text-align: center; cursor: pointer;
              background: radial-gradient(circle at 50% 38%, #fff 0, var(--surface-2) 70%); color: var(--muted);
              transition: border-color .15s, background-color .15s; }
.photo-drop:hover, .photo-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.photo-drop:focus-within { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.photo-drop b { margin-top: 10px; font-size: 1.1rem; color: var(--text); }
.photo-drop small { margin-top: 10px; font-size: .8rem; }
.photo-drop-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%;
                   background: var(--gold-soft); color: var(--gold-strong); box-shadow: 0 0 0 8px rgba(201, 174, 106, .12); }
.photo-drop-icon .icon { width: 32px; height: 32px; }

.photo-work { display: grid; gap: 12px; }
.photo-frame { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 12px; background: #ebe6d8;
               cursor: grab; touch-action: none; user-select: none; box-shadow: inset 0 0 0 1px rgba(3, 46, 52, .08); }
.photo-frame:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.photo-frame.dragging { cursor: grabbing; }
.photo-frame canvas { display: block; width: 100%; height: 100%; }
/* Yo'riqnoma: bosh shu oval ichida, ko'zlar chiziqda bo'lsin — surilayotganda ko'rinadi */
.photo-guide { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s; }
.photo-guide i { position: absolute; left: 25%; top: 15%; width: 50%; height: 50%; border-radius: 50%;
                 border: 2px dashed rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(3, 46, 52, .25); }
.photo-guide::after { content: ""; position: absolute; left: 12%; right: 12%; top: 40%; border-top: 1px dashed rgba(255, 255, 255, .8); }
.photo-frame:hover .photo-guide, .photo-frame.dragging .photo-guide, .photo-frame:focus-visible .photo-guide { opacity: 1; }
.photo-busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
              gap: 12px; background: rgba(3, 46, 52, .55); color: #fff; font-weight: 600; backdrop-filter: blur(2px); }
.photo-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25);
                 border-top-color: var(--gold); animation: spin .8s linear infinite; }

.photo-zoom { display: flex; align-items: center; gap: 6px; }
.photo-zoom input { flex: 1; accent-color: var(--primary); }
/* Yuz mosligi: foiz chizig'i va chegara belgisi */
.photo-match { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.photo-match-head { display: flex; align-items: center; gap: .45rem; font-size: .88rem; font-weight: 600; color: var(--text-2); }
.photo-match-head b { margin-left: auto; font-size: 1.05rem; color: var(--text); font-variant-numeric: tabular-nums; }
.photo-match-bar { position: relative; height: 8px; border-radius: 99px; background: #ebe6da; }
.photo-match-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--muted);
                     transition: width .35s ease, background-color .2s; }
.photo-match-bar span { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text-2); }
.photo-match small { font-size: .8rem; color: var(--muted); }
.photo-match.ok .photo-match-bar i { background: var(--success-bg); }
.photo-match.ok small { color: #14532d; }
.photo-match.bad .photo-match-bar i { background: var(--danger); }
.photo-match.bad small { color: #7f1d1d; }
.photo-match.pending .photo-match-head b { color: var(--muted); }
.photo-noref { display: grid; justify-items: center; gap: 10px; padding: 28px 12px; text-align: center; }
.photo-noref h3 { margin: 6px 0 0; }
.photo-noref p { margin: 0; color: var(--text-2); font-size: .92rem; }
.photo-status { display: flex; gap: .55rem; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px;
                font-size: .88rem; line-height: 1.45; background: var(--surface-2); color: var(--text-2); }
.photo-status:empty { display: none; }
.photo-status .icon { flex: none; margin-top: .12em; }
.photo-status.ok { background: var(--success-soft); color: #14532d; }
.photo-status.warn { background: var(--warning-soft); color: #78350f; }
.photo-status.bad { background: var(--danger-soft); color: #7f1d1d; }
.photo-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.photo-actions .btn { justify-content: center; padding-left: 8px; padding-right: 8px; }
.photo-tips { padding-top: 16px; border-top: 1px solid var(--border); font-size: .86rem; }

.photo-preview > h2 { margin: 0 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.photo-preview .cert-stage { padding: 0 0 32px; }
.photo-preview .cert { box-shadow: 0 2px 6px rgba(58, 48, 18, .12), 0 14px 34px rgba(58, 48, 18, .16); }
.photo-confirm { display: grid; gap: 14px; max-width: 560px; margin: 0 auto; }
.photo-confirm .check { align-items: flex-start; font-size: .9rem; color: var(--text-2); }
.photo-confirm .check input { margin-top: .2em; flex: none; }
@media (max-width: 900px) {
  .photo-grid { grid-template-columns: minmax(0, 1fr); }
  .photo-editor { position: static; max-width: 420px; width: 100%; margin: 0 auto; }
  .photo-intro h1 { font-size: 1.9rem; }
}
@media (max-width: 600px) {
  .photo-steps li:not(.current) span { display: none; }
  .photo-steps li + li::before { width: 10px; }
}

@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .no-print, .cert-toolbar, .cert-hint { display: none !important; }
  .cert-stage { display: block; padding: 0; overflow: visible; }
  .cert-scaler { width: auto !important; height: auto !important; }
  .cert-scaler > .cert { transform: none !important; }
  .cert { box-shadow: none; page-break-inside: avoid; break-inside: avoid; }
}
