/* Chore board. A fridge whiteboard: cool white surface, dry-erase ink,
   one marker color per roommate. Tally marks are the one loud thing. */

@font-face {
  font-family: "Recursive";
  src: url("fonts/recursive-latin-full-normal.woff2") format("woff2");
  font-weight: 300 1000;
  font-display: swap;
}

:root {
  color-scheme: light;
  --board: #f6f8f9;
  --surface: #ffffff;
  --frame: #cfd6dc;
  --rule: #e1e6ea;
  --ghost: #ebeff2;
  --ink: #1c2630;
  --ink-2: #55626e;
  --focus: #1d5fc4;
  --m-blue: #1d5fc4;
  --m-red: #d2492a;
  --m-green: #1f8a5b;
  --m-purple: #7a4bc4;
  --m-amber: #b07a00;
  --m-magenta: #c23f7d;
  --casual: "CASL" 1, "MONO" 0;
  --linear: "CASL" 0, "MONO" 0;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --board: #1b232a;
    --surface: #222b33;
    --frame: #3a4650;
    --rule: #2d3741;
    --ghost: #27313a;
    --ink: #e9eef2;
    --ink-2: #a7b3bd;
    --focus: #4f86e0;
    --m-blue: #4f86e0;
    --m-red: #e05a3f;
    --m-green: #2f9e6e;
    --m-purple: #9474e0;
    --m-amber: #b37d16;
    --m-magenta: #d55a96;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --board: #1b232a;
  --surface: #222b33;
  --frame: #3a4650;
  --rule: #2d3741;
  --ghost: #27313a;
  --ink: #e9eef2;
  --ink-2: #a7b3bd;
  --focus: #4f86e0;
  --m-blue: #4f86e0;
  --m-red: #e05a3f;
  --m-green: #2f9e6e;
  --m-purple: #9474e0;
  --m-amber: #b37d16;
  --m-magenta: #d55a96;
}

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

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

body {
  margin: 0;
  background: var(--board);
  color: var(--ink);
  font-family: "Recursive", ui-sans-serif, system-ui, sans-serif;
  font-variation-settings: var(--linear);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}

a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------- frame */

.board {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

@media (min-width: 760px) {
  .board {
    margin: 24px auto 40px;
    padding: 28px 36px 40px;
    background: var(--board);
    border: 6px solid var(--frame);
    border-radius: 18px;
    width: calc(100% - 48px);
  }
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}

.masthead h1 {
  margin: 0;
  font-variation-settings: var(--casual);
  font-weight: 820;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.masthead h1 a { text-decoration: none; }
.masthead .date { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }

.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 15px; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--frame); }
.nav a[aria-current="page"] { border-bottom-color: var(--ink); font-weight: 600; }

@media (min-width: 760px) {
  .masthead h1 { font-size: 38px; }
}

/* ------------------------------------------------------------ sections */

h2 {
  font-variation-settings: var(--casual);
  font-weight: 760;
  font-size: 23px;
  line-height: 1.2;
  margin: 0 0 4px;
}
h3 { font-size: 17px; font-weight: 650; margin: 0 0 6px; }
.section { margin: 0 0 36px; }
.section > .sub { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }

.layout { display: grid; gap: 8px 48px; grid-template-columns: minmax(0, 1fr); }
.layout > * { min-width: 0; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); align-items: start; }
}

/* ------------------------------------------------------ who's logging */

.whoami {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin: 0 0 14px; font-size: 15px;
}
.whoami select, .whoami .seg { font-size: 15px; }
.seg { display: inline-flex; border: 1px solid var(--frame); border-radius: 999px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 5px 12px; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--board); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }

/* --------------------------------------------------------- chore rows */

