/* === Fonts === */
@font-face {
  font-family: "Iosevka Etoile";
  src: url("/static/fonts/IosevkaEtoile.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Iosevka Slab";
  src: url("/static/fonts/IosevkaSlab.woff2") format("woff2");
  font-display: swap;
}

/* === Theme === */
:root {
  --bg: #2e2e2e;
  --bg-panel: #434343;
  --bg-panel-hover: #585858;
  --text: #e6e6e6;
  --text-muted: #cfcfcf;
  --primary: #87458a;
  --primary-hover: #d64d95;
  --secondary: #c48401;
  --link: #01b6c4;
  --link-hover: #d6d24d;
  --danger: #c40141;
  --danger-hover: #d03467;

  --border: 1px solid var(--secondary);
  --border-dashed: 1px dashed var(--secondary);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;

  --font-xs: 0.75rem;
  --font-sm: 0.85rem;

  color-scheme: dark;
}

/* === Base === */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font: 1rem "Iosevka Etoile", monospace;
  line-height: 1.5;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) 5rem;
}

/* === Header === */
header.site {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: var(--border-dashed);
  margin-bottom: var(--space-5);
}

.logo {
  font-family: "Iosevka Slab", monospace;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}
.logo:hover { color: var(--primary-hover); }

.logo .dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  background: var(--primary);
  border: 1px solid var(--secondary);
  margin-right: 0.4em;
}

.tagline {
  color: var(--text-muted);
  font-size: var(--font-sm);
}

/* === Typography === */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  border-bottom: var(--border-dashed);
  padding-bottom: var(--space-1);
  margin: 1.25rem 0 var(--space-2);
}

.sub { color: var(--text-muted); margin: 0 0 var(--space-5); max-width: 60ch; }

.hint { font-weight: normal; color: var(--text-muted); font-size: var(--font-sm); }

.note { font-size: var(--font-sm); color: var(--text-muted); }

/* === Panels (cards) === */
.card {
  border: var(--border);
  background: var(--bg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.panel-header {
  display: block;
  font-size: var(--font-xs);
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: var(--border-dashed);
  padding-bottom: var(--space-1);
  margin-bottom: var(--space-3);
}

/* === Form controls === */
label.field {
  display: block;
  font-size: var(--font-sm);
  margin-bottom: var(--space-4);
}

label.field span { display: block; margin-bottom: var(--space-1); }

input[type="text"], textarea, input[type="time"] {
  width: 100%;
  background: var(--bg-panel);
  border: var(--border);
  color: var(--text);
  font: inherit;
  padding: 0.3rem var(--space-2);
  outline: none;
}

input[type="text"]:focus, textarea:focus, input[type="time"]:focus {
  border-color: var(--primary-hover);
}

.day:focus-visible {
  outline: 1px dashed var(--primary-hover);
  outline-offset: 1px;
}

textarea { resize: vertical; min-height: 4rem; }

/* === Buttons ===
   Reference style: text wrapped in amber brackets, no background. */
.btn {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}
.btn::before { content: "["; color: var(--secondary); }
.btn::after { content: "]"; color: var(--secondary); }
.btn:hover { color: var(--primary-hover); }

.btn-primary { color: var(--link); }
.btn-primary:hover { color: var(--link-hover); }
.btn-primary:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-danger { color: var(--danger); }
.btn-danger:hover { color: var(--danger-hover); }
.btn-danger:disabled { color: var(--text-muted); cursor: not-allowed; }

.btn:disabled { color: var(--text-muted); cursor: not-allowed; }

.actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  margin: var(--space-4) 0;
}

.error { color: var(--danger-hover); font-size: var(--font-sm); margin-top: var(--space-2); min-height: 1.2em; }
.ok { color: var(--link); font-size: var(--font-sm); margin-top: var(--space-2); }

/* === Calendar === */
.cal { user-select: none; }

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  border-bottom: var(--border-dashed);
  padding-bottom: var(--space-1);
  margin-bottom: var(--space-2);
}

