/* Traditions Tracker.
   Every colour and font is a token on :root, so the look can be changed in
   one place. Phone first; the page never scrolls sideways. Light only. */

:root {
  /* Foothills: pine green on a cool, pale ground, with prairie gold for
     anything unsure. Chosen by Troy, 2026-09-29. */
  color-scheme: light;

  --bg: #f1f4f2;
  --card: #ffffff;
  --ink: #1b2a2a;
  --muted: #5c6b6a;
  --line: #dce3df;
  --accent: #1f5c4a;
  --accent-ink: #ffffff;
  --link: #1f5c4a;

  --ok-bg: #dcebe4;
  --ok-ink: #174637;
  --unsure-bg: #f7e8cc;
  --unsure-ink: #6e4a0e;
  --stale-bg: #f6dad5;
  --stale-ink: #7a2318;
  --error: #a3261a;

  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font-body);
  --radius: 12px;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--font-body);
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

a { color: var(--link); text-underline-offset: 3px; }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.25; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; margin: 32px 0 12px; color: var(--muted); font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
h3 a { color: inherit; text-decoration: none; }
h3 a:hover { text-decoration: underline; }
p { margin: 0; }

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 64px;
}

.pagehead { margin: 16px 0 20px; }
.pagehead p { margin-top: 4px; }
.notes { margin-top: 12px; white-space: pre-line; }

.muted { color: var(--muted); }
.small-text { font-size: 0.85rem; }
.empty { color: var(--muted); padding: 4px 0; }

/* ---- navigation ---- */

