/* Cards, flip and voting — shared by participant and creator.
   The flip is a VIEW toggle, never the way to vote. While voting, every card stays on its
   front, because comparing your answers side by side IS the task of finding a date. */

.vote-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: var(--s4);
  margin-bottom: var(--s5);
}
.vote-header::before {
  content: '';
  display: block;
  height: 3px;
  background: var(--vg-red);
  margin: calc(var(--s4) * -1) calc(var(--s4) * -1) var(--s4);
}
.vote-header-inner {
  max-width: var(--page);
  margin: 0 auto;
  display: flex;
  gap: var(--s4);
  align-items: center;
}
.vote-header img { height: 44px; flex: none; }

/* The participant page has no tab bar and no footer nav — it is one page, one job. */
body.vote main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--s4) var(--s6);
  width: 100%;
}

.noscript-note { padding: var(--s4); }

.identity {
  background: var(--vg-red-soft);
  border-left: 3px solid var(--vg-red);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-sm);
  font-size: var(--t-sm);
  margin-bottom: var(--s5);
}

/* ---------------------------------------------------------------- card grid */

.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(258px, 100%), 1fr));
  gap: var(--s4);
}

.vcard { perspective: 1400px; }

/* The two faces are STACKED IN A GRID, not absolutely positioned.
   Absolute faces are frozen at the container's min-height: below 340px the answer buttons
   stack and overflow the card, and a back side with 20 names got squeezed into a 196px
   scroll box. In one grid cell each, the taller face now decides the card's height. */
.vcard-inner {
  position: relative;
  display: grid;
  transform-style: preserve-3d;
  transition: transform var(--slow);
  min-height: 196px;
}
.vcard.flipped .vcard-inner { transform: rotateY(180deg); }

.vcard-front, .vcard-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  grid-area: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--e1);
  padding: var(--s3) var(--s4) var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  transition: box-shadow var(--fast), border-color var(--fast);
}
.vcard-back { transform: rotateY(180deg); }
.vcard:hover .vcard-front, .vcard:hover .vcard-back { box-shadow: var(--e2); }

/* A 3D rotation is a real trigger for vestibular disorders. Same information, no spin. */
@media (prefers-reduced-motion: reduce) {
  .vcard-inner { transform: none !important; }
  .vcard-front, .vcard-back { transition: opacity .01ms; }
  .vcard.flipped .vcard-front { opacity: 0; pointer-events: none; }
  .vcard:not(.flipped) .vcard-back { opacity: 0; pointer-events: none; }
  .vcard-back { transform: none; }
}

.vcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); }
.vcard-date { font-weight: var(--fw-bold); font-size: 1rem; display: block; letter-spacing: -.01em; }
.vcard-time { color: var(--text-muted); font-size: var(--t-xs); }

/* The flip has its own small button. The card itself is NOT a button — a segmented control
   inside a button is invalid HTML and unusable with a screen reader. */
.flip-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  flex: none;
  cursor: pointer;
  font-size: var(--t-md);
  line-height: 1;
  transition: color var(--fast), border-color var(--fast), background var(--fast), transform var(--fast);
}
.flip-btn:hover {
  border-color: var(--n-400);
  color: var(--text);
  background: var(--n-50);
  transform: rotate(90deg);
}

/* ------------------------------------------------------- segmented control */

.seg {
  border: none;
  padding: 0;
  margin: auto 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s1);
}
.seg.two { grid-template-columns: 1fr 1fr; }

/* Below ~340px three labels do not fit at 44px height. Stack them rather than squeeze —
   "Wenn nötig" has to stay readable. */
@media (max-width: 380px) {
  .seg-opt span { font-size: var(--t-sm); }
}
@media (max-width: 340px) {
  .seg, .seg.two { grid-template-columns: 1fr; }
}

.seg legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

.seg-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  min-height: var(--tap);
  padding: var(--s1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  /* This is THE button of the whole app — the one click a participant opens it for. It had
     the third-smallest type in the stylesheet. With a volunteer fire brigade averaging 45+,
     that is the wrong place to save space. */
  font-size: var(--t-md);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  background: var(--surface);
  text-align: center;
  line-height: 1.2;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.seg-opt:hover span { border-color: var(--text-muted); background: var(--surface-2); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--vg-red); outline-offset: 2px; }

/* Never colour alone (WCAG 1.4.1) — each state also carries a glyph, so red/green colour
   blindness does not make the card unreadable. */
