/* Copied unchanged from the prototype for the site's Cards section. Loaded only
   inside the standalone card frame (/cards/frame/...), shown in an <iframe>,
   so none of these rules can reach the rest of the site. */
/* A Little Christmas Note — three-tier vintage postcard.
   Tier 1 printed heading · Tier 2 layered scene · Tier 3 scalloped note card. */

:root {
  --ink: #4a2b1e;
  --red: #b5442e;
  --green: #3d5142;
  --sage: #6d7d58;
  --cream: #f6e7c6;
  --paper: #f8edd6;
  --warm: #eee0c6;
  --gold: #d9a441;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: #f3e5c9; background: var(--green);
  background-image:
    radial-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,.06) 1px, transparent 1px);
  background-size: 7px 7px, 11px 11px;
  font: 15px/1.55 Inter, Arial, sans-serif;
}
.masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 18px clamp(18px, 4vw, 52px) 4px; }
.masthead a { font: 600 30px/1 "Cormorant Garamond", Georgia, serif; text-decoration: none; color: #f6e7c6; }
.masthead i { color: #e8a07f; font-style: italic; }
.masthead span { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; opacity: .65; }
main {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr);
  gap: clamp(18px, 3vw, 38px); align-items: start;
  max-width: 1120px; margin: 0 auto; padding: 14px clamp(14px, 3vw, 36px) 48px;
}

/* ---------- the card shell ---------- */
.poster {
  position: relative; width: 100%; max-width: 620px; margin: 0 auto;
  aspect-ratio: 620 / 900; container-type: inline-size; background: var(--cream);
  border: .7cqw solid var(--ink); border-radius: 1cqw;
  box-shadow: 0 2.4cqw 5cqw rgba(18, 28, 20, .38), 0 .3cqw 0 rgba(255,255,255,.16) inset;
  transition: opacity .65s ease;
}
.frame {
  position: absolute; inset: 1.5cqw; border: .42cqw solid var(--ink);
  background: repeating-linear-gradient(90deg,
      var(--cream) 0 2.4cqw, var(--red) 2.4cqw 3.6cqw,
      var(--cream) 3.6cqw 6cqw, var(--green) 6cqw 7.2cqw);
}
.paper {
  position: absolute; inset: 1.35cqw; container-type: inline-size; overflow: hidden;
  background-color: var(--warm);
  background-image:
    linear-gradient(rgba(255,250,236,.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,250,236,.45) 1px, transparent 1px);
  background-size: 7.4cqw 7.4cqw;
  border: .35cqw solid rgba(74,43,30,.45);
}
.grain {
  position: absolute; inset: 0; z-index: 30; pointer-events: none; opacity: .2; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='150' height='150' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ---------- tier 1: heading ---------- */
.card-brand {
  position: absolute; z-index: 5; left: 4cqw; top: 1.5cqw;
  font: 600 2.6cqw/1 "Cormorant Garamond", Georgia, serif; color: var(--ink);
}
.card-brand i { color: var(--red); font-style: italic; }
.card-issue {
  position: absolute; z-index: 5; right: 4cqw; top: 2.1cqw;
  font: 600 1.25cqw/1 Inter, Arial, sans-serif; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink); opacity: .72;
}
.light-string { position: absolute; z-index: 2; left: 2cqw; top: 4cqw; width: 96cqw; height: 8cqw; }
.light-string .wire { stroke: rgba(74,43,30,.85); }
.bulb { transform-box: fill-box; transform-origin: center; }
.kicker {
  position: absolute; z-index: 5; left: 0; right: 0; top: 13.4cqw;
  display: flex; align-items: center; justify-content: center; gap: 2cqw;
  font: 600 1.75cqw/1 Inter, Arial, sans-serif; letter-spacing: .2em;
  text-transform: uppercase; color: var(--red);
}
.kicker::before, .kicker::after {
  content: ''; width: 9cqw; border-top: .18cqw solid var(--red); opacity: .55;
}
.title {
  position: absolute; z-index: 5; left: 0; right: 0; top: 17cqw; margin: 0;
  text-align: center; color: var(--ink); --base-rot: -1.2deg;
  transform: rotate(var(--base-rot)); text-shadow: .18cqw .18cqw 0 rgba(255,250,236,.7);
}
.title strong {
  display: block; white-space: nowrap;
  font: 400 9.4cqw/1.05 "DM Serif Display", Georgia, serif; letter-spacing: -.04em;
}
.title .tagline {
  display: block; margin-top: 1cqw; padding: 0 12cqw; white-space: pre-line;
  font: italic 600 2.85cqw/1.32 "Cormorant Garamond", Georgia, serif;
}
.spark {
  position: absolute; z-index: 6; width: 2.1cqw; height: 2.1cqw; background: var(--gold);
  clip-path: polygon(50% 0, 59% 41%, 100% 50%, 59% 59%, 50% 100%, 41% 59%, 0 50%, 41% 41%);
}
.spark-1 { left: 10cqw;  top: 15.5cqw; }
.spark-2 { left: 89cqw;  top: 16.5cqw; width: 1.7cqw; height: 1.7cqw; }
.spark-3 { left: 9.5cqw; top: 38cqw;   width: 1.8cqw; height: 1.8cqw; }
.spark-4 { left: 89cqw;  top: 44cqw; }
.spark-5 { left: 39cqw;  top: 51cqw;   width: 1.6cqw; height: 1.6cqw; }
.spark-6 { left: 53cqw;  top: 51cqw;   width: 1.6cqw; height: 1.6cqw; }
.spark-7 { left: 11cqw;  top: 55cqw;   width: 1.7cqw; height: 1.7cqw; }
.spark-8 { left: 89cqw;  top: 78cqw;   width: 1.7cqw; height: 1.7cqw; }

/* ---------- tier 2: the layered scene ----------
   Back to front: ground → tree + wreath → gifts + stocking + holly → cat.
   Every sticker's foot lands on the same printed ground strip. */
.ground {
  position: absolute; z-index: 2; left: 5cqw; right: 5cqw; top: 94cqw; height: 6cqw;
  background-image: radial-gradient(rgba(181,68,46,.2) .32cqw, transparent .38cqw);
  background-size: 2.5cqw 2.5cqw; opacity: .85;
}
.deco { position: absolute; display: block; height: auto; user-select: none; -webkit-user-drag: none; }
.tree        { z-index: 3; --base-rot: -2deg;  left: 4cqw;  top: 45cqw; width: 34cqw; transform: rotate(var(--base-rot)); }
.wreath      { z-index: 3; --base-rot: 5deg;   left: 58cqw; top: 48cqw; width: 33cqw; transform: rotate(var(--base-rot)); }
.gift-box    { z-index: 5; --base-rot: -8deg;  left: 8cqw;  top: 75cqw; width: 20cqw; transform: rotate(var(--base-rot)); }
.cat-in-box  { z-index: 6; --base-rot: 6deg;   left: 26cqw; top: 76cqw; width: 15cqw; transform: rotate(var(--base-rot)); }
.holly-right { z-index: 5; --base-rot: -12deg; left: 79cqw; top: 86cqw; width: 13cqw; transform: rotate(var(--base-rot)); }
.stocking    { z-index: 6; --base-rot: 9deg;   left: 66cqw; top: 75cqw; width: 15cqw; transform: rotate(var(--base-rot)); }
.cat-sitting { z-index: 8; --base-rot: 0deg;   left: 35cqw; top: 57cqw; width: 30cqw; transform: rotate(var(--base-rot)); }

/* ---------- tier 3: the scalloped note card ---------- */
.note { position: absolute; z-index: 11; left: 14.5cqw; top: 102cqw; width: 71cqw; aspect-ratio: 400 / 240; }
.cloud-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; }
.cloud-outer { fill: var(--paper); stroke: var(--ink); stroke-width: 2.6; }
.cloud-inner { fill: none; stroke: var(--red); stroke-width: 1.7; stroke-dasharray: 6 5; opacity: .75; }
.bow {
  position: absolute; z-index: 4; left: 50%; top: -7.4cqw; width: 19cqw;
  transform: translateX(-50%) rotate(-2deg); overflow: visible;
  filter: drop-shadow(0 .35cqw .3cqw rgba(74,43,30,.2));
}
.berry { position: absolute; z-index: 2; top: 12.5cqw; width: 11cqw; opacity: .96; }
.berry-left  { left: -8cqw;  transform: rotate(-18deg); }
.berry-right { right: -8cqw; transform: rotate(18deg) scaleX(-1); }
.note-copy {
  position: absolute; z-index: 5; left: 16%; right: 16%; top: 25%; bottom: 12%;
  display: flex; flex-direction: column; justify-content: space-between;
  text-align: center; color: #5a3b2a;
}
.note-message {
  margin: 0; font: 500 3cqw/5.2cqw "Caveat", "Segoe Script", "Bradley Hand", cursive;
  white-space: pre-wrap; overflow-wrap: anywhere; text-align: center;
}
.note-from {
  margin: 0; font: italic 600 3.3cqw/1.2 "Cormorant Garamond", Georgia, serif;
  color: var(--red); text-align: center;
}

