/* =====================================================================
   JJ Textile — Newsletter Signup Popup + Collapsed Side Tab
   Site-wide (not just the homepage). Appears a few seconds after any
   page loads (see js/jjt-newsletter-popup.js for timing/dismiss logic),
   closes to a small brown tab pinned to the left edge of the screen,
   and reopens the same popup if that tab is clicked.
   ===================================================================== */

:root {
    --jjt-popup-accent: var(--jjt-top-strip, #887342);
}

.jjt-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.jjt-popup.is-open {
    display: flex;
}

.jjt-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 18, 0.55);
}

.jjt-popup__card {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: #fff;
    border: 2px solid #111;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.jjt-popup__close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 3;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-width: 34px;
    max-height: 34px;
    flex: none;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 1.3rem;
    line-height: 1;
    color: #111;
    cursor: pointer;
    padding: 0 !important;
    margin: 0;
}

.jjt-popup__close:hover {
    background: #fff;
}

.jjt-popup__text {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 3rem 3.5rem;
    min-width: 300px;
}

.jjt-popup__sheep-icon {
    /* Fixed width AND height (matching the SVG's own 120:90 viewBox ratio)
       rather than "height: auto" — as a flex child inside a column flex
       container, "auto" was letting the parent's default align-items
       (stretch) distort it into an oval/squashed shape. display:block +
       flex-shrink:0 stop it being resized by the flex layout at all. */
    display: block;
    flex-shrink: 0;
    align-self: center;
    width: 90px;
    height: 67.5px;
    color: #111;
    margin: 0 0 1.5rem;
}

.jjt-popup__logo {
    display: block;
    flex-shrink: 0;
    align-self: center;
    max-width: 180px;
    max-height: 90px;
    width: auto;
    height: auto;
    margin: 0 0 1.5rem;
}

.jjt-popup__text h2 {
    font-family: var(--jjt-heading-font, inherit);
    font-weight: var(--jjt-heading-weight, 700);
    font-size: clamp(1.7rem, 2.8vw, 2.4rem);
    margin: 0 0 1rem;
    color: #111;
}

.jjt-popup__text p {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    margin: 0 0 1.75rem;
}

.jjt-popup__form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-width: 360px;
}

.jjt-popup__email {
    padding: 0.85rem 1.1rem;
    border: 1px solid #ccc;
    font-size: 0.95rem;
}

.jjt-popup__submit {
    display: inline-block;
    padding: 0.9rem 1.5rem;
    background: var(--jjt-popup-accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.jjt-popup__submit:hover {
    opacity: 0.88;
}

.jjt-popup__thanks {
    margin: 0;
    font-weight: 600;
    color: #2f3a2c;
}

.jjt-popup__image {
    flex: 1 1 50%;
    min-width: 260px;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    /* White gap between the photo and the card's outer black outline,
       matching the reference screenshot. */
    padding: 14px;
    background: #fff;
}

.jjt-popup__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 767px) {
    .jjt-popup__image {
        padding: 10px;
    }
}

@media (max-width: 767px) {
    .jjt-popup__card {
        flex-direction: column;
        max-height: 92vh;
        overflow-y: auto;
    }
    .jjt-popup__text {
        padding: 2.5rem 1.75rem 1.75rem;
    }
    .jjt-popup__image {
        min-height: 200px;
        order: -1;
    }
}

/* ---- Collapsed side tab ---- */
/* Was vertically centred (top: 50%); moved to sit a little above the
   bottom-left corner instead, per client request. Anchored from the
   bottom (not a "top: calc(100% - Npx)") so it stays the same distance
   above the bottom edge regardless of viewport height. */
.jjt-popup-tab {
    position: fixed;
    left: 0;
    bottom: 110px;
    top: auto;
    z-index: 99998;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--jjt-popup-accent);
    color: #fff;
    border: none;
    padding: 1.25rem 0.7rem;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    box-shadow: 2px 4px 14px rgba(0, 0, 0, 0.2);
}

.jjt-popup-tab.is-visible {
    display: flex;
}

.jjt-popup-tab .jjt-popup__sheep-icon {
    width: 34px;
    height: 25.5px;
    color: #fff;
    margin: 0;
    align-self: center;
}

.jjt-popup-tab__text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .jjt-popup-tab {
        padding: 1rem 0.5rem;
        bottom: 80px;
    }
}

/* Image-based tab (the client's own "brown label" graphic) — drop the
   CSS-built background/padding/border-radius entirely and just let the
   uploaded image be the whole tab, at its own proportions. Sized up from
   an original 76px/58px (roughly +20%) per client request. */
.jjt-popup-tab--image {
    background: none;
    padding: 0;
    border-radius: 0 6px 6px 0;
    box-shadow: 2px 4px 14px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    line-height: 0;
}

.jjt-popup-tab--image img {
    display: block;
    width: 92px;
    height: auto;
}

@media (max-width: 480px) {
    .jjt-popup-tab--image img {
        width: 70px;
    }
}
