/* =========================================================
   Gift card with artwork (assets/js/gift-designs.js cardHTML).
   Postcard layout: the art whole at 16:9 on top, nothing over it, and a
   solid band in the design's colour below for the text. Everything is sized
   in container units, so the card looks the same at any width (builder
   preview, hero, home tiles, the gift link page, the ERP) and matches the
   PDF in server/erp/gift-pdf.js.
   ========================================================= */

.gift-art-card {
  --gac-band: #173a66;
  --gac-ink: #faf5e8;
  --gac-accent: #ffd166;
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid #14140f;
  background: var(--gac-band);
  color: var(--gac-ink);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  box-shadow: 0 14px 34px rgba(20, 20, 15, 0.18);
  isolation: isolate;
  text-align: left;
}
.gac-art { aspect-ratio: 16 / 9; overflow: hidden; background: color-mix(in srgb, var(--gac-band) 70%, #fff); flex: none; }
.gac-art img { display: block; width: 100%; height: 100%; object-fit: cover; }

.gac-band {
  height: 37cqw;
  padding: 3.4cqw 4.4cqw 3.6cqw;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 2px solid #14140f;
}
/* Only the note may shrink when space is short; the rest keeps its height */
.gac-band > * { flex-shrink: 0; }
.gac-band > .gac-note { flex-shrink: 1; min-height: 0; }
.gac-top { display: flex; justify-content: space-between; align-items: center; gap: 3cqw; }
.gac-logo { display: block; height: 7.4cqw; width: auto; margin: -1.2cqw 0 -1.2cqw -0.6cqw; }
.gac-chip {
  font-size: 2.5cqw;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  padding: 1.1cqw 2.1cqw;
  border-radius: 999px;
  background: var(--gac-accent);
  color: #14140f;
  white-space: nowrap;
}
.gac-greet {
  margin-top: 2.4cqw;
  font-size: 4.3cqw;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gac-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 3cqw; margin-top: 0.6cqw; }
.gac-amount { font-size: 9.6cqw; font-weight: 800; letter-spacing: -0.02em; line-height: 1; white-space: nowrap; }
.gac-trip {
  font-size: 5.4cqw;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-width: 0;
}
.gac-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.6cqw; font-size: 2.7cqw; font-weight: 700; line-height: 1.2; text-align: right; flex: none; max-width: 46%; padding-bottom: 0.6cqw; }
.gac-meta span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gac-from:empty, .gac-valid:empty { display: none; }
.gac-valid { opacity: 0.82; }
.gac-note {
  margin-top: auto;
  font-size: 3cqw;
  font-style: italic;
  line-height: 1.35;
  opacity: 0.92;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gift-art-card.is-trip .gac-note { -webkit-line-clamp: 1; }

/* Small tiles (home section): drop the note and the meta column */
.gift-art-card.is-mini .gac-band { height: 34cqw; }
.gift-art-card.is-mini .gac-note,
.gift-art-card.is-mini .gac-meta { display: none; }
.gift-art-card.is-mini .gac-greet { font-size: 5cqw; margin-top: 3cqw; }
.gift-art-card.is-mini .gac-amount { font-size: 11cqw; }
.gift-art-card.is-mini .gac-logo { height: 8.6cqw; }
.gift-art-card.is-mini .gac-chip { font-size: 3cqw; }

/* Used up / expired (the gift link page) */
.gift-art-card.is-over { filter: grayscale(0.85); }

/* ---------- Design picker tiles ---------- */
.gift-designs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.gift-design { position: relative; cursor: pointer; display: block; }
.gift-design input { position: absolute; opacity: 0; pointer-events: none; }
.gift-design img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #d9d9d0;
  background: #efeee6;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.gift-design:hover img { border-color: #8d8d84; }
.gift-design input:checked + img { border-color: #14140f; box-shadow: 0 0 0 3px #d6ff3f; transform: translateY(-2px); }
.gift-design input:focus-visible + img { outline: 2px solid #14140f; outline-offset: 3px; }
.gift-design-tick {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #d6ff3f;
  border: 2px solid #14140f;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #14140f;
  transform: translateY(-2px);
}
.gift-design input:checked ~ .gift-design-tick { display: inline-flex; }
@media (max-width: 560px) {
  .gift-designs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .gift-design img { border-radius: 8px; }
  .gift-design-tick { width: 18px; height: 18px; font-size: 10px; top: 4px; right: 4px; }
}
