/* ============================================================
   OPICKO CORE — shared chrome
   Loaded on every opx_enabled() page via OPX_Assets::maybe_enqueue('opx-core').
   PDP-only rules stay in pdp.css.
   Patch Applied: Design token aliasing & Dark Mode readiness.
   Final Polish: .sr-only alias, mobile toast collision, & dark mode contrast fix.
   Template Sync: .opx-delivery-row styles added, dead h2 rule removed.
   ============================================================ */

/* ── 1. Tokens ───────────────────────────────────────────────── */
:root {
    --lux-ink: #141414;
    --lux-muted: #7a746c;
    --lux-line: #e6e2db;
    --lux-body: #4c4a46;
    --lux-accent: #027371;
    /* brand green — kills the theme gold everywhere */
    --lux-cream: #f3ede2;
    --lux-bg: #ffffff;
    /* Added for card/form surfaces */
    --opc-ok: #2e7d32;
    --opc-ok-bg: #eaf6ec;
    --opc-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --opx-brand: #027371;
    --opx-brand-hi: #4FB3AC;
    --opx-ink: #0B0B0C;
    --opx-paper: #F7F5F1;
    --opx-sand: #E5D9CC;
    --opx-line: #E3DED4;
    --opx-mut: #6D6A64;
    --opx-r: 4px;
    --opx-ease: cubic-bezier(.22, .61, .36, 1);
    --opx-disp: 'OPX Display', 'Anton', 'Archivo Black', Impact, sans-serif;
}



/* ── Display Font (Headlines/Heroes) ── */
@font-face {
    font-family: 'OPX Display';
    src: url('fonts/display.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Body font (self-hosted Inter, matches preloaded files) ── */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/inter-400.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/inter-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/inter-700.woff2') format('woff2');
}

/* ── 2. Utilities ─────────────────────────────────────────────── */
.screen-reader-text,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── 3. Shared icon sizing ───────────────────────────────────── */
.opx-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
    display: inline-block;
    vertical-align: middle;
}

/* ── 4. Shared focus states ──────────────────────────────────── */
.opx-drawer :focus-visible {
    outline: 2px solid var(--lux-ink);
    outline-offset: 2px;
}

/* ── 5. Drawers (site-wide shell) ────────────────────────────── */
.opx-drawer {
    position: fixed;
    inset: 0;
    z-index: 99997;
    pointer-events: none;
}

.opx-drawer[hidden] {
    display: none;
}

.opx-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    transition: opacity .25s ease;
}

.opx-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(480px, 92vw);
    background: var(--lux-bg);
    box-shadow: -8px 0 30px rgba(0, 0, 0, .15);
    transform: translateX(100%);
    transition: transform .3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.opx-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--lux-line);
}

.opx-drawer__head h2,
.opx-drawer__head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.opx-drawer.open {
    pointer-events: auto;
}

.opx-drawer.open .opx-drawer__overlay {
    opacity: 1;
}

.opx-drawer.open .opx-drawer__panel {
    transform: none;
}

.opx-drawer__close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: 0;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: var(--lux-ink);
    z-index: 2;
}

.opx-drawer__close:hover {
    color: var(--opx-brand);
}

.opx-drawer h2 {
    font: 800 20px/1.2 var(--opc-font);
    letter-spacing: .06em;
    text-transform: uppercase;
    margin: 0 0 22px;
    color: var(--lux-ink);
    padding: 20px 24px 0;
}

.opx-drawer__body {
    padding: 24px;
    flex: 1;
}

.opx-bag-load {
    padding: 40px 0;
    text-align: center;
    color: var(--lux-muted);
    font-size: 13px;
}

/* ── 6. Bag drawer ────────────────────────────────────────────── */
.opx-drawer--bag .opx-drawer__panel {
    padding: 0 !important;
}

.opx-drawer--bag .opx-drawer__close {
    position: static !important;
    order: 3;
}

.gs-bag__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--lux-line);
}

.gs-bag__head h2 {
    margin: 0 auto 0 0 !important;
    padding: 0 !important;
}

.gs-bag__tabs {
    display: flex;
    gap: 8px;
}

.gs-bag__tabs button {
    width: 48px;
    height: 48px;
    border: 1px solid var(--lux-line);
    background: var(--lux-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lux-muted);
}

.gs-bag__tabs button.on {
    border-color: var(--lux-ink);
    color: var(--lux-ink);
}

.gs-bag__tabs svg {
    width: 20px;
    height: 20px;
}

