/* h7 — on top of /field-notes-theme/tokens.css, which stays untouched. Everything
   that differs from the theme is a local override in this file.

   Voices: controls are sans; things you read (chore titles, dish names, notes) are
   serif; numerals are the stamp. Hover rules live in @media (hover: hover) so a tap
   on a phone never leaves a sticky hover state behind. */

:root {
  /* The theme's --ash is 4.1:1 on cream, under AA for small text. UI text uses this. */
  --ash-ui: #58544F;
  --tick-ring: rgba(15, 15, 16, 0.55);
  --z-header: 10;
  --z-tabbar: 20;
  --z-menu: 30;
  --tabbar-h: 60px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
}

body { font-family: var(--font-sans); line-height: 1.45; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.wrap {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 16px calc(48px + env(safe-area-inset-bottom));
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: var(--z-menu);
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--char);
  color: var(--cream);
  font-weight: 700;
}
.skip:focus { top: 12px; }

/* --- Header and navigation -------------------------------------------- */

.top {
  position: relative;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
}
.mark {
  font-family: var(--font-slab);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--char);
  letter-spacing: -0.02em;
}
.mark::after { content: "."; color: var(--rust); }
.mark.big { font-size: 2.6rem; margin: 0 0 18px; }

.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a, .me summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ash-ui);
  white-space: nowrap;
  border: 1px solid transparent;
  transition: color 150ms var(--ease), background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.tabs a[aria-current] { color: var(--cream); background: var(--char); }
.me { position: relative; margin-left: auto; }
.me summary { list-style: none; cursor: pointer; color: var(--rust-dark); border-color: rgba(178,58,43,.4); }
.me summary::-webkit-details-marker { display: none; }
.me-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: var(--z-menu);
  display: grid;
  min-width: 220px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--char);
  box-shadow: var(--shadow);
}
.me-menu a, .me-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--cream);
  text-align: left;
  font-weight: 600;
}
.me-menu .aside { font-size: .72rem; opacity: .7; font-weight: 500; }

/* Phones: the tabs become a bottom bar, inside thumb reach. */
@media (max-width: 640px) {
  .tabs {
    position: fixed;
    inset: auto 0 0 0;
    z-index: var(--z-tabbar);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--char);
  }
  .tabs a {
    justify-content: center;
    min-height: calc(var(--tabbar-h) - 12px);
    padding: 0 2px;
    border-radius: 16px;
    color: rgba(231, 225, 214, 0.78);
    letter-spacing: .06em;
    font-size: .7rem;
  }
  .tabs a[aria-current] { color: var(--char); background: var(--cream); }
  .wrap { padding-bottom: calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }
}

/* --- Type -------------------------------------------------------------- */

h1 { font-size: 2.25rem; margin: 0; text-wrap: balance; }
@media (min-width: 820px) { h1 { font-size: 3rem; } }
h1 .sub {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
  letter-spacing: 0;
  color: var(--ash-ui);
}
h1 .sub.stamp, h1 .sub .stamp { color: var(--rust-dark); }
h2 { font-size: 1.35rem; margin: 0; text-wrap: balance; }
h3 { font-size: 1.05rem; margin: 0; }
.label { margin: 0; font-weight: 700; font-size: 0.85rem; color: var(--ash-ui); }
.stamp { font-family: var(--stamp); font-weight: 400; letter-spacing: 0.04em; color: var(--rust-dark); }
.hint, .empty, .chore-notes, .legend {
  max-width: 65ch;
  margin: 6px 0;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: var(--ash-ui);
  text-wrap: pretty;
}
.empty { font-style: italic; }
.muted { color: var(--ash-ui); }
.error { color: var(--rust); font-weight: 700; margin: 4px 0; }

/* --- Page head --------------------------------------------------------- */

.pagehead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin: 18px 0 22px;
}
.pagehead > div { text-align: center; }
.pagehead.plain { grid-template-columns: 1fr auto; }
.pagehead .link { margin-top: 4px; }
.step {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--char);
  transition: color 150ms var(--ease), border-color 150ms var(--ease);
}
.step svg { width: 22px; height: 22px; }

