/* ==========================================================================
   INSTICK Israel — Certificates page
   ========================================================================== */


/* ==========================================================================
   PAGE / HERO
   ========================================================================== */

.certificates-page {
    padding-block: 2.2rem 4rem;
}

.certificates-page .ihero {
    padding-block: 2.2rem 1rem;
}

.certificates-page .ihero__title {
    margin: 0;

    font-family: var(--font-display);
    font-size: var(--step-3);
    font-weight: 600;
    line-height: 1.2;

    color: #161016;
}

:root[data-theme="dark"] .certificates-page .ihero__title {
    color: var(--ink);
}

.certificates-page .ihero__lead {
    margin-block-start: .5rem;

    max-width: 56ch;

    color: var(--ink-soft);

    font-size: var(--step-1);
    font-weight: 300;
    line-height: 1.6;
}


/* ==========================================================================
   CERTIFICATES LAYOUT
   ========================================================================== */

.certificates {
    width: 100%;
    padding-block: 1rem 3rem;
}

.certificates__grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 2rem;

    align-items: start;
}

.certificate-card {
    width: 100%;
    min-width: 0;
}

.certificate-card__title {
    margin: 0 0 12px;

    font-family: var(--font-display);

    font-size: var(--step-1);
    line-height: 1.35;

    font-weight: 600;

    color: #161016;

    text-align: start;
}

:root[data-theme="dark"] .certificate-card__title {
    color: var(--ink);
}


/* ==========================================================================
   PDF VIEWER
   ========================================================================== */

.pdf-pages {
    position: relative;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    overflow: hidden;

    border: 1px solid var(--border);

    border-radius: var(--radius-lg);

    background: #e9e9e9;

    box-shadow: var(--shadow-soft);
}


/* ==========================================================================
   PDF TOOLBAR
   ========================================================================== */

.pdf-pages__toolbar {
    position: relative;
    z-index: 5;

    width: 100%;
    min-height: 58px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 9px 12px;

    background: #000;
    color: #fff;

    border-bottom: 1px solid rgba(255,255,255,.1);
}


/* ==========================================================================
   NAV / ACTIONS
   ========================================================================== */

.pdf-pages__nav,
.pdf-pages__actions {
    display: flex;

    align-items: center;

    gap: 7px;

    min-width: 0;
}

.pdf-pages__actions {
    flex: 0 0 auto;
}


/* ==========================================================================
   BUTTONS
   ========================================================================== */

.pdf-pages__arrow,
.pdf-pages__action {
    min-width: 40px;
    height: 40px;

    padding: 0 12px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 6px;

    flex: 0 0 auto;

    border: 1px solid rgba(255,255,255,.16);

    border-radius: var(--radius);

    background: rgba(255,255,255,.08);

    color: #fff;

    font-family: var(--font-display);

    font-size: .82rem;

    font-weight: 600;

    line-height: 1;

    white-space: nowrap;

    text-decoration: none;

    cursor: pointer;

    transition:
        background-color .2s var(--ease),
        border-color .2s var(--ease),
        color .2s var(--ease),
        opacity .2s var(--ease);
}

.pdf-pages__arrow:hover,
.pdf-pages__action:hover {
    background: rgba(255,255,255,.16);

    border-color: rgba(255,255,255,.28);

    color: #fff;
}

.pdf-pages__arrow:disabled {
    opacity: .32;

    cursor: default;

    pointer-events: none;
}


/* ==========================================================================
   COUNTER
   ========================================================================== */

.pdf-pages__counter {
    min-width: 84px;
    height: 40px;

    padding: 0 10px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 5px;

    flex: 0 0 auto;

    border-radius: var(--radius);

    background: rgba(255,255,255,.08);

    color: #fff;

    font-size: .82rem;

    font-variant-numeric: tabular-nums;

    direction: ltr;
}

.pdf-pages__counter b {
    color: #fff;

    font: inherit;

    font-weight: 600;
}


/* ==========================================================================
   ARROWS
   ========================================================================== */

.pdf-pages__arrow span {
    display: block;

    font-family: Arial, sans-serif;

    font-size: 15px;

    line-height: 1;

    direction: ltr;
}


/* LTR */

html[dir="ltr"] .pdf-pages__arrow--prev span::before {
    content: "←";
}

html[dir="ltr"] .pdf-pages__arrow--next span::before {
    content: "→";
}


/* RTL / Hebrew */

html[dir="rtl"] .pdf-pages__arrow--prev span::before {
    content: "→";
}

html[dir="rtl"] .pdf-pages__arrow--next span::before {
    content: "←";
}


/* ==========================================================================
   PDF STAGE
   ========================================================================== */

.pdf-pages__stage {
    position: relative;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    min-height: 420px;

    display: flex;

    align-items: flex-start;
    justify-content: center;

    padding: 16px;

    overflow: hidden;

    background:
        linear-gradient(
            45deg,
            rgba(0,0,0,.018) 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            rgba(0,0,0,.018) 25%,
            transparent 25%
        ),
        linear-gradient(
            45deg,
            transparent 75%,
            rgba(0,0,0,.018) 75%
        ),
        linear-gradient(
            -45deg,
            transparent 75%,
            rgba(0,0,0,.018) 75%
        ),
        #e9e9e9;

    background-size: 18px 18px;

    background-position:
        0 0,
        0 9px,
        9px -9px,
        -9px 0;
}


/* ==========================================================================
   PDF IMAGE
   ========================================================================== */

.pdf-pages__image {
    position: relative;
    z-index: 1;

    display: block;

    width: auto;
    max-width: 100%;
    height: auto;

    margin: 0 auto;

    background: #fff;

    box-shadow: 0 12px 36px rgba(0,0,0,.18);

    user-select: none;
    -webkit-user-drag: none;

    opacity: 0;

    transition: opacity .2s var(--ease);
}

