/* ============================================================
   HobbyPlot styles — flexible theme system.
   Themes are sets of CSS custom properties on html[data-theme].
   Add a new theme by adding one more [data-theme="…"] block.
   ============================================================ */

/* ---------- Theme: Spring Meadow (default) ---------- */
/* Default theme = HobbyPlot brand palette: "Precision x Exchange" —
   sage green + deep loam brown on parchment, with a heritage rust accent. */
:root, [data-theme="meadow"] {
  --bg: #f2ecdd;
  --bg-card: #fbf7ee;
  --bg-soft: #e8dfc9;
  --text: #2c2620;
  --text-soft: #6b5443;
  --primary: #5f7d52;
  --primary-dark: #47603d;
  --primary-soft: #dde5d3;
  --accent: #b06a3b;
  --accent-soft: #f1e2d3;
  --danger: #b0432f;
  --danger-soft: #f3ddd6;
  --ok: #5f7d52;
  --border: #e0d6c2;
  --shadow: 0 2px 10px rgba(60, 45, 30, .10);
  --header-bg: linear-gradient(135deg, #47603d, #6b8a5b);
  --header-text: #ffffff;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --bg-img: url('../img/bg-meadow.svg');
  --card-alpha: rgba(251, 247, 238, .90);
}

/* ---------- Theme: Forest Night (dark, mossy) ---------- */
[data-theme="forest"] {
  --bg: #16211a;
  --bg-card: #1f2d24;
  --bg-soft: #263628;
  --text: #dce8d8;
  --text-soft: #93a68e;
  --primary: #6fbf73;
  --primary-dark: #55a05a;
  --primary-soft: #2b4630;
  --accent: #d9b96b;
  --accent-soft: #3a3625;
  --danger: #e07a6a;
  --danger-soft: #452723;
  --ok: #6fbf73;
  --border: #35473a;
  --shadow: 0 2px 12px rgba(0, 0, 0, .4);
  --header-bg: linear-gradient(135deg, #1d3323, #2c4a33);
  --header-text: #cfe6c8;
  --bg-img: url('../img/bg-forest.svg');
  --card-alpha: rgba(31, 45, 36, .86);
}

/* ---------- Theme: Terracotta Harvest (warm, earthy) ---------- */
[data-theme="terracotta"] {
  --bg: #faf3ec;
  --bg-card: #fffdf9;
  --bg-soft: #f3e5d7;
  --text: #46342a;
  --text-soft: #8c7362;
  --primary: #c0653a;
  --primary-dark: #a1502c;
  --primary-soft: #f4dfd2;
  --accent: #7d8f4c;
  --accent-soft: #e9edd6;
  --danger: #b03a3a;
  --danger-soft: #f5dddd;
  --ok: #7d8f4c;
  --border: #e6d4c2;
  --shadow: 0 2px 10px rgba(120, 80, 40, .1);
  --header-bg: linear-gradient(135deg, #b25a32, #cd7a49);
  --header-text: #fff6ee;
  --bg-img: url('../img/bg-terracotta.svg');
  --card-alpha: rgba(255, 253, 249, .88);
}

/* ---------- Theme: Lavender Field (calm, floral) ---------- */
[data-theme="lavender"] {
  --bg: #f5f3fa;
  --bg-card: #ffffff;
  --bg-soft: #ebe6f5;
  --text: #3a3350;
  --text-soft: #7d7492;
  --primary: #7b5ea7;
  --primary-dark: #634a8a;
  --primary-soft: #e6ddf3;
  --accent: #5e9a68;
  --accent-soft: #ddefe0;
  --danger: #b8506b;
  --danger-soft: #f5dde4;
  --ok: #5e9a68;
  --border: #ddd5ec;
  --shadow: 0 2px 10px rgba(90, 70, 140, .1);
  --header-bg: linear-gradient(135deg, #6a4f96, #8a6cb8);
  --header-text: #f6f2ff;
  --bg-img: url('../img/bg-lavender.svg');
  --card-alpha: rgba(255, 255, 255, .88);
}

/* ============================================================ base */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--bg);
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center bottom;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font, 'Segoe UI', system-ui, sans-serif);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* artistic SVG icons (sprite in partials/icons.jsp) */
.icon { width: 20px; height: 20px; vertical-align: -4px; flex: none; }
.icon.lg { width: 26px; height: 26px; }
.icon-circle {
  width: 54px; height: 54px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; margin-bottom: 8px;
  background: var(--primary-soft); color: var(--primary-dark);
}
.icon-circle .icon { width: 28px; height: 28px; vertical-align: 0; }
.icon-circle.accent { background: var(--accent-soft); color: var(--accent); }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
/* app layout: left sidebar (garden navigation) + main content */
.layout { flex: 1; display: grid; grid-template-columns: 225px 1fr; max-width: 1400px; width: 100%; margin: 0 auto; }
main { min-width: 0; padding: 20px 20px 48px; }

.sidebar {
  background: var(--card-alpha); border-right: 1px solid var(--border);
  padding: 14px 10px 24px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.side-nav a .icon { width: 19px; height: 19px; opacity: .8; }
.side-nav a.active .icon, .side-nav a:hover .icon { opacity: 1; }
.side-section {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-soft); padding: 14px 10px 4px;
}
.side-nav { display: flex; flex-direction: column; }
.side-nav a {
  display: flex; align-items: center; gap: 6px; justify-content: flex-start;
  color: var(--text); padding: 7px 10px; border-radius: 8px; font-size: .93rem;
}
.side-nav a:hover { background: var(--bg-soft); text-decoration: none; }
.side-nav a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.side-nav .lock {
  margin-left: auto; font-size: .68rem; background: var(--accent-soft); color: var(--text-soft);
  border-radius: 999px; padding: 1px 7px;
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none; border-bottom: 1px solid var(--border);
    display: flex; flex-wrap: wrap; gap: 2px; padding: 8px;
  }
  .side-section { display: none; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav a { padding: 5px 9px; font-size: .85rem; }
  .side-nav .lock { display: none; }
}

/* ============================================================ header / nav */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
  /* NOTE: no overflow:hidden here — it would clip header dropdowns such as the
     notifications panel (anchored in #notif-anchor). The decorative ::before
     background cannot paint outside the header box anyway, so nothing leaks. */
}
.site-header::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: url('../img/vine.svg') no-repeat right -20px bottom -6px / 480px auto;
  opacity: .35;
}
.header-inner { position: relative; }
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { font-size: 1.25rem; font-weight: 700; color: var(--header-text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
/* HobbyPlot logo mark: loam-brown "soil" tile so the cream sprout reads on the sage header */
.brand-mark { width: 30px; height: 30px; color: #4a3728; vertical-align: -8px;
  filter: drop-shadow(0 0 1px rgba(245,239,225,.9)) drop-shadow(0 1px 1px rgba(0,0,0,.22)); }
.main-nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.main-nav a {
  color: var(--header-text); opacity: .88; padding: 6px 10px; border-radius: 8px; font-size: .92rem;
}
.main-nav a:hover, .main-nav a.active { background: rgba(255,255,255,.16); opacity: 1; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; background: rgba(255,255,255,.14); color: var(--header-text);
  border: none; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: rgba(255,255,255,.25); }
.badge {
  position: absolute; top: -6px; right: -6px; background: var(--accent); color: #fff;
  font-size: .68rem; font-weight: 700; border-radius: 999px; padding: 1px 5px; min-width: 17px; text-align: center;
}
.theme-select {
  background: rgba(255,255,255,.14); color: var(--header-text); border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px; padding: 5px 6px; font-size: .85rem; cursor: pointer;
}
.theme-select option { color: #333; }

/* announcement banner */
.announce {
  background: var(--accent-soft); color: var(--text);
  border-bottom: 1px solid var(--border); padding: 8px 16px; text-align: center; font-size: .92rem;
}
.announce strong { color: var(--primary-dark); }
.maintenance { background: var(--danger-soft); }

/* ============================================================ cards / layout */
.card {
  background: var(--card-alpha); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--text-soft); font-size: .9rem; }
.small { font-size: .84rem; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.hidden { display: none !important; }

/* stat tiles */
.stat-tile {
  background: var(--card-alpha); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.stat-tile::after {
  content: ''; position: absolute; right: -14px; bottom: -16px; width: 74px; height: 74px;
  background: url('../img/leaf-mark.svg') no-repeat center / contain;
  opacity: .16; pointer-events: none;
}
.stat-tile .num { font-size: 1.7rem; font-weight: 700; color: var(--primary-dark); }
.stat-tile .lbl { color: var(--text-soft); font-size: .85rem; }

/* ============================================================ forms */
label { display: block; font-size: .88rem; color: var(--text-soft); margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card); color: var(--text); font-size: .95rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
.btn {
  display: inline-block; background: var(--primary); color: #fff; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; font-size: .95rem; font-weight: 600;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; font-size: .84rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.field-error { color: var(--danger); font-size: .85rem; margin-top: 4px; }
.form-msg { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: .92rem; }
.form-msg.error { background: var(--danger-soft); color: var(--danger); }
.form-msg.ok { background: var(--primary-soft); color: var(--primary-dark); }

/* ============================================================ tables */
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th {
  text-align: left; padding: 8px 10px; background: var(--bg-soft); color: var(--text-soft);
  font-weight: 600; border-bottom: 2px solid var(--border); white-space: nowrap;
}
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:hover td { background: var(--bg-soft); }
.table-wrap { overflow-x: auto; }

/* pills / tags */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--bg-soft); color: var(--text-soft); white-space: nowrap;
}
.pill.green { background: var(--primary-soft); color: var(--primary-dark); }
.pill.orange { background: var(--accent-soft); color: var(--accent); }
.pill.red { background: var(--danger-soft); color: var(--danger); }

/* ============================================================ notifications dropdown */
.notif-panel {
  position: absolute; right: 0; top: 42px; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 100;
}
.notif-item { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .88rem; cursor: pointer; }
.notif-item.unread { background: var(--primary-soft); }
.notif-item:hover { background: var(--bg-soft); }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }

/* ============================================================ toast */
#toast-box { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--primary-dark); color: #fff; padding: 10px 16px; border-radius: 8px;
  box-shadow: var(--shadow); font-size: .92rem; animation: fadein .2s;
}
.toast.error { background: var(--danger); }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ============================================================ modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(20, 30, 20, .5); z-index: 200;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 14px;
}
.modal {
  background: var(--bg-card); color: var(--text); border-radius: var(--radius);
  max-width: 560px; width: 100%; padding: 20px; box-shadow: var(--shadow); max-height: 86vh; overflow-y: auto;
}
.modal h3 { margin-top: 0; }