/* ---------- snow ---------- */
.snowfall, .intro-snow { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.snowfall { z-index: 20; }
.snowfall i, .intro-snow i {
  position: absolute; top: 0; left: var(--x); width: var(--size); height: var(--size); opacity: var(--o, .78);
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg stroke='%23fffaf0' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M12 2v20M2 12h20M4.9 4.9l14.2 14.2M19.1 4.9L4.9 19.1'/%3E%3Cpath d='M12 5.5L9.5 3M12 5.5L14.5 3M12 18.5L9.5 21M12 18.5L14.5 21M5.5 12L3 9.5M5.5 12L3 14.5M18.5 12L21 9.5M18.5 12L21 14.5'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- editor ---------- */
.editor {
  background: var(--cream); color: #4a2b1e; border: 1px solid #e0c9a8; border-radius: 16px;
  box-shadow: 0 10px 28px rgba(18,28,20,.3); padding: clamp(20px, 3vw, 32px);
}
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #a2563d; }
.editor h2 { margin: 6px 0 18px; font: 600 34px/1.1 "Cormorant Garamond", Georgia, serif; }
.editor label { display: block; margin: 15px 0 6px; font-size: 13px; font-weight: 600; }
.editor label small { font-weight: 400; opacity: .6; }
textarea, input {
  width: 100%; font: inherit; font-size: 14px; color: inherit;
  border: 1px solid #d9bd99; background: #fdf5e5; border-radius: 9px; padding: 10px 12px;
}
textarea { resize: vertical; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
button {
  font: 600 13px/1.2 Inter, Arial, sans-serif; min-height: 42px; padding: 8px 15px;
  border: 1px solid #8c3d28; border-radius: 24px;
  background: linear-gradient(#f8d7a4, #c2693b); color: #3b2116; cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
button:hover { filter: brightness(1.06); transform: translateY(-1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #356975; outline-offset: 2px; }
.hint { margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed #c9ab88; font-size: 12px; line-height: 1.7; opacity: .82; }
.actions #card-view { align-self: center; color: var(--ink); padding: 8px 10px; font-weight: 600; }

@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .poster, .editor { max-width: 560px; }
  .editor { width: 100%; margin: 0 auto; }
}

/* ---------- opening sequence ---------- */
.intro { display: none; position: fixed; inset: 0; z-index: 100; color: var(--cream); overflow: hidden; }
.intro-backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(246,231,198,.14) 0%, transparent 48%),
              radial-gradient(circle at 50% 45%, #4a6357 0%, #2b4237 62%, #17271f 100%);
}
.intro-backdrop::after {
  content: ''; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 10px 10px;
}
.intro-snow { z-index: 1; }
.intro-scene {
  position: absolute; z-index: 2; left: var(--scene-x, 50%); top: var(--scene-y, 50%);
  width: min(440px, 82vw); height: min(500px, 68vh); transform: translate(-50%, -58%);
}
.intro-env {
  position: absolute; z-index: 1; left: 50%; bottom: 4%; width: 82%; aspect-ratio: 320/300;
  transform: translateX(-50%); filter: drop-shadow(0 18px 24px rgba(0,0,0,.42));
}
.intro-env img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.intro-env-open { opacity: 0; }
.intro-sparkles { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.intro-sparkles i { position: absolute; width: 10px; height: 10px; opacity: 0; background: var(--gold); transform: rotate(45deg); }
.intro-sparkles i:nth-child(1) { left: 12%; top: 34%; }
.intro-sparkles i:nth-child(2) { left: 84%; top: 24%; width: 7px; height: 7px; }
.intro-sparkles i:nth-child(3) { left: 22%; top: 18%; width: 6px; height: 6px; }
.intro-sparkles i:nth-child(4) { left: 90%; top: 58%; width: 8px; height: 8px; }
.intro-caption {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 7%; margin: 0; text-align: center;
  font: italic 600 clamp(17px, 2.4vw, 24px)/1.3 "Cormorant Garamond", Georgia, serif; letter-spacing: .08em;
}
.intro-caption span { color: var(--gold); margin: 0 .4em; }
.intro-skip {
  position: absolute; z-index: 3; right: 24px; bottom: 22px; min-height: 36px; font-size: 12px;
  background: rgba(246,231,198,.1); border-color: rgba(246,231,198,.5); color: var(--cream);
}

html.intro-playing .intro { display: block; }
html.intro-playing .poster { opacity: 0; pointer-events: none; }
html.intro-playing .intro-env { animation: introEnvLand .85s cubic-bezier(.2,1.3,.4,1) both; }
.intro-env-closed, .intro-env-open { transition: opacity .2s ease; }
html.flap-open .intro-env-closed { opacity: 0; }
html.flap-open .intro-env-open { opacity: 1; }
html.flap-open .intro-sparkles i { animation: introSparkle 1.1s ease-out both; }
html.flap-open .intro-sparkles i:nth-child(2) { animation-delay: .18s; }
html.flap-open .intro-sparkles i:nth-child(3) { animation-delay: .36s; }
html.flap-open .intro-sparkles i:nth-child(4) { animation-delay: .54s; }
html.intro-playing .intro-caption { animation: introIn .8s ease .55s both; }
html.intro-playing .intro-skip { animation: introIn .8s ease 1s both; }
html.intro-playing .intro-snow i, .poster.live .snowfall i, .poster.run .snowfall i {
  animation: snowFall var(--dur) linear var(--delay) infinite;
}
html.intro-assembling .poster { opacity: 1; pointer-events: auto; }
html.intro-assembling .intro-backdrop,
html.intro-assembling .intro-snow { animation: introFadeOut .62s ease forwards; }
html.intro-assembling .intro-env { animation: introEnvVanish .55s cubic-bezier(.4,0,.7,.4) .18s forwards; }
html.intro-assembling .intro-sparkles,
html.intro-assembling .intro-caption,
html.intro-assembling .intro-skip { animation: introFadeOut .35s ease forwards; }
html.intro-assembling .intro { pointer-events: none; }
.poster.assembling .paper > *:not(.grain):not(.snowfall) { opacity: 0; }

@keyframes introEnvLand {
  0%   { opacity: 0; transform: translate(-50%, -70px) rotate(-12deg) scale(.82) }
  62%  { opacity: 1; transform: translate(-50%, 9px) rotate(3deg) scale(1.03) }
  82%  { transform: translate(-50%, -5px) rotate(-1.5deg) scale(.995) }
  100% { opacity: 1; transform: translate(-50%, 0) rotate(0) scale(1) }
}
@keyframes introSparkle {
  0% { opacity: 0; transform: rotate(45deg) scale(.3) }
  55% { opacity: .95; transform: rotate(135deg) scale(1.15) }
  100% { opacity: 0; transform: rotate(200deg) scale(.5) }
}
@keyframes introIn { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
@keyframes introFadeOut { to { opacity: 0 } }
@keyframes introEnvVanish { to { opacity: 0; transform: translateX(-50%) scale(.28) rotate(8deg) } }

/* ---------- ambient loops ---------- */
@keyframes snowFall {
  0%   { transform: translate3d(0, -12cqw, 0) rotate(0deg) }
  100% { transform: translate3d(var(--drift), 155cqw, 0) rotate(320deg) }
}
@keyframes bulbTwinkle { 0%,100% { opacity: .38; transform: scale(.82) } 50% { opacity: 1; transform: scale(1.18) } }
@keyframes treeSway { 0%,100% { transform: rotate(var(--base-rot)) } 50% { transform: rotate(calc(var(--base-rot) + 1.8deg)) } }
@keyframes wreathSway { 0%,100% { transform: rotate(var(--base-rot)) } 50% { transform: rotate(calc(var(--base-rot) - 2deg)) } }
@keyframes peek { 0%,100% { transform: rotate(var(--base-rot)) translateY(0) } 45% { transform: rotate(var(--base-rot)) translateY(-1.6cqw) } }
@keyframes catBob { 0%,100% { transform: rotate(var(--base-rot)) translateY(0) } 50% { transform: rotate(var(--base-rot)) translateY(-.7cqw) } }
@keyframes boxRock { 0%,100% { transform: rotate(var(--base-rot)) } 50% { transform: rotate(calc(var(--base-rot) + 2.4deg)) } }
@keyframes twinkle { 0%,100% { opacity: .55; transform: scale(.9) } 50% { opacity: 1; transform: scale(1.08) } }
@keyframes popIn { from { opacity: 0; transform: translateY(1.4cqw) scale(.9) rotate(var(--base-rot, 0deg)) } to { opacity: 1; transform: translateY(0) scale(1) rotate(var(--base-rot, 0deg)) } }
@keyframes inkIn { from { opacity: 0; transform: translateY(.7cqw) } to { opacity: 1; transform: translateY(0) } }
@keyframes noteIn { from { opacity: 0; transform: translateY(2cqw) scale(.94) } to { opacity: 1; transform: none } }

.poster.run .bulb, .poster.live .bulb { animation: bulbTwinkle 1.8s ease-in-out infinite; animation-delay: var(--blink, 0s); }
.poster.run .tree, .poster.live .tree { animation: treeSway 6.5s ease-in-out infinite; transform-origin: 50% 95%; }
.poster.run .wreath, .poster.live .wreath { animation: wreathSway 7s ease-in-out infinite; transform-origin: 50% 0; }
.poster.run .cat-in-box, .poster.live .cat-in-box { animation: peek 3.1s ease-in-out infinite; }
.poster.run .cat-sitting, .poster.live .cat-sitting { animation: catBob 3.4s ease-in-out infinite; }
.poster.run .gift-box, .poster.live .gift-box { animation: boxRock 4.6s ease-in-out infinite; transform-origin: 50% 90%; }
.poster.run .spark, .poster.live .spark { animation: twinkle 2.4s ease-in-out infinite; }
.poster.run .spark:nth-of-type(even), .poster.live .spark:nth-of-type(even) { animation-delay: 1.2s; }

.poster.run .card-brand { animation: popIn .7s ease .1s both; }
.poster.run .card-issue { animation: popIn .7s ease .2s both; }
.poster.run .kicker { animation: popIn .7s ease .3s both; }
.poster.run .title { animation: popIn .9s cubic-bezier(.2,1.35,.4,1) .45s both; }
.poster.run .note { animation: noteIn .9s cubic-bezier(.2,1.3,.4,1) .9s both; }
.poster.run .note-message { animation: inkIn .9s ease-out 1.2s both; }
.poster.run .note-from { animation: inkIn .9s ease-out 1.7s both; }

.poster.paused *, .poster.paused *::before, .poster.paused *::after,
html.intro-playing.poster-paused .intro-snow i { animation-play-state: paused !important; }
html.snow-off .snowfall { display: none; }

@media (prefers-reduced-motion: reduce) {
  .intro, .intro-snow { display: none !important; }
  .poster *, .poster *::before, .poster *::after { animation: none !important; }
  .poster .deco, .poster .title, .poster .note, .poster .note-message,
  .poster .note-from, .poster .card-brand, .poster .card-issue { opacity: 1 !important; }
}

.card-site-link { display: none; }
html.card-only :is(.masthead, .editor) { display: none; }
html.card-only main { display: block; max-width: none; padding: 12px 12px 0; }
html.card-only .poster { width: min(100%, 680px); max-width: none; }
html.card-only .card-site-link { display: block; text-align: center; padding: 10px 12px 16px; font-size: 12px; }
.card-site-link a { color: #f6e7c6; text-decoration: none; }
.card-site-link a + a { margin-inline-start: 16px; }
.card-site-link small { display: block; margin-top: 7px; }
