/* ==========================================================================
   match.css — "Passen wir zusammen?" swipe quiz in the home Kontakt section
   A dating-app parody: profile header, a statement card that swipes off,
   round cross and check buttons. Builds on base.css + home.css. The green
   is local to this widget; the red is the site signal.
   ========================================================================== */

:root {
  --match-yes: #1a7f37;  /* 5.1:1 on --paper, 4.7:1 on --paper-2 */
}

[data-theme="dark"] {
  --match-yes: #3fb950;  /* 7.7:1 on --paper, 7.0:1 on --paper-2 */
}

/* --------------------------------------------------------------------------
   1. Frame — same 200px rail as .contact-content
   -------------------------------------------------------------------------- */

.match {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--s-7);
  align-items: start;
  margin-top: var(--s-9);
  padding-top: var(--s-7);
  border-top: 1px solid var(--line);
}

.match[hidden] { display: none; }

.match-body { max-width: 640px; }

.match-title {
  font-family: var(--font-sans);
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}

.match-lede {
  font-size: var(--t-md);
  line-height: 1.5;
  color: var(--ink-2);
  margin: var(--s-2) 0 var(--s-6);
  max-width: 52ch;
  text-wrap: pretty;
}

/* The phone: rounder than the rest of the site on purpose, it is a parody */
.match-app {
  position: relative;
  max-width: 400px;
  padding: var(--s-5);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.35);
  overflow: hidden;  /* a card that swipes off leaves through the frame, never widens the page */
}

.match-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   2. Profile header + progress
   -------------------------------------------------------------------------- */

.match-play[hidden] { display: none; }

.match-profile {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.match-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  border: 1px solid var(--line);
}

[data-theme="dark"] .match-avatar { filter: brightness(0.85); }

.match-who { display: flex; flex-direction: column; line-height: 1.25; }

.match-name {
  font-weight: 600;
  font-size: var(--t-base);
  color: var(--ink);
}