.cal-title {
  font-size: var(--font-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.cal-nav { display: flex; gap: var(--space-2); }

/* Month pills (poll page): one per month that has offered dates */
.cal-months {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cal-months .pill {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--font-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 0 var(--space-1);
}
.cal-months .pill::before { content: "["; color: var(--secondary); }
.cal-months .pill::after { content: "]"; color: var(--secondary); }
.cal-months .pill:hover { color: var(--primary-hover); }

.cal-months .pill.active { color: var(--link); font-weight: 700; }

.cal-months .pill .n {
  font-size: var(--font-xs);
  margin-left: 0.35em;
  color: var(--secondary);
}

.cal-nav button {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  padding: 0 var(--space-1);
}
.cal-nav button::before { content: "["; color: var(--secondary); }
.cal-nav button::after { content: "]"; color: var(--secondary); }
.cal-nav button:hover { color: var(--primary-hover); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dow {
  text-align: center;
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-1) 0 var(--space-2);
}

.day {
  position: relative;
  aspect-ratio: 1 / 1.05;
  border: none;
  background: transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  padding: 0;
}

.day.blank { visibility: hidden; }

.day.clickable { cursor: pointer; }
.day.clickable:hover { background: var(--bg-panel-hover); }

.day.past { color: #777; }

.day.today .num { text-decoration: underline; text-underline-offset: 3px; }

/* Offered (poll page): amber wash behind the number */
.day.offered { background: var(--bg-panel); box-shadow: inset 0 0 0 1px var(--secondary); }
.day.offered:hover { background: var(--bg-panel-hover); }

/* The signature: a hand-drawn highlighter circle around picked dates */
.day .ring {
  position: absolute;
  inset: 4%;
  pointer-events: none;
  color: var(--primary-hover);
  opacity: 0;
  transform: scale(0.7) rotate(-8deg);
  transition: opacity 0.12s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.day.picked .ring { opacity: 1; transform: scale(1) rotate(0deg); }

@media (prefers-reduced-motion: reduce) {
  .day .ring { transition: none; }
}

.day.picked { font-weight: 700; }

.day .badge {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  line-height: 1;
  color: var(--link);
}

.day .timechip {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.55rem;
  line-height: 1;
  color: var(--secondary);
}

/* === Picked dates list (create page) === */
.picked-list { margin-top: var(--space-1); }

.picked-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-top: var(--border-dashed);
}
.picked-row:first-child { border-top: none; }

.picked-row .d { flex: 1; font-size: var(--font-sm); }

.picked-row input[type="time"] { width: 7rem; padding: 0.15rem var(--space-2); font-size: var(--font-sm); }

.picked-row .rm {
  background: none;
  border: none;
  color: var(--danger);
  font: inherit;
  font-size: var(--font-xs);
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
}
.picked-row .rm::before { content: "["; color: var(--secondary); }
.picked-row .rm::after { content: "]"; color: var(--secondary); }
.picked-row .rm:hover { color: var(--danger-hover); }

.empty {
  color: var(--text-muted);
  font-size: var(--font-sm);
  text-align: center;
  padding: var(--space-3) 0 var(--space-1);
}

/* === Share box === */
.share-link {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin: var(--space-2) 0 var(--space-1);
}

.share-link input {
  flex: 1;
  font-family: "Iosevka Slab", monospace;
  font-size: var(--font-sm);
}

/* === Results === */
.result-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-top: var(--border-dashed);
}
.result-row:first-of-type { border-top: none; }

.result-row .when { width: 12rem; flex-shrink: 0; font-size: var(--font-sm); }
.result-row .when .t { color: var(--secondary); margin-left: var(--space-2); }

.result-row .who { flex: 1; font-size: var(--font-sm); color: var(--text-muted); }

.result-row .count {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.result-row.best .when, .result-row.best .count { color: var(--link); }
.result-row.best:hover .when, .result-row.best:hover .count { color: var(--link); }

.best-tag {
  display: inline-block;
  border: var(--border-dashed);
  color: var(--link);
  font-size: var(--font-xs);
  padding: 0 var(--space-1);
  margin-left: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.closed-banner {
  background: var(--bg-panel);
  color: var(--secondary);
  border: var(--border);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--space-4) 0;
}

/* === Scrollbars === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: var(--primary); }
::-webkit-scrollbar-thumb:hover { background: var(--primary-hover); }

/* === Responsive === */
@media (max-width: 480px) {
  .result-row { flex-wrap: wrap; }
  .result-row .when { width: auto; }
  .result-row .who { flex-basis: 100%; order: 3; }
}
