/* ==========================================================================
   Halacards SPA + receiver styles. Tokens come from ../style.css.
   ========================================================================== */

/* ---------- Card art (shared by tiles, preview, receiver) ---------- */
.hc-art {
  position: relative; isolation: isolate; overflow: hidden;
  aspect-ratio: 3 / 2; width: 100%;
  display: grid; place-items: center; padding: 1rem;
  border-radius: var(--hc-radius);
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
}
.hc-art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 18% 12%, rgba(255,255,255,.38), transparent 55%); }
.hc-art__motif { width: 46%; max-width: 150px; height: auto; aspect-ratio: 1; filter: drop-shadow(0 4px 14px rgba(0,0,0,.18)); }
.hc-art--msg .hc-art__motif { position: absolute; inset: 0; margin: auto; width: 72%; max-width: none; opacity: .16; filter: none; }
.hc-art__photo {
  position: absolute; top: .9rem; left: .9rem; width: 56px; height: 56px; object-fit: cover;
  border-radius: 50%; border: 3px solid rgba(255,255,255,.95); box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.hc-art__msg {
  position: relative; margin: 0; max-width: 88%; max-height: 4.9em; overflow-y: auto; text-align: center;
  font: 600 1.05rem/1.55 var(--hc-font-head); color: #fff;
  padding: .55rem .9rem; border-radius: 14px; background: rgba(26,26,46,.5);
  overflow-wrap: anywhere; scrollbar-width: thin;
}
.hc-art--msg .hc-art__msg { font-family: var(--hc-msg-font, var(--hc-font-head)); font-weight: var(--hc-msg-weight, 600); }
.hc-art__msg.is-empty { opacity: .8; font-style: italic; font-weight: 400; }
.hc-art__from {
  position: absolute; left: .75rem; bottom: .75rem; max-width: 62%;
  font: 600 .8rem/1.2 var(--hc-font-body); padding: .3rem .7rem; border-radius: 999px;
  background: rgba(26,26,46,.55); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hc-art--preview { min-height: 240px; border-radius: var(--hc-radius-lg); box-shadow: var(--hc-shadow-hover); }
.hc-art--full { aspect-ratio: auto; min-height: 380px; padding: 2rem 1.25rem 3.5rem; border-radius: var(--hc-radius-lg); box-shadow: var(--hc-shadow-hover); }
.hc-art--full .hc-art__msg { max-height: none; font-size: 1.3rem; max-width: 34rem; }
.hc-art--full .hc-art__from { left: 1rem; bottom: 1rem; font-size: .9rem; }
.hc-art--full .hc-art__photo { width: 84px; height: 84px; top: 1.1rem; left: 1.1rem; }

/* ---------- Gallery ---------- */
.hc-page-hero--sm { padding-block: clamp(2rem, 5vw, 3.5rem); }
.hc-page-hero--sm h1 { margin-bottom: .5rem; }
.hc-gallery-wrap { padding-bottom: clamp(3rem, 7vw, 5rem); }

.hc-filters {
  position: sticky; top: var(--hc-header-h); z-index: 50;
  background: color-mix(in srgb, var(--hc-bg) 94%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: .9rem 0 .6rem; margin-bottom: .5rem; border-bottom: 1px solid var(--hc-border);
}
.admin-bar .hc-filters { top: calc(var(--hc-header-h) + 32px); }
@media (max-width: 782px) { .admin-bar .hc-filters { top: calc(var(--hc-header-h) + 46px); } }
.hc-pills { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.hc-pills::-webkit-scrollbar { display: none; }
.hc-filter-pill {
  flex: none; min-height: 40px; padding: .45rem 1.1rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--hc-border); background: var(--hc-surface); color: var(--hc-ink);
  font: 500 var(--hc-small)/1.2 var(--hc-font-body); transition: all var(--hc-transition);
}
.hc-filter-pill:hover { border-color: var(--hc-gold); }
.hc-filter-pill[aria-pressed="true"] { background: var(--hc-gold); border-color: var(--hc-gold); color: #1A1A2E; font-weight: 600; }
.hc-filters__row--tools { display: flex; gap: .75rem; margin-top: .6rem; flex-wrap: wrap; }
.hc-field--inline { margin: 0; display: flex; align-items: center; gap: .5rem; }
.hc-field--inline label { white-space: nowrap; }
.hc-field--inline .hc-input { min-height: 42px; }
.hc-field--grow { flex: 1 1 220px; }
.hc-notice--soft { margin: .75rem 0 0; font-size: var(--hc-small); color: var(--hc-muted); padding: .6rem .9rem; }
.hc-results { font-size: var(--hc-small); color: var(--hc-muted); margin: 1rem 0 .75rem; }

.hc-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .hc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .hc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; } }
@media (max-width: 420px) { .hc-grid { gap: .75rem; } .hc-card__body { padding: .75rem !important; } }

.hc-card { background: var(--hc-surface); border: 1px solid var(--hc-border); border-radius: var(--hc-radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.hc-card__art { padding: .5rem .5rem 0; }
.hc-card__body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; align-items: flex-start; }
.hc-card__title { margin: 0; font-size: var(--hc-h3); line-height: 1.25; }
.hc-card__meta { margin: 0; font-size: var(--hc-small); color: var(--hc-muted); }
.hc-card__body .hc-btn { margin-top: auto; }
.hc-card__art .hc-art { border-radius: calc(var(--hc-radius-lg) - 6px); }

/* PRD 3.5 motion */
@media (prefers-reduced-motion: no-preference) {
  .hc-card { transition: transform var(--hc-transition), box-shadow var(--hc-transition); }
  .hc-card:not(.hc-card--skeleton):hover { transform: translateY(-4px); box-shadow: var(--hc-shadow-hover); }
}

/* Skeleton shimmer: CSS only */
.hc-skel { background: linear-gradient(100deg, var(--hc-border) 30%, color-mix(in srgb, var(--hc-border) 40%, var(--hc-surface)) 50%, var(--hc-border) 70%); background-size: 200% 100%; border-radius: 10px; }
.hc-skel--art { aspect-ratio: 3/2; margin: .5rem .5rem 0; border-radius: 18px; }
.hc-skel--line { height: 16px; width: 80%; }
.hc-skel--short { width: 45%; }
@media (prefers-reduced-motion: no-preference) { .hc-skel { animation: hc-shimmer 1.4s linear infinite; } }
@keyframes hc-shimmer { to { background-position: -200% 0; } }

.hc-empty { grid-column: 1 / -1; text-align: center; padding: 3.5rem 1rem; display: grid; gap: .5rem; justify-items: center; }
.hc-empty__title { font: 600 var(--hc-h3)/1.3 var(--hc-font-head); margin: 0; }

/* ---------- Builder ---------- */
.hc-builder { padding-bottom: clamp(3rem, 7vw, 5rem); }
.hc-builder__top { padding-top: 1.5rem; }
.hc-stepper { list-style: none; display: flex; gap: .5rem; margin: 0 0 1rem; padding: 0; flex-wrap: wrap; }
.hc-stepper__item { display: flex; align-items: center; gap: .5rem; font-size: var(--hc-small); font-weight: 500; color: var(--hc-muted); }
.hc-stepper__item:not(:last-child)::after { content: ""; width: 28px; height: 2px; background: var(--hc-border); margin-left: .25rem; }
.hc-stepper__n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--hc-border); font-weight: 600; }
.hc-stepper__item.is-current { color: var(--hc-ink); }
.hc-stepper__item.is-current .hc-stepper__n { background: var(--hc-gold); border-color: var(--hc-gold); color: #1A1A2E; }
.hc-stepper__item.is-done .hc-stepper__n { background: var(--hc-sage); border-color: var(--hc-sage); color: #fff; }
@media (max-width: 560px) { .hc-stepper__t { display: none; } .hc-stepper__item.is-current .hc-stepper__t { display: inline; } }

.hc-builder__head { margin: .5rem 0 1.5rem; }
.hc-builder__h { margin: .25rem 0 .5rem; outline: none; }
.hc-back { display: inline-flex; margin-bottom: .25rem; }
.hc-linkbtn { background: none; border: 0; padding: .25rem 0; cursor: pointer; font: inherit; font-weight: 600; color: var(--hc-ink); }

/* Step 2: preview left, form right on desktop; preview above on mobile (PRD 10.3) */
.hc-step2 { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .hc-step2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; } }
.hc-step2__preview { position: sticky; top: calc(var(--hc-header-h) + 12px); z-index: 5; }
.admin-bar .hc-step2__preview { top: calc(var(--hc-header-h) + 44px); }
@media (max-width: 899px) {
  .hc-step2__preview { background: var(--hc-bg); padding-bottom: .5rem; margin-inline: -1rem; padding-inline: 1rem; }
  .hc-step2__preview .hc-art--preview { min-height: 0; aspect-ratio: 3/2; }
  .hc-preview__note { display: none; }
}
.hc-preview__note { text-align: center; margin-top: .75rem; }
.hc-count { font-variant-numeric: tabular-nums; }
.hc-file { padding: .55rem; min-height: 0; }
.hc-photo-row { display: flex; align-items: center; gap: .75rem; margin-top: .4rem; }
.hc-photo-row[hidden] { display: none; }
.hc-photo-row img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--hc-border); }
.hc-form__error { padding: 1rem 1.1rem; border-radius: var(--hc-radius); border: 1.5px solid #C0392B; background: color-mix(in srgb, #C0392B 8%, var(--hc-surface)); margin-bottom: 1rem; display: grid; gap: .6rem; justify-items: start; }
.hc-form__error[hidden] { display: none; }
.hc-form__error p { margin: 0; }
.hc-form__actions { display: flex; }
.hc-btn--lg { min-height: 52px; padding: .85rem 2rem; font-size: 1.05rem; }
.hc-form__actions .hc-btn { width: 100%; }
@media (min-width: 900px) { .hc-form__actions .hc-btn { width: auto; min-width: 220px; } }
.hc-form__hint { margin-top: .6rem; }

/* Step 3 */
.hc-done { max-width: 640px; margin: 1rem auto 0; text-align: center; display: grid; gap: 1.25rem; justify-items: center; }
.hc-done .hc-builder__h { margin: 0; }
.hc-done .hc-lead { margin-inline: auto; margin-bottom: 0; }
.hc-done__card { width: min(100%, 460px); }
.hc-check { width: 84px; height: 84px; }
.hc-check__c { stroke: var(--hc-sage); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 0; }
.hc-check__p { stroke: var(--hc-sage); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .hc-check__c { animation: hc-draw-c .6s ease-out both; }
  .hc-check__p { animation: hc-draw-p .4s .5s ease-out both; }
}
@keyframes hc-draw-c { from { stroke-dashoffset: 151; } }
@keyframes hc-draw-p { from { stroke-dashoffset: 40; } }
.hc-linkbox { display: flex; gap: .5rem; width: 100%; }
.hc-linkbox .hc-input { flex: 1; min-width: 0; }
.hc-share { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }

/* ---------- Receiver page (/c/{code}/) ---------- */
.hc-rcv { min-height: 100vh; display: flex; flex-direction: column; background: var(--hc-hero-bg); background-color: var(--hc-bg); }
.hc-rcv__head { padding: 1.25rem; display: flex; justify-content: center; }
.hc-rcv__main { flex: 1; width: min(100% - 2rem, 560px); margin: 0 auto; padding: 1rem 0 3rem; text-align: center; display: grid; gap: 1.5rem; align-content: start; }
.hc-rcv h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0; }
.hc-rcv__stage { position: relative; }
.hc-rcv__card { animation: none; }
.hc-rcv__actions { display: grid; gap: .75rem; justify-items: center; }
.hc-rcv__row { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.hc-rcv__foot { padding: 1.5rem; text-align: center; font-size: var(--hc-small); color: var(--hc-muted); }
.hc-rcv__foot a { color: inherit; }

/* Envelope reveal: CSS keyframes, 1.2s, plays once (PRD 3.5 / 5.4) */
.hc-env { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .hc-env {
    display: block; position: absolute; left: 50%; top: 50%; z-index: 5; width: min(78%, 360px); aspect-ratio: 3 / 2;
    transform: translate(-50%, -50%); pointer-events: none; perspective: 900px;
    animation: hc-env-out 1.2s ease both;
  }
  .hc-env__body { position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(160deg, #f4e7c9, #e2cd96); box-shadow: 0 12px 30px rgba(26,26,46,.25); }
  .hc-env__body::before, .hc-env__body::after { content: ""; position: absolute; bottom: 0; width: 55%; height: 62%; background: #ead7a4; }
  .hc-env__body::before { left: 0; clip-path: polygon(0 0, 100% 100%, 0 100%); }
  .hc-env__body::after { right: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); background: #e6d19b; }
  .hc-env__flap { position: absolute; left: 0; right: 0; top: 0; height: 56%; background: #dcc589; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; animation: hc-flap .5s .1s ease-in-out both; backface-visibility: hidden; }
  .hc-env__seal { position: absolute; left: 50%; top: 52%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; background: var(--hc-gold); box-shadow: 0 2px 6px rgba(0,0,0,.3); animation: hc-seal .25s ease both; }
  .hc-rcv__card { animation: hc-card-in .75s .45s cubic-bezier(.2,.8,.2,1) both; }
}
@keyframes hc-flap { to { transform: rotateX(180deg); } }
@keyframes hc-seal { to { opacity: 0; transform: scale(.4); } }
@keyframes hc-card-in { from { opacity: 0; transform: translateY(60px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes hc-env-out { 0%, 55% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -38%) scale(.96); visibility: hidden; } }
@media (prefers-reduced-motion: no-preference) { .hc-rcv__rest { animation: hc-fade .5s .9s ease both; } }
@keyframes hc-fade { from { opacity: 0; } }

/* ---------- Cards with an Airtable preview image ---------- */
.hc-art--img { aspect-ratio: 4 / 5; }
.hc-art--img::before { display: none; }
.hc-art__bg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; }
.hc-art--img .hc-art__motif { display: none; }
.hc-art--img.hc-art--msg { align-items: end; padding-bottom: 3.6rem; }
.hc-art--img .hc-art__msg { background: rgba(26,26,46,.62); }
.hc-art--img.hc-art--preview { max-width: 380px; margin-inline: auto; }
.hc-art--img.hc-art--full { max-width: 440px; margin-inline: auto; min-height: 0; padding-bottom: 3.6rem; }

/* ---------- Share method picker, consent, honeypot ---------- */
.hc-methods { border: 0; margin: 0 0 1.1rem; padding: 0; min-width: 0; }
.hc-methods legend { font-weight: 600; padding: 0; margin-bottom: .5rem; }
.hc-methods__row { display: grid; gap: .6rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .hc-methods__row { grid-template-columns: 1fr; } }
.hc-method { position: relative; display: block; cursor: pointer; }
.hc-method input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hc-method__box { display: flex; flex-direction: column; gap: .2rem; height: 100%; padding: .8rem .9rem; border: 2px solid var(--hc-border, rgba(0,0,0,.15)); border-radius: var(--hc-radius); background: var(--hc-surface, transparent); font-size: .85rem; line-height: 1.35; color: var(--hc-muted); }
.hc-method__box strong { font-size: .98rem; color: var(--hc-ink); }
.hc-method__icon { width: 26px; height: 26px; color: var(--hc-gold); margin-bottom: .15rem; flex: none; }
.hc-method input:checked + .hc-method__box { border-color: var(--hc-gold); box-shadow: 0 0 0 3px rgba(201,168,76,.28); }
.hc-method input:focus-visible + .hc-method__box { outline: 3px solid var(--hc-gold); outline-offset: 2px; }
.hc-email-only { padding: 1rem 1rem .2rem; margin-bottom: 1rem; border-radius: var(--hc-radius); border: 1px dashed var(--hc-border, rgba(0,0,0,.2)); }
.hc-email-only[hidden] { display: none; }
.hc-when { margin-top: 1rem; }
.hc-when__set { border: 0; margin: 0; padding: 0; }
.hc-when__set legend { font-weight: 600; margin-bottom: .4rem; padding: 0; }
.hc-when__opts { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-bottom: .8rem; }
.hc-when__opt { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.hc-when__opt input { width: 1.1rem; height: 1.1rem; accent-color: var(--hc-gold); }
.hc-sched__row { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-end; margin-bottom: .4rem; }
.hc-sched__col { flex: 1 1 9rem; min-width: 0; }
.hc-sched__tz { flex: 1 1 100%; margin: 0; font-size: .85rem; line-height: 1.35; color: var(--hc-muted); }
.hc-sched__tz strong { color: var(--hc-ink); }
.hc-sched__sum { font-weight: 600; color: var(--hc-ink); min-height: 1.2em; }
.hc-check { display: flex; width: 100%; font-weight: 400; gap: .65rem; align-items: flex-start; font-size: .9rem; line-height: 1.45; cursor: pointer; }
.hc-check input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; flex: none; accent-color: var(--hc-gold); }
.hc-consent { margin-bottom: 1rem; }
.hc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.hc-check > span { flex: 1; min-width: 0; }

/* ---------- Font picker (step 2) ---------- */
.hc-fonts { border: 0; margin: 0 0 1.1rem; padding: 0; min-width: 0; }
.hc-fonts legend { font-weight: 600; padding: 0; margin-bottom: .5rem; }
.hc-fonts__row { display: grid; gap: .5rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .hc-fonts__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hc-fontopt { position: relative; display: block; cursor: pointer; }
.hc-fontopt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hc-fontopt__box { display: flex; flex-direction: column; gap: .1rem; height: 100%; padding: .55rem .7rem; border: 2px solid var(--hc-border, rgba(0,0,0,.15)); border-radius: var(--hc-radius); background: var(--hc-surface, transparent); line-height: 1.25; }
.hc-fontopt__sample { font-family: var(--hc-msg-font); font-weight: var(--hc-msg-weight); font-size: 1.25rem; color: var(--hc-ink); overflow-wrap: anywhere; }
.hc-fontopt__name { font-size: .75rem; color: var(--hc-muted); }
.hc-fontopt input:checked + .hc-fontopt__box { border-color: var(--hc-gold); box-shadow: 0 0 0 3px rgba(201,168,76,.28); }
.hc-fontopt input:focus-visible + .hc-fontopt__box { outline: 3px solid var(--hc-gold); outline-offset: 2px; }

/* Email recipients (up to 5, added one at a time) */
.hc-recip__row { display: flex; gap: .5rem; align-items: center; }
.hc-recip__row .hc-input { flex: 1 1 auto; min-width: 0; }
.hc-recips__add { margin-bottom: 1rem; }
.hc-recips__count { margin-bottom: 1rem; font-weight: 600; }

/* Receiver (prompt 12): no "From" pill any more, so the card needs less room at the bottom; long text always wraps inside the card. */
.hc-rcv .hc-art--full { padding-bottom: 2rem; max-width: 100%; }
.hc-rcv .hc-art__msg { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
