/**
 * Seed A Day — styles
 * -------------------
 * Mobile-first, no framework. Styling follows the approved draft (seeds.html):
 * teal brand, gradient header banner, coloured band accents on chips and
 * cards, soft shadows, segmented controls, and the capture-style add rows.
 */

/* ── Tokens ────────────────────────────────────────────────────────────── */
:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --ink: #1c2523;
  --muted: #6b7975;
  --line: #e4e9e7;
  --brand: #0f766e;
  --brand-soft: #d7efeb;
  --danger: #a4483d;
  --shadow: 0 1px 3px rgba(20, 40, 35, 0.08), 0 8px 24px rgba(20, 40, 35, 0.06);

  /* band colours (times & moods) */
  --green: #22a06b;  --green-s: #e2f5ec;
  --yellow: #d99b16; --yellow-s: #fbf0d8;
  --orange: #e0742e; --orange-s: #fbe8da;
  --blue: #2f7ec4;   --blue-s: #dcecf9;
  --purple: #8257c9; --purple-s: #ece2f8;
  --rest: #3aa66f;   --rest-s: #e2f5ec;

  --radius: 16px;
  --radius-sm: 12px;
  --nav-height: 64px;
  --max-width: 560px;
}

/* ── Base ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.05rem; font-weight: 700; }   /* view titles, draft h2.section */
h2 { font-size: 0.98rem; font-weight: 700; }
h3 { font-size: 0.95rem; font-weight: 700; }
p { margin: 0 0 0.75rem; }

button { font-family: inherit; cursor: pointer; }

/* Default buttons: draft .btn.primary */
button {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--brand);
  color: #fff;
  transition: 0.15s;
}
button:active { transform: scale(0.97); }

.btn-secondary { background: var(--brand-soft); color: var(--brand); }
.btn-ghost {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
}
.btn-danger { background: var(--danger); color: #fff; }
.grow { flex: 1; }

input, textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 0.9rem;
  width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--brand); }
input[type="checkbox"] { width: auto; }

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.muted { color: var(--muted); font-size: 0.88rem; }
.small { font-size: 0.83rem; }

/* ── App shell & header banner ────────────────────────────────────────── */
.app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 1rem);
}

.app-header {
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px 14px;
  background: linear-gradient(160deg, #0f766e, #12897f);
  color: #fff;
  border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow);
}
.app-header .brand { display: flex; align-items: center; gap: 8px; }
.app-header .brand h1 { margin-right: auto; }
.app-header h1 {
  font-size: 1.32rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
}
.app-header .seed { font-size: 1.5rem; line-height: 1; }
.app-header .tagline { margin: 6px 0 0; font-size: 0.82rem; opacity: 0.9; color: #fff; }

/* Global header buttons (Help + Notes), top-right of the banner */
.header-btn {
  background: rgba(255, 255, 255, 0.16);
  border: none;
  border-radius: 10px;
  padding: 7px;
  color: #fff;
  display: flex;
  text-decoration: none;
}
.header-btn svg { width: 20px; height: 20px; }

/* The view fills the space between header and nav, so footers pushed with
   margin-top:auto really sit at the bottom. */
.view {
  padding: 16px;
  animation: fade 0.25s ease;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.view > * { flex-shrink: 0; }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.lead { font-size: 0.9rem; color: var(--muted); margin: 0 0 16px; }

/* ── Bottom nav ────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  padding: 8px 6px calc(env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 50;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 4px;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--brand); }

/* ── Chips (time / mood) ──────────────────────────────────────────────── */
/* Each picker row fits on ONE line: chips share the row equally, no wrap. */
.chip-row { display: flex; flex-wrap: nowrap; gap: 6px; margin-bottom: 8px; }
h1 + .chip-row { margin-top: 14px; }
.chip {
  flex: 1;
  min-width: 0;
  justify-content: center;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 8px 3px;
  border-radius: 999px;
  /* Scales with screen width so every row stays on one line: down to
     0.66rem on narrow phones, capped at 0.8rem on wide screens. */
  font-size: clamp(0.66rem, 3vw, 0.8rem);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: 0.15s;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chip.selected { border-color: transparent; color: #fff; background: var(--brand); }
.chip.selected.green { background: var(--green); }
.chip.selected.yellow { background: var(--yellow); }
.chip.selected.orange { background: var(--orange); }
.chip.selected.blue { background: var(--blue); }
.chip.selected.purple { background: var(--purple); }
.chip.selected.rest { background: var(--rest); }

/* ── Segmented control (Actions tabs) ─────────────────────────────────── */
.segmented {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
}
.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}
.segmented button.active { background: var(--brand-soft); color: var(--brand); }
.section-tabs { margin: 1rem 0 1.25rem; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--line);
}
.card.green { border-left-color: var(--green); }
.card.yellow { border-left-color: var(--yellow); }
.card.orange { border-left-color: var(--orange); }
.card.blue { border-left-color: var(--blue); }
.card.purple { border-left-color: var(--purple); }
.card.rest { border-left-color: var(--rest); }
.card.brand { border-left-color: var(--brand); }

.task-card h3 { margin: 0 0 0.25rem; font-size: 0.98rem; }
.task-card .desc, .task-card .muted { font-size: 0.86rem; }

.meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
}
.tag.brand { background: var(--brand-soft); color: var(--brand); }

.task-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
}
.hide-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 0;
}

