/* =========================================================
   Moss · plant companion
   Warm tactile palette · mobile-first · accessible
   ========================================================= */

:root {
  /* Palette — warm, tactile, optimistic */
  --bg: #F1E6CF;
  --bg-deep: #E8DAB9;
  --paper: #FBF3DF;
  --paper-2: #F6EBCF;
  --ink: #2A2418;
  --ink-soft: #5C513F;
  --ink-mute: #8A7C66;

  /* Greens */
  --moss: #6B7F4A;
  --moss-deep: #3E5A2E;
  --moss-soft: #C2CC9D;
  --sage: #97A577;

  /* Warm accents */
  --clay: #C97B5A;
  --clay-deep: #9C5436;
  --sun: #E8B547;
  --butter: #F4D88A;
  --rose: #D98477;
  --sky: #8FA0AB;
  --berry: #7E4F66;

  /* Status */
  --overdue: var(--clay-deep);
  --today: #B8842C;
  --tomorrow: var(--sage);
  --done: var(--moss-deep);

  /* Shape */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;
  --r-pebble: 28px 22px 30px 24px / 22px 30px 22px 28px;

  /* Type */
  --serif: "Iowan Old Style", "Georgia", "Palatino Linotype", "Book Antiqua", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* Motion */
  --t-fast: 140ms;
  --t-med: 260ms;
  --t-slow: 480ms;
  --ease: cubic-bezier(.2,.7,.3,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Paper-grain backdrop built from inline SVG noise */
body {
  background-image:
    radial-gradient(circle at 18% 22%, rgba(201, 123, 90, 0.08), transparent 38%),
    radial-gradient(circle at 82% 8%, rgba(232, 181, 71, 0.10), transparent 36%),
    radial-gradient(circle at 60% 92%, rgba(107, 127, 74, 0.10), transparent 42%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.16  0 0 0 0 0.12  0 0 0 0 0.06  0 0 0 0.045 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-attachment: fixed;
}

::selection { background: var(--moss-soft); color: var(--ink); }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

a { color: var(--moss-deep); }

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  z-index: 100;
  background: var(--moss-deep);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* =================== PAGE LAYOUT =================== */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 18px 80px;
}

/* =================== TOPBAR =================== */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 6px 4px 18px;
  border-bottom: 1.5px dashed rgba(60, 50, 30, 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 22px;
  color: var(--moss-deep);
}

.brand__mark {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 1px 0 rgba(60,50,30,0.1));
}

.brand__name { font-size: 1.1em; }

.brand__dot {
  color: var(--ink-mute);
  font-size: 1em;
  margin: 0 -2px;
}

.brand__tag {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 400;
  font-size: 14px;
  color: var(--ink-mute);
}

.topbar__meta { padding: 0 4px; }
.hello {
  margin: 6px 0 2px;
  font-family: var(--serif);
  font-size: clamp(28px, 7.5vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 600;
}
.hello::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 6px;
  vertical-align: 0.18em;
  background: var(--clay);
  border-radius: 50%;
  box-shadow: -16px 4px 0 var(--sun), -32px -2px 0 var(--moss-soft);
}
.date {
  margin: 4px 0 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.loc { color: var(--ink-mute); font-style: italic; }

/* =================== RHYTHM =================== */
.rhythm {
  margin: 22px 0 14px;
  padding: 18px 18px 14px;
  background: var(--paper);
  border-radius: var(--r-xl);
  box-shadow:
    0 1px 0 rgba(60,50,30,0.04),
    0 12px 28px -22px rgba(60,50,30,0.4);
  position: relative;
  overflow: hidden;
}
.rhythm::before {
  content: "";
  position: absolute;
  top: -24px; right: -30px;
  width: 110px; height: 110px;
  background: radial-gradient(circle at center, rgba(232, 181, 71, 0.28), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.rhythm__head { margin-bottom: 10px; }
.rhythm__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--ink);
}
.rhythm__sub {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--ink-mute);
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 16px 0 6px;
  padding: 0;
  list-style: none;
}

.bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bar__day {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}

.bar__pip {
  --h: 50%;
  position: relative;
  width: 100%;
  height: 88px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bar__pip::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: var(--h);
  background:
    linear-gradient(to top, var(--moss) 0%, var(--moss-soft) 100%);
  border-radius: 14px 14px 22px 22px / 12px 12px 30px 30px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.06);
  transition: height var(--t-slow) var(--ease);
}

.bar__pip::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 8px;
  bottom: 6px;
  background-image:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,0.35), transparent 40%);
  pointer-events: none;
  border-radius: 14px;
}