.topnav {
  display: flex;
  gap: 4px;
  align-items: center;
  max-width: 640px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-wrap: normal;
  white-space: nowrap;
}
.topnav a,
.topnav .linklike {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.topnav a.current { color: var(--ink); font-weight: 600; background: var(--card); }
.topnav .brand { padding: 4px 6px 0 0; display: inline-flex; }
.topnav .brand img { border-radius: 7px; }
.brand-mark { display: block; margin: 0 0 14px; border-radius: 13px; }
.topnav .away { margin-left: auto; border: 1px solid var(--line); color: var(--ink); font-size: 0.95rem; }
.topnav a.gear { display: inline-flex; align-items: center; padding-left: 10px; padding-right: 10px; }
.topnav a.gear svg { display: block; }

/* ---- cards ---- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 12px;
}
.card > * + * { margin-top: 6px; }
.card-slim { padding: 12px 16px; }
.card-unconfirmed { border-left: 4px solid var(--unsure-ink); }
.card-stale { border-left: 4px solid var(--stale-ink); }
.card-closed { opacity: 1; background: transparent; }

.dateline { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.date { font-weight: 600; }
.date-missing { font-weight: 400; font-style: italic; }
.away { color: var(--muted); font-size: 0.9rem; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: nowrap;
}
.chip-confirmed { background: var(--ok-bg); color: var(--ok-ink); }
.chip-unconfirmed { background: var(--unsure-bg); color: var(--unsure-ink); }
.chip-stale { background: var(--stale-bg); color: var(--stale-ink); }

.late { color: var(--unsure-ink); font-size: 0.9rem; }
.error { color: var(--error); font-size: 0.95rem; }
.status { color: var(--muted); font-size: 0.9rem; }

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

label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
textarea { min-height: 0; resize: vertical; }
input[type="checkbox"] { width: auto; min-height: 0; margin: 0 6px 0 0; }

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  min-height: 46px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: default; }
button.quiet { color: var(--ink); background: transparent; border-color: var(--line); }
button.small { min-height: 40px; padding: 8px 14px; font-size: 0.92rem; }
button.linklike {
  min-height: 0;
  background: none;
  border: 0;
  font-weight: 400;
  cursor: pointer;
}

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.field { margin: 0 0 14px; }
.field-pair { display: flex; gap: 12px; }
.field-pair .field { flex: 1; min-width: 0; }
.field-pair .field.grow { flex: 3; }
.help { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.check { display: flex; align-items: center; color: var(--ink); margin: 0; }

.inline-form,
.ladder-form,
.event-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.inline-form label { margin-top: 10px; }
.inline-form label:first-child { margin-top: 0; }

fieldset.ladder-step {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
fieldset.ladder-step legend { padding: 0 6px; color: var(--muted); font-size: 0.85rem; }

/* ---- idea capture ---- */

.idea {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.idea-row { display: flex; gap: 8px; }
.idea-row input { flex: 1; min-width: 0; }
.idea .status { margin-top: 8px; }

/* ---- tradition page ---- */

.ladder { margin: 0; padding: 0; list-style: none; }
.ladder li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ladder li:last-child { border-bottom: 0; }
.lead { display: inline-block; min-width: 118px; color: var(--muted); font-size: 0.9rem; }

.steps { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--line); }
.step {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.step-done .step-title,
.step-dropped .step-title { color: var(--muted); text-decoration: line-through; }
.step button { flex: none; }

.budget { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.budget label { margin: 0; }
.budget input { width: 130px; }

.panel {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 16px;
}
.panel summary { padding: 14px 0; cursor: pointer; font-weight: 600; }
.panel[open] { padding-bottom: 16px; }
.panel .card { background: var(--bg); }

.manage { margin-top: 32px; }

/* ---- sign in ---- */

body.centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
body.centered .card { width: 100%; max-width: 380px; padding: 28px 24px; }
body.centered h1 { margin-bottom: 20px; font-size: 1.5rem; }
body.centered label { margin-top: 14px; }
body.centered button { width: 100%; margin-top: 20px; }

@media (max-width: 420px) {
  .field-pair { flex-direction: column; gap: 0; }
  .lead { display: block; min-width: 0; }
}

/* ---- recaps, proposals, year, ideas ---- */

.card-recap { border-left: 4px solid var(--accent); }
.recap-form label { margin-top: 10px; }

.lasttime {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 0.92rem;
}
.lasttime-head { color: var(--muted); font-size: 0.8rem; margin-bottom: 2px; }

.proposal {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--unsure-ink);
  border-radius: 10px;
}
.proposal > * + * { margin-top: 6px; }
.proposal-head { font-weight: 600; font-size: 0.92rem; }
blockquote {
  margin: 8px 0;
  padding: 0 0 0 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-style: italic;
}

a.button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.notices { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }
.notices p + p { margin-top: 4px; }
.notices .row-actions { margin-top: 10px; }
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.segmented { display: flex; gap: 8px; margin-top: 12px; }

.yearlist { list-style: none; margin: 0; padding: 0; }
.yearrow {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.yearrow-date { flex: none; width: 108px; font-weight: 600; font-size: 0.95rem; }
.yearrow-main { flex: 1; min-width: 0; }
.yearrow-main a { color: inherit; font-weight: 600; text-decoration: none; }
.yearrow-main a:hover { text-decoration: underline; }
.yearrow-holiday .yearrow-date,
.yearrow-holiday .yearrow-main { color: var(--muted); font-weight: 400; }
.yearrow-holiday .chip { background: transparent; color: var(--muted); padding-left: 0; }
.yearrow-past { opacity: 0.62; }

ul.plain { margin: 0; padding-left: 20px; }
ul.plain li { margin: 0 0 6px; }
.idea-text { font-size: 1.05rem; margin-bottom: 10px; }

@media (max-width: 420px) {
  /* On a phone the bar sits under the status bar: keep clear of it, and give the
     buttons more height so they are easy to hit. */
  .topnav { gap: 2px; padding: calc(26px + env(safe-area-inset-top, 0px)) 10px 14px; }
  .topnav a, .topnav .linklike { padding: 11px 9px; font-size: 0.92rem; }
  .yearrow { flex-direction: column; gap: 2px; }
  .yearrow-date { width: auto; }
}

/* ---- desktop: use the width ---- */

.tiles { display: grid; gap: 16px; grid-template-columns: 1fr; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  min-width: 0;
}
.tile h2 { margin: 0 0 10px; }
.tile h2 a { color: inherit; text-decoration: none; }
.tile h2 a:hover { text-decoration: underline; }
.tile-lead { font-weight: 600; margin-bottom: 8px; }
.tile-list { list-style: none; margin: 0; padding: 0; }
.tile-list li { padding: 7px 0; border-bottom: 1px solid var(--line); line-height: 1.4; }
.tile-list li:last-child { border-bottom: 0; }
.tile-title { font-weight: 600; }
.tile-title a { color: inherit; text-decoration: none; }
.tile-title a:hover { text-decoration: underline; }
.tile-list-dates li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.tile-date { flex: none; width: 96px; color: var(--muted); font-size: 0.9rem; }
.idea-tile { padding: 0; border: 0; background: transparent; margin-bottom: 12px; }

.step-name { color: var(--muted); }
.forgot { margin-top: 14px; text-align: center; }
.card-h { margin: 0 0 12px; color: var(--ink); font-size: 1.1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pagehead-search { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search input { min-height: 44px; }
.search-results {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  margin: 6px 0 0;
  padding: 6px 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(27, 42, 42, 0.08);
}
.search-results li { padding: 8px 12px; }
.search-results a { font-weight: 600; text-decoration: none; color: inherit; }
.search-results a:hover { text-decoration: underline; }

h2.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
}
h2.divider::before, h2.divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.past { opacity: 0.85; }

@media (min-width: 900px) {
  .page-wide { max-width: 1120px; }
  .topnav { max-width: 1120px; }

  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-today { grid-row: span 2; }
  .tile-coming { grid-row: span 2; }

  .columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; align-items: start; }
  .col-side h2:first-child { margin-top: 32px; }

  #months, #past { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
  #months section, #past section { break-inside: avoid; }

  #list, #birthdays, #retired { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  #list .card, #birthdays .card, #retired .card { margin: 0; }
}

@media (min-width: 1200px) {
  #months, #past { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- what a tradition involves ---- */

.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
details.involves { margin-top: 8px; }
details.involves summary { cursor: pointer; color: var(--muted); font-size: 0.92rem; }
details.involves .notes { margin-top: 6px; }