/* --- Surfaces ---------------------------------------------------------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, rgba(255,250,239,.84), rgba(231,225,214,.72)), var(--cream);
  padding: 20px;
  margin-bottom: 18px;
}
.card.narrow { max-width: 420px; margin: 10vh auto 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.count { font-size: 1.15rem; }
.minor { margin: 18px 0 4px; font-family: var(--font-sans); font-size: 0.85rem; color: var(--ash-ui); }
.all-done { margin: 12px 0 2px; font-family: var(--font-serif); color: var(--ink); }

/* Folds: Everyone else, Finished, Earlier this week */
details.fold > summary, .earlier > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker, .earlier > summary::-webkit-details-marker { display: none; }
details.fold > summary { margin: 0; min-height: 44px; }
details.fold[open] > summary { margin-bottom: 10px; }
.fold-hint { display: inline-flex; align-items: center; gap: 8px; color: var(--ash-ui); }
.fold-hint svg { width: 20px; height: 20px; transition: rotate 200ms var(--ease); }
details[open] > summary .fold-hint svg { rotate: 180deg; }

.cols { display: grid; gap: 0 18px; }
@media (min-width: 820px) { .cols { grid-template-columns: 1.2fr 1fr; align-items: start; } }

/* Calendar notes: the one charcoal panel on a page */
.markers { display: grid; gap: 8px; margin-bottom: 18px; }
.marker {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: var(--card-dark);
  color: var(--cream);
}
.marker strong { font-family: var(--font-slab); font-size: 1.2rem; }
.marker span { font-family: var(--font-serif); opacity: .8; }
.marker.small { display: inline-flex; padding: 6px 14px; margin: 2px 6px 6px 0; border-radius: var(--radius-pill); }
.marker.small strong { font-size: .98rem; }

/* --- Chores ------------------------------------------------------------ */

.chores { list-style: none; margin: 0; padding: 0; }
.chore { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.chore:first-child { border-top: 0; }
.tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--tick-ring);
  background: rgba(255,250,239,.7);
  color: transparent;
  padding: 0;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.tick svg { width: 24px; height: 24px; stroke-width: 2.6; }
.tick.locked { border-style: dashed; border-color: rgba(15,15,16,.35); }
.done .tick, .done .tick.locked { background: var(--rust); border: 2px solid var(--rust); color: #fff0d5; }
.tick:disabled { cursor: progress; }
.chore-body { display: grid; gap: 3px; min-width: 0; padding-top: 2px; }
.chore-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.08rem; line-height: 1.3; color: var(--char); }
.done .chore-title { color: var(--ash-ui); text-decoration: line-through; text-decoration-color: rgba(178,58,43,.7); }
.chore-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.8rem; color: var(--ash-ui); align-items: center; }
.who {
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255,250,239,.8);
  font-weight: 800;
  color: var(--char);
}
.who.any { font-weight: 600; color: var(--ash-ui); }
.late { color: var(--rust); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.late.quiet { color: var(--ash-ui); }
.overdue .tick { border-color: var(--rust); }
.missed .chore-title { color: var(--ash-ui); }
.chore-notes { margin: 0; font-size: 0.92rem; }

.chores.compact .chore { gap: 10px; padding: 6px 0; align-items: center; }
.chores.compact .chore-title { font-size: 1rem; }
.chores.compact .chore-notes { display: none; }

/* A tap that didn't save */
.failed .tick, .failed .option { border-color: var(--rust); border-style: solid; }
.failed-note { margin: 4px 0 0; color: var(--rust); font-weight: 700; font-size: .85rem; }

/* --- Meals ------------------------------------------------------------- */

.meal + .meal { margin-top: 18px; }
.meal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 44px; margin-bottom: 4px; }
.meal-head h3 { margin-right: auto; }
.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255,250,239,.75);
  text-align: left;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.option-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-family: var(--font-serif); font-weight: 600; font-size: 1.05rem; color: var(--char); }