.bar__count {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 6px;
  background: var(--paper);
  border: 1.4px solid var(--moss);
  border-radius: 999px;
  padding: 2px 7px;
  line-height: 1;
}

/* Today gets a sun */
.bar--today .bar__pip::before {
  background: linear-gradient(to top, var(--clay) 0%, var(--butter) 100%);
}
.bar--today .bar__count {
  border-color: var(--clay-deep);
  background: var(--butter);
}
.bar--today .bar__day {
  color: var(--clay-deep);
}

.rhythm__caption {
  margin: 8px 4px 0;
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
}

/* =================== SPLIT (mobile single, desktop 2-col) =================== */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 18px;
}

/* =================== QUEUE =================== */
.queue__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 10px;
}
.queue__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.queue__count {
  margin: 0;
  font-size: 13px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

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

/* ---------- Card ---------- */
.card {
  position: relative;
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 14px 14px 12px;
  box-shadow:
    0 1px 0 rgba(60,50,30,0.04),
    0 10px 22px -16px rgba(60,50,30,0.35);
  transition: transform var(--t-med) var(--ease), background var(--t-med) var(--ease);
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -2px -2px auto;
  width: 22px; height: 22px;
  background: var(--moss-soft);
  border-radius: 50% 0 var(--r-lg) 50%;
  opacity: 0.7;
  pointer-events: none;
}

.card[data-state="done"] { background: linear-gradient(180deg, #E9E6CC 0%, var(--paper) 100%); }
.card[data-state="done"]::after { background: var(--moss); opacity: 0.85; }
.card[data-state="snoozed"] { background: linear-gradient(180deg, #ECDDC4 0%, var(--paper) 100%); }
.card[data-state="snoozed"]::after { background: var(--sky); opacity: 0.85; }

.card[data-selected="true"] {
  outline: 2px solid var(--moss-deep);
  outline-offset: 3px;
}

.card__btn {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 4px 4px 4px 4px;
  text-align: left;
  border-radius: var(--r-md);
}
.card__btn:focus-visible {
  outline: 2.5px dashed var(--moss-deep);
  outline-offset: 3px;
}

.card__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1.5px solid rgba(60,50,30,0.08);
  position: relative;
}
.card__avatar svg { width: 100%; height: 100%; display: block; }

.card__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.card__name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.card__species {
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.2;
}
.card__loc {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-mute);
}

.card__due {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 13px;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(60,50,30,0.06);
  color: var(--ink-soft);
  white-space: nowrap;
  border: 1.4px solid transparent;
}
.card[data-urgency="4"] .card__due {
  background: rgba(156, 84, 54, 0.14);
  color: var(--overdue);
  border-color: rgba(156, 84, 54, 0.3);
}
.card[data-urgency="2"] .card__due,
.card[data-urgency="1"] .card__due {
  background: rgba(184, 132, 44, 0.16);
  color: var(--today);
  border-color: rgba(184, 132, 44, 0.32);
}
.card[data-urgency="0"] .card__due {
  background: rgba(151, 165, 119, 0.18);
  color: #54633B;
  border-color: rgba(151, 165, 119, 0.42);
}

/* Card actions */
.card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1.4px dashed rgba(60,50,30,0.14);
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  border: 1.5px solid transparent;
}
.act svg { width: 16px; height: 16px; }

.act--water {
  background: var(--moss-deep);
  color: var(--paper);
  border-color: var(--moss-deep);
}
.act--water:hover { background: #4F6E3B; }
.act--water:focus-visible { outline: 2.5px dashed var(--ink); outline-offset: 3px; }

.act--snooze {
  background: transparent;
  color: var(--ink-soft);
  border-color: rgba(60,50,30,0.22);
}
.act--snooze:hover { background: rgba(60,50,30,0.06); color: var(--ink); }
.act--snooze:focus-visible { outline: 2.5px dashed var(--ink); outline-offset: 3px; }

.act:active { transform: scale(0.96); }

.card__status {
  margin-left: auto;
  font-size: 13px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--moss-deep);
  display: none;
}
.card[data-state="done"] .card__status { display: inline; }
.card[data-state="snoozed"] .card__status { display: inline; color: var(--sky); }

/* Water/snooze pulse on action */
@keyframes pulse-good {
  0%   { box-shadow: 0 0 0 0 rgba(62, 90, 46, 0.4); }
  100% { box-shadow: 0 0 0 16px rgba(62, 90, 46, 0); }
}
.card.is-watered { animation: pulse-good var(--t-slow) var(--ease); }

/* ---------- All-done ---------- */
.alldone {
  text-align: center;
  padding: 24px 18px;
  background: var(--paper);
  border-radius: var(--r-xl);
  box-shadow:
    0 1px 0 rgba(60,50,30,0.04),
    0 12px 28px -22px rgba(60,50,30,0.4);
  margin-top: 8px;
}
.alldone[hidden] { display: none; }
.alldone__art {
  width: 160px;
  height: auto;
  margin: 0 auto 6px;
  display: block;
}
.alldone__title {
  margin: 6px 0 4px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.alldone__sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
  max-width: 36ch;
  margin-inline: auto;
}

/* =================== DETAIL PANEL =================== */
.detail {
  background: var(--paper);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow:
    0 1px 0 rgba(60,50,30,0.04),
    0 14px 32px -22px rgba(60,50,30,0.4);
  position: sticky;
  top: 16px;
  align-self: start;
}

.detail__hero {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 18px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1.5px dashed rgba(60,50,30,0.18);
}

.detail__avatar {
  width: 110px;
  height: 110px;
  background: var(--paper-2);
  border-radius: var(--r-lg);
  border: 1.5px solid rgba(60,50,30,0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.detail__avatar svg { width: 100%; height: 100%; display: block; }

.detail__name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.detail__species {
  margin: 4px 0 8px;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 15px;
}
.detail__loc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-mute);
  padding: 4px 10px;
  background: rgba(60,50,30,0.06);
  border-radius: 999px;
}
.detail__loc svg { width: 13px; height: 13px; }

.detail__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}

.fact {
  background: var(--paper-2);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
}
.fact__icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--moss-deep);
}
.fact__icon svg { width: 16px; height: 16px; }
.fact__label {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  font-weight: 600;
}
.fact__value {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-top: 1px;
}