.match-meta {
  font-family: var(--font-mono);
  font-size: var(--t-xxs);
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.match-bar {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: var(--s-4) 0 0;
  padding: 0;
}

.match-bar li {
  flex: 1 1 0;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.2s ease;
}

.match-bar li.is-current { background: var(--ink-3); }
.match-bar li.is-same    { background: var(--match-yes); }
.match-bar li.is-differ  { background: var(--signal); }

.match-count {
  font-family: var(--font-mono);
  font-size: var(--t-xxs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: var(--s-2) 0 var(--s-3);
}

/* --------------------------------------------------------------------------
   3. Card stack
   -------------------------------------------------------------------------- */

/* All cards share one grid cell. min-height in rem, so the card grows with the
   reader's default font size; a statement that needs more room grows the cell. */
.match-stack {
  position: relative;
  display: grid;
  min-height: 14.75rem;  /* 236px at 16px */
}

/* The next card peeks out underneath */
.match-stack::before {
  content: "";
  position: absolute;
  inset: 10px 14px -8px;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.match-card {
  position: relative;  /* paints above the peeking ::before */
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-6) var(--s-5);
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  touch-action: pan-y;  /* vertical drags still scroll the page */
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.match-card.is-entering { transform: scale(0.96); opacity: 0; }
.match-card.is-dragging { transition: none; cursor: grabbing; }
.match-card.is-leaving  { z-index: 2; pointer-events: none; }

.match-card-label {
  font-family: var(--font-mono);
  font-size: var(--t-xxs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.match-statement {
  margin: 0;
  font-size: var(--t-lg);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

/* Stamps fade in with the drag: --drag runs from -1 (cross) to 1 (check) */
.match-stamp {
  position: absolute;
  top: var(--s-4);
  padding: 2px 10px;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 2px solid currentColor;
  border-radius: var(--r-2);
  pointer-events: none;
}

.match-stamp-yes {
  left: var(--s-4);
  color: var(--match-yes);
  transform: rotate(-12deg);
  opacity: clamp(0, calc(var(--drag, 0) * 2), 1);
}

.match-stamp-no {
  right: var(--s-4);
  color: var(--signal);
  transform: rotate(12deg);
  opacity: clamp(0, calc(var(--drag, 0) * -2), 1);
}

.match-feedback {
  min-height: 1.5em;  /* the line appears after the first answer without moving the buttons */
  margin: var(--s-4) 0 0;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  text-align: center;
  color: var(--ink-3);
}

.match-feedback.is-same   { color: var(--match-yes); }
.match-feedback.is-differ { color: var(--signal); }
.match-feedback.is-same::before   { content: "♥ "; }
.match-feedback.is-differ::before { content: "✗ "; }

/* --------------------------------------------------------------------------
   4. Answer buttons
   -------------------------------------------------------------------------- */

.match-actions {
  display: flex;
  justify-content: center;
  gap: var(--s-7);
  margin-top: var(--s-3);
}

.match-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1);
  background: none;
  border: 0;
  border-radius: var(--r-3);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--t-xxs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.match-btn svg {
  box-sizing: border-box;
  width: 64px;
  height: 64px;
  padding: 18px;
  border: 2px solid var(--match-btn);
  border-radius: 50%;
  background: var(--paper);
  fill: none;
  stroke: var(--match-btn);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: background 0.15s ease, stroke 0.15s ease, transform 0.12s ease;
}

.match-btn-yes { --match-btn: var(--match-yes); }
.match-btn-no  { --match-btn: var(--signal); }

/* Hover fill only where a pointer can hover: a tap leaves :hover stuck */
@media (hover: hover) {
  .match-btn:hover svg { background: var(--match-btn); stroke: var(--paper); }
}
.match-btn:active svg { transform: scale(0.92); }

.match-hint {
  margin: var(--s-4) 0 0;
  font-family: var(--font-mono);
  font-size: var(--t-xxs);
  text-align: center;
  color: var(--ink-3);
}

/* Touch-only devices get the swipe hint without the arrow keys */
@media (hover: none) and (pointer: coarse) {
  .match-hint-keys { display: none; }
}

.match-hint kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 0 4px;
  font-family: inherit;
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
}

/* --------------------------------------------------------------------------
   5. Result
   -------------------------------------------------------------------------- */

.match-result { text-align: center; padding: var(--s-3) 0 var(--s-2); }
.match-result[hidden] { display: none; }

.match-pair {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--s-4);
}

.match-pair-face {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line-strong);
  object-fit: cover;
  object-position: center 15%;
}

.match-pair-you {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-3);
  font-weight: 600;
  color: var(--ink-2);
}

.match-pair-icon {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  margin: 0 -12px;
  padding: 9px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.match-pair-icon svg { width: 100%; height: 100%; display: block; }
.is-match .match-pair-icon svg { fill: var(--match-yes); }
.is-talk  .match-pair-icon svg { fill: none; stroke: var(--signal); stroke-width: 2.2; stroke-linejoin: round; }

[data-theme="dark"] .match-pair-face:not(.match-pair-you) { filter: brightness(0.85); }

.match-verdict {
  font-size: var(--t-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
}

.is-match .match-verdict { color: var(--match-yes); }
.match-verdict:focus { outline: none; }  /* takes focus only so screen readers land on it */

.match-score {
  margin: var(--s-2) auto 0;
  max-width: 34ch;
  color: var(--ink-2);
  text-wrap: balance;
}

.match-diffs-title {
  margin: var(--s-5) 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-xxs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
}

.match-diffs {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  border-top: 1px solid var(--line);
}

.match-diffs li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
  line-height: 1.4;
  color: var(--ink);
}

.match-diff-meta {
  font-family: var(--font-mono);
  font-size: var(--t-xxs);
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.match-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

.match-book { display: flex; flex-direction: column; align-items: center; }
.match-book .booking-status { text-align: center; }

.match-again {
  margin-top: var(--s-4);
  padding: var(--s-1) var(--s-2);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--ink-3);
  border-radius: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  color: var(--ink);
}

.match-again:hover { color: var(--signal); border-color: var(--signal); }

/* --------------------------------------------------------------------------
   6. Responsive + motion
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .match { grid-template-columns: 1fr; gap: var(--s-3); margin-top: var(--s-8); }
}

@media (max-width: 480px) {
  .match-app { max-width: none; padding: var(--s-4); border-radius: 22px; }
  .match-stack { min-height: 15.75rem; }  /* 252px at 16px */
  .match-card { padding: var(--s-5) var(--s-4); }
  .match-statement { font-size: var(--t-md); -webkit-hyphens: auto; hyphens: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .match-card, .match-bar li, .match-btn svg { transition: none; }
}
