/*
 * tony-portal look: a quiet morning page. Ink on cool paper, one deep-teal accent.
 * Serif page titles, system sans body. Dark mode follows the phone.
 *
 * Reusable classes (later pages build only from these):
 *   .wrap              centred column, max 40rem, 1rem gutters
 *   .page-title        h1 for a page; .section-title for h2
 *   .card              bordered panel; .card + .card stacks with a gap; .card--link for a tappable one
 *   .list              unstyled list of rows; .list > li gets a divider
 *   .notice            boxed message; add .notice--error, .notice--warn or .notice--ok
 *   .form-row          label above a field; add .form-row--error plus .field-error text for errors
 *   .button            primary action; .button--quiet for secondary; .button--danger for delete
 *   .muted             secondary text; .small for fine print
 *   .pill              small status label; .pill--ok, .pill--warn, .pill--off, .pill--bad
 *   .row               flex row that wraps, with gaps; .row--between pushes ends apart
 *   .sr-only           visually hidden, still read aloud
 *   .fold              a <details> section that starts closed
 *   .find-*, .listing-*, .chips, .add-find   the Finds page
 *   .pup-*, .checks, .react, .hermes-notes, .timeline   the puppy cards (Puppies and history)
 */

:root {
  --paper: #f4f6f6;
  --surface: #ffffff;
  --ink: #17211f;
  --ink-soft: #55645f;
  --line: #d5dcda;
  --accent: #0d6b5f;
  --accent-ink: #ffffff;
  --ok: #1d6b36;
  --warn: #8a5a00;
  --bad: #a3282a;
  --tint-ok: #e3f2e7;
  --tint-warn: #fbf0d4;
  --tint-bad: #fae6e5;
  --radius: 0.75rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1514;
    --surface: #182120;
    --ink: #e8efed;
    --ink-soft: #9aaba6;
    --line: #2b3836;
    --accent: #4fc4b0;
    --accent-ink: #072622;
    --ok: #6fd18b;
    --warn: #e8bb5a;
    --bad: #f08a88;
    --tint-ok: #15301e;
    --tint-warn: #33290f;
    --tint-bad: #3a1b1b;
  }
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  overflow-wrap: anywhere;
}

.wrap { max-width: 40rem; margin: 0 auto; padding-inline: 1rem; }
main.wrap { padding-block: 1.25rem 3rem; }

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