/* ============================================================ designer */
.designer-layout { display: grid; grid-template-columns: 250px 1fr; gap: 14px; }
@media (max-width: 800px) { .designer-layout { grid-template-columns: 1fr; } }
.palette { max-height: 70vh; overflow-y: auto; }
.palette-item {
  display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 6px; background: var(--bg-card); cursor: grab; font-size: .9rem;
}
.palette-item:active { cursor: grabbing; }
/* --- cm-scaled bed canvas (real spacing footprints) --- */
.bed-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.bed-canvas-wrap { overflow: auto; max-width: 100%; padding: 16px 4px 4px; }
.bed-area {
  position: relative; background: var(--bg-soft); border: 2px dashed var(--border);
  border-radius: var(--radius); user-select: none;
  background-image:
    linear-gradient(to right, rgba(120,120,120,.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120,120,120,.16) 1px, transparent 1px);
  background-position: 0 0;
}
.bed-area.circle { border-radius: 50%; }
.bed-area.dragover { outline: 2px solid var(--primary); outline-offset: 2px; }
.bed-area.split-mode { cursor: crosshair; }

.plant-token {
  position: absolute; box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,.10); line-height: 1; overflow: visible;
  transition: border-color .1s, box-shadow .1s;
}
.plant-token:active { cursor: grabbing; }
.plant-token:hover { z-index: 5; border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.plant-token.path {
  background: repeating-linear-gradient(45deg, var(--bg-soft), var(--bg-soft) 4px, var(--border) 4px, var(--border) 8px);
}
.plant-token.structure { background: var(--accent-soft); }
.plant-token.sprinkler {
  background: var(--bg-card); border: 1px solid rgba(43,127,255,.85); border-radius: 50%;
  padding: 0; box-shadow: 0 1px 3px rgba(0,0,0,.2); z-index: 3;
}
.plant-token.sprinkler .spr-icon { display: block; }
.sprinkler-coverage {
  position: absolute; border-radius: 50%; z-index: 0; pointer-events: none;
  background: rgba(56,142,255,.15);
  border: 1.5px solid rgba(56,142,255,.55);
}
/* indoor rack: seed trays */
.tray-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tray-card { display: flex; flex-direction: column; gap: 4px; }
.plant-token.warn { outline: 2px solid var(--danger); outline-offset: 1px; border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset, 0 2px 8px rgba(200,0,0,.18); }
.plant-token .tok-warn { display: block; margin-top: 2px; color: #ffb4b4; font-weight: 700; }
.warn-badge {
  position: absolute; top: -6px; left: -6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; z-index: 6; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.tok-suggest {
  position: absolute; bottom: -8px; left: -8px; width: 20px; height: 20px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%; background: var(--bg-card); cursor: pointer;
  font-size: .72rem; line-height: 1; display: none; align-items: center; justify-content: center; z-index: 6;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.plant-token:hover .tok-suggest { display: flex; }
.tok-suggest:hover { background: var(--primary); }
.companion-pop { max-width: 280px; }
.companion-pop .cp-head { padding: 8px 12px 6px; font-weight: 700; font-size: .8rem; border-bottom: 1px solid var(--border); }
.companion-pop button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.companion-pop .cp-note { color: var(--text-soft); font-size: .72rem; font-weight: 400; }
.plant-token .qty {
  position: absolute; bottom: -3px; right: -3px; font-size: .6rem; font-weight: 700;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 7px; padding: 0 3px; color: var(--text-soft);
}
.plant-token .tok-name {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 5px;
  background: var(--text); color: var(--bg-card); padding: 2px 7px; border-radius: 7px;
  font-size: .7rem; font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .12s; z-index: 8;
}
.plant-token:hover .tok-name { opacity: 1; }

.group-box {
  position: absolute; border: 2px dashed var(--primary); border-radius: 10px; pointer-events: none; z-index: 1;
  background: rgba(76,175,80,.06);
}
.group-box.active { border-color: var(--accent, #ff9800); background: rgba(76,175,80,.12); z-index: 3; }
.group-box > * { pointer-events: auto; }
.group-caption {
  position: absolute; top: -11px; left: 8px; background: var(--bg-card); border: 1px solid var(--primary);
  color: var(--primary); font-size: .68rem; font-weight: 700; padding: 0 6px; border-radius: 8px; white-space: nowrap;
  cursor: move; z-index: 4;
}
.group-resize {
  position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px;
  background: var(--primary); border: 2px solid var(--bg-card); border-radius: 4px;
  cursor: nwse-resize; z-index: 4;
}
.group-resize:hover { background: var(--accent, #ff9800); }
.align-guide { position: absolute; background: var(--accent, #ff9800); z-index: 9; pointer-events: none; opacity: .9; }
.align-guide.x { width: 2px; top: 0; bottom: 0; }
.align-guide.y { height: 2px; left: 0; right: 0; }
.split-rect {
  position: absolute; border: 2px dashed var(--accent, var(--primary));
  background: rgba(255,152,0,.14); z-index: 7; pointer-events: none;
}
.ctx-menu {
  position: fixed; z-index: 1000; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.20); min-width: 180px; overflow: hidden;
  font-size: .85rem; padding: 4px 0;
}
.ctx-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 14px; background: none; border: 0;
  cursor: pointer; color: var(--text); font-size: .85rem;
}
.ctx-menu button:hover { background: var(--bg-soft); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ============================================================ messaging */
.msg-layout { display: grid; grid-template-columns: 280px 1fr; gap: 14px; min-height: 60vh; }
@media (max-width: 760px) { .msg-layout { grid-template-columns: 1fr; } }
.conv-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.conv-item:hover, .conv-item.active { background: var(--bg-soft); }
.chat-box { display: flex; flex-direction: column; height: 60vh; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.bubble {
  max-width: 75%; padding: 8px 12px; border-radius: 14px; font-size: .92rem; white-space: pre-wrap; word-break: break-word;
}
.bubble.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: var(--bg-soft); border-bottom-left-radius: 4px; }
.bubble .meta { font-size: .7rem; opacity: .7; margin-top: 3px; }

/* ============================================================ forum */
.topic-row { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); align-items: center; }
.topic-row:hover { background: var(--bg-soft); }
.post {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--bg-card);
}
.post .post-meta { display: flex; justify-content: space-between; color: var(--text-soft); font-size: .84rem; margin-bottom: 8px; }
.post .body { white-space: pre-wrap; word-break: break-word; }
.like-btn { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; cursor: pointer; color: var(--text-soft); font-size: .84rem; }
.like-btn.liked { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }

/* ============================================================ market */
.listing-card { display: flex; flex-direction: column; }
.listing-img {
  height: 150px; background: var(--bg-soft); border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 2.4rem; overflow: hidden; margin-bottom: 8px;
}
.listing-img img { width: 100%; height: 100%; object-fit: cover; }
.price { font-size: 1.15rem; font-weight: 700; color: var(--primary-dark); }
.stars { color: var(--accent); letter-spacing: 1px; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.gallery figcaption { font-size: .78rem; color: var(--text-soft); padding-top: 2px; }

/* timeline (journal) */
.timeline { border-left: 3px solid var(--primary-soft); margin-left: 8px; padding-left: 18px; }
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -25px; top: 5px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--primary); border: 2px solid var(--bg);
}

/* gantt-ish schedule */
.gantt-row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: center; margin-bottom: 6px; font-size: .86rem; }
.gantt-track { position: relative; height: 22px; background: var(--bg-soft); border-radius: 6px; }
.gantt-bar { position: absolute; top: 3px; height: 16px; border-radius: 5px; }
.gantt-bar.indoor { background: var(--accent); opacity: .85; }
.gantt-bar.grow { background: var(--primary); opacity: .8; }
.gantt-bar.harvest { background: var(--danger); opacity: .75; }

/* simple bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.bar-chart .bar {
  flex: 1; background: var(--primary); border-radius: 4px 4px 0 0; min-width: 14px; position: relative; opacity: .85;
}
.bar-chart .bar span {
  position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: .66rem; color: var(--text-soft);
}

/* subscription plans */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan-card {
  background: var(--card-alpha); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; box-shadow: var(--shadow); position: relative;
  overflow: hidden; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.plan-card::after {
  content: ''; position: absolute; right: -20px; top: -20px; width: 110px; height: 110px;
  background: url('../img/leaf-mark.svg') no-repeat center / contain;
  opacity: .1; transform: scaleX(-1); pointer-events: none;
}
.plan-card.featured { border-color: var(--primary); }
.plan-card.current { border-color: var(--accent); }
.plan-flag {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700;
  padding: 3px 12px; border-radius: 999px; white-space: nowrap;
}
.plan-card.current .plan-flag { background: var(--accent); }
.plan-name { font-size: 1.25rem; font-weight: 700; margin: 4px 0; }
.plan-price { font-size: 2rem; font-weight: 800; color: var(--primary-dark); }
.plan-price span { font-size: .85rem; font-weight: 400; color: var(--text-soft); }
/* Billing period toggle (Monthly / Yearly) */
.bill-toggle { display: inline-flex; gap: 4px; margin-top: 14px; padding: 4px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; }
.bill-opt { border: none; background: transparent; color: var(--text-soft); cursor: pointer;
  padding: 7px 16px; border-radius: 999px; font-size: .9rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.bill-opt.active { background: var(--bg-card); color: var(--primary-dark); box-shadow: var(--shadow); }
.save-badge { font-size: .68rem; font-weight: 700; background: var(--accent-soft); color: var(--accent);
  padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.side-nav .lock { white-space: nowrap; }
.plan-feats { list-style: none; padding: 0; margin: 14px 0; flex: 1; }
.plan-feats li { padding: 5px 0; font-size: .92rem; border-bottom: 1px dashed var(--border); }
.plan-feats li.off { color: var(--text-soft); opacity: .6; text-decoration: line-through; }

/* footer */
.site-footer {
  border-top: 1px solid var(--border); color: var(--text-soft); font-size: .84rem;
  padding: 18px 16px; text-align: center; background: var(--bg-card);
}

/* landing hero */
.hero {
  text-align: center; padding: 56px 28px 40px; margin-bottom: 20px;
  background: var(--card-alpha); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  position: relative; overflow: hidden;
}
.hero::before, .hero::after {
  content: ''; position: absolute; bottom: -24px; width: 150px; height: 150px;
  background: url('../img/leaf-mark.svg') no-repeat center / contain; opacity: .12; pointer-events: none;
}
.hero::before { left: -30px; transform: rotate(20deg); }
.hero::after { right: -30px; transform: scaleX(-1) rotate(20deg); }
.hero h1 { font-size: 2.3rem; margin-bottom: 8px; }
.hero p { color: var(--text-soft); font-size: 1.1rem; max-width: 640px; margin: 0 auto 24px; }
.feature-emoji { font-size: 2rem; }

/* footer & auth cards pick up the glass look too */
.site-footer { background: var(--card-alpha); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

@media (max-width: 640px) {
  .main-nav { font-size: .85rem; }
  main { padding: 12px 10px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ============================================================ legal / terms */
.legal-doc { max-width: 820px; margin: 24px auto; padding: 32px 34px; line-height: 1.65; }
.legal-doc h1 { margin-bottom: 2px; }
.legal-doc h2 { margin-top: 28px; font-size: 1.12rem; color: var(--primary-dark); }
.legal-doc ul { padding-left: 22px; }
.legal-doc li { margin: 6px 0; }
.legal-callout { background: var(--accent-soft); border-left: 4px solid var(--accent);
  padding: 12px 16px; border-radius: 8px; margin: 12px 0; }
/* T&C acceptance row on the register form */
.terms-accept { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 4px; font-size: .9rem; }
.terms-accept input { width: auto; margin-top: 3px; flex: none; }

/* ============================================================ feature tour (/features) */
.feat-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.feat-nav a { padding: 6px 13px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  background: var(--card-alpha); border: 1px solid var(--border); color: var(--text); }
.feat-nav a:hover { background: var(--bg-soft); text-decoration: none; }
.feat-nav a.active { background: var(--primary); border-color: var(--primary); color: var(--bg-card); }

.feat-hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 34px; align-items: center;
  margin: 8px 0 34px; }
.feat-hero.stack { grid-template-columns: 1fr; text-align: center; }
.feat-hero.stack .feat-lede { margin-left: auto; margin-right: auto; }
.feat-hero.stack .feat-cta-row { justify-content: center; }
.feat-eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.feat-hero h1 { font-size: 2.3rem; line-height: 1.15; margin: 8px 0 12px; }
.feat-lede { font-size: 1.1rem; color: var(--text-soft); max-width: 58ch; margin: 0 0 18px; }
.feat-cta-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.feat-cta-row .btn { padding: 11px 20px; font-size: .98rem; }

/* screenshot in a light "browser window" frame; click to enlarge */
.feat-shot { margin: 0; border-radius: 12px; overflow: hidden; background: var(--bg-card);
  border: 1px solid var(--border); box-shadow: 0 14px 34px rgba(40, 32, 22, .16), 0 2px 6px rgba(40, 32, 22, .08); }
.feat-shot::before { content: ''; display: block; height: 22px; background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  background-image: radial-gradient(circle, #d9756a 4px, transparent 4.5px), radial-gradient(circle, #e6b454 4px, transparent 4.5px),
    radial-gradient(circle, #7fae6b 4px, transparent 4.5px);
  background-size: 14px 22px; background-repeat: no-repeat; background-position: 10px 0, 26px 0, 42px 0; }
.feat-shot img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.feat-shot figcaption { font-size: .82rem; color: var(--text-soft); padding: 8px 12px; border-top: 1px solid var(--border); }
.feat-shot.bare::before { display: none; }

.feat-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 34px; align-items: center;
  padding: 30px 0; border-top: 1px solid var(--border); }
.feat-row.flip > .feat-copy { order: 2; }
.feat-row.narrow-shot { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.feat-row.narrow-shot.flip { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.feat-copy h2 { font-size: 1.5rem; margin: 6px 0 10px; }
.feat-copy p { color: var(--text-soft); }
.feat-points { list-style: none; padding: 0; margin: 12px 0 0; }
.feat-points li { position: relative; padding: 5px 0 5px 26px; }
.feat-points li::before { content: ''; position: absolute; left: 4px; top: 12px; width: 10px; height: 10px;
  border-radius: 3px; background: var(--primary); transform: rotate(45deg); }

.plan-badge { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); }
.plan-badge.paid { background: var(--accent-soft); color: var(--accent); }
a.plan-badge:hover { text-decoration: none; filter: brightness(.97); }

.feat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.feat-card { display: flex; flex-direction: column; background: var(--card-alpha); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; color: var(--text); transition: transform .15s, box-shadow .15s; }
.feat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(40, 32, 22, .13); text-decoration: none; }
.feat-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top left; display: block;
  border-bottom: 1px solid var(--border); }
.feat-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.feat-card h3 { margin: 0; font-size: 1.08rem; }
.feat-card p { margin: 0; color: var(--text-soft); font-size: .9rem; flex: 1; }
.feat-card .more { font-weight: 600; font-size: .88rem; color: var(--primary-dark); }

.feat-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: step; }
.feat-step { background: var(--card-alpha); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feat-step::before { counter-increment: step; content: counter(step); display: inline-flex; width: 30px; height: 30px;
  border-radius: 50%; align-items: center; justify-content: center; font-weight: 800; background: var(--primary); color: var(--bg-card);
  margin-bottom: 8px; }
.feat-step h3 { margin: 0 0 4px; font-size: 1.02rem; }
.feat-step p { margin: 0; font-size: .9rem; color: var(--text-soft); }

.feat-section-title { font-size: 1.5rem; margin: 40px 0 6px; }
.feat-section-sub { color: var(--text-soft); margin: 0 0 18px; }
.feat-note { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 12px 16px; font-size: .92rem; margin: 18px 0 0; }
.feat-final { text-align: center; background: var(--header-bg); color: #fff; border-radius: 16px;
  padding: 34px 24px; margin: 40px 0 10px; }
.feat-final h2 { margin: 0 0 8px; font-size: 1.7rem; color: #fff; }
.feat-final p { margin: 0 auto 18px; opacity: .9; max-width: 56ch; }
.feat-final .btn { background: #fff; color: var(--primary-dark); }
.feat-final .btn.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); }

.feat-lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(20, 16, 10, .88); display: flex;
  align-items: center; justify-content: center; padding: 48px 64px 24px; cursor: zoom-out; }
.feat-lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.feat-lightbox .lb-img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5); cursor: default; background: #fff; }
.feat-lightbox .lb-cap { color: #f1ead9; font-size: .9rem; margin-top: 10px; text-align: center; max-width: 80ch; }
.feat-lightbox button { position: absolute; border: none; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .14);
  border-radius: 999px; font-size: 1.4rem; line-height: 1; width: 44px; height: 44px; }
.feat-lightbox button:hover, .feat-lightbox button:focus-visible { background: rgba(255, 255, 255, .28); outline: none; }
.feat-lightbox .lb-close { top: 12px; right: 14px; }
.feat-lightbox .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); font-size: 2rem; }
.feat-lightbox .lb-next { right: 12px; top: 50%; transform: translateY(-50%); font-size: 2rem; }
@media (max-width: 600px) { .feat-lightbox { padding: 56px 8px 16px; } .feat-lightbox .lb-prev, .feat-lightbox .lb-next { top: auto; bottom: 14px; transform: none; } }

@media (max-width: 980px) {
  .feat-hero, .feat-row, .feat-row.narrow-shot, .feat-row.narrow-shot.flip { grid-template-columns: 1fr; gap: 18px; }
  .feat-row.flip > .feat-copy { order: 0; }
  .feat-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feat-hero h1 { font-size: 1.8rem; }
}
@media (max-width: 520px) { .feat-steps { grid-template-columns: 1fr; } }
/* Screenshot previews are height-capped so the whole preview fits the visible window; click opens it full size.
   Each figure sets --w/--h (the image's pixel size), so the width follows from the height cap and tall
   screenshots shrink proportionally instead of being cropped. width:100% keeps the figure from collapsing
   in one-column (phone) layouts; the floor of 320px keeps previews usable on very short windows. */
.feat-shot { --shot-max-h: 56vh; position: relative; width: 100%; margin-inline: auto;
  max-width: calc(max(var(--shot-max-h), 320px) * var(--w, 16) / var(--h, 10)); }
.feat-hero .feat-shot { --shot-max-h: 60vh; }
.feat-shot::after { content: '⤢  Click to enlarge'; position: absolute; right: 10px; bottom: 10px;
  font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; pointer-events: none;
  background: rgba(34, 28, 20, .74); color: #fff; opacity: 0; transition: opacity .15s; }
.feat-shot:hover::after, .feat-shot:focus-within::after { opacity: 1; }
@media (hover: none) { .feat-shot::after { content: '⤢'; opacity: .85; padding: 3px 9px; } }
.feat-shot img:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.feat-card .plan-badge { align-self: flex-start; }
.feat-plans { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.header-actions .icon-btn { white-space: nowrap; }

/* Plant page: the photo sits inside the plant card, above the Latin name, and fills the card width. */
.plant-photo { margin: 0 0 10px; }
.plant-photo img { display: block; width: 100%; height: auto; max-height: 320px;
  object-fit: contain; border-radius: 8px; }
.plant-photo figcaption { margin-top: 6px; }
/* Encyclopedia cards: a uniform thumbnail band keeps the grid aligned when only some plants have a photo.
   No background colour — while a lazy image loads the space stays clean instead of showing a grey block. */
.card .plant-thumb { display: block; width: 100%; height: 150px; object-fit: cover; border-radius: 8px;
  margin-bottom: 8px; }
/* The whole encyclopedia tile is the link to the plant page (keyboard/middle-click friendly). */
a.plant-card { display: block; text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
a.plant-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .12); }
a.plant-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a.plant-card h3 { margin: 0; }
a.plant-card .plant-more { display: inline-block; margin-top: 8px; }
