/**
 * HEXAMON Shop — single-column checkout
 */

:root {
    --ink: #102033;
    --ink-soft: #3d4f63;
    --muted: #6b7c8f;
    --line: rgba(16, 32, 51, 0.12);
    --surface: #ffffff;
    --accent: #0f7a57;
    --accent-deep: #0a5c41;
    --accent-soft: #e4f5ee;
    --danger: #c0352b;
    --danger-soft: #fdecea;
    --ok: #0b7a45;
    --ok-soft: #e8f8ef;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(16, 32, 51, 0.08);
    --font-display: 'Outfit', system-ui, sans-serif;
    --font-body: 'Source Sans 3', system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--ink);
    background: #f5f7fa;
    line-height: 1.5;
}

.checkout-shell {
    width: min(720px, calc(100% - 1.5rem));
    margin: 0 auto;
    padding: clamp(1.25rem, 3vw, 2.25rem) 0 clamp(2.5rem, 5vw, 3.5rem);
}

.checkout-brand {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.checkout-brand h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 4vw, 1.85rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.checkout-brand .secure-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1.15rem, 3vw, 1.6rem);
}

.product-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 0.85rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--line);
    align-items: center;
}

.product-media {
    width: 88px;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #e8eef4;
    margin: 0 auto;
}

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

.product-media-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8eef4 0%, #d5dee8 100%);
}

.product-info {
    min-width: 0;
    text-align: center;
}

.product-info h2 {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    font-weight: 650;
    line-height: 1.25;
}

.product-qty .field-error,
.product-qty .server-error {
    text-align: center;
    margin-top: 0.45rem;
}

.product-qty .qty-control {
    max-width: 14rem;
    margin: 0 auto;
}

.price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.4rem 0.65rem;
    margin-bottom: 0.55rem;
}

.price-row .price {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
}

.price-row .each {
    color: var(--muted);
    font-size: 0.9rem;
}

.stock-badge {
    display: inline-flex;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-deep);
    font-size: 0.82rem;
    font-weight: 600;
}

.stock-badge.is-unknown {
    background: #eef2f6;
    color: var(--ink-soft);
}

@media (min-width: 720px) {
    .product-bar {
        grid-template-columns: 96px minmax(0, 1fr) auto;
        gap: 1rem 1.15rem;
        align-items: center;
    }

    .product-media {
        width: 96px;
        margin: 0;
    }

    .product-info {
        text-align: left;
    }

    .price-row {
        justify-content: flex-start;
    }

    .product-qty {
        justify-self: end;
        min-width: 11.5rem;
    }

    .product-qty label {
        text-align: center;
    }

    .product-qty .qty-control {
        margin: 0;
        max-width: none;
        width: 11.5rem;
    }
}

.form-group {
    margin-bottom: 1.05rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 650;
    font-size: 0.92rem;
}

.form-group .optional {
    color: var(--muted);
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 1rem;
    background: #fff;
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.5rem;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7c8f' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 12px 8px;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: rgba(0, 112, 186, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 112, 186, 0.12);
}

.form-group input.is-invalid,
.form-group select.is-invalid {
    border-color: rgba(192, 53, 43, 0.55);
    box-shadow: 0 0 0 3px rgba(192, 53, 43, 0.1);
}

.form-group input.is-valid,
.form-group select.is-valid {
    border-color: rgba(11, 122, 69, 0.4);
}

.form-group small {
    display: block;
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.qty-control {
    display: grid;
    grid-template-columns: 2.75rem 1fr 2.75rem;
    gap: 0.45rem;
    max-width: 14rem;
}

.qty-btn {
    appearance: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #f7fafc;
    color: var(--ink);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.qty-btn:hover {
    background: #eef3f8;
}

.qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-control input {
    text-align: center;
    font-weight: 650;
    -moz-appearance: textfield;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ship-card,
.ship-notice {
    margin: 0.35rem 0 1.05rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    background: #f3f5f8;
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.ship-card p {
    margin: 0.2rem 0;
}

.ship-card-label {
    margin: 0 0 0.35rem;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.ship-card p:first-child {
    margin-top: 0;
}

.ship-card p:last-child {
    margin-bottom: 0;
}

.ship-card[hidden],
.ship-card:empty {
    display: none !important;
}

.options-fieldset {
    margin: 0 0 1.15rem;
    padding: 0;
    border: none;
}

.options-fieldset legend {
    padding: 0;
    margin: 0 0 0.55rem;
    font-weight: 650;
    font-size: 0.92rem;
}

.options-list {
    display: grid;
    gap: 0.55rem;
}

.option-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.7rem;
    align-items: start;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fafbfc;
    cursor: pointer;
}

.option-card:has(input:checked) {
    border-color: rgba(0, 112, 186, 0.45);
    background: #f3f9fd;
}

.option-card input {
    margin-top: 0.15rem;
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #0070ba;
}

.option-title {
    display: block;
    font-weight: 650;
}

.option-desc {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.option-price {
    display: block;
    margin-top: 0.3rem;
    font-weight: 650;
}

.option-price em {
    font-style: normal;
    font-weight: 500;
    color: var(--muted);
    font-size: 0.84rem;
}

.code-group,
.country-group {
    margin-bottom: 1.05rem;
}

.country-group .ship-notice {
    margin: 0.55rem 0 0;
    font-weight: 600;
}

.order-summary {
    margin: 0.15rem 0 1.15rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--line);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.35rem 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.summary-row span:last-child,
.summary-row strong {
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft);
}

.summary-row.discount-row[hidden] {
    display: none !important;
}

.summary-row.discount-row {
    color: var(--ok);
}

.summary-row.discount-row em {
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.summary-row.discount-row strong {
    font-weight: 700;
    color: inherit;
}

.summary-row.is-free span:last-child {
    color: var(--ok);
}

.ship-notice[hidden] {
    display: none !important;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.25rem 0 0;
    padding: 0.75rem 0 0.15rem;
    border-top: 1px solid var(--line);
}

.total-row span {
    color: var(--muted);
    font-weight: 600;
}

.total-row strong {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
}

.field-error {
    display: none;
    margin-top: 0.35rem;
    color: var(--danger);
    font-size: 0.86rem;
    font-weight: 600;
}

.field-error.is-visible,
.server-error {
    display: block;
}

.server-error {
    margin-top: 0.35rem;
    color: var(--danger);
    font-size: 0.86rem;
    font-weight: 600;
}

.alert {
    padding: 0.8rem 0.95rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.94rem;
    font-weight: 550;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(192, 53, 43, 0.2);
}

.alert-success {
    background: var(--ok-soft);
    color: var(--ok);
    border: 1px solid rgba(11, 122, 69, 0.2);
}

.info-text {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 3.1rem;
    padding: 0.85rem 1.2rem;
    border: none;
    border-radius: 1.5rem;
    background: #ffc439;
    color: #003087;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.btn-primary:hover {
    background: #f0bb33;
}

.btn-primary:active {
    background: #e6b22e;
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary .paypal-mark {
    font-style: italic;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.cf-turnstile {
    margin: 0.35rem 0 1rem;
}

.success-panel {
    max-width: 34rem;
    margin: 0 auto;
}

.success-panel h1 {
    font-family: var(--font-display);
    margin: 0 0 1rem;
}

.success-meta {
    color: var(--ink-soft);
    margin: 0.35rem 0;
}

@media (max-width: 480px) {
    .checkout-brand {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-media {
        width: 72px;
    }

    .qty-control {
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-primary,
    .form-group input,
    .form-group select {
        transition: none;
    }
}
