/* The gift card (improvement loop, round 25): the card itself, the live preview on its page, the thank-you page, the
   receiver's page with its envelope. Loaded only where a card is made, shown or looked up (inc/gift-card.php). */

/* ---------- The card: the trail-map print of the coffee bags, the waterfall, the amount ---------- */
.fb-gc {
	--gc-paper: var(--nysno);
	position: relative; isolation: isolate; width: 100%; max-width: 520px; aspect-ratio: 1.586; overflow: hidden; border-radius: 18px; container-type: inline-size;
	background: var(--gc-paper) url('img/gc-contour.svg?v=4') center / cover no-repeat; color: var(--blekk);
	box-shadow: inset 0 1px 0 rgba(242, 236, 226, 0.75), 0 0 0 1px rgba(23, 25, 28, 0.12), 0 24px 40px -20px rgba(23, 25, 28, 0.5), 0 6px 14px rgba(23, 25, 28, 0.12);
	transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 260ms var(--fb-ease);
}
.fb-gc__face { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; padding: 24px; padding: 6.2cqw 6.6cqw; }
.fb-gc__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fb-gc__brand { display: grid; line-height: 1; }
.fb-gc__brand b { font-size: 2rem; font-size: 8.6cqw; font-weight: 800; letter-spacing: -0.025em; }
.fb-gc__brand i { margin-top: 5px; margin-top: 1.4cqw; color: var(--skifer); font-size: 0.62rem; font-size: 2.6cqw; font-style: normal; font-weight: 700; letter-spacing: 0.32em; text-transform: uppercase; }
.fb-gc__emb { flex: none; width: 40px; height: 40px; width: max(36px, 9cqw); height: max(36px, 9cqw); border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--nysno), 0 0 0 3px rgba(23, 25, 28, 0.25), 0 3px 8px rgba(23, 25, 28, 0.3); }
.fb-gc__code {
	align-self: center; justify-self: start; padding: 4px 10px; padding: 1.3cqw 2.6cqw; border-radius: 8px; background: rgba(242, 236, 226, 0.88);
	font-size: 1.05rem; font-size: 5cqw; font-weight: 800; letter-spacing: 0.09em; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: 0 1px 5px rgba(23, 25, 28, 0.16);
}
.fb-gc__bot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.fb-gc__who { display: grid; gap: 2px; font-size: 0.82rem; font-size: 3.6cqw; font-weight: 700; line-height: 1.15; text-shadow: 0 0 4px var(--gc-paper), 0 0 8px var(--gc-paper); }
.fb-gc__amt { display: grid; justify-items: end; line-height: 1; margin-left: auto; }
.fb-gc__amt b { font-size: 2.4rem; font-size: 11.4cqw; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fb-gc__amt small { margin-bottom: 4px; margin-bottom: 1.2cqw; color: var(--skifer); font-size: 0.74rem; font-size: 3.2cqw; font-weight: 700; }
.fb-gc [hidden] { display: none; }
/* A gloss that follows the pointer. */
.fb-gc__sheen {
	position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; opacity: 0.55; mix-blend-mode: soft-light;
	background: linear-gradient(115deg, transparent 28%, rgba(242, 236, 226, 0.9) 46%, transparent 64%) no-repeat; background-size: 260% 100%; background-position: var(--sx, 120%) 0; transition: background-position 420ms var(--fb-ease);
}
@media (prefers-reduced-motion: reduce) { .fb-gc, .fb-gc__sheen { transition: none; } }

/* ---------- On the gift card's page: the card replaces the photograph and follows what is typed ---------- */
/* The block is printed in the summary and the script moves it into the gallery. Until then it stays out of sight, so the form does not
   jump and, without the script, the product photograph stays. */
.fb-gcp { display: none; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 16px; margin: 0 0 20px; }
.fb-gcp__note { position: relative; max-width: 440px; padding: 10px 16px 12px; border-radius: 3px; background: var(--nysno); box-shadow: 0 10px 22px -12px rgba(23, 25, 28, 0.5), 0 0 0 1px rgba(23, 25, 28, 0.06); transform: rotate(1.4deg); }
.fb-gcp__note[hidden] { display: none; }
.fb-gcp__tag { display: block; margin-bottom: 2px; color: var(--skifer); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.fb-gcp__note p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: 0; font-size: 1.05rem; font-style: italic; line-height: 1.35; overflow-wrap: anywhere; }
.fb-gcp__cap { margin: 0; color: var(--skifer); font-size: 0.88rem; text-align: center; }
@media (max-width: 560px) { .fb-gcp { gap: 12px; } .fb-gcp__note p { -webkit-line-clamp: 2; } } /* the panel is a square: on a phone the card and a two-line greeting fit inside it */
.fb-gcp-js .woocommerce-product-gallery, .woocommerce-product-gallery.fb-gcp-on { display: grid; place-items: center; aspect-ratio: 1; padding: clamp(20px, 5vw, 40px) clamp(18px, 4.4vw, 30px); border-radius: 18px; background: var(--rimfrost); }
.fb-gcp-js .woocommerce-product-gallery > :not(.fb-gcp), .woocommerce-product-gallery.fb-gcp-on > :not(.fb-gcp) { display: none !important; }
.fb-gcp-on .fb-gcp { display: grid; width: 100%; margin: 0; }
@keyframes fb-gcp-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.fb-gcp-on .fb-gcp { animation: fb-gcp-in 420ms var(--fb-ease) both; }
@media (prefers-reduced-motion: reduce) { .fb-gcp-on .fb-gcp { animation: none; } }
.fb-gcp-on .fb-gc { transform: perspective(900px) rotateX(var(--rx, 3deg)) rotateY(var(--ry, -6deg)) rotate(-2.5deg); }
.fb-gcp-on .fb-gcp__cap { display: none; }
.fb-giftcard__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fb-giftcard__wallet { margin: 14px 0 0; color: var(--skifer); font-size: 0.95rem; }
/* WooCommerce's script fills in the price of the chosen amount a moment after the page loads, and the row slides open. Its room is kept from the
   first paint (46.7px on a phone, 71.2px beside the photograph, as measured), so the form does not jump. */
.fb-gcp-js .single_variation_wrap > .woocommerce-variation { display: block !important; min-height: 71.2px; }
@media (max-width: 999px) { .fb-gcp-js .single_variation_wrap > .woocommerce-variation { min-height: 46.7px; } }

/* ---------- Thank-you page ---------- */
.fb-gcs { margin: 0 0 32px; padding: clamp(18px, 3vw, 32px); border-radius: 14px; background: var(--rimfrost); }
.fb-gcs h2 { margin: 0 0 8px; font-size: clamp(1.7rem, 3.2vw, 2.4rem); line-height: 1.08; letter-spacing: -0.02em; }
.fb-gcs__lead { margin: 0 0 20px; color: var(--skifer); max-width: 46rem; }
.fb-gcs__one { display: grid; gap: 14px; margin: 0 0 22px; }
.fb-gcs__one .fb-gc { max-width: 480px; }
.fb-gcs__acts { display: flex; flex-wrap: wrap; gap: 10px; }
.fb-gcs__msg, .fb-gcs__mail { margin: 0; color: var(--skifer); }
@media (min-width: 900px) { .fb-gcs__one { grid-template-columns: minmax(0, 480px) minmax(0, 1fr); align-items: center; gap: 28px; } .fb-gcs__one .fb-gcs__acts, .fb-gcs__one p { grid-column: 2; } .fb-gcs__one .fb-gc { grid-row: 1 / span 4; } }


/* ---------- The receiver's page: look a card up, and the envelope that opens ---------- */
.fb-gcw { max-width: 760px; margin: 0 auto; padding: clamp(8px, 2vw, 20px) 0 56px; }
.fb-gcw__form label { display: block; margin-bottom: 6px; font-weight: 700; }
.fb-gcw__row { display: flex; flex-wrap: wrap; gap: 10px; }
.fb-gcw__row input { flex: 1 1 240px; min-width: 0; font-size: 1.1rem; letter-spacing: 0.06em; text-transform: uppercase; }
.fb-gcw__out { margin: 14px 0 8px; min-height: 0; }
.fb-gcw__note { margin: 14px 0 0; text-align: center; color: var(--skifer); }
.fb-gcw__msg { margin: 6px 0 0; text-align: center; font-size: 1.15rem; font-style: italic; }
.fb-gcw__err { margin: 6px 0 0; padding: 12px 16px; border-radius: var(--fb-r); background: var(--nysno); color: var(--error); box-shadow: inset 0 0 0 1px var(--error); font-weight: 700; }
.fb-gcw__use { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--rimfrost); }
.fb-gcw__use h2 { margin: 0 0 8px; font-size: 1.3rem; }
.fb-gcw__use ol { margin: 0 0 18px; padding-left: 1.2em; }
.fb-gcw__use li { margin: 4px 0; }