/* link-style quiet buttons (re-roll, own idea, keep-going) */
.draw-extras { display: flex; justify-content: center; gap: 18px; }
.draw-extras button, .link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 0 0;
}
.link-btn { text-decoration: underline; }

.empty, .done-state { text-align: center; color: var(--muted); padding: 38px 20px; }
.done-state h2 { color: var(--ink); }
.btn-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--brand);
  font-weight: 700;
  font-size: 0.85rem;
}

.committed-card { border-left-color: var(--brand); }

.intro-card { border-left-color: var(--brand); }
.intro-card a { color: var(--brand); font-weight: 700; }

.do-hint { text-align: center; margin-top: 14px; }
.do-hint a { color: var(--brand); font-weight: 600; }

.note-form {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
}
.note-form label { display: block; margin-bottom: 0.4rem; }

/* ── Home ─────────────────────────────────────────────────────────────── */
.quote {
  margin: 8px 0 24px;
  padding: 1.4rem 1.2rem;
  text-align: center;
  border-left-color: var(--brand);
}
.quote blockquote {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.55;
  font-style: italic;
}
.quote figcaption { margin-top: 0.75rem; color: var(--muted); font-size: 0.85rem; }

.cta {
  display: block;
  text-align: center;
  text-decoration: none;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: 0.15s;
}
.cta:active { transform: scale(0.98); }
.cta-sub { display: block; margin-top: 0.35rem; font-size: 0.82rem; font-weight: 400; opacity: 0.9; }

.home { display: flex; flex-direction: column; flex: 1; }
.site-footer { margin-top: auto; padding-top: 3rem; text-align: center; }
.site-footer a { color: var(--muted); }
.site-footer .footer-links { margin-top: 4px; }
.site-footer .footer-links a { margin: 0 6px; }

/* ── Add rows (capture style) ─────────────────────────────────────────── */
.add-row { display: flex; gap: 8px; margin-bottom: 14px; align-items: stretch; }
.add-row input, .add-row textarea { flex: 1; resize: vertical; }
.add-row button {
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-size: 1.2rem;
  font-weight: 700;
}

