/* Startseite: Postkarten-Stapel, der wie Zauberkarten auffächert, und die Info-Karte */

/* ---------- Headline with hand-drawn underline ---------- */
.hero .hero-title { font-size: var(--step-4); max-width: none; text-shadow: none; }
.hero-sub { margin-top: 10px; font-size: var(--step-0); color: var(--ink-soft); max-width: 46ch; }
.scribble { position: relative; display: inline-block; white-space: nowrap; }
.scribble svg { position: absolute; left: 0; right: 0; bottom: -0.12em; width: 100%; height: 0.32em; overflow: visible; }
.scribble path { fill: none; stroke: var(--red); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 340; stroke-dashoffset: 340; animation: scribble 1.4s 0.5s var(--ease-out) forwards; }
@keyframes scribble { to { stroke-dashoffset: 0; } }

/* ---------- Layout ---------- */
.hero-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); align-items: start; margin-top: clamp(16px, 2vw, 28px); }
.hero-layout .deck-area { padding-top: clamp(0px, 2vw, 28px); }
.hero-note { --tilt: 1.2deg; }
.hero-note .message { padding: clamp(22px, 3vw, 40px); }
.hero-note .stamp { position: absolute; top: clamp(16px, 2vw, 26px); right: clamp(16px, 2vw, 26px); animation: bob 2.6s ease-in-out 1.2s 2; }
.hero-note .greeting { font-size: var(--step-0); color: var(--ink-soft); padding-right: 150px; min-height: 96px; }
.hero-note .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-note .quick-note { grid-column: 1 / -1; margin-top: 10px; font-size: 0.9rem; color: var(--ink-soft); }
.hero-note .quick-note a { display: inline-block; padding-block: 10px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.hero-note .hero-proof { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
@keyframes bob { 0%, 100% { transform: rotate(3deg) translateY(0); } 50% { transform: rotate(1deg) translateY(-5px); } }
@media (max-width: 1100px) {
  .hero-layout { grid-template-columns: minmax(0, 1fr); }
  .hero-note { max-width: 640px; width: 100%; justify-self: center; }
}
@media (max-width: 520px) {
  .hero-note .stamp { position: static; float: right; margin: -4px -4px 10px 14px; }
  .hero-note .greeting { padding-right: 0; min-height: 0; }
  .hero-note .address { clear: both; }
  .hero-note .stamp-inner { min-width: 100px; padding: 8px 10px; }
  .hero-note .stamp-inner strong { font-size: 1.55rem; }
}

/* ---------- Deck ---------- */
.deck-area { position: relative; }
.deck {
  --card-w: clamp(210px, 21vw, 300px);
  --card-h: calc(var(--card-w) * 1.33);
  position: relative; list-style: none; margin: 0; padding: 0;
  height: calc(var(--card-h) + 64px);
}
.deck-card {
  position: absolute; left: 50%; top: 18px; width: var(--card-w); height: var(--card-h);
  margin-left: calc(var(--card-w) / -2);
  --fan-scale: 0.86;
  transform-origin: 50% 160%;
  transform: translate(var(--sx, 0px), var(--sy, 0px)) rotate(var(--sr, 0deg));
  transition: transform 0.75s var(--ease-out), filter 0.4s, opacity 0.4s;
  transition-delay: var(--delay, 0ms);
  z-index: var(--z, 1);
}
.deck.is-fanned .deck-card { transform: translate(var(--fx, 0px), var(--fy, 0px)) rotate(var(--fr, 0deg)) scale(var(--fan-scale)); z-index: var(--fz, 1); }
.deck-card.is-leaving { transform: translate(-125%, -4%) rotate(-16deg) !important; transition-delay: 0ms; z-index: 30; }

.deck-btn {
  position: relative; display: flex; flex-direction: column; width: 100%; height: 100%;
  padding: 10px 10px 0; border: 0; border-radius: 6px; background: #fff; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}
.deck-photo { position: relative; flex: 1; overflow: hidden; border-radius: 3px; background: var(--green-wash); }
.deck-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease-out); }
.deck-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 6px 14px; }
.deck-cap strong { font-family: var(--font-display); font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.3rem); line-height: 1.1; }
.deck-cap small { font-size: 0.78rem; font-weight: 700; color: var(--ink-faint); white-space: nowrap; }
.deck-badge { position: absolute; top: 18px; left: 18px; font-size: 0.7rem; font-weight: 700; background: rgba(255, 255, 255, 0.9); padding: 3px 9px; border-radius: 999px; }

/* Magic light: a foil sheen that follows the pointer, plus sparkles */
.deck-btn::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background:
    radial-gradient(circle at var(--mx, 40%) var(--my, 15%), rgba(255, 236, 190, 0.55) 0, rgba(255, 222, 160, 0.18) 30%, transparent 60%);
  mix-blend-mode: soft-light;
  transition: opacity 0.35s;
}

/* Hover / focus after the fan has opened */
.deck.is-fanned .deck-card.is-hot { transform: translate(var(--fx, 0px), calc(var(--fy, 0px) - 34px)) rotate(var(--fr, 0deg)) scale(0.95); z-index: 40; transition-delay: 0ms; }
.deck.is-fanned .deck-card.is-hot .deck-btn {
  box-shadow:
    0 0 0 2px rgba(233, 185, 73, 0.55),
    0 -10px 36px -6px rgba(233, 185, 73, 0.38),
    0 34px 50px -18px rgba(38, 49, 61, 0.42);
}
.deck.is-fanned .deck-card.is-hot .deck-btn::after { opacity: 1; }
.deck.is-fanned .deck-card.is-hot .deck-photo img { transform: scale(1.06); }
.deck.is-fanned.has-hot .deck-card:not(.is-hot) { filter: saturate(0.7) brightness(0.97); }

