/* Survey and thank-you pages (base_swipe.html, survey.html, thanks.html).
 * Full-screen cards on an animated gradient; swipe.js moves between them.
 * --c1..--c4, --glow and --shade come from the colour scheme (themes.py) and are set on <html>,
 * so the defaults below only apply if that's missing.
 *
 * Without JavaScript the <html> has no .js class and the cards are simply stacked.
 */
:root {
  --c1: #fd297b; --c2: #ff5864; --c3: #ff655b; --c4: #ff7854;
  --glow: 253, 41, 123; --shade: 120, 0, 40;
  --grad: linear-gradient(135deg, var(--c1), var(--c2) 55%, var(--c3));
  --ink: #21262e;
  --muted: #7c8591;
  --line: #e9ebef;
  --star-off: #e3e6ea;
  --card-radius: 28px;
  --ease-out: cubic-bezier(0.2, 0.9, 0.25, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.swipe {
  margin: 0;
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, var(--c1), var(--c2), var(--c3), var(--c4), var(--c1));
  background-size: 400% 400%;
  animation: bg-shift 14s ease infinite;
  -webkit-tap-highlight-color: transparent;
}
.js body.swipe { overflow: hidden; }

@keyframes bg-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Soft blobs drifting behind the cards */
.bg-blobs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bg-blobs span {
  position: absolute;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
  animation: drift 18s ease-in-out infinite;
}
.bg-blobs span:nth-child(1) { top: -25vmax; left: -20vmax; }
.bg-blobs span:nth-child(2) { bottom: -30vmax; right: -25vmax; animation-delay: -6s; }
.bg-blobs span:nth-child(3) { top: 30%; left: 40%; width: 35vmax; height: 35vmax; animation-delay: -12s; }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vmax, -4vmax) scale(1.15); }
}

/* Top bar: back button, progress segments, logo */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px 8px;
  height: calc(64px + env(safe-area-inset-top));
}
.back {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.back:active { transform: scale(0.9); }
.back svg { width: 22px; height: 22px; }
.back[hidden] { display: grid; visibility: hidden; }

.segments { flex: 1; display: flex; gap: 4px; }
.seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  overflow: hidden;
  position: relative;
}
.seg::after {
  content: "";
  position: absolute; inset: 0;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}
.seg.done::after { transform: scaleX(1); }
.seg.current::after { transform: scaleX(0.35); }

.logo-svg { display: block; }
.logo-top { width: 30px; height: 30px; flex: none; color: #fff; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15)); margin-left: auto; }

/* Deck of slides */
.deck { position: relative; z-index: 1; }
.js .deck {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 0; right: 0;
  bottom: 0;
}

.slide {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: 0 20px 50px rgba(var(--shade), 0.28);
  padding: 28px 22px 22px;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 16px auto;
}
.js .slide {
  position: absolute;
  top: 8px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px; right: 16px;
  margin: 0 auto;
  overflow-y: auto;
  transition: transform 0.55s var(--ease-out), opacity 0.4s ease;
  will-change: transform, opacity;
}
.js .slide.is-next { transform: translateX(115%) rotate(10deg); opacity: 0; }
.js .slide.is-prev { transform: translateX(-115%) rotate(-10deg); opacity: 0; }
.js .slide.is-active { transform: none; opacity: 1; }

.slide-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.slide-actions { margin-top: 20px; }

/* Content entering on the active card */
.js .slide.is-active .slide-body > * { animation: rise 0.6s var(--ease-out) both; }
.js .slide.is-active .slide-body > :nth-child(2) { animation-delay: 0.06s; }
.js .slide.is-active .slide-body > :nth-child(3) { animation-delay: 0.12s; }
.js .slide.is-active .slide-body > :nth-child(4) { animation-delay: 0.18s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.shake { animation: shake 0.45s; }
@keyframes shake {
  0%, 100% { translate: 0; }
  20%, 60% { translate: -10px; }
  40%, 80% { translate: 10px; }
}

/* Typography */
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 14px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 24px; font-weight: 800; letter-spacing: -0.01em; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow, .q-count {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.muted { color: var(--muted); font-size: 0.92rem; }
.required { color: var(--c2); }
.fine-print { font-size: 0.68rem; color: var(--muted); text-align: center; margin: 14px 0 0; }

/* Intro */
.intro .slide-body { text-align: center; align-items: center; }
.intro-badge {
  width: 96px; height: 96px;
  border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 20px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(var(--glow), 0.35);
  animation: pulse 2.2s ease-in-out infinite;
}
.logo-big { width: 58px; height: 58px; }
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(var(--glow), 0.35); }
  50% { transform: scale(1.07); box-shadow: 0 14px 40px rgba(var(--glow), 0.55); }
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.btn-primary {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 22px rgba(var(--glow), 0.38);
}
.btn:active { transform: scale(0.97); }
.btn.is-skip { background: #fff; color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); }
.btn:focus-visible, .back:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* Honeypot */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Shared hidden radio styling */
.stars input, .nps input, .choice input { position: absolute; opacity: 0; pointer-events: none; }

/* Stars: inputs are rendered 5..1 and reversed visually, so ~ selects "this and lower" */
.stars { display: flex; flex-direction: row-reverse; justify-content: center; gap: 4px; }
.stars label {
  font-size: 3.2rem;
  line-height: 1;
  color: var(--star-off);
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s, transform 0.15s;
}
.stars.small { justify-content: flex-end; gap: 0; }
.stars.small label { font-size: 1.7rem; }
.stars input:checked ~ label { color: var(--c2); }
.stars input:checked + label { animation: pop 0.45s var(--ease-out); }
.stars input:focus-visible + label { outline: 3px solid var(--c1); border-radius: 8px; }

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45) rotate(-8deg); }
  100% { transform: scale(1); }
}

