/* Overlap — minimalist, Apple-inspired styling.
   Palette: white surface, near-black text, single blue accent,
   plus semantic yes/maybe/no colors used only in the voting control. */

:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --border: #d2d2d7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #005ea6;
  --yes: #3d7a5a;
  --no: #b5493f;
  --maybe: #9c6a28;
  --danger: #ff3b30;
  --danger-hover: #e0332b;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 980px;
  --shadow-card: 0 2px 14px rgba(0, 0, 0, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.site-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

h1 {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.lede {
  color: var(--text-secondary);
  font-size: 19px;
  margin: 0 0 32px;
}
.muted { color: var(--text-secondary); }
.optional { color: var(--text-secondary); font-weight: 400; }
.hint { color: var(--text-secondary); font-size: 14px; margin-top: 8px; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

/* ---- Forms ---- */
form label {
  display: block;
  font-weight: 500;
  margin: 20px 0 6px;
  font-size: 15px;
}
form label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  font: inherit;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }

input:focus, textarea:focus, select:focus, button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

fieldset {
  border: none;
  padding: 0;
  margin: 20px 0 0;
}
legend {
  font-weight: 500;
  font-size: 15px;
  padding: 0;
  margin-bottom: 8px;
}

/* Segmented control — the recurring "Apple" affordance across the app */
.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.card .segmented { background: #fff; }
.segmented .seg {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.segmented .seg input { position: absolute; opacity: 0; pointer-events: none; }
/* Selected-state styling. Uses :has() where supported (instant, no JS
   required) and a JS-applied .active class as a fallback for older
   browsers -- see assets/app.js. Both target the same visual result. */
.segmented .seg.active,
.segmented .seg:has(input:checked) {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.card .segmented:not(.vote-segmented) .seg.active,
.card .segmented:not(.vote-segmented) .seg:has(input:checked) { background: var(--surface); }

.vote-segmented { width: 100%; justify-content: space-between; }
.vote-segmented .seg { flex: 1; justify-content: center; }
.vote-segmented .seg-yes.active,
.vote-segmented .seg-yes:has(input:checked) { background: var(--yes) !important; color: #fff; }
.vote-segmented .seg-maybe.active,
.vote-segmented .seg-maybe:has(input:checked) { background: var(--maybe) !important; color: #fff; }
.vote-segmented .seg-no.active,
.vote-segmented .seg-no:has(input:checked) { background: var(--no) !important; color: #fff; }

/* Option rows in create form */
.option-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.option-row input[type="date"] { flex: 1.2; }
.option-row .time-input { flex: 1; }
.remove-row {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}
.remove-row:hover { background: var(--border); color: var(--text); }

/* Honeypot — hidden from real users, present for bots */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Buttons ---- */
.btn-primary, .btn-secondary, .btn-danger {
  font: inherit;
  font-weight: 500;
  border-radius: var(--radius-pill);
  padding: 12px 24px;
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.card .btn-secondary { background: #fff; }
.btn-secondary:hover { background: #ebebed; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.actions { margin-top: 28px; }
.inline-form { display: inline-block; margin: 0 12px 12px 0; }

/* ---- Alerts ---- */
.alert {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 15px;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: #fff1f0; color: #a3221a; }
.alert-success { background: #eafaf0; color: #146c2e; }
.alert-info { background: #eef6ff; color: #0b4f8a; }

/* ---- Voting list ---- */
.vote-list { margin-top: 16px; }
.vote-option {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.vote-option:last-child { border-bottom: none; }
.vote-option-label {
  display: block;
  font-weight: 500;
  margin-bottom: 10px;
}

/* ---- Share link row ---- */
.share-row { display: flex; gap: 8px; }
.share-row input {
  flex: 1;
  font-size: 14px;
  background: #fff;
}

/* ---- Results grid ---- */
.results-scroll { overflow-x: auto; }
.results-grid {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.results-grid th, .results-grid td {
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.results-grid th.corner, .results-grid td.option-label {
  text-align: left;
  white-space: normal;
  min-width: 160px;
}
.results-grid thead th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
}
.results-grid td.tally-cell { font-weight: 600; }
.results-grid tr.best-row { background: #eef6ff; }
.best-pill {
  display: inline-block;
  margin-left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  vertical-align: middle;
}
.vote-cell.vote-yes { color: var(--yes); font-weight: 600; }
.vote-cell.vote-no { color: var(--no); }
.vote-cell.vote-maybe { color: var(--maybe); font-weight: 600; }

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 24px;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .container { padding: 32px 16px 72px; }
  h1 { font-size: 28px; }
  .card { padding: 20px; }
  .segmented .seg { padding: 8px 12px; font-size: 13px; }
}

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