/* =========================================================
   THE JUNTO PRESS STORE
   Namespaced under `.jp-` / `#jp-` so nothing here can collide
   with the Future Imperfect template's global selectors.
   Uses the site's existing CSS variables so light/dark mode
   (body.dark-mode) is inherited automatically.
   ========================================================= */

.jp-store-loading {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 3em 0;
}

.jp-store-error {
    text-align: center;
    color: var(--text-muted);
    padding: 2em;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    max-width: 500px;
    margin: 0 auto;
}

.jp-store-banner {
    max-width: 700px;
    margin: 0 auto 2.5em auto;
    padding: 1em 1.5em;
    border-radius: 4px;
    border: 1px solid var(--accent-color);
    background: rgba(128, 128, 128, 0.03);
    color: var(--text-main);
    font-family: var(--font-sans);
    text-align: center;
}

/* --- Product Grid --- */

.jp-store-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.5em 1.5em;
    max-width: 1200px;
    margin: 0 auto;
}

.jp-product-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 280px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.jp-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.jp-product-image {
    background: rgba(128, 128, 128, 0.05);
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.jp-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jp-product-body {
    padding: 1.25em 1.25em 1.5em 1.25em;
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

.jp-product-name {
    font-family: var(--font-serif);
    font-size: 1.15em;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
    line-height: 1.3;
}

.jp-product-price {
    font-family: var(--font-sans);
    font-weight: 700;
    color: var(--accent-color);
    margin: 0;
    font-size: 0.95em;
}

.jp-product-desc {
    font-family: var(--font-sans);
    font-size: 0.8em;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.jp-size-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.4em;
}

.jp-size-label {
    font-family: var(--font-sans);
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.jp-size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
}

.jp-size-btn {
    font-size: 0.55em !important;
    padding: 0 1.2em !important;
    height: 2.2em !important;
    line-height: 2.2em !important;
}

.jp-size-btn.is-selected {
    box-shadow: inset 0 0 0 2px var(--accent-color) !important;
    color: var(--accent-color) !important;
}

.jp-qty-row {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin-top: 0.5em;
}

.jp-qty-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.jp-qty-btn {
    background: transparent;
    border: 0;
    color: var(--text-main);
    width: 2em;
    height: 2em;
    font-size: 1em;
    cursor: pointer;
}

.jp-qty-value {
    display: inline-block;
    min-width: 1.5em;
    text-align: center;
    font-family: var(--font-sans);
    font-weight: 700;
}

.jp-add-btn {
    flex: 1;
    font-size: 0.55em !important;
}

/* --- Floating Cart Toggle --- */

.jp-cart-toggle {
    position: fixed;
    bottom: 1.5em;
    right: 1.5em;
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 0.6em;
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 0.8em 1.4em;
    font-family: var(--font-sans);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8em;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.jp-cart-count {
    background-color: var(--accent-color);
    color: var(--bg-surface);
    border-radius: 50%;
    min-width: 1.5em;
    height: 1.5em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    padding: 0 0.3em;
}

/* --- Cart Drawer --- */

.jp-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 100002;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.jp-cart-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.jp-cart-drawer {
    /* max-width/margin/padding use !important: the template's global
       `.post > *` rule (active at viewport widths <= 1280px) forces
       max-width: 100% !important on every direct child of the article,
       which this drawer is. Without !important here it silently loses
       that fight and renders full-viewport-width instead of a drawer. */
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 100%;
    max-width: 420px !important;
    margin: 0 !important;
    background-color: var(--bg-main);
    color: var(--text-main);
    border-left: 1px solid var(--border-color);
    z-index: 100003;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s ease;
    box-sizing: border-box;
}

.jp-cart-drawer.is-open {
    transform: translateX(0);
}

.jp-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5em;
    border-bottom: 1px solid var(--border-color);
}

.jp-cart-header h3 {
    font-family: var(--font-serif);
    margin: 0;
    font-size: 1.4em;
}

.jp-cart-close {
    background: transparent;
    border: 0;
    font-size: 1.8em;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.jp-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1em 1.5em;
}

.jp-cart-empty {
    text-align: center;
    color: var(--text-muted);
    margin-top: 3em;
}

.jp-cart-item {
    display: flex;
    gap: 1em;
    padding: 1em 0;
    border-bottom: 1px solid var(--border-color);
}

.jp-cart-item-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    background: rgba(128, 128, 128, 0.05);
    flex-shrink: 0;
}

.jp-cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.jp-cart-item-name {
    font-family: var(--font-serif);
    font-size: 0.95em;
    margin: 0;
    color: var(--text-main);
}

.jp-cart-item-size {
    font-size: 0.75em;
    color: var(--text-muted);
    margin: 0.2em 0 0.5em 0;
}

.jp-cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.5em;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: fit-content;
}

.jp-cart-item-qty button {
    background: transparent;
    border: 0;
    width: 1.8em;
    height: 1.8em;
    cursor: pointer;
    color: var(--text-main);
}

.jp-cart-item-price {
    font-family: var(--font-sans);
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.jp-cart-footer {
    padding: 1.5em;
    border-top: 1px solid var(--border-color);
}

.jp-cart-total-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-serif);
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 1em;
}

.jp-checkout-btn {
    font-size: 0.7em !important;
    height: 3em !important;
    line-height: 3em !important;
}

.jp-checkout-btn:disabled,
.jp-checkout-btn.disabled {
    pointer-events: none;
    opacity: 0.5;
}

@media screen and (max-width: 600px) {
    .jp-product-card {
        width: 100%;
        max-width: 340px;
    }

    .jp-cart-drawer {
        max-width: 100%;
    }
}
