/* ── Theme tokens ─────────────────────────────────────────── */
:root {
    --reg-red: #B73C2C;
    --reg-red-hover: #9a3224;
    --reg-gold: #FFD663;
    --reg-gold-light: #FFF3CC;
    --reg-blush: #F7C6CE;
    --reg-white: #FFFFFF;
    --reg-dark: #111827;
    --reg-muted: #6B7280;
    --reg-funded: #2D6A4F;
    --reg-funded-bg: #D8F3DC;
    --reg-border: #F0E8E0;
    --reg-font-heading: 'Parisienne', cursive;
    --reg-font-body: 'Nunito', sans-serif;
}

/* ── Page wrapper ─────────────────────────────────────────── */
.registry-page {
    font-family: var(--reg-font-body);
    color: var(--reg-dark);
    padding: 3rem 1.5rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

#wrapwrap:has(.registry-page) {
    background: linear-gradient(160deg, #FFF9F5 0%, var(--reg-white) 60%, #FFF9E6 100%);
}

/* ── Header ──────────────────────────────────────────────── */
.registry-header {
    text-align: center;
    margin-bottom: 3rem;
}

.registry-title {
    font-family: var(--reg-font-heading);
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    color: var(--reg-red);
    font-weight: 400;
    margin: 0 0 0.75rem;
    line-height: 1.2;
}

.registry-subtitle {
    color: var(--reg-muted);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto;
}

/* ── Currency toggle ─────────────────────────────────────── */
.registry-currency-toggle {
    display: inline-flex;
    margin-top: 1.25rem;
    border: 1px solid var(--reg-border);
    border-radius: 999px;
    background: var(--reg-white);
    padding: 0.25rem;
    box-shadow: 0 2px 8px rgba(183, 60, 44, 0.06);
}

.registry-currency-toggle button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--reg-muted);
    font-family: var(--reg-font-body);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.registry-currency-toggle button:hover {
    color: var(--reg-dark);
}

.registry-currency-toggle button.is-active {
    background: var(--reg-red);
    color: var(--reg-white);
}

/* ── Error banner ────────────────────────────────────────── */
.registry-error-banner {
    background: #FEE2E2;
    border: 1px solid #FECACA;
    color: #991B1B;
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 0.95rem;
}

/* ── Section (category) ──────────────────────────────────── */
.registry-section {
    margin-bottom: 3rem;
}

.registry-section__header {
    text-align: center;
    margin: 0 auto 1.5rem;
    max-width: 700px;
}

.registry-section__title {
    font-family: var(--reg-font-heading);
    font-size: clamp(2rem, 4vw, 2.8rem);
    color: var(--reg-red);
    font-weight: 400;
    margin: 0 0 0.25rem;
    line-height: 1.2;
    position: relative;
    display: inline-block;
}

.registry-section__title::after {
    content: '';
    display: block;
    width: 60%;
    height: 2px;
    background: var(--reg-gold);
    margin: 0.4rem auto 0;
    border-radius: 2px;
    opacity: 0.7;
}

.registry-section__desc {
    color: var(--reg-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0.5rem 0 0;
}

/* ── Gift grid ───────────────────────────────────────────── */
.registry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.75rem;
}

/* ── Gift card ───────────────────────────────────────────── */
.registry-card {
    background: var(--reg-white);
    border: 1px solid var(--reg-border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.registry-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.registry-card--funded {
    opacity: 0.75;
}

.registry-card__image-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #FAF5F0;
}

.registry-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.registry-card__image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    background: var(--reg-gold-light);
}

.registry-card__badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.registry-card__badge--funded {
    background: var(--reg-funded-bg);
    color: var(--reg-funded);
}

.registry-card__body {
    padding: 1.25rem 1.25rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.registry-card__name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: var(--reg-dark);
}

.registry-card__ext-link {
    font-size: 0.85rem;
    color: var(--reg-muted);
    text-decoration: none;
    margin-left: 0.25rem;
    vertical-align: super;
}

.registry-card__ext-link:hover {
    color: var(--reg-red);
}

.registry-card__desc {
    font-size: 0.9rem;
    color: var(--reg-muted);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.registry-card__pricing {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.registry-card__price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--reg-dark);
}

.registry-card__contributed {
    font-size: 0.82rem;
    color: var(--reg-funded);
    font-weight: 600;
}

/* ── Progress bar ────────────────────────────────────────── */
.registry-card__progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.registry-card__progress-bar {
    flex: 1;
    height: 7px;
    background: #F0E8E0;
    border-radius: 99px;
    overflow: hidden;
}

.registry-card__progress-fill {
    height: 100%;
    background: var(--reg-gold);
    border-radius: 99px;
    transition: width 0.4s ease;
    min-width: 4px;
}

.registry-card__progress-label {
    font-size: 0.78rem;
    color: var(--reg-muted);
    white-space: nowrap;
    min-width: 2.5rem;
    text-align: right;
}

