/* Tokens ------------------------------------------------------------------
   Every colour, size and radius in the app comes from here.
   The look is flat: no shadows, gradients or blur. Colours are the Ostrich and
   Zebra palette, used quietly: warm neutrals do most of the work, navy carries
   the structure, and mint appears only as a small accent.
   The voter page shares the suite's tokens, so it looks like Ash's other tools, without their sidebar. */

@font-face {
  font-family: "Urbanist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/urbanist.woff2") format("woff2");
}

:root {
  /* Brand palette */
  --navy-900: #061826;
  --navy-700: #12293d;
  --navy-500: #29465c;
  --navy-300: #5c7a8f;
  --navy-100: #b9c7d1;
  --mint-300: #8affc1;
  --mint-600: #0e9d62;
  --mint-700: #0a7a4c;
  --mint-50: #d9ffea;
  --mauve-700: #6b3f4d;
  --mauve-500: #955d6d;
  --mauve-50: #ebd9de;
  --white: #fbf9f9;
  --off-white: #e2dadb;
  --grey-300: #b9aeb0;
  --grey-500: #756b6e;

  /* Roles */
  /* Surfaces are a touch lighter than the brand White and Off-white, which read heavy across a whole screen. */
  --bg: #ffffff;
  --side: color-mix(in srgb, var(--off-white) 32%, #ffffff);
  --ink: var(--navy-900);
  --muted: var(--grey-500);
  --faint: var(--grey-300);
  --line: color-mix(in srgb, var(--grey-300) 55%, transparent);
  --line-soft: color-mix(in srgb, var(--grey-300) 30%, transparent);
  --fill: color-mix(in srgb, var(--off-white) 28%, #ffffff);
  --accent: var(--mint-700);
  --accent-wash: var(--mint-50);
  --primary: var(--navy-900);
  --primary-hover: var(--navy-700);
  --primary-ink: var(--white);
  /* The navy and mint pairing: the bar that offers an undo. */
  --bar: var(--navy-900);
  --bar-ink: var(--white);
  --bar-muted: var(--navy-100);
  --bar-accent: var(--mint-300);
  --tag: var(--mauve-50);
  --tag-ink: var(--mauve-700);
  --danger: #c4494f;
  --danger-wash: #f8e4e5;
  --scrim: rgb(6 24 38 / 0.4);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23756b6e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");

  --small: 0.8125rem;
  --base: 0.9375rem;
  --large: 1.0625rem;
  --title: 1.75rem;

  --radius: 6px;
  --radius-large: 8px;
  --sidebar: 16.5rem;
}

/* Dark mode swaps the tokens. js/theme.js sets data-theme from the switch, or from the device. */
:root { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--navy-900);
  --side: color-mix(in srgb, var(--navy-700) 55%, var(--navy-900));
  --ink: var(--white);
  --muted: var(--navy-100);
  --faint: var(--navy-300);
  --line: color-mix(in srgb, var(--navy-300) 45%, transparent);
  --line-soft: color-mix(in srgb, var(--navy-300) 22%, transparent);
  --fill: var(--navy-700);
  --accent: var(--mint-300);
  --accent-wash: color-mix(in srgb, var(--mint-300) 14%, var(--navy-900));
  --primary: var(--mint-300);
  --primary-hover: #a6ffd0;
  --primary-ink: var(--navy-900);
  --bar: var(--navy-700);
  --tag: color-mix(in srgb, var(--mauve-500) 35%, var(--navy-900));
  --tag-ink: var(--mauve-50);
  --danger: #ef8a8f;
  --danger-wash: color-mix(in srgb, #c4494f 25%, var(--navy-900));
  --scrim: rgb(0 0 0 / 0.55);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23b9c7d1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
}

/* Base -------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 var(--base)/1.45 "Urbanist", "Century Gothic", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--title); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
h2 { font-size: var(--base); font-weight: 700; }
h3 { font-size: var(--base); font-weight: 700; }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

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

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.icon { flex: none; display: block; }

/* Text boxes, dropdowns and date pickers share one look. */
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="month"], select, textarea {
  width: 100%; min-height: 2.25rem; padding: 0.35rem 0.65rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background-color: transparent;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--ink); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 1.9rem; text-overflow: ellipsis;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 0.75rem;
}
textarea { resize: vertical; }

/* iOS zooms the whole page in when a field with text under 16px takes focus, and
   does not zoom back out. On touch screens every field is at least that size. */
@media (pointer: coarse) {
  input, select, textarea { font-size: max(16px, 1em) !important; }
}
::placeholder { color: var(--faint); opacity: 1; }

/* Square ticks (forms and settings). Task ticks are round: see Tasks. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1rem; height: 1rem; margin: 0; flex: none; }

/* The voter page ---------------------------------------------------------- */

.muted { color: var(--muted); }
.top { display: flex; align-items: center; padding: 1rem 1.25rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; }
.brand img { border-radius: 6px; }
.brand .logo-dark, :root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }

.page { width: 100%; max-width: 76rem; margin: 0 auto; padding: 1.5rem 1.5rem 4rem; }
.loading { color: var(--muted); }
.message { max-width: 30rem; margin: 3rem auto; text-align: center; }
.message h1 { margin-bottom: 0.5rem; }
.message p { color: var(--muted); }
.message p + p { margin-top: 0.75rem; }
.thanks-mark { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin: 0 auto 1.25rem; border-radius: 50%; background: var(--accent-wash); color: var(--accent); font-size: 1.6rem; font-weight: 700; }
.thanks h1 + p { color: var(--ink); font-size: var(--large); }

