/* Pip & Pot app, artled Gouache (Q13: the site's tokens, type and shapes).
   Mobile-first. Light default; dark theme from the same tokens (U9). */
@font-face { font-family: "Young Serif"; src: url("../../../_shared/fonts/young-serif-400.woff2?v=2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../../../_shared/fonts/nunito-var.woff2?v=2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --bg: #EEF1E4;
  --surface: #FAFBF5;
  --bark: #2B241C;      /* 13.37:1 on bg */
  --muted: #5B5447;     /* 6.54:1 on bg, 7.20:1 on surface */
  --leaf: #2F6B3A; --on-leaf: #FAFBF5; /* 6.14:1 on leaf */
  --leaf-text: #2F6B3A;
  --terracotta: #E07A55; --terracotta-text: #A8432A;
  --terracotta-dark: #E28A64;  /* dark theme link: 6.20:1 on bg, 5.56:1 on surface */
  --butter: #F2C94C;
  --line: rgba(43, 36, 28, .13); --line-2: rgba(43, 36, 28, .3);
  --glass: rgba(250, 251, 245, .72);
  --focus: #A8432A;
  --link: #2F6B3A;
  --shadow: 0 10px 30px -12px rgba(43, 36, 28, .25);
  --radius-card: 24px; --radius-input: 12px;
  --display: "Young Serif", Georgia, serif;
  --body: "Nunito", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1E2219; --surface: #262B20;
  --bark: #EEF1E4;     /* 14.13:1 on bg, 12.66:1 on surface */
  --muted: #B4B8A6;    /* 7.97:1 on bg, 7.14:1 on surface */
  --leaf: #8CC98F; --on-leaf: #1E2219;  /* 8.37:1 both ways */
  --leaf-text: #8CC98F;
  --terracotta: #D96A45; --terracotta-text: #E28A64;
  --butter: #F2C94C;
  --line: rgba(238, 241, 228, .15); --line-2: rgba(238, 241, 228, .32);
  --glass: rgba(30, 34, 25, .72);
  --focus: #E28A64;
  --link: #E28A64;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--bark); font: 400 1.0625rem/1.6 var(--body); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 400; line-height: 1.08; }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 3px; }
a[href], button, summary, label[for], select, input { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 90; background: var(--surface); color: var(--bark); border: 1px solid var(--line-2); padding: 0 18px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 999px; font-weight: 800; text-decoration: none; }
.skip:focus { top: 12px; }
.mist { color: var(--muted); } .small { font-size: .9rem; }
.ph { font-size: 1.15em; vertical-align: -0.15em; }
.num, .t-num { font-variant-numeric: tabular-nums; }

.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--display); font-size: 1.2rem; color: var(--bark); min-height: 44px; }
.logo svg { flex: none; }
.logo-drop { fill: var(--terracotta); }
.logo-sill { stroke: var(--leaf); stroke-width: 2.6; stroke-linecap: round; }