.your-pick { font-family: var(--font-sans); font-weight: 800; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--rust-dark); }
.option.leading { background: rgba(178,58,43,.08); }
.option.mine { border-color: var(--rust); box-shadow: inset 0 0 0 1px var(--rust); }
.option.settled { background: var(--char); border-color: var(--char); cursor: default; }
.option.settled .option-name { color: var(--cream); }
.option.settled .your-pick { color: #f0b9a8; }
.option.out { cursor: default; background: transparent; }
.option.out .option-name { color: var(--ash-ui); font-weight: 400; }
.option.out .voter { background: var(--ash-ui); }
.option:disabled:not(.settled):not(.out) { cursor: progress; }
.voters { display: flex; gap: 4px; }
.voter {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rust);
  color: #fff0d5;
  font-weight: 800;
  font-size: .72rem;
}

/* --- Week & menu sheets: one sheet, a ruled row per day ------------------ */

.sheet { padding: 4px 20px; }
.row { display: grid; gap: 8px 24px; padding: 18px 0; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.sheet > .row:first-child, .earlier + .row, .earlier > .row:first-of-type { border-top: 0; }
.earlier { border-bottom: 1px solid var(--line); }
.earlier[open] { padding-bottom: 4px; }
.earlier > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  font-weight: 700;
  color: var(--ash-ui);
}
.row-date { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; align-self: start; }
.row-date h2 { font-size: 1.25rem; }
.today-tag {
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(178,58,43,.45);
  color: var(--rust-dark);
  font-weight: 800;
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.row.is-today .row-date h2 { color: var(--rust-dark); }
.row-body { min-width: 0; }
.meal-line { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 6px; font-family: var(--font-serif); }
.meal-line a { display: inline-flex; align-items: baseline; gap: 8px; min-height: 32px; }
.meal-line .kind { font-family: var(--font-sans); font-weight: 700; font-size: .85rem; color: var(--ash-ui); }
@media (min-width: 720px) {
  .row { grid-template-columns: 12rem 1fr; }
  .row-date { flex-direction: column; gap: 4px; }
}
@media (min-width: 1000px) {
  .row-body .chores.compact { columns: 2; column-gap: 28px; }
  .row-body .chores.compact .chore { break-inside: avoid; border-top: 0; border-bottom: 1px solid var(--line); }
  .meals-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .meals-pair .meal + .meal { margin-top: 0; }
}

/* Planner */
.planner .hint { margin-top: 0; }
.plan { display: grid; gap: 14px; margin-top: 14px; }
@media (min-width: 820px) { .plan { grid-template-columns: 1fr 1fr; } }
.plan-day { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; min-width: 0; scroll-margin-top: 16px; }
.plan-day legend { font-family: var(--font-slab); font-weight: 700; font-size: 1.1rem; padding: 0 6px; }
.plan-meal { display: grid; gap: 6px; margin-top: 8px; }
.plan-meal .label { margin-top: 4px; }

/* --- Month ------------------------------------------------------------- */

.month-card { padding: 12px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wd { padding: 4px 6px; font-weight: 700; font-size: .75rem; color: var(--ash-ui); }
.cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 96px;
  padding: 6px 7px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,250,239,.6);
  font-size: .74rem;
  overflow: hidden;
  transition: border-color 150ms var(--ease);
}
.cell.outside { background: transparent; border-style: dashed; }
.cell.outside .num { color: var(--ash-ui); }
.cell.is-today { border-color: var(--rust); box-shadow: inset 0 0 0 1px var(--rust); }
.num { font-size: 1rem; color: var(--char); }
.is-today .num { color: var(--rust-dark); }
.m-marker { padding: 1px 6px; border-radius: 6px; background: var(--card-dark); color: var(--cream); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-meal { font-family: var(--font-serif); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-count { color: var(--ash-ui); font-weight: 700; margin-top: auto; }
.legend { display: none; font-size: .85rem; font-style: normal; }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--char); vertical-align: middle; }
@media (max-width: 640px) {
  .month-card { padding: 8px; }
  .month { gap: 2px; }
  .wd { padding: 2px; text-align: center; font-size: .7rem; }
  .cell { min-height: 56px; padding: 5px 3px; align-items: center; border-radius: 10px; }
  .m-meal, .wide { display: none; }
  .m-marker { width: 8px; height: 8px; padding: 0; border-radius: 50%; font-size: 0; background: var(--char); }
  .legend { display: block; }
  .m-count { font-size: .68rem; }
}