.intro { max-width: 40rem; margin-bottom: 1.75rem; }
.intro h1 { margin-bottom: 0.4rem; }
.meta { color: var(--muted); font-weight: 600; }
.how { margin-top: 0.85rem; }
.how + .how { margin-top: 0.35rem; font-size: var(--small); }

/* Your answer to a time: No or Yes. A tap switches it. */
.choice {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 2.6rem; min-width: 7.5rem; padding: 0 0.85rem;
  border: 1px solid var(--line); border-radius: var(--radius-large); background: var(--bg); color: var(--muted); font-weight: 700;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.choice-mark { font-size: 1.05rem; line-height: 1; }
.choice-mark:empty { display: none; }
.choice.is-no { color: var(--faint); font-weight: 600; }
.choice.is-yes { border-color: var(--accent); background: var(--accent); color: #fff; }
:root[data-theme="dark"] .choice.is-yes { color: var(--navy-900); }
@media (hover: hover) { .choice.is-no:hover { border-color: var(--ink); color: var(--ink); } }
.choice:active { transform: scale(0.97); }
.choice.is-passed { border-style: dashed; color: var(--faint); font-weight: 600; cursor: default; }
.choice.is-compact { min-width: 0; width: 100%; min-height: 2.4rem; padding: 0 0.3rem; flex-direction: column; gap: 0; font-size: 0.6875rem; }
.choice.is-compact .choice-mark { font-size: 1rem; }
@media (prefers-reduced-motion: reduce) { .choice { transition: none; } .choice:active { transform: none; } }

/* Wide screens: everyone's answers in a grid, a row a person and yours at the bottom. */
.grid-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.grid { border-collapse: collapse; width: max-content; min-width: 100%; }
.grid th, .grid td { padding: 0.4rem; border-bottom: 1px solid var(--line-soft); text-align: center; white-space: nowrap; }
.grid thead th { color: var(--muted); font-size: var(--small); font-weight: 600; }
.grid .day { border-left: 1px solid var(--line); color: var(--ink); font-weight: 700; }
.grid .time { min-width: 5.25rem; line-height: 1.2; }
.grid .time span { display: block; }
.grid .time-to { color: var(--faint); font-size: 0.6875rem; }
.grid .corner, .grid tbody th, .grid tfoot th { position: sticky; left: 0; z-index: 1; width: 12rem; min-width: 12rem; max-width: 12rem; background: var(--bg); text-align: left; border-right: 1px solid var(--line); }
.grid .who { overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.grid .mark { font-weight: 700; }
.grid .mark.is-yes { background: color-mix(in srgb, var(--accent) 20%, var(--bg)); color: var(--accent); }
.grid .mark.is-no { color: var(--faint); }
.grid .you th, .grid .you td { padding: 0.5rem 0.3rem; background: var(--fill); border-bottom: 0; }
.grid .you th { background: var(--fill); }
.grid .name { min-height: 2.4rem; background: var(--bg); font-weight: 600; }
.grid tfoot th, .grid tfoot td { border-top: 1px solid var(--line); border-bottom: 0; color: var(--muted); font-size: var(--small); font-weight: 700; }

/* Phones: a list of times, each with your answer beside it and who else said what. */
.name-row { display: grid; gap: 0.35rem; margin-bottom: 1.5rem; }
.label { color: var(--muted); font-size: var(--small); font-weight: 600; }
.name-row .name { min-height: 2.9rem; font-size: var(--large); font-weight: 600; }
.day-block + .day-block { margin-top: 1.5rem; }
.day-name { margin-bottom: 0.4rem; font-size: var(--base); }
.slots { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.slot { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line-soft); }
.slot-text { flex: 1; min-width: 0; display: grid; gap: 0.3rem; }
.slot-time { font-size: var(--large); font-weight: 700; }
.slot.is-passed .slot-time { color: var(--faint); }
.slot-others { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.who-chip { display: inline-block; max-width: 100%; overflow: hidden; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.who-chip.is-yes { background: var(--accent-wash); color: var(--accent); }
.who-chip.is-no { background: var(--fill); color: var(--faint); text-decoration: line-through; }

/* Sending */
.foot { display: grid; justify-items: start; gap: 0.75rem; margin-top: 1.75rem; }
.send-note { color: var(--muted); font-size: var(--small); }
.check:empty { display: none; }
.send { min-height: 2.9rem; padding: 0 1.5rem; font-size: var(--large); }
.problem { padding: 0.6rem 0.8rem; border-radius: var(--radius); background: var(--danger-wash); color: var(--danger); }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 2.1rem; padding: 0.2rem 0.85rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: transparent; font-weight: 600; white-space: nowrap;
}
.button:disabled { opacity: 0.45; cursor: default; }
.button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.button.primary:not(:disabled):hover { background: var(--primary-hover); border-color: var(--primary-hover); }

@media (max-width: 44rem) {
  .page { padding: 0.5rem 1rem calc(2.5rem + env(safe-area-inset-bottom)); }
  .top { padding: calc(0.85rem + env(safe-area-inset-top)) 1rem 0.5rem; }
  /* On a phone the Send button stays in reach at the foot of the screen. */
  .foot { position: sticky; bottom: 0; z-index: 2; margin: 1.25rem -1rem 0; padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
  .send { width: 100%; }
  .foot { justify-items: stretch; }
}
