/* The Mark — design tokens and base styles (SPEC-BUILD "Design system", "Design guide").
   One accent, used only by the Yes button, the `on` title and the progress fill.
   Borders 1px --line; no shadows, no gradients; radius 8 (chips, buttons) / 12 (cards).
   Budget: 12 KB. test/unit/assets/design.test.ts checks tokens, contrast and size. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/fraunces-600.woff2') format('woff2');
}

:root {
  --bg: #FAF7F2;
  --ink: #1C1A17;
  --muted: #6B655C;
  --line: #E4DED4;
  --accent: #B4452B;
  --good: #2F6B3A;

  --serif: 'Fraunces', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-small: 8px;
  --r-card: 12px;
  --gap: 24px;
  --gutter: 16px;
  --max: 480px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130F;
    --ink: #F3EFE8;
    --muted: #A39B8F;
    --line: #2C2822;
    --accent: #D8694C;
    --good: #6FAE7A;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

main,
footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main > * + * {
  margin-top: var(--gap);
}

h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.1;
  margin: 32px 0 16px;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-underline-offset: 2px;
}

.muted {
  color: var(--muted);
}

/* State cards: the only centred text (Design guide layout rule 3). */
.state {
  text-align: center;
  padding: 32px 0;
}

/* Buttons: the text button is the default; .yes is the one accent button per screen. */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.yes {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px var(--gutter);
  border-radius: var(--r-small);
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.yes:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px var(--gutter);
  align-items: center;
  margin-top: 48px;
  padding-top: var(--gutter);
  padding-bottom: 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

footer .lang button {
  min-height: 32px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

footer .lang button[aria-current='true'] {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

/* Decide screen (SPEC-BUILD Screens). */
.host {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
}

.photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.host + h1 {
  margin-top: 24px;
}

.why {
  margin-top: -8px;
}

.answer > * + * {
  margin-top: var(--gap);
}

/* The voice line opens the decide screen while there is no answer (Screens 0). */
.voice {
  margin-bottom: var(--gap);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.3;
}

.saved {
  font-size: 14px;
  color: var(--muted);
}

/* Someone else's link: I'm Marco / I'm not Marco, then the asks, one under the other. */
.asks > * {
  display: block;
  margin-top: 16px;
}

/* Chips: labelled checkboxes, two-state. The native box is hidden; the span is the chip. */
.dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.dates legend {
  float: left;
  width: 100%;
  margin-bottom: 8px;
  padding: 0;
}

.chip {
  position: relative;
  display: inline-flex;
}

.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.chip span {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-small);
  line-height: 22px;
  transition: background-color 120ms;
}

.chip input:checked + span {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.quorum progress {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 8px;
  border: 0;
  border-radius: 2px;
  background: var(--line);
  appearance: none;
  -webkit-appearance: none;
}

.quorum progress::-webkit-progress-bar {
  background: var(--line);
  border-radius: 2px;
}

.quorum progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 2px;
}

.quorum progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 2px;
}

/* The bar: Yes full width, No as text; sticky at the bottom with a top border. */
.bar {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.bar[hidden] {
  display: none;
}

.no {
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.after {
  margin-top: 8px;
  font-size: 14px;
}

.not-you {
  font-size: 14px;
  color: var(--muted);
}

.not-you button {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* State screens (SPEC-BUILD Screens, "After Yes"). The on title is the accent's second place. */
h1.on {
  color: var(--accent);
}

.state h1 + p {
  margin-top: 8px;
}

.plain,
.cancel button,
.remove button,
.more a,
details summary {
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.change > * + *,
.on-details > * + * {
  margin-top: 16px;
}

.bringing legend {
  float: left;
  width: 100%;
  margin-bottom: 8px;
  padding: 0;
}

details {
  display: inline;
}

details[open] fieldset {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.field input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-small);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.question {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.2;
}

.actions {
  display: flex;
  justify-content: center;
  gap: var(--gap);
  margin-top: var(--gap);
}

/* /attending: groups of one-line rows. */
.group h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.group li {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.remove {
  font-size: 14px;
  color: var(--muted);
}

/* Host screens (SPEC-BUILD Screens "Host list" … "People"). Plain: no accent; the primary
   button is ink. Errors are ink and bold: the accent stays with Yes (Design guide rule 4). */
.primary,
.button {
  display: inline-block;
  min-height: 44px;
  padding: 10px var(--gutter);
  border-radius: var(--r-small);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.host-nav,
.presets,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px var(--gutter);
  margin-top: var(--gutter);
  font-size: 14px;
}

.badge {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-small);
  font-size: 13px;
  color: var(--muted);
}

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rows li {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.rows .actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px var(--gutter);
  margin-top: 4px;
  font-size: 14px;
}

.inline {
  display: inline;
}

.tab h2,
.attendance h2,
.cohost h2,
.ring h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

/* Host gathering sections read apart on a phone: each title sits on a light band [D, Oct 21]. */
.tab + .tab {
  margin-top: var(--gap);
}

.tab h2 {
  padding: 8px 12px;
  border-radius: var(--r-small);
  background: var(--line);
}

.host-form,
.host-form fieldset,
.cohost form,
.add form,
.create {
  display: grid;
  gap: var(--gutter);
}

.host-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.host-form legend {
  font-weight: 600;
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.host-form > *,
.host-form fieldset > *,
.pair > * {
  min-width: 0;
}

.field {
  display: block;
}

.field select {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.field input {
  min-width: 0;
}

.field select,
.who select,
.row-new select,
.rings select {
  min-height: 44px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-small);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.field small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.error,
.field small.error {
  color: var(--ink);
  font-weight: 600;
}

.who {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.who th,
.who td {
  padding: 4px 4px 4px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.row-new {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.segmented label {
  margin-right: var(--gutter);
}

.host-form details,
.add {
  display: block;
}

.login .actions {
  flex-direction: column;
  align-items: flex-start;
}

/* /about, /how, /see (Screens "About", "How", "See"). */
.photo.big {
  width: 96px;
  height: 96px;
}

.about .who {
  margin-top: 8px;
  color: var(--muted);
}

.prompts dt {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.prompts dd {
  margin: 0;
}

.diagram {
  display: block;
  width: 100%;
  height: auto;
  color: var(--ink);
}

.diagram text {
  font: 12px var(--sans);
}

.see {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.see th,
.see td {
  padding: 8px 8px 8px 0;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.see th span {
  display: block;
  font-weight: 400;
}

.see .value {
  overflow-wrap: anywhere;
}

/* The passkey link on /host/people: one long word, wrapped anywhere so the page never scrolls sideways. */
p.link {
  overflow-wrap: anywhere;
}