.opx-bag-slot {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.gs-bag__empty {
    padding: 40px 0;
    text-align: center;
    color: var(--lux-muted);
    font-size: 13px;
}

/* free-ship progress */
.gs-ship {
    font-size: 12px !important;
    margin-bottom: 16px;
    text-align: center;
}

.gs-ship--ok {
    color: var(--opc-ok);
    font-weight: 700;
}

.gs-ship__msg {
    font-size: 14px;
    font-weight: 600;
    color: var(--lux-ink);
    margin-bottom: 10px;
}

.gs-ship__track {
    height: 6px !important;
    background: var(--lux-line) !important;
    border-radius: 99px !important;
    overflow: hidden;
    margin-top: 8px;
}

.gs-ship__track i {
    background: var(--opx-brand, #1a1a1a);
    display: block;
    height: 100%;
    transition: width .4s;
}

.gs-ship__labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--lux-muted);
    margin-top: 8px;
}

.gs-bag__note {
    background: none !important;
    padding: 0 !important;
    font-size: 14px;
    color: var(--lux-body);
    display: flex;
    gap: 10px;
}

.gs-bag__note::before {
    content: 'i';
    flex: 0 0 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--lux-ink);
    color: var(--lux-bg);
    /* Dark mode contrast fix */
    font: 700 12px/18px var(--opc-font);
    text-align: center;
}

.gs-bag__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gs-bag__item {
    display: flex;
    gap: 12px;
    padding: 16px 0 !important;
    border-bottom: 0 !important;
    font-size: 13px;
    align-items: flex-start;
}

.gs-bag__img img {
    width: 96px !important;
    height: 120px !important;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

.gs-bag__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gs-bag__name {
    font: 600 15px var(--opc-font) !important;
    color: var(--lux-ink) !important;
    text-decoration: none;
}

.gs-bag__meta {
    font-size: 11px !important;
    color: var(--lux-muted) !important;
}

.gs-bag__price {
    font: 700 13px var(--opc-font) !important;
    color: var(--lux-ink) !important;
}

.gs-bag__qty {
    display: flex;
    align-items: center;
    gap: 6px !important;
    align-self: flex-end;
}

.gs-bag__qty button {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    border: 1px solid var(--lux-line);
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--lux-ink);
}

.gs-bag__n {
    min-width: 20px;
    text-align: center;
    font: 600 13px var(--opc-font) !important;
}

.gs-bag__total {
    display: flex;
    justify-content: space-between;
    font: 700 14px var(--opc-font) !important;
    color: var(--lux-ink) !important;
    margin-bottom: 12px;
}

.gs-bag__checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--lux-ink);
    color: var(--lux-bg);
    /* Dark mode contrast fix */
    border-radius: 999px;
    padding: 16px;
    font: 700 12px var(--opc-font);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    border: 0;
    cursor: pointer;
}

.gs-bag__checkout:hover {
    background: var(--opx-brand) !important;
}

.gs-bag__checkout svg {
    width: 16px;
    height: 16px;
}

/* cross-sell rail in drawer */
.gs-bag__extra {
    background: var(--lux-cream);
    margin: 0 -24px;
    padding: 20px 24px;
}

.gs-bag__extra h3,
.gs-bag__coupon h3,
.gs-bag__foot h3 {
    font: 800 16px var(--opc-font);
    text-transform: uppercase;
    margin: 0 0 10px;
}

.gs-bag__extra>p {
    font-size: 13px;
    color: var(--lux-muted);
    margin: 0 0 14px;
}

.gs-bag__extra-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
}

