/* Gift vouchers: the voucher itself (invitation + bookmark) shared by the
   compose preview, the order page and the print page, and the compose form.
   The voucher is sized by its container (cqw), so the same markup is a small
   preview on a phone and exactly A5 on paper. */

.gift-invite {
    container-type: inline-size;
    position: relative;
    width: 100%;
    aspect-ratio: 1748 / 2480;
    background: #f4efe4 center / cover no-repeat;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
}
.gift-invite .gi-text {
    position: absolute;
    left: var(--gi-left, 10%);
    right: var(--gi-right, 10%);
    top: var(--gi-top, 9%);
    height: var(--gi-height, 50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--gi-ink, #24324a);
    gap: calc(1.6cqw * var(--gi-scale, 1));
}
.gi-kicker { font-size: calc(3.4cqw * var(--gi-scale, 1)); letter-spacing: .5cqw; text-transform: uppercase; opacity: .8; }
.gi-to { font-size: calc(7.2cqw * var(--gi-scale, 1)); font-style: italic; line-height: 1.1; overflow-wrap: anywhere; }
.gi-what { font-size: calc(6cqw * var(--gi-scale, 1)); font-weight: 700; line-height: 1.15; }
.gi-perk { font-size: calc(3.1cqw * var(--gi-scale, 1)); line-height: 1.35; max-width: 92%; opacity: .85; }
.gi-msg { font-size: calc(3.6cqw * var(--gi-scale, 1)); font-style: italic; line-height: 1.4; max-width: 94%; white-space: pre-line; overflow-wrap: anywhere; }
.gi-msg-long { font-size: calc(2.9cqw * var(--gi-scale, 1)); line-height: 1.35; }
.gi-from { font-size: calc(3.6cqw * var(--gi-scale, 1)); }
.gi-code {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: calc(5.6cqw * var(--gi-scale, 1)); letter-spacing: .6cqw; font-weight: 700;
    padding: 1.2cqw 3cqw; border: .35cqw solid currentColor; border-radius: 1.6cqw;
    background: rgba(255, 255, 255, .55); margin-top: 1cqw;
}
.gi-how { font-size: calc(2.7cqw * var(--gi-scale, 1)); opacity: .8; }
.gi-empty { opacity: .45; }

.gift-bookmark {
    container-type: inline-size;
    position: relative;
    width: 100%;
    aspect-ratio: 600 / 2160;
    background: #f4efe4 center / cover no-repeat;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
    color: #24324a;
}
.gift-bookmark .gb-mid {
    position: absolute; left: 8%; right: 8%; top: 30%; height: 42%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 4cqw;
}
.gb-to { font-size: 11cqw; font-style: italic; line-height: 1.15; overflow-wrap: anywhere; }
.gb-what { font-size: 10cqw; font-weight: 700; line-height: 1.2; }
.gb-brand { font-size: 7cqw; letter-spacing: 1.5cqw; text-transform: uppercase; opacity: .75; }
.gift-bookmark .gb-foot {
    position: absolute; left: 8%; right: 8%; bottom: 3.5%;
    display: flex; flex-direction: column; align-items: center; gap: 2.5cqw;
}
.gb-qr { width: 46%; aspect-ratio: 1; background: #fff; padding: 2cqw; border-radius: 2cqw; }
.gb-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 9.5cqw; font-weight: 700; letter-spacing: .8cqw; }
.gb-how { font-size: 6cqw; opacity: .8; text-align: center; }

/* ── Compose page ─────────────────────────────────────────────────────── */
.gift-page { max-width: 1060px; margin: 0 auto; }
.gift-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.gift-preview { max-width: 340px; width: 78%; margin: 0 auto; }
.gift-preview-note { text-align: center; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
@media (min-width: 860px) {
    .gift-grid { grid-template-columns: 360px minmax(0, 1fr); gap: 36px; align-items: start; }
    .gift-side { position: sticky; top: 18px; }
    .gift-preview { width: 100%; }
}
.gift-step { margin: 0 0 22px; }
.gift-step h2 { font-size: 17px; margin: 0 0 10px; display: flex; gap: 10px; align-items: center; }
.gift-step h2 .n {
    display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; font-size: 14px; flex: 0 0 26px;
}
.gift-choices { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .gift-choices.cols { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.gift-choice { position: relative; display: block; cursor: pointer; }
.gift-choice input { position: absolute; opacity: 0; pointer-events: none; }
.gift-choice .box {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    border: 2px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--card);
    min-height: 54px; transition: border-color .15s, background .15s;
}
.gift-choice input:checked + .box { border-color: var(--accent); background: rgba(99, 102, 241, .12); }
.gift-choice input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.gift-choice .box > .what { flex: 1 1 auto; min-width: 0; }
.gift-choice .price { font-weight: 800; white-space: nowrap; flex: 0 0 auto; }
.gift-choice .gift-tag { font-size: 12.5px; color: #fbbf24; display: block; margin-top: 3px; line-height: 1.35; }
/* 1+1 campaign: the offer stands out and unfolds its explanation when picked. */
.gift-promo .box {
    flex-wrap: wrap; border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, .16), rgba(239, 68, 68, .10));
}
.gift-promo input:checked + .box { border-color: #f59e0b; background: linear-gradient(135deg, rgba(245, 158, 11, .24), rgba(239, 68, 68, .14)); box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
.gift-promo .box > .what { flex: 1 1 0; }
.gift-badge {
    display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px; vertical-align: 1px;
    background: #ef4444; color: #fff; font-size: 12.5px; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
}
.gift-countdown { display: block; margin-top: 4px; font-size: 13px; color: #fbbf24; font-variant-numeric: tabular-nums; }
.gift-promo-more { display: none; flex: 1 0 100%; border-top: 1px dashed rgba(245, 158, 11, .55); padding-top: 10px; font-size: 14px; line-height: 1.55; }
.gift-promo-more strong { display: block; margin-bottom: 4px; font-size: 15px; }
.gift-promo input:checked + .box .gift-promo-more { display: block; }
.gift-promo-own { margin-top: 10px; font-size: 14px; line-height: 1.5; }
.gift-promo-own[hidden] { display: none; }
.gift-promo-own p { margin: 0; color: var(--muted); }
.gift-promo-own label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.gift-promo-own input { width: 20px; height: 20px; flex: 0 0 20px; margin: 1px 0 0; accent-color: #f59e0b; }
.gift-design .box { flex-direction: column; padding: 8px; gap: 8px; justify-content: flex-start; }
.gift-design img { width: 100%; aspect-ratio: 1748 / 2480; object-fit: cover; border-radius: 8px; display: block; }
.gift-design .name { font-size: 14px; }
.gift-designs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gift-fields { display: grid; gap: 12px; }
.gift-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.gift-fields input, .gift-fields textarea {
    padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: #0f131b; color: var(--fg);
    font-size: 16px; /* 16px: iOS does not zoom into the field */ font-family: inherit; width: 100%; box-sizing: border-box;
}
.gift-fields textarea { min-height: 96px; resize: vertical; }
.gift-fields input:focus, .gift-fields textarea:focus { outline: none; border-color: var(--accent); }
.gift-count { font-size: 12px; color: var(--muted); text-align: right; margin-top: -2px; }
@media (min-width: 560px) { .gift-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } }
.gift-submit { width: 100%; padding: 15px; font-size: 17px; font-weight: 700; border-radius: 12px; }
.gift-how { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-top: 26px; background: var(--card); }
.gift-how ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; color: var(--muted); }
.gift-error { border: 1px solid var(--danger); color: var(--danger); border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }
.gift-ok { border: 1px solid #34d399; border-radius: 12px; padding: 16px 18px; margin: 0 0 18px; }

/* ── Order page ───────────────────────────────────────────────────────── */
.gift-order { max-width: 760px; margin: 0 auto; }
.gift-codes { display: grid; gap: 10px; margin: 14px 0; }
.gift-code-row {
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(20px, 6vw, 28px); font-weight: 700;
    letter-spacing: 2px; text-align: center; padding: 12px; border: 2px dashed var(--accent); border-radius: 12px;
}
.gift-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.gift-actions .btn { flex: 1 1 200px; padding: 13px 16px; font-weight: 700; }
.gift-summary { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 14px 0; }
.gift-summary .thumb { width: 92px; flex: 0 0 92px; }
.gift-summary .what { flex: 1 1 200px; }
.gift-summary .what strong { font-size: 17px; }

/* "I paid": the button and its note wrap under each other on a phone. */
.gift-claim { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 14px 0 6px; }
.gift-claim .btn { padding: 13px 18px; font-weight: 700; }
.gift-claim .muted { font-size: 13.5px; flex: 1 1 220px; }

/* Sharing the gift link: who has it sees the code. */
.gift-share { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 4px 0 14px; font-size: 13.5px; }
.gift-share p { margin: 0; color: var(--muted); }
.gift-share .warn { margin-top: 6px; color: #fbbf24; }

/* ── Redeem page ──────────────────────────────────────────────────────── */
.gift-redeem { max-width: 520px; margin: 0 auto; }
.gift-redeem .code-input {
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: 3px; text-align: center;
    text-transform: lowercase;
}

/* "Give N books to someone" card under the redeem form. */
.gift-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 26px;
    padding: 16px 18px; border-radius: 14px; text-decoration: none; color: var(--fg);
    border: 1px solid rgba(99, 102, 241, .45); background: linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(139, 92, 246, .08));
}
.gift-banner:hover { border-color: var(--accent); }
.gift-banner .gb-icon { font-size: 30px; line-height: 1; }
.gift-banner .gb-text { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; }
.gift-banner .gb-text strong { font-size: 16.5px; }
.gift-banner .gb-text .muted { font-size: 13.5px; }
.gift-banner .gb-btn { flex: 1 1 100%; text-align: center; padding: 12px; font-weight: 700; }
@media (min-width: 560px) { .gift-banner .gb-btn { flex: 0 0 auto; } }

/* What the recipient opens: the invitation and one big button. */
.gift-show { max-width: 520px; margin: 0 auto; display: grid; gap: 34px; }
.gift-show-item { display: grid; gap: 14px; }
.gift-show-note { font-size: 13px; text-align: center; margin: 0; }
.gift-show-done { text-align: center; font-weight: 700; margin: 0; }
