:root {
  --bg: #f6f1ea;
  --bg-accent: #efe6da;
  --card: #fffdf9;
  --text: #2e2a26;
  --muted: #7a7168;
  --accent: #b5603f;
  --accent-hover: #9c4f31;
  --accent-soft: #f6e3d9;
  --accent-text: #ffffff;
  --sage: #5d7a64;
  --sage-soft: #e3ece4;
  --border: #e6dccf;
  --danger: #a33a3a;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.05), 0 6px 20px rgba(60, 40, 20, 0.06);
  --shadow-hover: 0 2px 4px rgba(60, 40, 20, 0.06), 0 12px 32px rgba(60, 40, 20, 0.12);
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916;
    --bg-accent: #221f1b;
    --card: #262320;
    --text: #ede8e1;
    --muted: #a69d92;
    --accent: #e08a66;
    --accent-hover: #eb9d7c;
    --accent-soft: #3a2a22;
    --accent-text: #1b1916;
    --sage: #94b59b;
    --sage-soft: #26302a;
    --border: #3a3631;
    --danger: #e07a7a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
h3 { font-size: 1.1rem; margin: 0; }

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

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

.site-header { border-bottom: 1px solid var(--border); background: var(--card); }
.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
}

.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav form { margin: 0; }
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font: inherit;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 8px;
}
.nav-link:hover { color: var(--text); background: var(--bg-accent); }
.nav-button { background: none; border: none; cursor: pointer; }

main.page { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 28px 20px 56px; }

.site-footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 24px 16px; }
.site-footer p { margin: 0; }

/* ---------- Landing ---------- */