.deck-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

.deck-foot { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.deck-pause { border: 0; background: none; font: 700 0.85rem var(--font-body); color: var(--ink-soft); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; min-height: 44px; padding: 0 4px; }
.deck-pause:hover { color: var(--red); }
.deck-hint { display: flex; justify-content: center; margin: 0; font-size: 0.88rem; font-weight: 700; color: var(--ink-faint); transition: opacity 0.4s; }
.deck-hint span { display: inline-flex; align-items: center; gap: 8px; }
.deck-hint span::before { content: ""; width: 26px; height: 2px; background: currentColor; border-radius: 2px; animation: hint 1.8s ease-in-out 3; }
.deck-hint .hint-touch { display: none; }
@media (hover: none) { .deck-hint .hint-mouse { display: none; } .deck-hint .hint-touch { display: inline-flex; } }
.deck.is-fanned + .deck-hint { opacity: 0; }
@keyframes hint { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
  .deck-card, .deck-btn, .deck-photo img { transition-duration: 0.01ms !important; }
  .scribble path { animation: none; stroke-dashoffset: 0; }
  .hero-note .stamp, .deck-hint span::before { animation: none; }
}

/* ---------- Card dialog: the back of the postcard ---------- */
.card-dialog { border: 0; padding: 0; background: transparent; max-width: min(920px, calc(100vw - 24px)); width: 100%; overflow: visible; }
.card-dialog::backdrop { background: rgba(38, 49, 61, 0.5); backdrop-filter: blur(3px); }
.card-dialog[open] .dialog-card { animation: flipIn 0.75s var(--ease-out) both; }
.card-dialog[open]::backdrop { animation: fadeIn 0.3s ease-out both; }
.dialog-card {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  background: #fff; border-radius: 8px; padding: 14px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.55);
  transform-origin: 50% 50%;
}
.dialog-photo { position: relative; min-height: 380px; border-radius: 4px; overflow: hidden; background: var(--green-wash); }
.dialog-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dialog-photo .wash-label { position: absolute; left: 14px; bottom: 14px; }
.dialog-message { position: relative; display: flex; flex-direction: column; gap: 18px; padding: clamp(22px, 3vw, 40px); margin-left: 18px; border-left: 1.5px dashed #c7cfd6; }
.dialog-body h2 { font-size: var(--step-2); padding-right: 48px; }
.dialog-body p { margin-top: 12px; color: var(--ink-soft); }
.dialog-body .link-arrow { margin-top: 16px; }
.card-facts { list-style: none; margin: 18px 0 0; padding: 0; }
.card-facts li { display: grid; grid-template-columns: 9.5em 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.card-facts strong { font-weight: 700; }
.card-facts span { color: var(--ink-soft); }
.dialog-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: auto; }
.dialog-stamp { flex: none; }
.dialog-stamp .stamp-inner { min-width: 104px; padding: 8px 10px; }
.dialog-stamp .stamp-inner strong { font-size: 1.25rem; }
.dialog-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.dialog-step { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; border: 0; background: none; font: 700 0.92rem var(--font-body); color: var(--ink); cursor: pointer; }
.dialog-step:hover { color: var(--red); }
.dialog-step .icon { width: 18px; height: 18px; }
.dialog-step .icon--back { transform: scaleX(-1); }
.dialog-count { font-size: 0.85rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dialog-step { white-space: nowrap; }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--paper-soft); color: var(--ink); cursor: pointer; display: grid; place-items: center; transition: background-color 0.2s, transform 0.3s var(--ease-out); }
.dialog-close:hover { background: var(--red-wash); transform: rotate(90deg); }
.dialog-close .icon { width: 22px; height: 22px; }
@keyframes flipIn { from { transform: perspective(1400px) rotateY(-80deg) scale(0.9); opacity: 0; } to { transform: perspective(1400px) rotateY(0) scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } }
@media (max-width: 720px) {
  .dialog-card { grid-template-columns: 1fr; max-height: calc(100dvh - 24px); overflow-y: auto; }
  .dialog-photo { min-height: 200px; }
  .dialog-message { margin: 14px 0 0; border-left: 0; border-top: 1.5px dashed #c7cfd6; padding: 20px 6px 8px; }
  .card-facts li { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .card-dialog[open] .dialog-card, .card-dialog[open]::backdrop { animation: none; } }

/* ---------- Touch and narrow screens: swipe through the postcards ---------- */
@media (hover: none), (max-width: 700px) {
  .deck {
    display: flex; gap: 16px; height: auto; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scrollbar-width: none;
    padding: 18px calc(50% - var(--card-w) / 2) 30px; margin-inline: calc(var(--gutter) * -1);
    --card-w: min(68vw, 280px);
  }
  .deck::-webkit-scrollbar { display: none; }
  .deck-card, .deck.is-fanned .deck-card {
    position: relative; left: auto; top: auto; margin: 0; flex: 0 0 var(--card-w);
    transform: rotate(var(--strip-tilt, -1deg)) !important; scroll-snap-align: center;
    transition: transform 0.4s var(--ease-out);
  }
  .deck-card:nth-child(even) { --strip-tilt: 1.2deg; }
  .deck-card.is-current { --strip-tilt: 0deg; }
  .deck-card.is-current .deck-btn {
    box-shadow: 0 0 0 2px rgba(233, 185, 73, 0.55), 0 -10px 36px -6px rgba(233, 185, 73, 0.38), 0 26px 40px -18px rgba(38, 49, 61, 0.42);
  }
  .deck-card.is-current .deck-btn::after { opacity: 1; }
  .deck-pause { display: none; }
}
