/* ============================================================
   When? — styled to match timo-mandler.com
   Accent : golden yellow #f7c52e (active items, buttons, links)
   Type   : Open Sans / Source Sans 3 — 400 body, 500 emphasis, 700 anchors
   Shapes : full pills (99px), no underlines, opacity-fade hovers
   Signature: the winning time becomes the "active" element in the
              site's own visual language (yellow fill + amber wash).
   ============================================================ */

:root {
  --accent:       #f7c52e;
  --accent-hover: #e0b225;
  --accent-fill:  #fef8e6;
  --accent-border:#f7d76a;
  --cream:        #fdf9f3;

  --text:    #333333;
  --muted:   #777777;
  --label:   #666666;
  --line:    #E5E5E5;
  --bg:      #ffffff;

  --yes:     #5a9e16;   /* derived from Divi green #7cda24, darkened for legibility */
  --yes-fill:#eef7e0;
  --if:      #0c71c3;   /* Divi blue */
  --if-fill: #e4eff8;
  --no:      #c4c4c4;   /* Divi gray — "no" recedes */

  --radius:  8px;
  --pill:    99px;
  --maxw:    1140px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Open Sans', 'Source Sans 3', 'Source Sans Pro', 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; margin: 0 0 .5rem; color: var(--text); }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

a { color: var(--accent-hover); font-weight: 500; text-decoration: none; transition: opacity .3s ease; }
a:hover { opacity: .6; }

.muted { color: var(--muted); }
.hint  { color: var(--muted); font-weight: 400; font-size: .85em; }
.center { text-align: center; }
.tabnum { font-variant-numeric: tabular-nums; }

/* ---- header / footer ---- */
header.site {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.1rem clamp(1rem, 4vw, 2rem);
  max-width: var(--maxw); margin: 0 auto; border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 700; font-size: 1.45rem; color: var(--text); letter-spacing: -.01em; }
.wordmark:hover { opacity: 1; }
.wordmark span { color: var(--accent); }
header.site nav { display: flex; align-items: center; gap: 1.25rem; font-size: .95rem; }

footer.site {
  max-width: var(--maxw); margin: 4rem auto 2rem; padding: 1.4rem clamp(1rem,4vw,2rem) 0;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem;
}

main { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem) 2rem; }
main.narrow { max-width: 540px; }

/* ---- buttons & pills ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: .95rem; font-weight: 700; line-height: 1;
  background: var(--accent); color: var(--text); border: 1px solid var(--accent);
  padding: .7rem 1.3rem; border-radius: var(--pill); cursor: pointer;
  text-decoration: none; transition: background .3s ease, border-color .3s ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--text); opacity: 1; }
.btn-lg { padding: .85rem 1.7rem; font-size: 1rem; }
.btn-sm { padding: .45rem .95rem; font-size: .85rem; }
.btn-ghost { background: var(--bg); color: var(--text); border-color: var(--line); font-weight: 500; }
.btn-ghost:hover { background: var(--accent-fill); border-color: var(--accent-border); color: var(--text); }
.copied { background: var(--yes) !important; border-color: var(--yes) !important; color: #fff !important; }

:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; border-radius: 4px; }

/* ---- forms ---- */
label { display: block; margin: 0 0 1rem; font-weight: 500; }
input, textarea {
  display: block; width: 100%; margin-top: .35rem;
  font-family: inherit; font-size: 16px; font-weight: 400; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem .7rem;
}
input[type=datetime-local] { width: auto; max-width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(247,197,46,.25); }

.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: clamp(1.25rem, 4vw, 2rem);
}
.card.auth h2 { text-align: center; }

.flash { padding: .65rem .9rem; border-radius: var(--radius); margin: 0 0 1rem; font-size: .92rem; }
.flash-ok   { background: var(--accent-fill); color: #8a6a12; border: 1px solid var(--accent-border); }
.flash-warn { background: #fdeceb; color: #a3271f; border: 1px solid #f3c4c0; }

/* ============================================================
   Landing
   ============================================================ */
.hero { padding: 2.5rem 0 1rem; max-width: 40rem; }
.eyebrow {
  font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  font-weight: 600; color: var(--label); margin: 0 0 1rem;
}
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.3rem); font-weight: 700; line-height: 1.1; margin: 0 0 1.1rem; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(transparent 62%, var(--accent) 62%);
  padding: 0 .08em;
}
.lede { font-size: 1.15rem; color: var(--muted); margin: 0 0 1.8rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .8rem; }

.steps { margin: 3.5rem 0; }
.steps ol { list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.steps li { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; }
.step-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%; font-size: .95rem; font-weight: 700;
  background: var(--accent); color: var(--text); margin-bottom: .8rem;
}
.steps h3 { margin: 0 0 .4rem; }
.steps p { margin: 0; color: var(--muted); font-size: .95rem; }

.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem 2rem; padding: 2rem 0;
}
.features h4 { margin: 0 0 .2rem; }
.features p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ============================================================
   Dashboard
   ============================================================ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0 1.5rem; }
.page-head h2 { margin: 0; }

.empty {
  text-align: center; padding: 3.5rem 1rem; background: var(--cream);
  border: 1px solid var(--line); border-radius: 12px;
}
.empty p { margin: 0 0 .5rem; }
.empty .btn { margin-top: 1rem; }