/* App bar: the only glass in the app (P7). */
.appbar { position: sticky; top: 0; z-index: 50; background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid var(--line); }
.appbar-in { max-width: 1000px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 12px; min-height: 62px; }
.appbar-right { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.sample-label { font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.app-note { padding: 9px 16px; text-align: center; font-size: .82rem; color: var(--muted); border-bottom: 1px solid var(--line); }

/* Painted banner cut from the sill painting (app-harmony bridge).
   Its own scrim keeps it readable in both themes. */
.banner { position: relative; overflow: hidden; height: 200px; }
.banner img { width: 100%; height: 100%; object-fit: cover; object-position: 62% 42%; }
.banner::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(250, 251, 245, .38), rgba(250, 251, 245, .86) 82%, var(--bg)); }
[data-theme="dark"] .banner::after { background: linear-gradient(180deg, rgba(30, 34, 25, .42), rgba(30, 34, 25, .86) 82%, var(--bg)); }
.banner-in { position: absolute; z-index: 1; inset: auto 20px 16px; display: grid; gap: 2px; }
.banner-in .kicker { color: var(--terracotta-text); font-weight: 800; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; }
[data-theme="dark"] .banner-in .kicker { color: var(--terracotta-dark); }
.banner-h { font-size: clamp(1.7rem, 3.2vw, 2.4rem); color: #2B241C; }
[data-theme="dark"] .banner-h { color: #EEF1E4; }
.banner-status { font-size: .82rem; font-weight: 800; color: #2B241C; }
[data-theme="dark"] .banner-status { color: #B4B8A6; }

.app-main { max-width: 720px; margin: 0 auto; padding: 22px 16px 104px; }

/* Screens */
.screen { display: none; }
.screen.is-active { display: block; }
.screen > h2 { font-size: 1.8rem; margin-bottom: 2px; }
.screen-sub { color: var(--muted); margin-bottom: 16px; }
.date-chip { display: inline-flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; font-size: .88rem; font-weight: 800; margin-bottom: 14px; }
.list-label { font-family: var(--display); font-size: 1.15rem; margin: 18px 0 10px; }
.list-label:first-of-type { margin-top: 0; }

/* Plant cards */
.plant-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow); }
.plant-band { height: 12px; }
.band-leaf { background: var(--leaf); }
[data-theme="dark"] .band-leaf { background: #4C7A50; }
.band-butter { background: var(--butter); }
.band-terracotta { background: var(--terracotta); }
.card-body { padding: 14px 18px 16px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.plant-card h3 { font-size: 1.3rem; }
.who-chip { display: inline-flex; gap: 6px; align-items: center; font-size: .84rem; font-weight: 800; color: var(--muted); }
.who-chip .ph { color: var(--terracotta-text); }
.next-line { margin-top: 6px; font-weight: 700; }
.next-line b { font-variant-numeric: tabular-nums; }

/* Status pills: state by icon plus word, colours from the tokens. */
.status { display: inline-flex; gap: 6px; align-items: center; font-size: .86rem; font-weight: 800; border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 12px; background: var(--bg); white-space: nowrap; }
.status.due { background: var(--butter); color: #2B241C; border-color: rgba(43, 36, 28, .3); }
.status.ok { background: var(--bg); color: var(--leaf-text); }
.status.late { background: var(--terracotta); color: #2B241C; border-color: rgba(43, 36, 28, .3); }
[data-theme="dark"] .status.due, [data-theme="dark"] .status.late { color: #1E2219; border-color: rgba(30, 34, 25, .3); }

/* Watered buttons: 56px primaries (U2, H2). */
.water-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; font: 800 1.15rem var(--body); background: var(--leaf); color: var(--on-leaf); border: 1px solid transparent; border-radius: 18px; cursor: pointer; transition: transform 160ms var(--ease), filter 160ms var(--ease); margin-top: 12px; }
.water-btn:hover { filter: brightness(1.08); }
.water-btn:active { transform: translateY(1px); }
.water-btn .ph { font-size: 1.35rem; }
.undo-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; font-size: .92rem; flex-wrap: wrap; }
.undo-btn { background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 18px; font: 800 .92rem var(--body); color: var(--bark); cursor: pointer; min-height: 44px; }
.undo-btn:active { transform: translateY(1px); }
.done-note { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-top: 10px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.done-note .ph { color: var(--leaf-text); }

/* Empty states teach (U8). */
.empty-state { text-align: center; padding: 34px 20px 42px; border: 2px dashed var(--line-2); border-radius: var(--radius-card); margin-top: 10px; }
.empty-state h3 { font-size: 1.35rem; }
.empty-state p { color: var(--muted); margin: 0 auto 16px; max-width: 26em; }
.empty-art { width: 180px; height: 84px; border-radius: 16px; margin: 0 auto 14px; object-fit: cover; object-position: 62% 42%; }

/* Drop progress (plant detail). */
.drop-track { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.drop-shape { width: 32px; height: 40px; background: var(--bg); border: 2px solid var(--line-2); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; position: relative; overflow: hidden; flex: none; }
.drop-shape .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--leaf); transition: height 300ms var(--ease); }
.drop-shape.filled .fill { height: 100%; }
.drop-legend { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }

.detail-meta { display: grid; gap: 6px 18px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 8px; color: var(--muted); font-size: .92rem; }
.detail-meta div { display: flex; gap: 8px; align-items: center; }
.detail-meta .ph { color: var(--terracotta-text); flex: none; }

.schedule-rows { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.schedule-rows th, .schedule-rows td { text-align: left; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.schedule-rows th { font: 800 .76rem var(--body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.schedule-rows td.r { text-align: right; }
.schedule-rows tr:last-child th, .schedule-rows tr:last-child td { border-bottom: 0; }

.back-link { display: inline-flex; gap: 8px; align-items: center; color: var(--link); text-decoration: none; font-weight: 800; min-height: 44px; margin-bottom: 4px; }
.back-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Family */
.family-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 14px 18px; margin-bottom: 12px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.family-card .avatar { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 1.15rem; color: var(--on-leaf); background: var(--leaf); flex: none; }
.family-card .avatar.v-t { background: var(--terracotta); color: #2B241C; }
.family-card .avatar.v-b { background: var(--butter); color: #2B241C; }
.family-card .who-line { flex: 1; min-width: 0; }
.family-card h3 { font-size: 1.15rem; }
.family-card .plant-count { color: var(--muted); font-size: .88rem; }

/* Settings */
.settings-group { border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); padding: 2px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.set-label { font-weight: 800; }
.set-note { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.switch { position: relative; width: 62px; height: 34px; flex: none; background: var(--bg); border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-2); transition: transform 200ms var(--ease); }
.switch[aria-checked="true"] { background: var(--leaf); }
.switch[aria-checked="true"]::after { transform: translateX(28px); }
.reset-btn { width: 100%; min-height: 48px; font: 800 1rem var(--body); background: var(--bg); color: var(--bark); border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; }
.reset-btn:active { transform: translateY(1px); }
.settings-foot { margin-top: 18px; color: var(--muted); font-size: .88rem; }

/* Tab bar: bottom on phones, rail on desktop (U1: current tab marked). */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 6px 4px; border-radius: 16px; color: var(--muted); text-decoration: none; font-weight: 800; font-size: .74rem; justify-content: center; }
.tabbar a .ph { font-size: 1.4rem; }
.tabbar a:hover { color: var(--bark); }
.tabbar a[aria-current="page"] { color: var(--bark); background: var(--bg); }
.tabbar a[aria-current="page"]::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--leaf); margin-top: 3px; }
.tabbar a[aria-current="page"] .ph { color: var(--leaf-text); }

/* Dialog (U12: focus moves in, is trapped, returns). */
dialog.sheet { border: 1px solid var(--line-2); border-radius: var(--radius-card); background: var(--surface); color: var(--bark); padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 60px var(--shadow); }
dialog.sheet::backdrop { background: rgba(43, 36, 28, .5); }
[data-theme="dark"] dialog.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.sheet-head h2 { font-size: 1.45rem; }
.icon-btn { background: var(--bg); border: 1px solid var(--line-2); border-radius: 999px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--bark); font-size: 1.25rem; cursor: pointer; }
.icon-btn:active { transform: translateY(1px); }
dialog.sheet form { padding: 12px 22px 22px; }
dialog.sheet .field { margin-bottom: 13px; }
dialog.sheet label { display: block; font-weight: 800; font-size: .9rem; margin-bottom: 6px; }
dialog.sheet select, dialog.sheet input { width: 100%; font: 600 1rem var(--body); color: var(--bark); background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-input); padding: 10px 12px; min-height: 44px; }
dialog.sheet .field .help { font-size: .82rem; color: var(--muted); margin: 6px 0 0; }
.sheet-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.preview-line { color: var(--muted); font-size: .92rem; margin: 4px 0 0; font-weight: 800; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--line-2); font: 800 1rem var(--body); text-decoration: none; color: var(--bark); background: var(--surface); cursor: pointer; white-space: nowrap; }
.btn-leaf { background: var(--leaf); color: var(--on-leaf); border-color: transparent; }
.btn-leaf:hover { filter: brightness(1.08); }
.btn-leaf:active { transform: translateY(1px); }

/* Toast */
.toast { position: fixed; bottom: 88px; left: 50%; transform: translate(-50%, 16px); background: var(--bark); color: var(--bg); padding: 10px 20px; border-radius: 999px; font-weight: 800; font-size: .92rem; opacity: 0; pointer-events: none; transition: transform 200ms var(--ease), opacity 200ms var(--ease); z-index: 60; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Embed mode (the site's phone frame). */
body.embed .sample-label, body.embed .app-note, body.embed .banner { display: none; }
body.embed .app-main { padding-top: 18px; }

/* Desktop: side rail. */
@media (min-width: 900px) {
  .app-shell { display: flex; flex-direction: row; min-height: 100vh; }
  .tabbar { position: sticky; top: 0; bottom: auto; width: 210px; height: 100vh; border-top: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: flex-start; gap: 6px; padding: 96px 14px 20px; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 52px; padding: 10px 14px; font-size: .95rem; }
  .tabbar a[aria-current="page"]::after { margin: 0 0 0 auto; }
  .appbar { position: fixed; left: 210px; right: 0; z-index: 45; }
  .app-main { max-width: 760px; padding: 24px 32px 60px; }
  .app-work { flex: 1; min-width: 0; padding-top: 62px; }
  .app-shell { padding-top: 0; }
  .appbar-in { max-width: 760px; padding: 0 32px; }
  body.embed .appbar { left: 0; }
  body.embed .tabbar { width: 100%; height: auto; position: fixed; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 6px 8px; top: auto; bottom: 0; }
  body.embed .tabbar a { flex-direction: column; font-size: .74rem; min-height: 52px; padding: 6px 4px; }
  body.embed .tabbar a[aria-current="page"]::after { margin: 3px 0 0; }
  body.embed .app-main { padding: 18px 16px 104px; }
}

/* Reduced motion: transitions off, drops fill instantly. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .drop-shape .fill { transition: none; }
}