.seg-opt input:checked + span.yes { background: var(--yes); border-color: var(--yes); color: #fff; }
.seg-opt input:checked + span.maybe { background: var(--maybe); border-color: var(--maybe); color: #fff; }
.seg-opt input:checked + span.no { background: var(--no); border-color: var(--no); color: #fff; }
.seg-opt input:disabled + span { opacity: .45; cursor: not-allowed; }

/* --------------------------------------------------------------- back side */

.answer-line { font-size: var(--t-md); font-weight: var(--fw-bold); }
.answer-line .yes { color: var(--yes); }
.answer-line .maybe { color: var(--maybe); }
.answer-line .no { color: var(--no); }

.bars { display: flex; flex-direction: column; gap: var(--s1); margin-top: auto; }
.bar { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-xs); }
.bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}
.bar-track i { display: block; height: 100%; transition: width var(--slow); }
.bar-track i.yes { background: var(--yes); }
.bar-track i.maybe { background: var(--maybe); }
.bar-track i.no { background: var(--no); }

.who-line { font-size: var(--t-sm); margin-bottom: var(--s2); }
.who-line .yes { color: var(--yes); font-weight: var(--fw-bold); }
.who-line .maybe { color: var(--maybe); font-weight: var(--fw-bold); }
.who-line .no { color: var(--no); font-weight: var(--fw-bold); }

.best .vcard-front, .best.vcard-front, .best.vcard-back { border-color: var(--vg-red); }
.best-badge {
  background: var(--vg-red);
  color: #fff;
  font-size: var(--t-2xs);
  font-weight: var(--fw-bold);
  padding: 2px var(--s2);
  border-radius: 999px;
  letter-spacing: .02em;
  width: fit-content;
}

/* ------------------------------------------- option cards (draft, creator) */

/* A proposed date is a card too: the creator builds the very thing the participant will
   see, instead of filling a row of bare inputs and hoping. */
.ocard .vcard-inner { min-height: 208px; }
.ocard .vcard-front { cursor: default; }

.ocard-fields { display: grid; gap: 2px; margin-top: auto; }
.ocard-label { font-size: var(--t-2xs); font-weight: var(--fw-bold); color: var(--text-muted); margin: 0; }
.ocard input[type='datetime-local'],
.ocard input[type='date'] { min-height: 38px; font-size: var(--t-sm); padding: var(--s1) var(--s2); }

.ocard-new {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: var(--fw-bold);
  min-height: 208px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.ocard-new:hover { border-color: var(--n-400); color: var(--text); background: var(--n-50); }
.ocard-new .plus { font-size: 1.7rem; line-height: 1; }

/* ------------------------------------------------------------- sticky bar */

/* Sticky needs room to move INSIDE its parent. On the participant page the bar sits in
   <div id="bar">, which is exactly as tall as the bar itself — so it never stuck and slid
   off screen on long date lists. The sticky context has to be the container. */
body.vote #bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
}
body.vote #bar .votebar { position: static; }

.votebar {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: var(--s3) var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  margin-top: var(--s5);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -2px 12px rgba(16, 24, 40, .06);
  z-index: 10;
}
.votebar .spacer { flex: 1; }

@media (max-width: 560px) {
  .votebar { padding: var(--s2) var(--s3); gap: var(--s2); }
  .votebar .btn { flex: 1; }
}

/* The all-day switch sits between the header and the fields — changing it swaps which
   inputs exist, so it must be visible before you start typing, not after. */
.allday-toggle {
  margin: 0;
  font-size: var(--t-xs);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  padding: var(--s1) 0;
}
.allday-toggle input { width: 16px; height: 16px; margin-top: 2px; }
.ocard.is-allday .vcard-front { border-color: var(--border-strong); }


/* The invitation page is often the ONLY contact a volunteer has with this system. The crest
   gets a moment here — as a cropped detail at the edge, felt rather than read. */
.vote-header { position: relative; overflow: hidden; }
.vote-header::after {
  content: '';
  position: absolute;
  right: calc(var(--s6) * -1);
  top: 50%;
  translate: 0 -50%;
  width: 180px;
  height: 180px;
  background: url('/img/vg-logo.png') no-repeat center / contain;
  opacity: .05;
  pointer-events: none;
}
@media (max-width: 720px) { .vote-header::after { display: none; } }
