/* Stocks & Green brand: Main Green #4F8823, Background #EFF7EF, Accent Dark Purple #540663,
   Assistant (Google Fonts) for text, Jenna Sue (self-hosted) for handwritten touches. */
@font-face {
  font-family: "Jenna Sue";
  src: url("/assets/fonts/JennaSue.woff2") format("woff2");
  font-display: swap;
}

:root {
  --green: #4F8823;
  --green-dark: #3d6a1b;
  --paper: #EFF7EF;
  --surface: #ffffff;
  --purple: #540663;
  --ink: #1f2a1c;
  --muted: #55644f;
  --line: #d3e3d0;
  --sow-in: #d9952b;
  --sow-out: #4F8823;
  --flower: #8d3a9c;
  --harvest: #8a5a2b;
  --cal-empty: #e0ebdf;
  --radius: 14px;
  --hand: "Jenna Sue", "Segoe Script", cursive;
  --sans: "Assistant", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  padding-bottom: env(safe-area-inset-bottom);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--purple); }
h1, h2 { font-family: var(--sans); font-weight: 800; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 6vw, 2.5rem); }
h2 { font-size: 1.3rem; margin-bottom: 0.6rem; color: var(--green-dark); }
p { margin: 0 0 0.8rem; }
p:last-child { margin-bottom: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(0.55rem + env(safe-area-inset-top)) 16px 0.55rem;
  background: var(--green); color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: #fff; }
.brand-logo { height: 42px; width: auto; }
.brand-label {
  font-family: var(--hand); font-size: 1.9rem; line-height: 1; padding-top: 0.2rem;
  border-left: 1.5px solid rgba(255, 255, 255, 0.55); padding-left: 0.75rem;
}
.topbar-link { color: #fff; font-weight: 700; font-size: 1rem; text-decoration: none; white-space: nowrap; }
.topbar-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.topbar-nav { display: flex; align-items: center; gap: 1rem; flex: none; }
@media (max-width: 600px) { .topbar-link { display: none; } }
@media (max-width: 400px) { .brand-label { font-size: 1.6rem; } .brand-logo { height: 36px; } .brand { gap: 0.55rem; } .brand-label { padding-left: 0.55rem; } }

/* Language picker */
.lang { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 0.4rem; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.9rem; color: #fff;
  background: rgba(255, 255, 255, 0.14); border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px; padding: 0.3rem 0.6rem 0.3rem 0.45rem; min-height: 36px;
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.26); }
.flag { width: 24px; height: 16px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); object-fit: cover; flex: none; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 190px;
  list-style: none; margin: 0; padding: 6px; background: var(--surface); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(20, 40, 10, 0.22), 0 0 0 1px var(--line);
}
.lang-menu a {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.7rem; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.lang-menu a:hover, .lang-menu a:focus-visible { background: var(--paper); outline: none; }
.lang-menu a[aria-current="true"] { color: var(--green-dark); }
.lang-menu a[aria-current="true"]::after { content: "✓"; margin-left: auto; font-weight: 800; }

/* Jenna Sue has no accented letters, so other languages use Caveat for the handwritten touches. */
html:not([data-lang="en"]) { --hand: "Caveat", "Segoe Script", cursive; }
html:not([data-lang="en"]) .brand-label { font-size: 1.45rem; font-weight: 600; }
html:not([data-lang="en"]) .eyebrow { font-size: 1.3rem; font-weight: 600; }
html:not([data-lang="en"]) .index-hero h1 { font-size: clamp(2.1rem, 8.5vw, 2.9rem); font-weight: 600; }
html:not([data-lang="en"]) .footer .tagline { font-size: 1.5rem; font-weight: 600; }
@media (max-width: 400px) { html:not([data-lang="en"]) .brand-label { font-size: 1.2rem; } }

/* Guide page */
.guide, .index, .simple, .patch { max-width: 760px; margin: 0 auto; padding: 0 16px 2rem; }
.hero { display: block; margin: 0 -16px; background: var(--cal-empty); }
.hero-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
@media (min-width: 760px) {
  .hero { margin: 1.5rem 0 0; border-radius: var(--radius); overflow: hidden; }
}
.guide-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; padding: 1.4rem 0 0.8rem; }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; text-underline-offset: 4px; }
.fact-latin dd { font-style: italic; }
.eyebrow { font-family: var(--hand); font-size: 1.7rem; line-height: 1; color: var(--purple); margin-bottom: 0.3rem; }
.subtitle { color: var(--muted); font-size: 1.15rem; margin: 0.35rem 0 0; font-style: italic; }
.rhs-badge { width: 60px; height: 60px; flex: none; }
.intro { font-size: 1.15rem; margin-bottom: 1.2rem; }
.intro ul { padding-left: 1.2rem; }

.facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  margin: 0 0 1rem; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
@media (min-width: 560px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fact { background: var(--surface); padding: 0.75rem 0.9rem; }
.fact dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.fact dd { margin: 0.15rem 0 0; font-weight: 700; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.2rem; margin-bottom: 1rem;
}

/* Calendar */
.cal { display: grid; gap: 6px; }
.cal-row { display: grid; grid-template-columns: 6.2rem 1fr; align-items: center; gap: 8px; }
.cal-label { font-size: 0.92rem; font-weight: 700; }
.cal-cells { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; }
.cal-m { text-align: center; font-size: 0.8rem; color: var(--muted); font-weight: 700; border-radius: 4px; }
.cal-m.is-now { background: var(--purple); color: #fff; }
.cal-c { height: 22px; border-radius: 4px; background: var(--cal-empty); }
.cal-c.is-now { outline: 2px solid var(--purple); outline-offset: -2px; }
.cal-c.on.sow-in { background: var(--sow-in); }
.cal-c.on.sow-out { background: var(--sow-out); }
.cal-c.on.flower { background: var(--flower); }
.cal-c.on.harvest { background: var(--harvest); }
@media (max-width: 380px) { .cal-row { grid-template-columns: 5rem 1fr; } .cal-label { font-size: 0.82rem; } }

/* Gallery */
.gallery-section { margin-top: 1.6rem; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.g-item { display: block; border-radius: 10px; overflow: hidden; background: var(--cal-empty); }
.g-item img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform 0.3s; }
.g-item:hover img { transform: scale(1.03); }
.sku-ref { margin-top: 1.6rem; color: var(--muted); font-size: 0.85rem; }

.lightbox {
  border: 0; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  background: rgba(16, 24, 12, 0.94);
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button {
  position: absolute; background: rgba(255, 255, 255, 0.14); color: #fff; border: 0;
  width: 48px; height: 48px; border-radius: 999px; font-size: 1.9rem; line-height: 1; cursor: pointer;
}
.lb-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* Index */
.index-hero { padding: 1.8rem 0 1rem; }
.index-hero h1 { font-family: var(--hand); font-weight: 400; color: var(--purple); font-size: clamp(2.8rem, 11vw, 3.8rem); line-height: 1; letter-spacing: 0; }
.index-hero > p { color: var(--muted); margin-top: 0.4rem; font-size: 1.1rem; }
.search input {
  width: 100%; margin-top: 0.8rem; font: inherit; padding: 0.8rem 1.1rem;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(79, 136, 35, 0.25); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.9rem; }
.chip {
  font: inherit; font-size: 0.95rem; font-weight: 600; padding: 0.3rem 0.95rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
}
.chip.is-on { background: var(--green); border-color: var(--green); color: #fff; }
.install, .button {
  display: inline-block; margin-top: 1rem; font: inherit; font-weight: 700; padding: 0.6rem 1.2rem;
  border-radius: 999px; border: 0; background: var(--purple); color: #fff; cursor: pointer; text-decoration: none;
}
.install:hover, .button:hover { background: #6b0a7e; }
.count { color: var(--muted); font-size: 0.92rem; margin: 0.4rem 0 0.8rem; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tiles li[hidden] { display: none; }
.tile {
  display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; height: 100%;
}
.tile:hover { border-color: var(--green); }
.card-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--cal-empty); }
.tile-text { display: block; padding: 0.6rem 0.75rem 0.75rem; }
.tile-title { display: block; font-weight: 700; line-height: 1.3; }
.tile-sub { display: block; color: var(--muted); font-size: 0.92rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }

.simple { padding-top: 3rem; text-align: center; }
.simple p { color: var(--muted); }

/* Footer */
.footer {
  text-align: center; padding: 2rem 16px calc(2.5rem + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 4px solid var(--green); color: var(--muted);
}
.footer-roundel { width: 84px; height: 84px; margin: 0 auto 0.6rem; }
.footer .tagline { text-wrap: balance; font-family: var(--hand); font-size: 2rem; line-height: 1.1; color: var(--purple); margin-bottom: 0.4rem; }
.footer-link a { color: var(--green-dark); font-weight: 700; }

/* Growing patch: hearts */
.icon { width: 1.2em; height: 1.2em; flex: none; fill: currentColor; }
.heart .icon { fill: none; stroke: currentColor; stroke-width: 2; }
.heart[aria-pressed="true"] .icon { fill: currentColor; }
.patch-link { position: relative; display: inline-flex; align-items: center; color: #fff; padding: 6px; border-radius: 999px; }
.patch-link .icon { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; }
.patch-link:hover { background: rgba(255, 255, 255, 0.16); }
.patch-count {
  position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--purple); color: #fff; font-size: 0.72rem; font-weight: 800;
  line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--green);
}
.guide-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0.2rem 0 1.2rem; }
.heart-label, .action-btn {
  display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.98rem; padding: 0.5rem 1rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
}
.heart-label { color: var(--purple); border-color: rgba(84, 6, 99, 0.35); }
.heart-label[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: #fff; }
.heart-label:hover, .action-btn:hover { border-color: var(--green); }
.tiles li { position: relative; }
.tile-heart {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 40px; height: 40px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: var(--purple); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.tile-heart .icon { width: 22px; height: 22px; }

/* Patch page */
.patch-hero { padding: 1.8rem 0 1rem; }
.patch-hero h1 { font-family: var(--hand); font-weight: 400; color: var(--purple); font-size: clamp(2.6rem, 10vw, 3.6rem); line-height: 1; }
html:not([data-lang="en"]) .patch-hero h1 { font-size: clamp(2rem, 8vw, 2.8rem); font-weight: 600; }
.patch-hero > p { color: var(--muted); margin-top: 0.4rem; }
.patch-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 1rem; }
.patch-tools .button { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0; }
.patch-tools .button .icon { fill: none; stroke: currentColor; stroke-width: 2; }
.name-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); font-weight: 600; flex: 1 1 200px; }
.name-field input {
  font: inherit; font-size: 1rem; color: var(--ink); padding: 0.55rem 0.9rem;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface);
}
.text-link { color: var(--green-dark); font-weight: 700; }

/* Share sheet */
.share-sheet {
  border: 0; border-radius: 18px; padding: 1.4rem 1.2rem 1.2rem; width: min(92vw, 380px);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.share-sheet::backdrop { background: rgba(16, 24, 12, 0.5); }
.share-sheet h2 { margin: 0 2rem 1rem 0; font-size: 1.15rem; }
.share-options { display: grid; gap: 8px; }
.share-opt {
  display: block; width: 100%; text-align: left; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  padding: 0.8rem 1rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
}
.share-opt:hover { border-color: var(--green); }
.share-opt[hidden] { display: none; }
.share-close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 999px;
  background: var(--paper); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 0.6rem 1.1rem; border-radius: 999px; font-weight: 700; font-size: 0.95rem;
}
.toast[hidden] { display: none; }
.patch-tools[hidden] { display: none; }

/* App-only features (hearts, growing patch, sharing) vs the website's app promotion */
html:not(.in-app) .app-only { display: none !important; }
html.in-app .web-only { display: none !important; }
.app-promo {
  background: var(--surface); border: 1.5px solid var(--line); border-left: 5px solid var(--purple);
  border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0.4rem 0 1.2rem;
}
.app-promo p { margin: 0 0 0.4rem; }
.app-promo-title { font-weight: 800; color: var(--purple); }
.store-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.6rem !important; }
.store-btn {
  display: inline-block; padding: 0.5rem 1rem; border-radius: 10px; background: var(--ink); color: #fff;
  font-weight: 700; text-decoration: none;
}

.share-sheet > p { margin: 0 2rem 0.6rem 0; }

/* Leave room for the sticky header when scrolling to search results */
.count { scroll-margin-top: 84px; }
