/* Advent Log: editorial, phone-first.
   Phone is the base layout; the two-column board turns on at 900px and up. */

:root {
  --ivory: #f6efe2;
  --paper: #fbf7ef;
  --ink: #2b1d18;
  --muted: #6f5f55;
  --cranberry: #7a1e2e;
  --cranberry-soft: #f5e8e6;
  --evergreen: #1d4a3a;
  --evergreen-soft: #e8efe5;
  --brass: #a98a4f;
  --rule: #d9cbb2;
  --danger: #8a2a1f;

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
}

/* Yule hearth: charred oak, candle-gold rules, ember-lit cranberry and evergreen.
   Flat colour only, no gradients. Same variable names as the ivory theme. */
[data-theme="hearth"] {
  color-scheme: dark;
  --ivory: #1a120e;
  --paper: #241a15;
  --ink: #efe3cf;
  --muted: #a89686;
  --cranberry: #d9707f;
  --cranberry-soft: #2f1c1f;
  --evergreen: #86b89a;
  --evergreen-soft: #1c2a22;
  --brass: #c9a25c;
  --rule: #3e2f27;
  --danger: #e38a7a;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.15; }
em { font-style: italic; }
a { color: var(--ink); }
small { color: var(--muted); }
p { margin: 0; }

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

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 3px double var(--brass);
  background: var(--ivory);
}
.masthead-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-style: italic;
  text-decoration: none;
  color: var(--cranberry);
}
.season {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.season { display: none; }
form.inline { display: inline; margin: 0; }

.themes { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.theme-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
/* Two-position switch: the thumb slides under the selected option. */
.switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 210px;
  height: 44px;
  padding: 3px;
  border: 1px solid var(--brass);
  border-radius: 999px;
  background: var(--paper);
}
.switch .thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: var(--ink);
  transition: left 0.2s ease;
}
.switch.at-hearth .thumb { left: 50%; }
.switch-opt {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
  white-space: nowrap;
}
.switch-opt.on { color: var(--ivory); }
@media (prefers-reduced-motion: reduce) {
  .switch .thumb { transition: none; }
}
@media (max-width: 480px) {
  .masthead-inner { flex-wrap: wrap; row-gap: 0.4rem; }
  .masthead form.inline { margin-left: auto; }
  .themes { order: 3; width: 100%; margin-left: 0; }
  .switch { flex: 1; min-width: 0; }
}

.textbtn {
  min-height: 44px;
  padding: 0 0.25rem;
  background: none;
  border: 0;
  font: inherit;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* ---------- flash ---------- */

.flash {
  border-top: 1px solid var(--brass);
  border-bottom: 1px solid var(--brass);
  padding: 0.6rem 0;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

/* ---------- intro + stats ---------- */

.intro h1 {
  font-size: 2.4rem;
  letter-spacing: -0.01em;
  margin: 0.25rem 0 1.25rem;
}
.intro h1 em { color: var(--cranberry); }

.stats { display: grid; gap: 1.25rem; margin-bottom: 1.75rem; }
.stat {
  border-top: 1px solid var(--rule);
  padding-top: 0.75rem;
}
.stat h2 {
  font-size: 1.35rem;
  font-style: italic;
  margin-bottom: 0.5rem;
}
.stat-hot h2 { color: var(--cranberry); }
.stat-tea h2 { color: var(--evergreen); }
.stat h2 span { font-family: var(--sans); font-style: normal; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-left: 0.3rem; }
.stat dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 0.6rem;
}
.stat dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat dd { margin: 0.1rem 0 0; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat dd small { font-size: 0.8rem; }
.stat p { font-size: 0.93rem; color: var(--muted); margin-top: 0.25rem; }
.stat p strong { color: var(--ink); font-weight: 600; }
.score { font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- sort chips ---------- */

.sortbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.sortlabel {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-right: 0.25rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}
.chip.on { border-color: var(--ink); font-weight: 600; }
.chip-hot.on { background: var(--cranberry); border-color: var(--cranberry); color: var(--ivory); }
.chip-tea.on { background: var(--evergreen); border-color: var(--evergreen); color: var(--ivory); }

/* ---------- the board (one row per day) ---------- */

.board-head { display: none; }

.day {
  border-bottom: 1px solid var(--rule);
  padding: 1rem 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.daycell {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.daynum {
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: lining-nums;
}
.dow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.pick {
  --accent: var(--cranberry);
  border-left: 3px solid var(--accent);
  padding: 0.1rem 0 0.1rem 0.9rem;
}
.pick-tea { --accent: var(--evergreen); }
.who {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.pick-name {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.brand {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
}
.scores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
  margin: 0.25rem 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.scores b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.desc { font-size: 0.97rem; color: var(--ink); overflow-wrap: anywhere; }
.note { font-size: 0.9rem; color: var(--muted); margin-top: 0.3rem; overflow-wrap: anywhere; }
.note span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.35rem;
}
.empty { font-style: italic; color: var(--muted); }
.who .when { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }

.actions {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.35rem;
}
.action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.25rem;
  margin: 0 -0.25rem;
  background: none;
  border: 0;
  font: inherit;
  font-size: 0.92rem;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.action-danger { color: var(--danger); }

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

.form-page { max-width: 620px; }
.form-page h1 { font-size: 2rem; margin: 0.25rem 0 0.75rem; }
.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }

.entry-form,
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1rem;
}
.entry-form label,
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}
input, select, textarea {
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  font-weight: 400;
  color: var(--ink);
  min-height: 48px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--paper);
  width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr; gap: 1.1rem; }

.btn {
  min-height: 52px;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  color: var(--ivory);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-hot { background: var(--cranberry); }
.btn-tea { background: var(--evergreen); }

.delete-form { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.delete-form button {
  min-height: 44px;
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  font: inherit;
  padding: 0 1rem;
  cursor: pointer;
}

/* ---------- desktop: two people side by side ---------- */

@media (min-width: 900px) {
  body { font-size: 16px; }
  main { padding: 2rem 2rem 4rem; }
  .masthead-inner { padding: 1.1rem 2rem; gap: 1.5rem; }
  .season { display: inline; }
  .wordmark { font-size: 1.5rem; }

  .intro h1 { font-size: 3.6rem; margin-bottom: 1.75rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 2.5rem; }
  .stat h2 { font-size: 1.6rem; }
  .stat dd { font-size: 1.25rem; }

  .board-head,
  .day {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
  }
  .board-head {
    border-bottom: 1px solid var(--ink);
    padding: 0.7rem 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
  }
  .board-head .hot-text { color: var(--cranberry); padding-left: 1.05rem; }
  .board-head .tea-text { color: var(--evergreen); padding-left: 1.05rem; }

  .day {
    flex-direction: row;
    align-items: flex-start;
    padding: 1.25rem 0 1.4rem;
  }
  .day .daycell {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding-top: 0.1rem;
  }
  .daynum { font-size: 2.6rem; }
  .pick { padding-top: 0.2rem; padding-bottom: 0.2rem; }
  .pick-name { font-size: 1.4rem; }
  .combined.solo .board-head,
  .combined.solo .day { grid-template-columns: 110px minmax(0, 1fr); }
}

@media (max-width: 380px) {
  .stat dl { grid-template-columns: 1fr 1fr; }
}