/* ── Card button ─────────────────────────────────────────── */
.registry-card__btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 10px;
    font-family: var(--reg-font-body);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--reg-red);
    color: var(--reg-white);
    transition: background 0.2s ease;
}

.registry-card__btn:hover {
    background: var(--reg-red-hover);
}

.registry-card__btn--disabled {
    background: #E5E7EB;
    color: var(--reg-muted);
    cursor: default;
}

/* ── Empty state ─────────────────────────────────────────── */
.registry-empty {
    text-align: center;
    color: var(--reg-muted);
    font-size: 1.05rem;
    padding: 3rem;
}

/* ── Modal ───────────────────────────────────────────────── */
.registry-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.registry-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
}

.registry-modal__box {
    position: relative;
    z-index: 1;
    background: var(--reg-white);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    margin: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.registry-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--reg-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.registry-modal__close:hover {
    background: #F3F4F6;
    color: var(--reg-dark);
}

.registry-modal__title {
    font-family: var(--reg-font-heading);
    font-size: 2rem;
    color: var(--reg-red);
    font-weight: 400;
    margin: 0 0 0.25rem;
}

.registry-modal__item-name {
    color: var(--reg-muted);
    font-weight: 600;
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
}

/* ── Contribution form ───────────────────────────────────── */
.registry-form__group {
    margin-bottom: 1.1rem;
}

.registry-form__label {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--reg-dark);
    margin-bottom: 0.35rem;
}

.registry-form__required {
    color: var(--reg-red);
}

.registry-form__hint {
    font-weight: 400;
    color: var(--reg-muted);
    font-size: 0.82rem;
    margin-left: 0.4rem;
}