.chores { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.chore {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.chore .name { font-weight: 620; font-size: 17px; line-height: 1.3; }
.chore .pts { color: var(--ink-2); font-size: 13px; font-weight: 400; margin-left: 6px; white-space: nowrap; }
.chore .status { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chore[data-state="done"] .name { color: var(--ink-2); }
.chore[data-state="due"] .status, .chore[data-state="late"] .status { color: var(--ink); }
.chores-later-label { margin: 22px 0 6px; font-size: 14px; color: var(--ink-2); }

.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: currentColor; flex: none;
}
.late-flag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; padding: 1px 8px 1px 6px;
  border: 1.5px solid var(--ink); border-radius: 999px;
}
.late-flag svg { width: 12px; height: 12px; }
.check { width: 14px; height: 14px; flex: none; }

/* --------------------------------------------------------------- buttons */

button, .button {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px;
  white-space: nowrap;
}
button:hover, .button:hover { background: var(--ghost); }
button:active { transform: translateY(1px); }
button.primary, .button.primary { background: var(--ink); color: var(--board); }
button.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--board)); }
button.quiet, .button.quiet { border-color: var(--frame); font-weight: 500; }
button.link {
  border: 0; padding: 0; min-height: 0; background: none; font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
button.link:hover { background: none; text-decoration-thickness: 2px; }
button.danger { border-color: var(--m-red); color: var(--ink); }
button.small, .button.small { font-size: 14px; padding: 5px 12px; min-height: 32px; }
.chore button { min-width: 92px; }

/* ------------------------------------------------------------- tallies */

.standings { list-style: none; margin: 0; padding: 0; }
.standing {
  display: grid;
  grid-template-columns: minmax(84px, 9rem) 1fr auto;
  align-items: center;
  gap: 6px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.standing:first-child { border-top: 1px solid var(--rule); }
.standing .who { font-weight: 650; font-size: 17px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.standing .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standing .score { font-size: 24px; font-weight: 700; text-align: right; font-variation-settings: var(--casual); }
.standing .note { grid-column: 2 / -1; font-size: 14px; color: var(--ink-2); margin-top: -4px; }
.standing .marks { min-width: 0; overflow: hidden; }
@media (max-width: 480px) {
  .standing { grid-template-columns: 1fr auto; }
  .standing .marks { grid-column: 1 / -1; grid-row: 2; }
  .standing .note { grid-column: 1 / -1; grid-row: 3; margin-top: 0; }
}

.tally { display: block; max-width: 100%; height: auto; overflow: visible; }
.tally path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.tally-none { color: var(--ink-2); }
.tally-none.tally-lg { font-size: 20px; }

@media (prefers-reduced-motion: no-preference) {
  .tally.draw path {
    stroke-dashoffset: 1;
    animation: draw 160ms ease-out forwards;
    animation-delay: calc(var(--i) * 28ms + 120ms);
  }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.catchup {
  margin: 16px 0 0;
  font-size: 15px;
  padding-left: 12px;
  border-left: 3px solid var(--frame);
}

/* --------------------------------------------------------------- tables */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
th { font-weight: 600; font-size: 14px; color: var(--ink-2); }
thead th { border-bottom-color: var(--frame); }
td.num, th.num { text-align: right; padding-right: 0; padding-left: 12px; }
.tally-table td { padding-top: 10px; padding-bottom: 10px; }
.tally-table th .dot { margin-right: 6px; vertical-align: -1px; }
.tally-cell { display: flex; align-items: center; gap: 8px; }
.tally-cell .n { font-size: 13px; color: var(--ink-2); min-width: 1ch; }

/* --------------------------------------------------------------- recent */

.recent { list-style: none; margin: 0; padding: 0; }
.recent li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.recent .what { display: flex; align-items: center; gap: 8px; min-width: 0; }
.recent .when { font-size: 14px; color: var(--ink-2); grid-column: 1; }
.recent form { grid-row: 1 / span 2; grid-column: 2; }
.empty { color: var(--ink-2); padding: 14px 0; border-top: 1px solid var(--rule); margin: 0; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: var(--board);
  padding: 10px 10px 10px 18px; border-radius: 14px; z-index: 20;
  font-weight: 500;
}
.toast button { border-color: var(--board); color: var(--board); }
.toast button:hover { background: color-mix(in srgb, var(--board) 14%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 220ms ease-out; }
  @keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }
}

.flash { margin: 0 0 20px; padding: 10px 14px; border-radius: var(--radius); border: 1.5px solid var(--frame); }
.flash.error { border-color: var(--m-red); }
.flash.ok { border-color: var(--m-green); }

/* ---------------------------------------------------------------- forms */

.form { max-width: 640px; }
.field { margin: 0 0 18px; }
.field > label, .field > .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 14px; color: var(--ink-2); margin: 4px 0 0; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"],
input[type="url"], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--frame); border-radius: 8px;
  padding: 8px 10px; min-height: 42px; width: 100%; max-width: 100%;
}
input[type="number"] { max-width: 120px; }
input[type="time"], input[type="date"] { max-width: 200px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label, .check-row { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
fieldset { border: 0; border-top: 1px solid var(--rule); margin: 0 0 8px; padding: 18px 0 4px; }
legend { font-variation-settings: var(--casual); font-weight: 740; font-size: 19px; padding: 0 10px 0 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.row > .field { margin-bottom: 0; }
.inline-form { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
code, .code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px;
  background: var(--ghost); padding: 2px 6px; border-radius: 6px; word-break: break-all;
}
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- admin */

.subnav {
  display: flex; flex-wrap: wrap; gap: 4px 16px; margin: -8px 0 28px; font-size: 15px;
  padding-bottom: 12px; border-bottom: 1px solid var(--rule);
}
.subnav a { text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.subnav a[aria-current="page"] { border-bottom-color: var(--ink); font-weight: 600; }
.list { list-style: none; margin: 0 0 12px; padding: 0; border-top: 1px solid var(--rule); }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--rule); display: flex; gap: 8px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.list .meta { font-size: 14px; color: var(--ink-2); }
.archived { opacity: 0.6; }
.preview {
  white-space: pre-wrap; font-size: 15px; background: var(--surface);
  border: 1.5px solid var(--frame); border-radius: 12px; padding: 12px 14px; margin: 6px 0 16px;
}
.preview .ptitle { font-weight: 700; display: block; margin-bottom: 4px; }
.preview .pbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.preview .pbtns span { font-size: 13px; border: 1px solid var(--frame); border-radius: 6px; padding: 2px 8px; }
.status-ok::before, .status-bad::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.status-ok::before { background: var(--m-green); }
.status-bad::before { background: var(--m-red); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.swatches label { display: inline-flex; align-items: center; gap: 6px; }
.swatches .dot { width: 14px; height: 14px; }

/* ----------------------------------------------------------------- tag page */

.tagpage { max-width: 520px; margin: 0 auto; }
.tagpage h1 { font-variation-settings: var(--casual); font-weight: 820; font-size: 40px; line-height: 1.1; margin: 8px 0 6px; }
.people-buttons { display: grid; gap: 10px; margin: 20px 0; }
.people-buttons button { width: 100%; justify-content: flex-start; font-size: 18px; min-height: 56px; padding: 12px 18px; border-radius: 14px; }
.people-buttons button.me { background: var(--ink); color: var(--board); }
.people-buttons .dot { width: 14px; height: 14px; }

/* ----------------------------------------------------------------- stats */

.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: minmax(80px, 8rem) 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.bars li:first-child { border-top: 1px solid var(--rule); }
.bars .track { height: 12px; position: relative; }
.bars .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: currentColor; min-width: 2px; }
.bars .val { text-align: right; font-size: 15px; white-space: nowrap; }
.ranges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.ranges a { text-decoration: none; padding: 5px 12px; border: 1.5px solid var(--frame); border-radius: 999px; font-size: 14px; }
.ranges a[aria-current="page"] { background: var(--ink); color: var(--board); border-color: var(--ink); }

.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--ink-2); font-size: 12px; font-family: inherit; }
.chart .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: currentColor; stroke: var(--board); stroke-width: 2; }
.chart .endlabel { fill: var(--ink); font-size: 13px; font-weight: 600; font-family: inherit; }
.chart .crosshair { stroke: var(--ink-2); stroke-width: 1; }
.tip {
  position: absolute; top: 0; pointer-events: none; z-index: 2;
  background: var(--surface); border: 1.5px solid var(--frame); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; min-width: 130px;
}
.tip .t { font-weight: 700; margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip .r span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

details summary { cursor: pointer; font-size: 14px; color: var(--ink-2); margin: 10px 0; }

/* ---------------------------------------------------------------- footer */

.foot { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ----------------------------------------------------------------- print (chore tags) */

.tags-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.tagcard { border: 1.5px dashed var(--frame); border-radius: 14px; padding: 16px; text-align: center; break-inside: avoid; }
.tagcard svg { width: 160px; height: 160px; display: block; margin: 6px auto 10px; }
.tagcard .tname { font-variation-settings: var(--casual); font-weight: 800; font-size: 22px; }
.tagcard .turl { font-size: 11px; color: var(--ink-2); word-break: break-all; }
@media print {
  :root { --board: #fff; --ink: #000; }
  .masthead .nav, .subnav, .noprint, .foot { display: none !important; }
  .board { border: 0; margin: 0; padding: 0; width: 100%; }
  .tagcard { border-color: #999; }
}

.tally-table tbody th { color: var(--ink); font-size: 15px; font-weight: 600; white-space: nowrap; }
.recent .what strong { font-weight: 650; }

@media (min-width: 960px) {
  .board-layout {
    grid-template-areas: "today week" "recent week";
    grid-template-rows: auto 1fr;
  }
  .area-today { grid-area: today; }
  .area-week { grid-area: week; }
  .area-recent { grid-area: recent; }
}
.tally-table thead th { white-space: nowrap; }
.field > label.check-row { display: inline-flex; font-weight: 400; margin-bottom: 0; }
.hint { font-size: 14px; color: var(--ink-2); }

/* ------------------------------------------------------- web version extras */

.warn {
  margin: 0 0 24px; padding: 12px 16px; border-radius: var(--radius);
  border: 2px solid var(--m-red); background: var(--surface);
}
.warn[hidden] { display: none; }
.steps { padding-left: 22px; margin: 0; }
.steps > li { margin: 0 0 16px; padding-left: 4px; }
.steps > li p { margin: 6px 0; }
.steps > li.done > strong { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-2); }
.steps > li.done::marker { content: "✓  "; color: var(--m-green); font-weight: 700; }
.steps .copy-row { margin: 6px 0 8px; }
.tagcard .qr svg { width: 160px; height: 160px; display: block; margin: 6px auto 10px; }
.tagcard .qr svg rect { fill: #fff; }
pre.preview { overflow-x: auto; white-space: pre; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.people-buttons button { white-space: normal; text-align: left; }

/* Form errors */
.req { font-weight: 400; color: var(--ink-2); font-size: 14px; margin-left: 4px; }
.field-error { color: var(--m-red); font-weight: 600; font-size: 14px; margin: 6px 0 0; }
[aria-invalid="true"] { border-color: var(--m-red) !important; border-width: 2px; }
.error-summary { margin: 0 0 24px; padding: 12px 16px; border: 2px solid var(--m-red); border-radius: var(--radius); background: var(--surface); }
.error-summary ul { margin: 6px 0 0; padding-left: 20px; }
.error-summary a { font-weight: 600; }
button[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
.checks-box { margin-top: 32px; }
.checks-box .list > li { padding: 8px 0; }
