:root {
    --primary: #d72638;
    --text: #111111;
    --accent: #64748b;
    --border: rgba(45, 55, 72, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.certificate-page {
    padding: calc(var(--hero-top-offset, 5.5rem) + 1.5rem) 0 4.5rem;
    background: #eceef2;
}

.certificate-verify-wrap {
    max-width: 720px;
    margin: 0 auto 2rem;
}

.certificate-verify-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.certificate-verify-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
}

.certificate-verify-card p {
    margin: 0 0 1rem;
    color: var(--accent);
    font-size: 0.92rem;
}

.certificate-verify-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.certificate-verify-form input {
    flex: 1 1 220px;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 1.1rem;
    font: inherit;
}

.certificate-verify-form button {
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    padding: 0 1.35rem;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.certificate-verify-error {
    margin-top: 0.85rem;
    color: #b91c1c;
    font-size: 0.9rem;
}

/* ── Certificate document (reference layout) ── */
.certificate-sheet {
    max-width: 920px;
    margin: 0 auto;
}

.certificate-sheet__outer {
    position: relative;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    padding-left: 72px;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(15, 23, 42, 0.06);
}

/* Left black sidebar */
.cert-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 72px;
    background: #0c0c0c;
}

.cert-sidebar__art {
    position: absolute;
    left: 0;
    width: 100%;
    pointer-events: none;
    display: block;
}

.cert-sidebar__art--top {
    top: 0;
    height: 96px;
}

.cert-sidebar__art--bottom {
    bottom: 0;
    height: 84px;
}

.cert-sidebar__tagline {
    position: absolute;
    left: 50%;
    bottom: 5.5rem;
    transform: translateX(-50%) rotate(180deg);
    writing-mode: vertical-rl;
    margin: 0;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
}

.cert-sidebar__tagline span {
    color: #d72638;
}

/* Main body */
.certificate-sheet__body {
    position: relative;
    padding: 2rem 2.25rem 1.5rem 3.5rem;
    background: #fff;
}

.cert-shape {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    display: block;
}

.cert-shape--tr {
    top: 0;
    right: 0;
    width: 200px;
    height: 130px;
}

.cert-shape--bl {
    bottom: 0;
    left: 0;
    width: 160px;
    height: 100px;
    opacity: 0.95;
}

/* Certified seal */
.cert-seal {
    position: absolute;
    top: 1.1rem;
    left: -1.65rem;
    width: 88px;
    z-index: 3;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.18));
}

.cert-seal svg {
    width: 100%;
    height: auto;
    display: block;
}

.cert-seal--revoked svg circle:nth-of-type(3) {
    fill: #64748b;
}

.cert-seal--draft svg circle:nth-of-type(3) {
    fill: #94a3b8;
}

/* Header */
.cert-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
    padding-left: 3.5rem;
}

.cert-header__brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.cert-header__brand img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
}

.cert-header__name {
    display: block;
    font-weight: 800;
    font-size: 1.2rem;
    line-height: 1.15;
    color: var(--text);
}

.cert-header__tag {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 0.12rem;
}



/* Intro */
.cert-intro {
    position: relative;
    z-index: 1;
    margin-bottom: 1.35rem;
}

.cert-kicker {
    margin: 0 0 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #d72638;
}

.cert-title {
    margin: 0 0 0.55rem;
    font-size: clamp(1.85rem, 4.2vw, 2.55rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.cert-lead {
    margin: 0;
    max-width: 62ch;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #475569;
}

/* Recipient */
.cert-recipient {
    position: relative;
    z-index: 1;
    margin-bottom: 1.25rem;
    padding: 1.1rem 1.25rem;
    border-radius: 14px;
    background: #f1f3f6;
    border: 1px solid #e2e8f0;
}

.cert-recipient__label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.cert-recipient__name {
    margin: 0 0 0.35rem;
    font-size: clamp(1.85rem, 4vw, 2.45rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.cert-recipient__role {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: #475569;
}

.cert-recipient__role i {
    color: #d72638;
    margin-right: 0.3rem;
}

/* Meta grid */
.cert-meta-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.cert-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.cert-meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(215, 38, 56, 0.08);
    color: #d72638;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.cert-meta-label {
    display: block;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.15rem;
}

.cert-meta-item strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
}

/* Highlights */
.cert-highlights {
    position: relative;
    z-index: 1;
    margin-bottom: 0;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: #f1f3f6;
    border: 1px solid #e2e8f0;
}

.cert-highlights__title {
    margin: 0 0 0.75rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.cert-highlights__title i {
    color: #d72638;
}

.cert-highlights__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.cert-highlights__list li {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #334155;
}

.cert-highlights__list li i {
    color: #d72638;
    margin-top: 0.18rem;
    flex-shrink: 0;
    font-size: 0.82rem;
}

/* Footer */
.cert-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 1rem;
    padding-top: 1rem;
}

.cert-ids {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.cert-id-chip {
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    min-width: 168px;
}

.cert-id-chip span {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.15rem;
}

.cert-id-chip strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    color: #0f172a;
    word-break: break-all;
}

/* QR */
.cert-qr {
    flex-shrink: 0;
    text-align: center;
}

.cert-qr__frame {
    position: relative;
    display: inline-block;
    padding: 0.45rem;
    background: #fff;
}

.cert-qr__corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: #d72638;
    border-style: solid;
}

.cert-qr__corner--tl { top: 0; left: 0; border-width: 3px 0 0 3px; }
.cert-qr__corner--tr { top: 0; right: 0; border-width: 3px 3px 0 0; }
.cert-qr__corner--bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; }
.cert-qr__corner--br { bottom: 0; right: 0; border-width: 0 3px 3px 0; }