/* --- Lists & forms ----------------------------------------------------- */

.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li > * { display: grid; gap: 4px; padding: 12px 10px; margin: 0 -10px; border-radius: 16px; transition: background-color 150ms var(--ease); }
.tasks li + li { border-top: 1px solid var(--line); }
.task-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.08rem; color: var(--char); }

.stack { display: grid; gap: 14px; }
.card.narrow h1 { margin-bottom: 18px; }
.stack label { display: grid; gap: 6px; font-weight: 700; font-size: .9rem; }
input[type=text], input[type=password], input[type=date], input[type=number], input:not([type]), textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid rgba(15,15,16,.3);
  border-radius: 14px;
  background: rgba(255,250,239,.9);
  font-size: 1rem;
  color: var(--ink);
}
::placeholder { color: var(--ash-ui); opacity: 1; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}
textarea { font-family: var(--font-serif); }

.taskform { max-width: 680px; }
.taskform .field { display: grid; gap: 6px; justify-items: start; margin-bottom: 18px; }
.taskform .field > input:not([type=number]):not([type=date]), .taskform .field > textarea { justify-self: stretch; }
.taskform .field .hint { margin: 0; font-size: .92rem; }
.taskform .field > div { display: flex; flex-wrap: wrap; gap: 6px; }
.taskform .field > div > div label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255,250,239,.8);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}
.taskform .field > div > div label:has(input:checked) { border-color: var(--rust); background: rgba(178,58,43,.1); color: var(--rust-dark); }
.taskform .field > div > div label:has(input:focus-visible) { outline: 2px solid var(--rust); outline-offset: 2px; }
.taskform input[type=radio], .taskform input[type=checkbox] { accent-color: var(--rust); margin: 0; }
.taskform input[type=number] { max-width: 110px; }
.taskform input[type=date] { max-width: 220px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15,15,16,.3);
  background: rgba(255,250,239,.8);
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--char);
  transition: color 150ms var(--ease), background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.btn.primary { background: var(--char); border-color: var(--char); color: var(--cream); }
.btn.danger { border-color: var(--rust); color: var(--rust); }
.card .btn { margin-top: 8px; }
.danger-zone { justify-content: flex-end; max-width: 680px; }
.confirm { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; font-size: .9rem; color: var(--ash-ui); }

/* Text actions: sentence case, underlined, so they never read as a button label. */
.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0 2px;
  font-weight: 700;
  font-size: .88rem;
  color: var(--rust-dark);
  text-decoration: underline;
  text-decoration-color: rgba(122,42,31,.35);
  text-underline-offset: 4px;
  transition: color 150ms var(--ease), text-decoration-color 150ms var(--ease);
}

.htmx-request.tick, .htmx-request.option { opacity: .6; }

/* --- Hover, only where a pointer can hover ------------------------------ */

@media (hover: hover) {
  .tabs a:hover, .me summary:hover { color: var(--char); border-color: var(--line); }
  .tabs a[aria-current]:hover { color: var(--cream); }
  .me-menu a:hover, .me-menu button:hover { background: rgba(178,58,43,.35); }
  .step:hover { border-color: rgba(178,58,43,.5); color: var(--rust); }
  button.tick:hover { border-color: var(--rust); }
  .chore:not(.done) button.tick:hover { color: rgba(178,58,43,.45); }
  button.option:not(:disabled):hover { border-color: rgba(178,58,43,.55); }
  a.row-date:hover h2, .meal-line a:hover { color: var(--rust-dark); }
  .cell:hover { border-color: rgba(178,58,43,.5); }
  .tasks a:hover { background: rgba(178,58,43,.07); }
  .btn:hover { border-color: var(--rust); color: var(--rust-dark); }
  .btn.primary:hover { background: var(--rust); border-color: var(--rust); color: #fff0d5; }
  .btn.danger:hover { background: var(--rust); color: #fff0d5; }
  .link:hover { color: var(--rust); text-decoration-color: currentColor; }
  details.fold > summary:hover .fold-hint, .earlier > summary:hover { color: var(--char); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}
.formhead { max-width: 680px; }