.poll-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.poll-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.2rem; color: var(--text); font-weight: 400; transition: border-color .3s ease;
}
.poll-row:hover { border-color: var(--accent-border); opacity: 1; }
.poll-title { font-weight: 700; font-size: 1.05rem; }
.poll-meta { display: flex; align-items: center; gap: .8rem; font-size: .88rem; }
.tag {
  font-size: .8rem; font-weight: 500; background: var(--accent-fill); color: #8a6a12;
  border: 1px solid var(--accent-border); padding: .2rem .6rem; border-radius: var(--pill);
}

/* ============================================================
   Create — slot rows
   ============================================================ */
fieldset.slots { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin: 0 0 1.5rem; }
fieldset.slots legend { font-weight: 700; padding: 0 .4rem; }
.slot-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.slot-row .dash { color: var(--muted); font-size: .9rem; }
.remove {
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  width: 2rem; height: 2rem; border-radius: 50%; cursor: pointer; font-size: 1.1rem; line-height: 1;
  transition: border-color .3s ease, color .3s ease;
}
.remove:hover { border-color: #e02b20; color: #e02b20; }

/* ============================================================
   Poll page
   ============================================================ */
.poll-header { margin-bottom: 1.5rem; }
.poll-header h2 { font-size: 1.9rem; }
.poll-desc { font-size: 1.02rem; margin: .3rem 0; color: var(--text); }
.poll-loc { font-weight: 500; font-size: .92rem; color: var(--accent-hover); margin: .3rem 0; }
.tz-note { font-size: .82rem; margin: .6rem 0 0; }
.tz-here { font-weight: 600; color: var(--text); }

.share { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 2rem; }
.share label { margin: 0; font-weight: 600; }
.share-field { display: flex; gap: .5rem; margin-top: .4rem; }
.share-field input { margin: 0; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.share-field .btn { flex: 0 0 auto; }

.results { margin-bottom: 2.5rem; }

.grid-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
table.grid { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.grid th, table.grid td { padding: .6rem .7rem; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid .who {
  text-align: left; position: sticky; left: 0; background: var(--bg);
  font-weight: 600; z-index: 1; box-shadow: 1px 0 0 var(--line);
}
table.grid thead th { vertical-align: bottom; }
.slot-time { font-size: .8rem; color: var(--muted); display: inline-block; font-variant-numeric: tabular-nums; }
table.grid thead .slot-time { color: var(--text); font-weight: 600; }

.cell span { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; font-weight: 700; }
td.v-yes span { background: var(--yes-fill); color: var(--yes); }
td.v-if  span { background: var(--if-fill);  color: var(--if); }
td.v-no  span { color: var(--no); }

.tally { font-size: .82rem; font-variant-numeric: tabular-nums; }
.tally .t-yes { color: var(--yes); font-weight: 700; }
.tally .t-if  { color: var(--if); margin-left: .35rem; }

/* --- the signature: the winning column reads as the "active" element --- */
.best-pill {
  display: block; font-size: .6rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text); margin-bottom: .35rem;
}
th.slot.best { background: var(--accent); border-radius: 8px 8px 0 0; }
th.slot.best .slot-time { color: var(--text); }
td.cell.best, td.tally.best { background: var(--accent-fill); }
td.tally.best { box-shadow: inset 0 -3px 0 var(--accent); }
tbody tr.mine .who { color: var(--accent-hover); }
tbody tr.mine { background: var(--accent-fill); }

@media (prefers-reduced-motion: no-preference) {
  th.slot.best { animation: settle .4s ease both; }
  @keyframes settle { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
}

.legend { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .82rem; margin-top: .8rem; color: var(--muted); }
.legend span { font-weight: 600; }
.legend .v-yes { color: var(--yes); }
.legend .v-if  { color: var(--if); }
.legend .v-no  { color: var(--muted); }

/* ---- vote form ---- */
.vote { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: clamp(1.25rem,4vw,2rem); }
.vote-slots { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.vote-slots li {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.vote-slots li:last-child { border-bottom: none; }
.vote-slots .slot-time { font-size: .95rem; color: var(--text); font-weight: 500; }

/* past/dimmed items — matches the site's "no longer current" pattern */
.vote-slots li.past { opacity: .4; transition: opacity .3s ease; }
.vote-slots li.past:hover { opacity: 1; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--pill); overflow: hidden; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span {
  display: inline-block; padding: .45rem .9rem; font-size: .88rem; font-weight: 500;
  color: var(--muted); border-right: 1px solid var(--line); transition: background .2s ease, color .2s ease;
}
.seg label:last-child span { border-right: none; }
.seg-yes input:checked + span { background: var(--yes); color: #fff; }
.seg-if  input:checked + span { background: var(--if);  color: #fff; }
.seg-no  input:checked + span { background: #eee; color: var(--text); }
.seg label:has(input:focus-visible) span { box-shadow: inset 0 0 0 2px var(--accent-hover); }

/* ---- danger ---- */
.danger { margin-top: 2rem; }
.link-danger { background: none; border: none; color: #e02b20; cursor: pointer; font: inherit; font-weight: 500; padding: 0; transition: opacity .3s ease; }
.link-danger:hover { opacity: .6; }

@media (max-width: 540px) {
  .vote-slots li { flex-direction: column; align-items: flex-start; gap: .5rem; }
}