/* Header and nav */
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead-row { display: flex; align-items: center; justify-content: space-between; padding-block: 0.5rem; }
.wordmark {
  font: 700 1.5rem/1 var(--serif);
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.signout { margin: 0; }
.nav { display: flex; gap: 0.25rem; padding-block: 0 0.5rem; }
.nav a {
  flex: 1;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
}
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.nav a:not([aria-current="page"]):hover { background: var(--paper); color: var(--ink); }

/* Type */
.page-title { font: 700 1.75rem/1.15 var(--serif); letter-spacing: -0.01em; margin: 0 0 1rem; }
.section-title { font: 700 1.2rem/1.25 var(--serif); margin: 1.75rem 0 0.75rem; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.875rem; }
p { margin: 0 0 0.75rem; }

/* Card and list */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.card + .card { margin-top: 0.75rem; }
.card--link { display: block; color: inherit; text-decoration: none; }
.card--link:hover { border-color: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding-block: 0.75rem; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.row--between { justify-content: space-between; }

/* Notice */
.notice {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.notice--ok { background: var(--tint-ok); border-color: var(--ok); }
.notice--warn { background: var(--tint-warn); border-color: var(--warn); }
.notice--error { background: var(--tint-bad); border-color: var(--bad); }

/* Forms */
.form-row { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.form-row label { font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
textarea { min-height: 6rem; }
.form-row--error input, .form-row--error select, .form-row--error textarea { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 0.9rem; margin: 0; }

.button {
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  font: 600 1rem var(--sans);
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button--quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.button--quiet:hover { border-color: var(--ink-soft); filter: none; }
.button--danger { background: transparent; color: var(--bad); border-color: var(--bad); }

/* Status pill */
.pill {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
}
.pill--ok { color: var(--ok); background: var(--tint-ok); border-color: transparent; }
.pill--warn { color: var(--warn); background: var(--tint-warn); border-color: transparent; }
.pill--bad { color: var(--bad); background: var(--tint-bad); border-color: transparent; }
.pill--off { color: var(--ink-soft); background: transparent; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Puppies */
.icon { width: 1.25rem; height: 1.25rem; flex: none; vertical-align: -0.25rem; }
details.card > summary, .fold > summary, .pup-notes > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 0.75rem; }
.fold > summary h2 { display: inline; }
.litter-name { font: 700 1.1rem/1.3 var(--serif); margin: 0; }
.litter-meta { margin: 0 0 0.5rem; }
.pup-head { display: flex; gap: 0.75rem; align-items: flex-start; }
.pup-photo {
  width: 4.5rem; height: 4.5rem; flex: none; object-fit: cover;
  border-radius: 0.5rem; background: var(--paper);
}
.pup-photo--none { display: grid; place-items: center; border: 1px solid var(--line); color: var(--ink-soft); }
.pup-photo--none .icon { width: 2rem; height: 2rem; }
.pup-name { font-weight: 700; margin: 0; }
.pup-price { margin: 0; }
.pup-amount { font-weight: 700; }
.pup-price--over, .pup-price--none { color: var(--warn); }
.pup-flag { font-size: 0.875rem; font-weight: 600; }
.pup-flag::before { content: " \00b7  "; }
.pup-facts, .pup-reason { margin: 0.25rem 0 0; color: var(--ink-soft); }
.checks { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.check { display: flex; align-items: center; gap: 0.25rem; font-size: 0.9rem; }
.check--yes .icon { color: var(--ok); }
.check--no, .check--unknown { color: var(--ink-soft); }
.pup-more { margin-top: 0.75rem; gap: 0.25rem 1rem; }
.pup-link { display: inline-flex; align-items: center; min-height: 2.75rem; }
.pup-link--replied { font-weight: 700; }
.pup-notes { margin-top: 0.5rem; }
.pup-notes dl { margin: 0.5rem 0 0; }
.pup-notes dt { font-weight: 600; }
.pup-notes dd { margin: 0 0 0.5rem; color: var(--ink-soft); }
.reactions { margin-top: 0.75rem; }
.react { display: inline-flex; align-items: center; gap: 0.35rem; }
.react--heart[aria-pressed="true"] { color: var(--bad); border-color: var(--bad); }
.react--pass[aria-pressed="true"] { background: var(--paper); border-color: var(--ink-soft); }
.hermes-notes { margin-top: 0.75rem; padding: 0.5rem 0.75rem; border-left: 3px solid var(--accent); background: var(--paper); }
.hermes-notes-label { margin: 0; font-size: 0.8125rem; font-weight: 700; color: var(--ink-soft); }
.hermes-notes-text { margin: 0; }
.hermes-notes-fold summary { cursor: pointer; list-style: none; }
.hermes-notes-fold summary::-webkit-details-marker { display: none; }
.hermes-notes-fold .hermes-notes-text {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hermes-notes-fold[open] .hermes-notes-text { display: block; }
.hermes-notes-toggle { color: var(--accent); font-weight: 600; font-size: 0.875rem; }
.hermes-notes-toggle--less, .hermes-notes-fold[open] .hermes-notes-toggle--more { display: none; }
.hermes-notes-fold[open] .hermes-notes-toggle--less { display: inline; }
.timeline { margin-top: 1rem; }

/* Finds */
.add-find { display: grid; gap: 0.9rem; margin-bottom: 1.5rem; }
.add-find > .button { justify-self: start; min-width: 9rem; }
.add-find .form-row { margin-bottom: 0; }
.more-options > summary, .change-schedule > summary, .delete-find > summary, .no-longer > summary {
  cursor: pointer; font-weight: 600; color: var(--accent);
}
.more-fields { display: grid; gap: 1rem; margin-top: 0.9rem; }
.field { display: grid; gap: 0.35rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.field-label { font-weight: 600; padding: 0; }
.field p { margin: 0; }
.price-field { display: flex; align-items: center; gap: 0.4rem; max-width: 11rem; font-weight: 700; }
.price-field input { font-weight: 400; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.chip span {
  display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0.5rem 0.9rem;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 600; font-size: 0.9375rem; cursor: pointer;
}
.chip input:checked + span { background: var(--tint-ok); border-color: var(--accent); }
.chip input:checked + span::before {
  content: ""; width: 0.6rem; height: 0.35rem; margin-right: 0.5rem;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-2px);
}
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.finds { display: grid; gap: 1.5rem; }
.finds > * { min-width: 0; }
.find { border-top: 1px solid var(--line); padding-top: 1rem; scroll-margin-top: 1rem; }
.find-head { display: grid; gap: 0.125rem; }
.find-name { font: 700 1.3rem/1.3 var(--serif); margin: 0; }
.find--stopped .find-name { color: var(--ink-soft); }
.find-details, .find-meta, .find-note { margin: 0; color: var(--ink-soft); font-size: 0.9375rem; }
.find-note { margin-top: 0.75rem; }
.find-schedule { margin: 0.6rem 0 0; }
.find-actions { display: flex; flex-wrap: wrap; align-items: start; gap: 0.5rem; margin-top: 0.75rem; }
.find-actions form { margin: 0; }
.change-schedule, .delete-find, .no-longer { margin-top: 0.75rem; }
.find-actions .delete-find { margin-top: 0; align-self: center; }
.delete-find form, .schedule-form { margin-top: 0.5rem; }
.schedule-form { display: grid; gap: 0.9rem; }
.schedule-form > .button { justify-self: start; }
.listings { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.listing { display: grid; gap: 0.125rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.listing p { margin: 0; }
.listing-price { font-size: 1.3rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.listing-price--none { font-size: 1rem; font-weight: 600; color: var(--ink-soft); }
.listing-title { font-weight: 600; color: var(--ink); }
.listing-where { color: var(--ink-soft); font-size: 0.9375rem; }
.new-tag {
  display: inline-block; margin-right: 0.5rem; padding: 0 0.5rem; border-radius: 999px;
  background: var(--tint-ok); color: var(--ok); font-size: 0.8125rem; font-weight: 700;
}
.listing-talk { margin-top: 0.75rem; }
.archived { margin-top: 2.5rem; }
.archived > summary { cursor: pointer; }
.archived > summary .section-title { display: inline; }
.archived-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.archived-list li {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 0.75rem; padding: 0.6rem 0; border-top: 1px solid var(--line);
}
.archived-name { color: var(--ink-soft); }
.archived-list .find-actions { margin-top: 0; }

@media (min-width: 40rem) {
  main.wrap { padding-block-start: 2rem; }
  .page-title { font-size: 2.1rem; }
}

/* Messages and conversations */
.back { margin: 0 0 0.5rem; font-size: 0.9375rem; }
.back a { display: inline-flex; align-items: center; min-height: 2.75rem; }
/* Taps on a <summary> toggle need a 44px target. */
summary { min-height: 2.75rem; padding-block: 0.6rem; }
.conversation-status { font-weight: 600; max-width: 44rem; }
.conversation-open { margin-top: 0.4rem; }
.messages { list-style: none; display: grid; gap: 0.75rem; margin: 1.5rem 0 0; padding: 0; max-width: 44rem; }
.bubble { max-width: min(32rem, 85%); padding: 0.6rem 0.9rem; border-radius: var(--radius); margin: 0; }
.bubble--theirs { justify-self: start; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.bubble--ours { justify-self: end; background: var(--tint-ok); }
.bubble p { margin: 0; }
.bubble-text { white-space: pre-line; overflow-wrap: anywhere; }
.bubble-when { margin-top: 0.25rem; color: var(--ink-soft); font-size: 0.8125rem; }
.replies { margin-top: 1.5rem; max-width: 44rem; }
.reply-form textarea { width: 100%; }
.reply-form > .button { margin-top: 0.25rem; }
.reply-list { list-style: none; display: grid; gap: 0.75rem; margin: 1.25rem 0 0; padding: 0; }
.reply { justify-self: end; max-width: min(32rem, 85%); padding: 0.6rem 0.9rem; border-radius: var(--radius); border: 1px dashed var(--accent); }
.reply p { margin: 0; }
.reply--failed { background: var(--tint-bad); border-color: var(--bad); }
.reply-status { margin-top: 0.25rem; color: var(--ink-soft); font-size: 0.8125rem; }
.message-list { list-style: none; margin: 0; padding: 0; max-width: 44rem; }
.message-row + .message-row { border-top: 1px solid var(--line); }
.message-row a { display: grid; gap: 2px; padding: 0.9rem 0; color: inherit; text-decoration: none; }
.message-seller { font-weight: 800; }
.message-about { min-width: 0; color: var(--ink-soft); font-size: 0.9375rem; }
.message-status { font-weight: 600; }

/* Settings */
.copy-list { margin: 0; }
.copy-list dt { margin-top: 0.75rem; font-weight: 600; }
.copy-list dd { margin: 0.25rem 0 0; overflow-wrap: anywhere; }
.copy-list .button { margin-left: 0.25rem; padding-block: 0.15rem; }
.copy-list .button[hidden] { display: none; }

/* Today: a briefing's Markdown body */
.briefing-title { margin-top: 0; }
.briefing-body { overflow-wrap: anywhere; }
.briefing-body h1, .briefing-body h2, .briefing-body h3, .briefing-body h4 {
  font: 700 1.05rem/1.3 var(--serif); margin: 1.1rem 0 0.4rem;
}
.briefing-body ul, .briefing-body ol { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.briefing-body li { margin-bottom: 0.3rem; }
.briefing-body hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.briefing-body blockquote { margin: 0 0 0.75rem; padding-left: 0.75rem; border-left: 3px solid var(--line); color: var(--ink-soft); }
.briefing-body code { font-size: 0.9em; }

/* Jobs */
.job-list { list-style: none; margin: 0 0 1rem; padding: 0; max-width: 44rem; }
.job-row + .job-row { border-top: 1px solid var(--line); }
.job-row a { display: grid; gap: 2px; padding: 0.8rem 0; color: inherit; text-decoration: none; }
.job-company { font-weight: 800; }
.job-role, .job-next { color: var(--ink-soft); font-size: 0.9375rem; }
.job-next--overdue strong { color: var(--bad); }
.job-next--soon strong { color: var(--warn); }