.cert-qr__frame img {
    display: block;
    width: 108px;
    height: 108px;
}

.cert-qr__label {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #d72638;
}

.certificate-actions {
    max-width: 920px;
    margin: 1.25rem auto 0;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Dedicated print page (exact same UI as certificate page) ── */
.certificate-print-body {
    margin: 0;
    min-height: 100vh;
    background: #eceef2;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    color: #111;
}

.certificate-print-body .certificate-page {
    /* Match public certificate page spacing without site header */
    padding-top: 2rem;
}

.certificate-print-toolbar {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
}

.certificate-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    background: #d72638;
    color: #fff;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(215, 38, 56, 0.25);
}

.certificate-print-btn--ghost {
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

@media print {
    @page {
        size: auto;
        margin: 10mm;
    }

    html,
    body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .no-print,
    .certificate-verify-wrap,
    .certificate-actions,
    .certificate-print-toolbar,
    .header,
    .footer,
    .whatsapp-float,
    .ai-agent-widget,
    .back-to-top,
    .menu-toggle,
    .mobile-menu {
        display: none !important;
    }

    .certificate-print-body,
    .certificate-page {
        background: #fff !important;
        padding: 0 !important;
        min-height: 0 !important;
    }

    .certificate-page > .container {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .certificate-sheet {
        max-width: none !important;
        margin: 0 !important;
    }

    .certificate-sheet__outer {
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Keep desktop layout when printing (ignore mobile breakpoints) */
    .certificate-sheet__outer {
        padding-left: 72px !important;
        padding-top: 0 !important;
    }

    .cert-sidebar {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: auto !important;
        bottom: 0 !important;
        width: 72px !important;
        height: auto !important;
        background: #0c0c0c !important;
    }

    .cert-sidebar__tagline,
    .cert-sidebar__art--top,
    .cert-sidebar__art--bottom {
        display: block !important;
    }

    .cert-sidebar__art--top {
        height: 96px !important;
    }

    .cert-sidebar__art--bottom {
        height: 84px !important;
    }

    .certificate-sheet__body {
        padding: 2rem 2.25rem 1.5rem 3.5rem !important;
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
    }

    .cert-seal {
        top: 1.1rem !important;
        left: -1.65rem !important;
        width: 88px !important;
        filter: none !important;
    }

    .cert-header {
        flex-direction: row !important;
        padding-left: 3.5rem !important;
    }



    .cert-meta-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .cert-footer {
        flex-direction: row !important;
        align-items: center !important;
        margin-top: 1rem !important;
    }

    .cert-recipient,
    .cert-highlights,
    .cert-id-chip {
        background: #f1f3f6 !important;
    }

    .cert-highlights {
        flex: none !important;
    }
}

/* Mobile: keep exact desktop design, zoom to fit (no horizontal scroll) */
.certificate-scale-wrap {
    width: 100%;
    overflow: hidden;
}

@media screen and (max-width: 960px) {
    .certificate-page > .container {
        max-width: 100%;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        overflow-x: hidden;
    }

    .certificate-sheet {
        width: 900px;
        max-width: none;
    }

    .certificate-actions {
        max-width: 100%;
    }
}

@media print {
    .certificate-scale-wrap {
        overflow: visible !important;
        height: auto !important;
    }

    .certificate-sheet {
        width: auto !important;
        max-width: none !important;
        zoom: 1 !important;
        transform: none !important;
    }
}