/* Notes — draft note style */
.note-card {
  border-left: none;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 9px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.note-card .note-body { flex: 1; }
.note-card .note-text { font-size: 0.88rem; white-space: pre-wrap; margin: 0; }
.note-card .note-date { font-size: 0.7rem; color: var(--muted); margin-top: 4px; }
.note-card .btn-ghost {
  background: none; border: none;
  color: var(--muted); font-size: 1.05rem; padding: 2px; flex-shrink: 0;
}

/* Explanation cards + user-task forms (Actions) */
.explain { background: var(--brand-soft); border-left-color: var(--brand); box-shadow: none; }
.explain p { margin: 0; color: var(--ink); }

.action-form label, .action-form legend { display: block; margin: 0.6rem 0 0.25rem; font-weight: 600; }
.action-form fieldset {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 0.75rem 0 0;
  padding: 0.4rem 0.8rem 0.8rem;
}
.checkbox-row { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; }
.check-label { display: flex; align-items: center; gap: 0.45rem; margin: 0.75rem 0 0.25rem; cursor: pointer; }
.checkbox-row .check-label { margin: 0; font-weight: 500; }
.action-form .task-actions { margin-top: 1rem; }
.form-error { color: var(--danger); margin: 0.5rem 0 0; font-weight: 600; }
.action-card .meta { margin-bottom: 2px; }

/* ── Actions: Standard catalogue accordion ────────────────────────────── */
.cat-group {
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
  overflow: hidden;
}
.cat-group summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.cat-group summary::-webkit-details-marker { display: none; }
.cat-group summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 0.15s;
}
.cat-group[open] summary::after { transform: rotate(180deg); }
.cat-heading { font-weight: 700; font-size: 0.88rem; flex: 1; }
.cat-count { flex-shrink: 0; }

.cat-list { list-style: none; margin: 0; padding: 0 14px 8px; }
.cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.cat-text { flex: 1; }
.cat-title { font-size: 0.86rem; font-weight: 600; }
.cat-item.is-hidden .cat-title { text-decoration: line-through; color: var(--muted); }
.cat-item.is-hidden .cat-text .muted { text-decoration: line-through; }
.cat-item button { flex-shrink: 0; }

/* Notes modal */
.notes-modal { display: flex; flex-direction: column; max-height: 80vh; }
.notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.notes-head h3 { margin: 0; }
.notes-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.notes-scroll::-webkit-scrollbar { width: 6px; }
.notes-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.notes-modal .note-card { box-shadow: none; border: 1px solid var(--line); }

/* ── Modal dialogs (hide warning, reset) ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(28, 37, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.modal { max-width: 420px; width: 100%; margin: 0; border-left: 5px solid var(--brand); }

/* ── Storage warning banner (§10a) ────────────────────────────────────── */
.storage-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--yellow-s);
  border-bottom: 1px solid #eed9ae;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}
.storage-banner .spacer { flex: 1; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: 0.3s;
  z-index: 100;
  max-width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Progress (stats & panels, draft style) ───────────────────────────── */
.statgrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.stat .l {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 3px;
}
.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel h3 { margin: 0 0 14px; font-size: 0.9rem; }

/* Heatmap: columns = weeks, rows = Mon→Sun */
.heatmap-wrap { display: flex; gap: 8px; }
.hm-days {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
  gap: 4px;
}
.hm-days span { display: flex; align-items: center; }
.heatmap {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.hm-cell { aspect-ratio: 1; border-radius: 4px; background: var(--bg); }
/* Active day: green square with the little sprout planted in it —
   same glyph as the Do nav icon, inlined as a data URI. */
.hm-cell.active {
  background-color: var(--green);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21v-8m0 0c0-4-2.5-6.5-7-6.5C5 11 7.5 13 12 13Zm0-2c0-4.5 2.5-7 7-7 0 5-2.5 7-7 7Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 80%;
}
.hm-cell.future { background: transparent; border: 1px dashed var(--line); }
.hm-cell.today { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Done journal */
.journal-entry {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.journal-entry:last-of-type { border-bottom: none; }
.j-date {
  flex-shrink: 0;
  width: 84px;
  font-size: 0.72rem;
  color: var(--muted);
  padding-top: 2px;
}
.j-title { font-size: 0.88rem; font-weight: 600; }
.j-note { font-size: 0.82rem; color: var(--muted); margin-top: 2px; white-space: pre-wrap; }
.journal .linkbtn { display: block; margin: 10px auto 0; }

.linkbtn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  padding: 4px;
}

/* ── Housekeeping (Actions page bottom) ───────────────────────────────── */
/* Danger zone: small, quiet, red, at the very bottom */
.danger-zone {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.reset-btn {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
}
