/* ippoll - styles */

:root {
  --ink: #16222c;
  --muted: #55646f;
  --paper: #f1f5f7;
  --card: #ffffff;
  --line: #d3dde3;
  --accent: #0b6e75;
  --accent-soft: #e3f1f2;
  --yes: #176e43;
  --yes-bg: #d9f1e3;
  --maybe: #7a5200;
  --maybe-bg: #fbebc4;
  --no: #55646f;
  --no-bg: #e9eef1;
  --danger: #a3372d;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Bricolage Grotesque", "Public Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font-body);
}

h1, h2 {
  font-family: var(--font-head);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: 1.35rem; letter-spacing: -0.01em; }

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

:focus-visible {
  outline: 3px solid #1b8fa0;
  outline-offset: 2px;
}

.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.narrow { width: min(640px, 100% - 2rem); margin-top: 2.5rem; }

.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------------------------------------- header */
.site-header { border-bottom: 1px solid var(--line); background: var(--card); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; }

.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font: 800 1.45rem/1 var(--font-head);
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}
.mark { display: inline-flex; gap: 3px; }
.mark i { display: block; width: 8px; height: 22px; border-radius: 4px; }
.mark i:nth-child(1) { background: var(--yes); }
.mark i:nth-child(2) { background: #e0a526; height: 15px; align-self: flex-end; }
.mark i:nth-child(3) { background: #9aa8b2; height: 9px; align-self: flex-end; }

.nav-link { font-weight: 600; text-decoration: none; }
.nav-link:hover { text-decoration: underline; }

.site-footer { margin-top: 4rem; padding: 2rem 0; color: var(--muted); font-size: 0.9rem; }

/* ------------------------------------------------------------- cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem;
}

/* -------------------------------------------------------------- hero */
.hero {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: 3.5rem;
  align-items: start;
  padding-top: 3.5rem;
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 34ch; margin: 0 0 2rem; }

.steps { list-style: decimal; padding-left: 1.4rem; margin: 0; display: grid; gap: 1rem; }
.steps li::marker { font-weight: 700; color: var(--accent); }
.steps strong { display: block; }
.steps span { color: var(--muted); }

/* ------------------------------------------------------------- forms */
.form h2 { margin-bottom: 1.25rem; }

.field { display: block; margin: 0 0 1.1rem; padding: 0; border: 0; min-width: 0; }
.field > span, .field > legend, .link-block label {
  display: block; font-weight: 600; margin-bottom: 0.35rem; padding: 0;
}
.field em { font-weight: 400; font-style: normal; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

input[type="text"], input[type="email"], input[type="date"], input[type="time"], textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid #aebbc4;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}
input::placeholder, textarea::placeholder {
  color: #94a1ab;
  opacity: 1;   /* Firefox lowers placeholder opacity by default */
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }

.opt-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.opt-row { align-items: stretch; }
.opt-row input { flex: 1; min-width: 0; }
.opt-row input[type="date"] { flex: 1 1 9rem; }
.opt-row input[type="time"] { flex: 0 0 8rem; }
.opt-row .to { align-self: center; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 480px) {
  .opt-row { flex-wrap: wrap; }
  .opt-row input[type="date"] { flex: 1 1 100%; }
  .opt-row input[type="time"] { flex: 1; }
}

.btn {
  display: inline-block;
  font: 600 1rem/1 var(--font-body);
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  border: 1px solid #aebbc4;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f4f7f9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #095a60; }
.btn.ghost { border-style: dashed; margin-top: 0.25rem; }
.btn.danger { color: var(--danger); border-color: #d9aaa5; }
.btn.danger:hover { background: #fbeeec; }
.form .btn.primary { width: 100%; margin-top: 0.5rem; padding: 1rem; }

.icon-btn {
  font-size: 1.3rem; line-height: 1;
  width: 2.6rem;
  border: 1px solid #aebbc4;
  background: #fff;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--danger); border-color: #d9aaa5; }
.icon-btn.small { width: 1.6rem; height: 1.6rem; font-size: 1rem; border-radius: 50%; }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.75rem; }

.error-list { margin: 0 0 1rem; padding-left: 1.2rem; }

/* -------------------------------------------------- created / share */
.link-block { margin-top: 1.75rem; }
.copy-row { display: flex; gap: 0.5rem; margin-bottom: 0.9rem; }
.copy-row input { flex: 1; background: var(--paper); }

/* --------------------------------------------------------- poll page */
.poll-head { padding: 2.5rem 0 1.25rem; }
.poll-head h1 { margin-bottom: 0.3em; }
.desc { max-width: 65ch; color: var(--muted); font-size: 1.05rem; margin: 0 0 0.5rem; }
.meta { color: var(--muted); margin: 0; font-size: 0.95rem; }

.notice {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}
.notice.ok  { border-left-color: var(--yes); background: #f0faf4; }
.notice.bad { border-left-color: var(--danger); background: #fdf3f2; }
.notice .error-list { margin: 0; }

.grid-scroll {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

table.votes { border-collapse: separate; border-spacing: 0; width: 100%; min-width: max-content; }
table.votes th, table.votes td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); }
table.votes tbody tr:last-child th, table.votes tbody tr:last-child td { border-bottom: 0; }

.name-col {
  position: sticky; left: 0;
  background: var(--card);
  text-align: left;
  min-width: 11rem;
  max-width: 14rem;
  z-index: 1;
  border-right: 1px solid var(--line);
  font-weight: 600;
}
thead .name-col { font-weight: 500; color: var(--muted); font-size: 0.9rem; vertical-align: bottom; }
.name-col .voter { display: inline-block; max-width: 10rem; overflow-wrap: anywhere; }
.name-col form.inline { display: inline; margin-left: 0.4rem; vertical-align: middle; }

th.opt {
  text-align: center;
  min-width: 8rem;
  font-weight: 500;
  line-height: 1.2;
  border-top: 4px solid transparent;
}
th.opt .wd  { display: block; color: var(--muted); font-size: 0.85rem; }
th.opt .day { display: block; font: 800 1.9rem/1.1 var(--font-head); letter-spacing: -0.02em; }
th.opt .mon { display: block; color: var(--muted); font-size: 0.85rem; }
th.opt .tm  { display: block; font-weight: 600; margin-top: 0.25rem; }

/* the one standout element: the best-fit column */
th.opt.best { border-top-color: var(--accent); }
.best { background: var(--accent-soft); }
.name-col.best { background: var(--card); }
.tag {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
}

td.cell { text-align: center; font-weight: 700; font-size: 1.15rem; }
td.cell.yes   { color: var(--yes);   background: var(--yes-bg); }
td.cell.maybe { color: var(--maybe); background: var(--maybe-bg); }
td.cell.no    { color: var(--no);    background: var(--no-bg); }
td.empty { text-align: center; color: var(--muted); padding: 1.5rem; }

tr.vote-row td, tr.vote-row th { background: #fafcfd; }
tr.vote-row .name-col { background: #fafcfd; }
tr.vote-row td.best { background: var(--accent-soft); }
tr.vote-row input[type="text"] { padding: 0.5rem 0.65rem; }

.seg { display: inline-flex; border: 1px solid #aebbc4; border-radius: 999px; overflow: hidden; background: #fff; }
.seg label { position: relative; display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block;
  min-width: 2.2rem;
  padding: 0.4rem 0.2rem;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}
.seg label + label span { border-left: 1px solid var(--line); }
.seg input:checked + span.yes   { background: var(--yes);   color: #fff; }
.seg input:checked + span.maybe { background: #c58a00;      color: #fff; }
.seg input:checked + span.no    { background: #6b7a86;      color: #fff; }
.seg input:focus-visible + span { outline: 3px solid #1b8fa0; outline-offset: -3px; }

td.totals { text-align: center; font-size: 0.85rem; line-height: 1.35; }
td.totals span { display: block; }
td.totals .yes { color: var(--yes); font-weight: 700; }
td.totals .maybe { color: var(--maybe); }
tfoot th, tfoot td { border-top: 1px solid var(--line); border-bottom: 0 !important; }
tfoot .name-col { color: var(--muted); font-weight: 500; }

.submit-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1.25rem 0 0; }
.submit-row .hint { margin: 0; }

.share, .admin { margin-top: 2rem; }
.share .copy-row { margin-bottom: 0; }
.admin-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ------------------------------------------------------------ mobile */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 2rem; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .card { padding: 1.25rem; }
  .name-col { min-width: 8.5rem; }
  .copy-row { flex-direction: column; }
}

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