/* The envelope. Without the script the card simply lies there; with it, the flap opens, the card rises out of the pocket
   and the envelope slips away (about two seconds, once). The box keeps the same size before and after, so nothing moves. */
.fb-gcenv { position: relative; width: 100%; max-width: 520px; margin: 0 auto; }
.fb-gcenv .fb-gc { margin: 0 auto; }
.fb-gcenv__flap, .fb-gcenv__front { display: none; }
.fb-gcp-js .fb-gcenv { display: grid; place-items: center; aspect-ratio: 1.34; }
.fb-gcp-js .fb-gcenv .fb-gc { width: 92%; max-width: none; margin: 0; }
.fb-gcp-js .fb-gcenv:not(.is-done) .fb-gc { z-index: 2; transform: translateY(13%) scale(0.94); opacity: 0; transition: transform 760ms var(--fb-ease) 260ms, opacity 240ms ease 260ms; }
.fb-gcp-js .fb-gcenv.is-open:not(.is-done) .fb-gc { transform: none; opacity: 1; }
.fb-gcp-js .fb-gcenv:not(.is-done) .fb-gcenv__front, .fb-gcp-js .fb-gcenv:not(.is-done) .fb-gcenv__flap { display: block; position: absolute; left: 0; right: 0; transition: transform 520ms var(--fb-ease), opacity 420ms ease 1.2s; }
.fb-gcp-js .fb-gcenv:not(.is-done) .fb-gcenv__front { bottom: 0; height: 58%; z-index: 3; border-radius: 6px 6px 14px 14px; background: var(--rimfrost); clip-path: polygon(0 18%, 50% 62%, 100% 18%, 100% 100%, 0 100%); filter: drop-shadow(0 -2px 3px rgba(23, 25, 28, 0.18)); }
.fb-gcp-js .fb-gcenv:not(.is-done) .fb-gcenv__flap { top: 0; height: 52%; z-index: 4; background: var(--isfoss); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 0; border-radius: 10px 10px 0 0; }
.fb-gcp-js .fb-gcenv:not(.is-done)::before { content: ''; position: absolute; inset: 0; z-index: 0; border-radius: 12px; background: var(--isfoss); box-shadow: 0 18px 30px -16px rgba(23, 25, 28, 0.45); transition: opacity 420ms ease 1.2s; }
.fb-gcp-js .fb-gcenv.is-open .fb-gcenv__flap { transform: rotateX(180deg); z-index: 1; opacity: 0; transition: transform 520ms var(--fb-ease), opacity 120ms ease 0.46s; }
.fb-gcp-js .fb-gcenv.is-open .fb-gcenv__front, .fb-gcp-js .fb-gcenv.is-open::before { opacity: 0; }
.fb-gcp-js .fb-gcenv.is-open .fb-gcenv__front { transform: translateY(14%); }
.fb-gcp-js .fb-gcenv ~ .fb-gcw__note { margin-top: -12px; }
@media (prefers-reduced-motion: reduce) { .fb-gcp-js .fb-gcenv:not(.is-done) .fb-gc, .fb-gcp-js .fb-gcenv:not(.is-done) .fb-gcenv__front, .fb-gcp-js .fb-gcenv:not(.is-done) .fb-gcenv__flap { transition: none; } }

/* ---------- On paper ---------- */
@media print {
	body * { visibility: hidden; }
	.fb-gcs, .fb-gcs *, .fb-gcw__out, .fb-gcw__out * { visibility: visible; }
	.fb-gcs, .fb-gcw__out { position: absolute; left: 0; top: 0; width: 100%; background: none; padding: 0; }
	.fb-gcs__acts, .fb-gcs__mail, .fb-gcenv__flap, .fb-gcenv__front { display: none !important; }
	.fb-gc { box-shadow: none; transform: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; border: 1px solid var(--skifer); }
	.fb-gc__sheen { display: none; }
}
