/* Lior's Birthday chooser — RTL, mobile-first, self-contained. */

:root {
  --bg-1: #fff1ec;
  --bg-2: #ffe3ef;
  --bg-3: #f3e9ff;
  --card: #ffffff;
  --card-border: #f0d9e2;
  --ink: #2a2233;
  --ink-soft: #6c5f72;
  --ink-faint: #948a9c;
  --accent: #e0556f;
  --accent-ink: #ffffff;
  --accent-soft: #fde8ee;
  --accent-ring: rgba(224, 85, 111, 0.30);
  --shadow: 0 10px 30px rgba(120, 60, 90, 0.10);
  --shadow-sm: 0 3px 10px rgba(120, 60, 90, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
  --maxw: 520px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans Hebrew", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #221a25;
    --bg-2: #2a1d2b;
    --bg-3: #1f1b2e;
    --card: #2e2733;
    --card-border: #41384a;
    --ink: #f4eef7;
    --ink-soft: #c7bcd0;
    --ink-faint: #9a8fa6;
    --accent: #ff7d96;
    --accent-ink: #2a1018;
    --accent-soft: #3c2630;
    --accent-ring: rgba(255, 125, 150, 0.32);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.28);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 22px 18px 40px;
}

/* Isolate Latin/number tokens (times, ranges) so RTL bidi stays clean. */
.t {
  unicode-bidi: isolate;
  direction: ltr;
}

/* ---------- header ---------- */
.header { text-align: center; padding: 6px 0 8px; }

.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.hero-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.hero-cap {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  padding: 36px 16px 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0));
  text-align: center;
}
.hero-cap .cake { font-size: 40px; line-height: 1; display: block; }
.hero-cap h1 {
  margin: 2px 0 0;
  color: #fff;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.header .subtitle {
  margin: 0 auto;
  max-width: 440px;
  color: var(--ink-soft);
  font-size: 1rem;
}
.context {
  margin: 14px auto 0;
  max-width: 460px;
  background: var(--accent-soft);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

/* ---------- sections ---------- */
.slot {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  min-inline-size: 0; /* allow fieldset to shrink in flex/grid */
}
.slot > legend {
  font-size: 1.12rem;
  font-weight: 700;
  padding: 0;
  margin-bottom: 4px;
  color: var(--ink);
}
.slot .hint { color: var(--ink-faint); font-size: 0.82rem; margin: 0 0 10px; }

.cards { display: grid; gap: 10px; }

/* ---------- option card ---------- */
.card {
  position: relative;
  display: block;
  width: 100%;
  text-align: start;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0;
  overflow: hidden;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s,
    transform 0.06s;
}
.card:hover { border-color: var(--accent-ring); }
.card:active { transform: scale(0.992); }
.card:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 2px;
}

/* photo at the top of each card */
.card-media {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--accent-soft);
  overflow: hidden;
}
.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-body { display: block; padding: 12px 16px 14px; }

/* the "אחר" card has no photo — keep text clear of the corner check */
.card-other .card-body { padding-inline-end: 52px; }

.card .card-title { display: block; font-weight: 650; font-size: 1.02rem; }
.card .card-desc {
  display: block;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-top: 2px;
}
.card .card-meta {
  display: block;
  color: var(--ink-faint);
  font-size: 0.8rem;
  margin-top: 6px;
}

.card .card-check {
  position: absolute;
  inset-inline-end: 12px;
  inset-block-start: 12px;
  inline-size: 28px;
  block-size: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.30);
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 0.85rem;
  font-weight: 800;
  z-index: 2;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
/* on the photoless "אחר" card, center the check at the inline-end edge */
.card-other .card-check {
  inset-block-start: 50%;
  transform: translateY(-50%);
  inline-size: 24px;
  block-size: 24px;
  background: transparent;
  border-color: var(--card-border);
}

.card[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1.5px var(--accent) inset, var(--shadow-sm);
}
.card[aria-checked="true"] .card-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* "other" inline input revealed under a slot */
.other-wrap { margin-top: 10px; }
.other-wrap[hidden] { display: none; }

/* ---------- vibe segmented control ---------- */
.vibe { margin: 0 0 20px; padding: 0; border: 0; min-inline-size: 0; }
.vibe > legend { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; padding: 0; }
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.seg {
  font: inherit;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: 999px;
  padding: 11px 6px;
  min-height: 44px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.06s;
}
.seg:active { transform: scale(0.98); }
.seg:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.seg[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ---------- text fields ---------- */
label.field { display: block; margin: 0 0 18px; }
label.field .lbl { display: block; font-weight: 650; margin-bottom: 6px; }
input[type="text"], textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: start;
  direction: rtl;
  box-shadow: var(--shadow-sm);
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
::placeholder { color: var(--ink-faint); opacity: 1; }

/* ---------- submit ---------- */
.submit-wrap { margin-top: 8px; }
.btn-primary {
  width: 100%;
  font: inherit;
  font-weight: 750;
  font-size: 1.08rem;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  padding: 16px;
  min-height: 52px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: filter 0.15s, transform 0.06s;
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 3px; }
.btn-primary[disabled] { opacity: 0.65; cursor: default; }

.spinner {
  display: inline-block;
  inline-size: 1em;
  block-size: 1em;
  margin-inline-end: 8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -0.15em;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-msg {
  margin-top: 12px;
  text-align: center;
  font-size: 0.92rem;
  min-height: 1.2em;
}
.form-msg.error { color: var(--accent); font-weight: 600; }

/* ---------- confirmation ---------- */
.confirm {
  text-align: center;
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 22px;
}
.confirm .big { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.confirm h2 { margin: 0 0 6px; font-size: 1.3rem; }
.confirm p { color: var(--ink-soft); margin: 0 0 18px; }
.link-btn {
  font: inherit;
  font-weight: 650;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px;
  min-height: 44px;
}
.link-btn:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }

.footer {
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.78rem;
  margin-top: 26px;
}

/* ---------- admin ---------- */
.admin-head { text-align: center; margin-bottom: 18px; }
.admin-head h1 { font-size: 1.4rem; margin: 0 0 4px; }
.admin-head .count { color: var(--ink-soft); font-size: 0.9rem; }
.notice {
  text-align: center;
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px 18px;
  color: var(--ink-soft);
}
.notice.error { color: var(--accent); font-weight: 600; }
.sub {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.sub .when { color: var(--ink-faint); font-size: 0.8rem; margin-bottom: 8px; }
.sub .who { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.sub dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.sub dt { color: var(--ink-faint); font-size: 0.85rem; }
.sub dd { margin: 0; }
.sub .notes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
  white-space: pre-wrap;
  word-break: break-word;
}
.sub .notes .nlabel { color: var(--ink-faint); font-size: 0.82rem; display: block; margin-bottom: 2px; }

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