@layer base, components, pages;

/* TR4 gift cards: the giver's form with a live card preview, the receipt with a
   printable card, and the recipient's page. Colours come from the storefront's
   tokens (Alpenglow on Contourkeep), so light and dark both work. */
@layer pages {
  .gift-choice { margin-top: var(--space-3); display: grid; gap: var(--space-2); }
  .gift-choice .hint { margin: 0; }

  /* Wider than the 44rem page column: the form and the card sit side by side. */
  .gift-wide { --gift-w: min(60rem, calc(100vw - 2 * var(--space-4))); width: var(--gift-w); margin-inline: calc((100% - var(--gift-w)) / 2); }
  .gift-wide .lede { max-width: 40rem; }
  .gift-layout { --gift-w: min(60rem, calc(100vw - 2 * var(--space-4))); width: var(--gift-w); margin-inline: calc((100% - var(--gift-w)) / 2);
                 display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); align-items: start; }
  @media (max-width: 52rem) { .gift-layout { grid-template-columns: minmax(0, 1fr); } .gift-preview { position: static; max-width: 22rem; } }
  .gift-what { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid color-mix(in srgb, var(--fg) 12%, transparent); }
  .gift-what p { margin: 0; }
  .gift-delivery .choice-label .hint { display: block; font-weight: 400; }
  .gift-layout:has(input[value="self"]:checked) .gift-email-fields { display: none; }
  .gift-preview { position: sticky; top: var(--space-4); }
  .gift-preview .eyebrow { margin-bottom: var(--space-2); }

  .gift-card { margin: 0; position: relative; overflow: hidden; aspect-ratio: 5 / 7; border-radius: var(--radius-lg);
               background: var(--surface, var(--bg)); color: var(--fg); border: 1px solid color-mix(in srgb, var(--fg) 14%, transparent);
               box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--fg) 45%, transparent); display: flex; flex-direction: column; justify-content: flex-end; }
  .gift-card-contours { position: absolute; inset: 0 0 auto 0; width: 100%; height: 48%; }
  .gift-card-contours path { fill: none; stroke: var(--contour, color-mix(in srgb, var(--fg) 30%, transparent)); stroke-width: 1; opacity: .7; }
  .gift-card-contours .gift-card-route { stroke: var(--route, var(--accent)); stroke-width: 3; stroke-linecap: round; opacity: 1; }
  .gift-card figcaption { position: relative; padding: var(--space-6); display: grid; gap: var(--space-2); }
  .gift-card p, .gift-card blockquote { margin: 0; }
  .gift-card-to { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
  .gift-card-what { color: var(--muted); font-size: var(--text-sm); }
  .gift-card-note { font-family: Georgia, "Iowan Old Style", serif; font-size: var(--text-base); line-height: 1.5; border-left: 3px solid var(--route, var(--accent)); padding-left: var(--space-3); overflow-wrap: anywhere; }
  .gift-card-note[hidden] { display: none; }
  .gift-card-from { font-weight: 600; }
  .gift-card-how { font-size: var(--text-xs); color: var(--muted); padding-top: var(--space-2); border-top: 1px dashed color-mix(in srgb, var(--fg) 20%, transparent); }
  .gift-card-how .mono { color: var(--fg); }

  .gift-print { display: grid; gap: var(--space-4); justify-items: center; }
  .gift-print .gift-card { width: min(100%, 24rem); }
  .gift-link { overflow-wrap: anywhere; margin: 0 0 var(--space-2); padding: var(--space-3); border-radius: var(--radius-md); background: color-mix(in srgb, var(--fg) 5%, var(--bg)); }
  .gift-ribbon { display: inline-block; margin: 0 0 var(--space-3); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill);
                 background: color-mix(in srgb, var(--accent) 14%, var(--bg)); color: var(--fg); font-weight: 600; font-size: var(--text-sm); }

  .gift-claim { max-width: 34rem; margin: 0 auto; display: grid; gap: var(--space-6); }
  .gift-claim .gift-card { aspect-ratio: auto; min-height: 22rem; }
  .gift-steps { margin: 0; padding-left: var(--space-6); display: grid; gap: var(--space-2); }

  @media print {
    .gift-layout { display: block; }
    .gift-card { width: 5in; height: 7in; margin: .75in auto 0; box-shadow: none; border: 1px solid #999; background: #fff; color: #111; }
    .gift-card-what, .gift-card-how { color: #444; }
  }
}