.gs-bag__extra-item {
    flex: 0 0 250px;
    background: var(--lux-bg);
    border: 1px solid var(--lux-line);
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.gs-bag__extra-item img {
    width: 64px;
    height: 80px;
    object-fit: cover;
}

.gs-bag__extra-name {
    font-size: 13px;
    font-weight: 600;
    display: block;
}

.gs-bag__extra-price {
    font-size: 13px;
    display: block;
}

.gs-bag__extra-add {
    margin-left: auto;
    font: 600 13px var(--opc-font);
    color: var(--lux-ink);
    text-decoration: none;
    white-space: nowrap;
}

/* coupon */
.gs-bag__coupon-row {
    display: flex;
    gap: 12px;
}

.gs-bag__coupon-row input {
    flex: 1;
    height: 56px;
    border: 1px solid var(--lux-line);
    padding: 0 16px;
    font: 400 14px var(--opc-font);
}

.gs-bag__coupon-row button {
    background: var(--lux-ink);
    color: var(--lux-bg);
    /* Dark mode contrast fix */
    border: 0;
    padding: 0 28px;
    font: 600 14px var(--opc-font);
    cursor: pointer;
}

.gs-bag__coupon-msg {
    font-size: 12px;
    margin-top: 8px;
    min-height: 14px;
}

/* payment badges (shared: drawer + footer) */
.gs-pay {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.gs-pay img {
    height: 28px;
    width: auto;
    border-radius: 5px;
    display: block;
    background: var(--lux-bg);
    border: 1px solid var(--lux-line);
    padding: 3px 6px;
}

.gs-pay--footer {
    justify-content: flex-start;
    margin: 18px 0 0;
}

/* ── 7. Delivery drawer ───────────────────────────────────────── */
.opx-drawer--delivery .opx-drawer__panel {
    padding: 0 !important;
}

.opx-drawer--delivery .opx-drawer__close {
    top: 16px;
    right: 18px;
}

/* Delivery Drawer Rows (Matches templates/drawers.php) */
.opx-delivery-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 28px;
    border-bottom: 1px solid var(--lux-line);
}

.opx-delivery-row:last-of-type {
    border-bottom: 0;
}

.opx-delivery-row svg {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    color: var(--opx-brand);
    margin-top: 2px;
}

.opx-delivery-row strong {
    display: block;
    font: 600 14px/1.3 var(--opc-font);
    color: var(--lux-ink);
    margin-bottom: 4px;
}

.opx-delivery-row span {
    font-size: 13px;
    line-height: 1.5;
    color: var(--lux-muted);
}

.opx-drawer__footer {
    margin: 0 28px;
    padding: 16px 0;
    border-top: 1px solid var(--lux-line);
    font-size: 13px;
    color: var(--lux-muted);
    text-align: center;
}

.opx-delivery {
    padding: 16px 28px 36px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--lux-body);
}

.opx-delivery p {
    margin: 0;
}

.opx-dlv__intro {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--lux-cream);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 0 0 8px;
}

.opx-dlv__intro svg {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    color: var(--lux-ink);
    margin-top: 2px;
}

.opx-delivery h3 {
    font: 700 12px var(--opc-font) !important;
    letter-spacing: .14em !important;
    text-transform: uppercase !important;
    color: var(--lux-ink) !important;
    margin: 24px 0 14px !important;
}

.opx-dlv__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opx-dlv__list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.opx-dlv__list svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    color: var(--opc-ok);
    margin-top: 3px;
}

.opx-dlv__note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid var(--lux-line);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 20px 0 0;
}

.opx-dlv__note svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    color: var(--lux-ink);
    margin-top: 2px;
}

.opx-dlv__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.opx-dlv__grid>div {
    border: 1px solid var(--lux-line);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.opx-dlv__grid svg {
    width: 20px;
    height: 20px;
    color: var(--lux-ink);
    margin-bottom: 8px;
}

.opx-dlv__grid strong {
    font-size: 13px;
    color: var(--lux-ink);
}

.opx-dlv__grid span {
    font-size: 12px;
    color: var(--lux-muted);
}

@media (max-width: 420px) {
    .opx-dlv__grid {
        grid-template-columns: 1fr;
    }
}

/* ── 8. Reserved-rating stars (ugc honest display) ─────────────── */
.opx-stars--reserved {
    color: var(--lux-line);
    letter-spacing: 3px;
}

/* ── 9. Scroll reveal ────────────────────────────────────────── */
.opx-rv {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .6s var(--opx-ease), transform .6s var(--opx-ease);
}

.opx-rv.is-in {
    opacity: 1;
    transform: none;
}

/* ── 10. Drawer scroll lock + toast ──────────────────────────── */
/* Runtime contracts consumed by core.js; must ship even if unused on a page. */
body.opx-modal-open {
    overflow: hidden;
}

.opx-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    background: var(--opx-ink);
    color: var(--lux-bg);
    /* Dark mode contrast fix */
    font: 600 13px/1 var(--opc-font);
    letter-spacing: .06em;
    padding: 14px 24px;
    border-radius: 999px;
    z-index: 99999;
    transition: opacity .25s var(--opx-ease), transform .25s var(--opx-ease);
}

.opx-toast.is-on {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

/* ── 11. Responsive + reduced-motion ─────────────────────────── */
@media (max-width: 1024px) {
    .opx-drawer__panel {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Fix: Toast vs. Mobile Bar overlap on PDP */
    body.single-product .opx-toast {
        bottom: calc(84px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {

    .opx-drawer *,
    .opx-drawer *::before,
    .opx-drawer *::after,
    .opx-toast {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}