.hero { text-align: center; padding: 40px 0 32px; }
.hero h1 { font-size: 2.6rem; margin-bottom: 12px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 32em; margin: 0 auto; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.choice:hover { color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.choice-guest:hover { border-color: var(--sage); }

.choice-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: 4px;
}
.choice-guest .choice-icon { background: var(--sage-soft); color: var(--sage); }
.choice-title { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.choice-text { color: var(--muted); flex: 1; }
.choice-cta { font-weight: 600; color: var(--accent); }
.choice-guest .choice-cta { color: var(--sage); }

/* ---------- Cards, forms, buttons ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}
.card.narrow { max-width: 420px; margin: 24px auto; }
.card.narrow .choice-icon { margin-bottom: 12px; }

.page-head { margin-bottom: 20px; }
.page-head p { margin: 0; }
.section-title { margin-top: 8px; }

.stack { display: flex; flex-direction: column; gap: 18px; margin-top: 20px; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.95rem; }

input, textarea {
  font: inherit;
  font-weight: normal;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
/* Added by app.js: the box grows with its text, so no scrollbar or drag handle. */
textarea.autogrow { resize: none; overflow: hidden; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 20px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.button.secondary { background: transparent; color: var(--accent); }
.button.secondary:hover { background: var(--accent-soft); color: var(--accent); }
.button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.button.danger:hover { background: var(--danger); color: var(--card); }
.button.block { width: 100%; }

.link-button {
  font: inherit;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.link-button:hover { color: var(--danger); }

.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.inline-form label { font-weight: normal; color: var(--muted); }
.inline-form input { width: auto; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.actions form { margin: 0; }
.owner-actions { padding-top: 20px; border-top: 1px solid var(--border); }
.owner-actions form { margin-left: auto; }

.aside { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: 0.95rem; }
.back-link { display: inline-block; margin-bottom: 16px; color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.back-link:hover { color: var(--text); }

.today-card h1 { font-size: 1.7rem; }
.today-card .muted { margin: 0; }

/* ---------- Entry list ---------- */

.entry-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }

.entry-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.entry-card:hover { color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow-hover); border-color: var(--accent); }

.entry-date {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 64px;
  padding: 8px 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  line-height: 1.1;
}
.entry-day { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; }
.entry-month { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }

.entry-summary { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.entry-weekday { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.snippet { color: var(--muted); font-size: 0.95rem; overflow-wrap: anywhere; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- Entry page ---------- */

.entry-head { margin-bottom: 20px; }
.entry .prose { font-family: var(--serif); font-size: 1.12rem; line-height: 1.75; }

.answer { margin-top: 24px; padding-left: 16px; border-left: 3px solid var(--accent-soft); }
.answer.unanswered { border-left-color: var(--border); }
.no-answer { margin: 0; color: var(--muted); font-style: italic; font-size: 0.95rem; }
h2.question {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 4px;
}

/* Daily checklist: tick boxes on the form, ✓ / ✗ on the entry page. */
.checklist {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.checklist legend { font-weight: 600; font-size: 0.95rem; padding: 0 6px; }
label.check {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  font-weight: normal;
  padding: 8px 4px;
  cursor: pointer;
}
label.check input {
  width: 22px;
  height: 22px;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.checklist-view {
  list-style: none;
  padding: 14px 16px;
  margin: 24px 0 0;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checklist-view li { display: flex; align-items: center; gap: 10px; }
.check-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  flex: none;
}
.done .check-mark { background: var(--sage-soft); color: var(--sage); }
.not-done .check-mark { background: var(--bg-accent); color: var(--muted); }
.not-done { color: var(--muted); }

/* Photos */
.photos { margin-top: 24px; }
.photo-grid {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg-accent);
}
.photo-grid a:hover img { opacity: 0.9; }
.photo-grid.editable li { display: flex; flex-direction: column; gap: 2px; }
.photo-remove { padding: 4px 2px; font-size: 0.9rem; }

.photo-fieldset {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.photo-fieldset legend { font-weight: 600; font-size: 0.95rem; padding: 0 6px; }
.photo-hint { margin: 0; color: var(--muted); font-size: 0.95rem; }
.photo-hint strong { color: var(--text); }

.photo-upload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* The real file input is invisible but still focusable; its label is the button. */
.upload-button {
  position: relative;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.upload-button:hover { background: var(--accent); color: var(--accent-text); transform: translateY(-1px); }
.upload-button:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.upload-icon { flex: none; }
.upload-status { color: var(--muted); font-size: 0.9rem; }
.upload-status.has-files { color: var(--sage); font-weight: 600; }

.prose { white-space: pre-wrap; margin: 0 0 12px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: 0.85rem; }

/* ---------- Comments ---------- */

.comments h2 { display: flex; align-items: center; gap: 10px; }
.count {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--sage-soft);
  color: var(--sage);
  border-radius: 999px;
  padding: 2px 10px;
}

.comment-list { list-style: none; padding: 0; margin: 0 0 8px; }
.comment { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment:first-child { padding-top: 4px; }
.comment:last-child { border-bottom: none; }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 700;
}
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.comment-delete { margin-left: auto; }
.comment-delete .link-button { font-size: 0.85rem; }
.comment .prose { margin: 0; }

.comment-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Owner replies, nested under the guest comment they answer. */
.reply-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; }
.reply {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
}
.reply .prose { margin: 0; }
.avatar-owner { width: 32px; height: 32px; font-size: 0.9rem; background: var(--accent); color: var(--accent-text); }
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  padding: 2px 8px;
  align-self: center;
}

.reply-toggle { margin-top: 8px; }
.reply-toggle summary {
  display: inline-block;
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
}
.reply-toggle summary::-webkit-details-marker { display: none; }
.reply-toggle summary::before { content: "↩ "; }
.reply-toggle[open] summary { margin-bottom: 8px; }
.reply-form { display: flex; flex-direction: column; gap: 10px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Spam trap: kept out of sight and out of the tab order. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Flash messages ---------- */

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  margin: 0 0 20px;
}
.flash-error { border-color: var(--danger); color: var(--danger); }
.flash-success { border-color: var(--sage); background: var(--sage-soft); color: var(--text); }

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  body { font-size: 16px; }
  .site-header-inner { padding: 12px 16px; }
  .brand { font-size: 1.05rem; }
  main.page { padding: 20px 16px 40px; }
  .hero { padding: 20px 0 24px; }
  .hero h1 { font-size: 2rem; }
  .lede { font-size: 1.05rem; }
  .choices { grid-template-columns: 1fr; gap: 14px; }
  .choice { padding: 22px; }
  .card { padding: 20px; border-radius: 12px; margin-bottom: 16px; }
  h1 { font-size: 1.6rem; }
  .entry-card { padding: 14px; gap: 14px; }
  .entry-date { width: 56px; }
  .entry .prose { font-size: 1.05rem; }
  .owner-actions form { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