.detail__history {
  margin-top: 20px;
}
.detail__history h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 9px; top: 4px; bottom: 4px;
  width: 2px;
  background: linear-gradient(to bottom, var(--moss) 0%, transparent 100%);
  border-radius: 2px;
}
.timeline li {
  position: relative;
  padding: 6px 0 6px 28px;
  font-size: 14px;
  color: var(--ink-soft);
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 4px; top: 11px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--moss);
}
.timeline li:first-child::before { background: var(--clay); border-color: var(--clay-deep); }
.timeline time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
  display: inline-block;
  min-width: 6em;
  margin-right: 8px;
}

.detail__actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.detail__note {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--butter);
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: #6B4F1A;
  font-style: italic;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.detail__note::before {
  content: "";
  flex: 0 0 auto;
  width: 10px; height: 10px;
  background: var(--clay-deep);
  border-radius: 50%;
  margin-top: 6px;
}

/* =================== FOOT =================== */
.foot {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1.5px dashed rgba(60,50,30,0.18);
  text-align: center;
}
.foot__line {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  font-style: italic;
}
.foot__small {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

/* =================== TOAST =================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 18px 30px -10px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
  z-index: 60;
  max-width: calc(100vw - 36px);
}
.toast[hidden] { display: none; }
.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast__icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; }
.toast__icon svg { width: 100%; height: 100%; }
.toast__msg { font-weight: 500; }
.toast__undo {
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.toast__undo:hover { background: var(--butter); }
.toast__undo:focus-visible { outline: 2px solid var(--butter); outline-offset: 2px; }

/* =================== RESPONSIVE — DESKTOP =================== */
@media (min-width: 860px) {
  .page { padding: 36px 32px 60px; }

  .topbar {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 36px;
  }
  .topbar__meta { text-align: right; }
  .hello { text-align: right; }

  .rhythm { padding: 22px 24px; }

  .split {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.45fr);
    gap: 24px;
    margin-top: 26px;
    align-items: start;
  }

  .queue__title { font-size: 26px; }

  /* On desktop, hide in-card actions; show via detail panel */
  .card__actions { display: none; }
  .card { padding: 16px 16px 14px; }

  .detail { padding: 26px; }
  .detail__hero { grid-template-columns: 130px 1fr; }
  .detail__avatar { width: 130px; height: 130px; }
  .detail__name { font-size: 36px; }

  .detail__grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
  .detail__name { font-size: 40px; }
}

/* =================== REDUCED MOTION =================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .hello::after { animation: none !important; }
}

/* =================== High contrast =================== */
@media (prefers-contrast: more) {
  :root {
    --ink: #1B1610;
    --ink-soft: #2A2418;
  }
  .card, .detail, .rhythm, .alldone { border: 1px solid rgba(0,0,0,0.4); }
}