/* NPS 0-10 */
.nps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.nps label {
  aspect-ratio: 1;
  display: grid; place-items: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--line);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, color 0.2s, box-shadow 0.2s;
}
.nps input:checked + label {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(var(--glow), 0.4);
  animation: pop 0.45s var(--ease-out);
}
.nps input:focus-visible + label { outline: 3px solid var(--c1); outline-offset: 2px; }
.nps-legend { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-top: 10px; }

/* Single choice: pill buttons */
.choices { display: grid; gap: 10px; }
.choice span {
  display: block;
  padding: 15px 20px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px var(--line);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, color 0.2s, box-shadow 0.2s;
}
.choice span:active { transform: scale(0.97); }
.choice input:checked + span {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 20px rgba(var(--glow), 0.38);
  animation: pop-soft 0.4s var(--ease-out);
}
.choice input:focus-visible + span { outline: 3px solid var(--c1); outline-offset: 2px; }
@keyframes pop-soft {
  0% { transform: scale(1); }
  45% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Rating grid */
.matrix-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.matrix-row:last-child { border-bottom: 0; }
.matrix-label { font-weight: 600; }

/* Contact details: method pills in two columns, then the username/number field */
.contact-methods { grid-template-columns: 1fr 1fr; }
.contact-methods .choice span { padding: 13px 10px; font-size: 0.95rem; }
.contact-methods .choice.wide { grid-column: 1 / -1; }
.contact-handle { margin-top: 14px; }
.js .contact-handle.is-hidden { display: none; }

/* Text */
textarea, input[type=text], input[type=tel] {
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px var(--line);
  font: inherit;
  font-size: 1.05rem;
  color: inherit;
  background: #fafbfc;
  resize: vertical;
  transition: box-shadow 0.2s;
}
textarea:focus, input[type=text]:focus, input[type=tel]:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--c2); background: #fff; }

.slide-error { color: var(--c1); font-weight: 700; margin: 14px 0 0; text-align: center; }

/* Without JavaScript: plain stacked cards, no step controls */
html:not(.js) .js-only { display: none; }
html:not(.js) .deck { padding: 80px 0 24px; }
html:not(.js) .slide { margin: 0 16px 16px; }
@media (min-width: 552px) { html:not(.js) .slide { margin: 0 auto 16px; } }

/* Thank-you page */
.match {
  position: relative;
  z-index: 1;
  min-height: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #fff;
}
.match-title {
  font-size: 3rem;
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 20px rgba(var(--shade), 0.3);
  animation: zoom-in 0.7s var(--ease-out) both 0.15s;
}
.match p { margin: 0 0 10px; animation: rise 0.6s var(--ease-out) both 0.4s; }
.ticket { font-size: 1.2rem; }
.muted-light { opacity: 0.8; font-size: 0.9rem; }
.intro-badge.pop { animation: zoom-in 0.6s var(--ease-out) both, pulse 2.2s ease-in-out 0.6s infinite; }
@keyframes zoom-in {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: scale(1); }
}

.hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.hearts span {
  position: absolute;
  bottom: -40px;
  left: calc(4% + var(--i) * 7%);
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--size);
  animation: float-up var(--dur) linear infinite;
  animation-delay: calc(var(--i) * -0.7s);
}
@keyframes float-up {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-110vh) rotate(40deg); opacity: 0; }
}

/* Settings preview marker */
.preview-ribbon {
  position: fixed;
  left: 50%;
  bottom: calc(4px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 5;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

@media (min-width: 600px) {
  h1 { font-size: 2.4rem; }
  h2 { font-size: 1.85rem; }
  .nps { grid-template-columns: repeat(11, 1fr); gap: 6px; }
}

/* Hover only where there is a real pointer; on phones it would stick after a tap */
@media (hover: hover) {
  .back:hover { background: rgba(255, 255, 255, 0.35); }
  .btn-primary:hover { filter: brightness(1.05); box-shadow: 0 10px 28px rgba(var(--glow), 0.5); }
  .stars label:hover,
  .stars label:hover ~ label { color: var(--c2); }
  .stars label:hover { transform: scale(1.15); }
  .nps label:hover { box-shadow: inset 0 0 0 2px var(--c2); }
  .choice span:hover { box-shadow: inset 0 0 0 2px var(--c2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
