/* Vesa Size Guide — pairs with templates/size-guide.php
 * Also used inside the single-product modal popup (#vesa-size-guide-modal).
 */

/* ── Modal popup (single-product) ──────────────────── */
.vesa-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    z-index: 9999;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.vesa-modal.is-open {
    display: flex;
    animation: vesa-modal-fade .18s ease-out;
}

@keyframes vesa-modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.vesa-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 4px;
    width: 100%;
    max-width: 1100px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    animation: vesa-modal-rise .22s ease-out;
}

@keyframes vesa-modal-rise {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.vesa-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.vesa-modal__close:hover {
    background: #1a1a1a;
    color: #fff;
    transform: rotate(90deg);
}

.vesa-modal__body {
    padding: 8px 0 32px;
}

.vesa-modal__title {
    margin: 0;
    padding: 24px 24px 16px;
    font-size: clamp(20px, 2vw, 24px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    text-align: center;
    border-bottom: 1px solid #ececec;
}

/* Inside the modal: trim the hero padding and remove background tints
 * so the content fits cleanly in the dialog. */
.vesa-modal__body .size-guide__hero {
    padding: 32px 0 16px;
    border-bottom: 1px solid #ececec;
}

.vesa-modal__body .size-guide__charts {
    background: transparent;
    padding: 32px 0;
}

.vesa-modal__body .size-guide__section--with-illu {
    background: transparent;
}

.vesa-modal__body .container-lg {
    max-width: 1000px !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
}

/* Size guide trigger — outlined rectangular button.
 * High specificity to defeat any remaining Bootstrap .btn rules.
 */
button.vesa-size-guide-trigger,
.woocommerce button.vesa-size-guide-trigger,
.product .vesa-size-guide-trigger,
.variations td.value > .vesa-size-guide-trigger,
.vesa-size-guide-trigger {
    display: inline-block;
    margin: 16px 0 0;
    padding: 12px 24px;
    background: transparent;
    color: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-radius: 2px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .04em;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    transition: background .18s ease, color .18s ease;
    -webkit-appearance: none;
            appearance: none;
}

button.vesa-size-guide-trigger:hover,
button.vesa-size-guide-trigger:focus,
.woocommerce button.vesa-size-guide-trigger:hover,
.woocommerce button.vesa-size-guide-trigger:focus,
.vesa-size-guide-trigger:hover,
.vesa-size-guide-trigger:focus {
    background: #1a1a1a;
    color: #fff;
    outline: none;
    box-shadow: none;
}

/* ── Standalone page styles (existing) ──────────── */

.page-size-guide {
    color: #1a1a1a;
}

.page-size-guide .container-lg {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* ── Hero ────────────────────────────────────────────── */
.size-guide__hero {
    padding: 64px 0 32px;
    text-align: center;
    border-bottom: 1px solid #ececec;
}

.size-guide__title {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
    line-height: 1.1;
}

.size-guide__lead {
    margin: 0 auto;
    max-width: 720px;
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}

/* ── Body charts ────────────────────────────────────── */
.size-guide__charts {
    padding: 48px 0;
    background: #fafafa;
    border-bottom: 1px solid #ececec;
}

.size-guide__charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

.size-guide__chart {
    text-align: center;
}

.size-guide__chart-img {
    display: block;
    width: 100%;
    max-width: 420px;
    height: auto;
    margin: 0 auto;
}

/* ── Section + headings ─────────────────────────────── */
.size-guide__section {
    padding: 56px 0;
    border-bottom: 1px solid #ececec;
}

.size-guide__section:last-of-type {
    border-bottom: none;
}

.size-guide__h2 {
    margin: 0 0 28px;
    font-size: clamp(20px, 2.4vw, 26px);
    font-weight: 600;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #1a1a1a;
}

.size-guide__h3 {
    margin: 32px 0 16px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #1a1a1a;
}

.size-guide__h3:first-child {
    margin-top: 0;
}

/* ── Tables wrapper (stacked) ───────────────────────── */
.size-guide__tables {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

/* ── Table styling ─────────────────────────────────── */
.size-guide__table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 2px;
    overflow: hidden;
}

.size-guide__caption {
    padding: 14px 16px;
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-align: center;
    caption-side: top;
}

.size-guide__table thead th {
    padding: 14px 8px;
    background: #f5f5f5;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .03em;
    border-bottom: 1px solid #e5e5e5;
}

.size-guide__table thead th:first-child {
    width: 22%;
    text-align: left;
    padding-left: 18px;
    background: #ececec;
}

.size-guide__table tbody th {
    padding: 14px 18px;
    background: #fafafa;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    border-bottom: 1px solid #ececec;
    border-right: 1px solid #ececec;
    width: 22%;
}

.size-guide__table tbody td {
    padding: 14px 8px;
    color: #333;
    border-bottom: 1px solid #ececec;
    word-break: keep-all;
}

.size-guide__table tbody tr:last-child th,
.size-guide__table tbody tr:last-child td {
    border-bottom: none;
}

.size-guide__table tbody tr:nth-child(even) td,
.size-guide__table tbody tr:nth-child(even) th {
    background: #fcfcfc;
}

/* ── Section with side illustration (Hats / Gloves) ─── */
.size-guide__section--with-illu {
    background: #fafafa;
}

.size-guide__with-illu {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 48px;
    align-items: start;
}

.size-guide__illu {
    position: sticky;
    top: 24px;
    text-align: center;
    padding: 24px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ececec;
}

.size-guide__illu img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 200px;
    margin: 0 auto;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 990px) {
    .size-guide__charts-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .size-guide__with-illu {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .size-guide__illu {
        position: static;
        max-width: 240px;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .size-guide__hero {
        padding: 48px 0 24px;
    }

    .size-guide__charts {
        padding: 32px 0;
    }

    .size-guide__section {
        padding: 40px 0;
    }

    .size-guide__table {
        font-size: 12px;
    }

    .size-guide__table thead th,
    .size-guide__table tbody th,
    .size-guide__table tbody td {
        padding: 10px 4px;
    }

    .size-guide__table thead th:first-child,
    .size-guide__table tbody th {
        padding-left: 10px;
        padding-right: 6px;
        width: 30%;
    }
}
