/* ===========================================================
   Espressimo — Checkout (form + sticky order summary)
   =========================================================== */

.esp-co {
    font-family: 'Dialect PM', sans-serif;
    display: flex;
    gap: 40px;
    align-items: flex-start;
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 48px;
}

.esp-co__form { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 28px; }

/* ── Section cards ── */
.esp-co__sec {
    background: #fff9f2;
    border: 1px solid #e6dad4;
    border-radius: 16px;
    padding: 28px;
}
.esp-co__sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.esp-co__step {
    width: 32px; height: 32px; border-radius: 999px;
    background: #522c25; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 700;
}
.esp-co__sec-title { color: #522c25; font-size: 26px; font-weight: 700; margin: 0; }

/* ── Fields ── */
.esp-co__grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.esp-co__col2 { grid-column: 1 / -1; }
.esp-co__field { display: block; }
.esp-co__field > span {
    display: block; color: #522c25; font-size: 17px; opacity: 0.75; margin-bottom: 6px;
}
.esp-co__field i { color: #c46500; font-style: normal; }
.esp-co__field input {
    width: 100%; box-sizing: border-box;
    background: #fff9f2; border: 1px solid #e6dad4; border-radius: 8px;
    padding: 12px 16px; color: #522c25; font: inherit; font-size: 19px;
    outline: none; transition: border-color 0.2s ease;
}
.esp-co__field input:focus { border-color: #c46500; }
.esp-co__field input::placeholder { opacity: 0.4; }

/* ── Method toggles (shipping + payment) ── */
.esp-co__methods { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.esp-co__pays { display: flex; flex-direction: column; gap: 12px; }
.esp-co__method {
    display: flex; align-items: center; gap: 12px; text-align: right;
    border: 1px solid #e6dad4; border-radius: 12px; padding: 16px 20px;
    background: #fff9f2 !important; color: #c46500 !important; cursor: pointer; font: inherit;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
/* !important defeats the theme's default button:hover background + color (which
   otherwise turned the icon — drawn with currentColor — invisible). */
.esp-co__method:hover { border-color: #c46500; background: #fff9f2 !important; color: #c46500 !important; }
.esp-co__method.is-active,
.esp-co__method.is-active:hover { border-color: #c46500; background: #f6ede3 !important; color: #c46500 !important; }
.esp-co__method svg { color: #c46500 !important; }
.esp-co__method .esp-co__method-title { color: #522c25 !important; }
.esp-co__method .esp-co__method-sub { color: #522c25 !important; }
.esp-co__radio {
    width: 20px; height: 20px; border-radius: 999px; border: 1px solid #d4c4bc;
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.esp-co__method.is-active .esp-co__radio { border-color: #8B3A00; }
.esp-co__method.is-active .esp-co__radio::after {
    content: ''; width: 10px; height: 10px; border-radius: 999px; background: #8B3A00;
}
.esp-co__method-txt { display: flex; flex-direction: column; }
.esp-co__method-title { color: #522c25; font-size: 20px; font-weight: 700; line-height: 1.2; }
.esp-co__method-sub { color: #522c25; font-size: 16px; opacity: 0.55; }

/* ── Card fields block ── */
.esp-co__card-fields {
    background: #f6ede3; border: 1px solid #e6dad4; border-radius: 12px; padding: 20px;
}
.esp-co__card-note { color: #522c25; opacity: 0.6; font-size: 15px; margin: 0; }

.esp-co__back {
    display: inline-flex; align-items: center; gap: 4px;
    color: #522c25; font-size: 18px; opacity: 0.6; text-decoration: none;
    transition: opacity 0.2s ease, color 0.2s ease;
}
.esp-co__back:hover { opacity: 1; color: #8B3A00; }

/* ── Order summary ── */
.esp-co__summary {
    width: 420px; flex-shrink: 0; position: sticky; top: 24px; align-self: flex-start;
    background: #f6ede3; border: 1px solid #e6dad4; border-radius: 16px; overflow: hidden;
}
.esp-co__summary-head { padding: 20px 28px; border-bottom: 1px solid #e6dad4; }

.esp-co__items { padding: 20px 28px; display: flex; flex-direction: column; gap: 20px; }
.esp-co__item { display: flex; gap: 16px; }
.esp-co__item-img {
    width: 78px; height: 78px; border-radius: 12px; background: #fff9f2;
    border: 1px solid #e6dad4; overflow: hidden; flex-shrink: 0;
}
.esp-co__item-img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; padding: 8px; box-sizing: border-box; }
.esp-co__item-body { flex: 1; min-width: 0; }
.esp-co__item-name { color: #522c25; font-size: 19px; font-weight: 700; line-height: 1.2; margin: 0; }
.esp-co__item-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.esp-co__qty { display: flex; align-items: center; border: 1px solid #e6dad4; border-radius: 8px; overflow: hidden; background: #fff9f2; }
.esp-co__qty button { width: 32px; height: 32px; border: 0; background: transparent !important; color: #522c25; font-size: 18px; cursor: pointer; }
.esp-co__qty button:hover { background: #ede0d4 !important; }
.esp-co__qty-val { width: 32px; text-align: center; color: #522c25; font-size: 17px; font-weight: 700; }
.esp-co__item-price { color: #522c25; font-size: 20px; font-weight: 700; }

.esp-co__empty { padding: 8px 28px 20px; color: #522c25; opacity: 0.7; }
.esp-co__empty a { color: #8B3A00; }

.esp-co__coupon { padding: 20px 28px; border-top: 1px solid #e6dad4; border-bottom: 1px solid #e6dad4; display: flex; gap: 8px; }
.esp-co__coupon-input { flex: 1; background: #fff9f2; border: 1px solid #e6dad4; border-radius: 8px; padding: 10px 12px; color: #522c25; font: inherit; font-size: 18px; outline: none; }
.esp-co__coupon-btn { background: #522c25 !important; color: #fff !important; border: 0; font: inherit; font-size: 18px; padding: 0 20px; border-radius: 8px; cursor: pointer; transition: background-color 0.2s ease; }
.esp-co__coupon-btn:hover { background: #8B3A00 !important; color: #fff !important; }

.esp-co__totals { padding: 20px 28px; border-bottom: 1px solid #e6dad4; display: flex; flex-direction: column; gap: 10px; }
.esp-co__row { display: flex; align-items: center; justify-content: space-between; color: #522c25; font-size: 19px; }
.esp-co__row > span:first-child { opacity: 0.65; }
.esp-co__ship-free { display: inline-flex; align-items: center; gap: 6px; color: #2e7d32; font-weight: 700; }

.esp-co__grand { padding: 20px 28px; }
.esp-co__grand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.esp-co__grand-label { color: #522c25; font-size: 24px; font-weight: 700; }
.esp-co__total { color: #522c25; font-size: 32px; font-weight: 700; }

.esp-co__submit {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #8B3A00; color: #fff; border: 0; font: inherit; font-size: 23px; letter-spacing: 0.04em;
    height: 56px; border-radius: 12px; cursor: pointer; transition: background-color 0.2s ease;
    background: #8B3A00 !important; color: #fff !important;
}
.esp-co__submit:hover { background: #a34500 !important; color: #fff !important; }
.esp-co__submit svg { color: #fff !important; }
.esp-co__submit:disabled { opacity: 0.5; cursor: not-allowed; }
.esp-co__submit.is-loading { opacity: 0.7; cursor: progress; }

.esp-co__secure { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: #522c25; opacity: 0.55; font-size: 15px; }
.esp-co__secure svg { color: #c46500; }

.esp-co__done {
    margin-top: 16px; padding: 18px; border-radius: 12px;
    background: rgba(46, 125, 50, 0.1); color: #2e7d32; font-size: 18px; font-weight: 700; text-align: center;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    /* align-items:stretch so the stacked form/summary fill the full width — the base
       align-items:flex-start otherwise leaves the form shrunk to its content width. */
    .esp-co { flex-direction: column; align-items: stretch; padding: 32px 20px; }
    .esp-co__form { width: 100%; }
    .esp-co__summary { width: 100%; position: static; order: -1; }
}
@media (max-width: 560px) {
    .esp-co__grid2, .esp-co__methods { grid-template-columns: 1fr; }
    .esp-co__sec-title { font-size: 22px; }
}

/* ---- Case 14: entrance upsell popup ---- */
.esp-co-pop[hidden] { display: none; }
.esp-co-pop { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; }
.esp-co-pop__overlay { position: absolute; inset: 0; background: rgba(43,35,32,.5); }
.esp-co-pop__modal {
    position: relative; z-index: 1; width: 640px; max-width: 92vw; max-height: 90vh; overflow-y: auto;
    background: #fff; border-radius: 18px; padding: 30px 28px 24px; text-align: center;
    font-family: 'Dialect PM', sans-serif; box-shadow: 0 30px 80px rgba(74,51,37,.35);
}
.esp-co-pop__close {
    position: absolute; top: 12px; left: 12px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    background: none !important; border: 0 !important; box-shadow: none !important; border-radius: 50%;
    font-size: 30px; line-height: 1; color: #6f4e37 !important; cursor: pointer; transition: background .15s, color .15s;
}
.esp-co-pop__close:hover { background: #8b3a00 !important; color: #fff !important; }
.esp-co-pop__title { font-size: 1.5rem; font-weight: 800; color: #2b2320; margin: 0 0 4px; }
.esp-co-pop__sub { color: #6b615b; margin: 0 0 20px; }
.esp-co-pop__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.esp-co-pop__card { border: 1px solid #eadfd5; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; }
.esp-co-pop__img { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #faf6f1; margin-bottom: 10px; }
.esp-co-pop__img img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; }
.esp-co-pop__name { font-weight: 700; font-size: .9rem; color: #2b2320; margin: 0 0 4px; line-height: 1.25; min-height: 2.3em; }
.esp-co-pop__price { color: #8b3a00; font-weight: 700; margin: 0 0 10px; direction: ltr; }
.esp-co-pop__add {
    margin-top: auto; background: #8b3a00 !important; color: #fff !important; border: 0 !important; box-shadow: none !important;
    border-radius: 999px; padding: 9px 10px; font-family: 'Dialect PM', sans-serif; font-weight: 700; font-size: .85rem; cursor: pointer;
    transition: background .15s;
}
.esp-co-pop__add:hover { background: #6f4e37 !important; }
.esp-co-pop__add.esp-added { background: #2e7d32 !important; }
.esp-co-pop__continue {
    margin-top: 20px; background: none !important; border: 0 !important; box-shadow: none !important;
    color: #6b615b; cursor: pointer; font-family: 'Dialect PM', sans-serif; font-size: 1rem; text-decoration: underline; text-underline-offset: 3px;
}
.esp-co-pop__continue:hover { color: #8b3a00; }
@media (max-width: 640px) {
    .esp-co-pop__grid { grid-template-columns: repeat(2, 1fr); }
}