.pdf-pages.is-ready .pdf-pages__image {
    opacity: 1;
}


/* ==========================================================================
   LOADING
   ========================================================================== */

.pdf-pages__loading {
    position: absolute;

    z-index: 3;

    inset: 0;

    min-height: 320px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(245,245,245,.9);

    color: #4a4048;

    text-align: center;

    font-size: .9rem;
}

.pdf-pages__loading::before {
    content: "";

    width: 24px;
    height: 24px;

    flex: 0 0 24px;

    margin-inline-end: 10px;

    border: 3px solid rgba(21,122,68,.2);

    border-top-color: #157A44;

    border-radius: 50%;

    animation: pdf-pages-spin .7s linear infinite;
}

@keyframes pdf-pages-spin {
    to {
        transform: rotate(360deg);
    }
}

.pdf-pages.is-ready .pdf-pages__loading {
    display: none;
}


/* ==========================================================================
   ERROR
   ========================================================================== */

.pdf-pages.is-error .pdf-pages__loading {
    color: #8f241c;

    background: #fff7f6;
}


/* ==========================================================================
   DARK MODE
   ========================================================================== */

:root[data-theme="dark"] .pdf-pages {
    background: #202020;
}

:root[data-theme="dark"] .pdf-pages__stage {
    background-color: #202020;
}

:root[data-theme="dark"] .pdf-pages__loading {
    background: rgba(25,25,25,.92);

    color: rgba(255,255,255,.75);
}


/* ==========================================================================
   RTL
   ========================================================================== */

html[dir="rtl"] .pdf-pages__toolbar {
    direction: rtl;
}

html[dir="rtl"] .pdf-pages__actions {
    direction: rtl;
}

/* В RTL порядок должен быть:
   next ← | counter | → prev
*/
html[dir="rtl"] .pdf-pages__nav {
    direction: rtl !important;
}


/* ==========================================================================
   LTR
   ========================================================================== */

html[dir="ltr"] .pdf-pages__toolbar {
    direction: ltr;
}

html[dir="ltr"] .pdf-pages__actions {
    direction: ltr;
}

html[dir="ltr"] .pdf-pages__nav {
    direction: ltr !important;
}


/* ==========================================================================
   TABLET
   ========================================================================== */

@media (max-width: 939px) {

    .certificates-page {
        padding-block: 1.6rem 3rem;
    }

    .certificates__grid {
        gap: 1.5rem;
    }

    .pdf-pages__stage {
        padding: 12px;
    }

}


/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 767px) {

    .certificates-page {
        padding-block: 1.25rem 2.5rem;
    }

    .certificates-page .ihero {
        padding-block: 1.4rem .8rem;
    }

    .certificates__grid {
        grid-template-columns: 1fr;

        gap: 1.5rem;
    }

    .certificate-card__title {
        margin-bottom: 10px;

        font-size: var(--step-0);
    }

    .pdf-pages {
        width: 100%;
        max-width: 100%;

        margin: 0;

        overflow: hidden;

        border-radius: var(--radius);
    }

    .pdf-pages__toolbar {
        width: 100%;

        min-height: 54px;

        padding: 8px;

        gap: 7px;

        overflow: hidden;
    }

    .pdf-pages__nav,
    .pdf-pages__actions {
        gap: 5px;
    }

    .pdf-pages__arrow,
    .pdf-pages__action {
        min-width: 38px;
        width: 38px;

        height: 38px;

        padding: 0;
    }

    .pdf-pages__action span {
        display: none;
    }

    .pdf-pages__counter {
        min-width: 74px;

        height: 38px;

        padding: 0 7px;

        gap: 4px;

        font-size: .78rem;
    }

    .pdf-pages__stage {
        display: block;

        width: 100%;
        max-width: 100%;

        min-height: 0;

        height: auto;

        max-height: none;

        padding: 8px;

        overflow: visible;
    }

    .pdf-pages__image {
        display: block;

        width: 100%;
        max-width: 100%;

        height: auto;

        margin: 0;

        box-shadow: 0 6px 18px rgba(0,0,0,.16);
    }

    .pdf-pages__loading {
        min-height: 260px;

        padding: 16px;

        font-size: .82rem;
    }

}


/* ==========================================================================
   SMALL MOBILE
   ========================================================================== */

@media (max-width: 480px) {

    .pdf-pages__toolbar {
        min-height: 52px;

        padding: 7px;
    }

    .pdf-pages__arrow,
    .pdf-pages__action {
        min-width: 36px;
        width: 36px;

        height: 36px;
    }

    .pdf-pages__counter {
        min-width: 68px;

        height: 36px;

        padding: 0 6px;

        font-size: .75rem;
    }

    .pdf-pages__stage {
        padding: 6px;
    }

}


/* ==========================================================================
   VERY SMALL MOBILE
   ========================================================================== */

@media (max-width: 360px) {

    .pdf-pages__toolbar {
        gap: 4px;

        padding: 6px;
    }

    .pdf-pages__nav,
    .pdf-pages__actions {
        gap: 4px;
    }

    .pdf-pages__arrow,
    .pdf-pages__action {
        min-width: 34px;
        width: 34px;

        height: 34px;
    }

    .pdf-pages__counter {
        min-width: 62px;

        height: 34px;

        padding: 0 4px;

        font-size: .72rem;
    }

    .pdf-pages__stage {
        padding: 4px;
    }

}


/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .pdf-pages__loading::before {
        animation-duration: 1.4s;
    }

    .pdf-pages__image,
    .pdf-pages__arrow,
    .pdf-pages__action {
        transition: none;
    }

}