.registry-form__input {
    width: 100%;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    font-family: var(--reg-font-body);
    font-size: 0.95rem;
    color: var(--reg-dark);
    background: var(--reg-white);
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.registry-form__input:focus {
    border-color: var(--reg-red);
    box-shadow: 0 0 0 3px rgba(183, 60, 44, 0.1);
}

.registry-form__textarea {
    resize: vertical;
    min-height: 80px;
}

.registry-form__amount-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.registry-form__amount-wrap:focus-within {
    border-color: var(--reg-red);
    box-shadow: 0 0 0 3px rgba(183, 60, 44, 0.1);
}

.registry-form__input--amount {
    flex: 1;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding-right: 0.5rem;
}

.registry-form__input--amount:focus {
    border-color: transparent;
    box-shadow: none;
}

.registry-form__currency {
    padding: 0 0.9rem;
    background: #F9FAFB;
    color: var(--reg-muted);
    font-weight: 700;
    border-left: 1.5px solid #E5E7EB;
    align-self: stretch;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.registry-form__char-counter {
    text-align: right;
    font-size: 0.78rem;
    color: var(--reg-muted);
    margin-top: 0.2rem;
}

.registry-form__char-counter.is-warning {
    color: #D97706;
}

.registry-form__char-counter.is-error {
    color: #DC2626;
}

.registry-form__submit {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.8rem 1rem;
    background: var(--reg-red);
    color: var(--reg-white);
    border: none;
    border-radius: 10px;
    font-family: var(--reg-font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.registry-form__submit:hover {
    background: var(--reg-red-hover);
}

/* ── Payment return page ─────────────────────────────────── */
.registry-return-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
}

.registry-return-card {
    background: var(--reg-white);
    border-radius: 24px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
    padding: 3rem 2.5rem;
    max-width: 520px;
    width: 100%;
    text-align: center;
}

.registry-return-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.registry-return-icon--success {
    background: var(--reg-funded-bg);
    color: var(--reg-funded);
}

.registry-return-icon--error {
    background: #FEE2E2;
    color: #991B1B;
}

.registry-return-icon--pending {
    background: var(--reg-gold-light);
    color: #92400E;
}

.registry-return-title {
    font-family: var(--reg-font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--reg-red);
    font-weight: 400;
    margin: 0 0 1rem;
}

.registry-return-msg {
    color: var(--reg-muted);
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

.registry-return-quote {
    font-style: italic;
    color: var(--reg-dark);
    background: #FAF5F0;
    border-left: 3px solid var(--reg-gold);
    padding: 0.75rem 1rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
    text-align: left;
}

.registry-return-instructions {
    background: #FAF5F0;
    border: 1px solid var(--reg-gold);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0 0 1.5rem;
    color: var(--reg-dark);
    text-align: left;
    line-height: 1.6;
}

.registry-return-instructions p {
    margin: 0 0 0.5rem;
}

.registry-return-instructions p:last-child {
    margin-bottom: 0;
}

.registry-return-back {
    display: inline-block;
    color: var(--reg-red);
    font-weight: 700;
    text-decoration: none;
    margin-top: 0.5rem;
}

.registry-return-back:hover {
    text-decoration: underline;
}

/* ── Cart FAB ─────────────────────────────────────────── */
.registry-cart-fab {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 8500;
    background: var(--reg-red);
    color: var(--reg-white);
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    font-family: var(--reg-font-body);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: 0 10px 28px rgba(183, 60, 44, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: transform 0.15s ease, background 0.2s ease;
}

.registry-cart-fab:hover {
    background: var(--reg-red-hover);
    color: var(--reg-white);
    text-decoration: none;
    transform: translateY(-1px);
}

.registry-cart-fab__icon {
    font-size: 1.15rem;
    line-height: 1;
}

.registry-cart-fab__label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.registry-cart-fab__count {
    background: var(--reg-gold);
    color: var(--reg-dark);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.82rem;
    min-width: 1.5rem;
    text-align: center;
}

.registry-cart-fab__total {
    opacity: 0.9;
    font-weight: 600;
    padding-left: 0.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
}

/* ── Checkout layout ─────────────────────────────────────── */
.registry-checkout-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.registry-checkout-cart,
.registry-checkout-form {
    background: var(--reg-white);
    border: 1px solid var(--reg-border);
    border-radius: 18px;
    padding: 1.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.registry-checkout-section-title {
    font-family: var(--reg-font-heading);
    font-size: 1.8rem;
    color: var(--reg-red);
    font-weight: 400;
    margin: 0 0 1rem;
}

.registry-checkout-identity {
    padding: 0.9rem 1rem;
    background: #FFFBF6;
    border: 1px solid var(--reg-border);
    border-radius: 12px;
    margin-bottom: 1.25rem;
}

.registry-checkout-identity__line {
    margin: 0;
    color: var(--reg-dark);
}

.registry-checkout-identity__line--muted {
    color: var(--reg-muted, #6b6b6b);
    font-size: 0.92rem;
    margin-top: 0.15rem;
}

.registry-checkout-lines {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.registry-cart-line {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem;
    background: #FFFBF6;
    border: 1px solid var(--reg-border);
    border-radius: 12px;
}

.registry-cart-line__info {
    min-width: 0;
}

.registry-cart-line__name {
    font-weight: 700;
    color: var(--reg-dark);
    font-size: 0.98rem;
    margin-bottom: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.registry-cart-line__meta {
    color: var(--reg-muted);
    font-size: 0.8rem;
}

.registry-cart-line__amount {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.registry-cart-line__amount input {
    width: 6.5rem;
    text-align: right;
    padding: 0.45rem 0.6rem;
}

.registry-cart-line__currency {
    color: var(--reg-muted);
    font-weight: 700;
}

.registry-cart-line__remove {
    background: none;
    border: none;
    color: var(--reg-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    line-height: 1;
}

.registry-cart-line__remove:hover {
    background: #FEE2E2;
    color: #991B1B;
}

.registry-checkout-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1.5px dashed var(--reg-border);
    font-size: 1.1rem;
}

.registry-checkout-total strong {
    font-size: 1.35rem;
    color: var(--reg-red);
}

.registry-checkout-empty {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--reg-muted);
}

.registry-form__submit--link {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    width: auto;
    margin-top: 1rem;
    padding: 0.6rem 1.25rem;
}

.registry-checkout-back {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: var(--reg-muted);
    font-size: 0.9rem;
    text-decoration: none;
}

.registry-checkout-back:hover {
    color: var(--reg-red);
}

.registry-form__submit:disabled {
    background: #E5E7EB;
    color: var(--reg-muted);
    cursor: not-allowed;
}

/* ── Payment return order lines list ─────────────────────── */
.registry-return-lines {
    list-style: none;
    padding: 0;
    margin: 1rem 0 1.25rem;
    text-align: left;
    background: #FAF5F0;
    border-radius: 10px;
}

.registry-return-lines li {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--reg-border);
}

.registry-return-lines li:last-child {
    border-bottom: none;
}

.registry-return-lines__name {
    color: var(--reg-dark);
}

.registry-return-lines__amount {
    color: var(--reg-red);
    font-weight: 700;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .registry-checkout-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .registry-page {
        padding: 2rem 1rem 3rem;
    }

    .registry-grid {
        grid-template-columns: 1fr;
    }

    .registry-modal__box {
        padding: 2rem 1.25rem;
    }

    .registry-cart-fab {
        bottom: 1rem;
        right: 1rem;
        padding: 0.55rem 0.95rem;
        font-size: 0.9rem;
    }

    .registry-cart-fab__total {
        display: none;
    }

    .registry-cart-line {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "info remove"
            "amount amount";
        row-gap: 0.5rem;
    }

    .registry-cart-line__info { grid-area: info; }
    .registry-cart-line__remove { grid-area: remove; }
    .registry-cart-line__amount { grid-area: amount; justify-self: start; }
}
