:root {
  --page: #f4f2e4;
  --card: #e7ead3;
  --card-top: #fbf9ef;
  --ink: #2f3a2c;
  --muted: #7b8571;
  --green: #4f9d4f;
  --green-dark: #2f6e37;
  --haze-1: #b5e39a;
  --haze-2: #6dbb5c;
  --haze-3: #3f8f48;
  --radius: 24px;
  --serif: "Bitter", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--page);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='%233f8f48' fill-opacity='0.03' font-family='Georgia,serif' font-weight='700'%3E%3Ctext x='10' y='55' font-size='34' transform='rotate(-12 50 50)'%3E4:20%3C/text%3E%3Ctext x='95' y='150' font-size='26' transform='rotate(10 130 140)'%3E4:20%3C/text%3E%3C/g%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.4;
}

.app {
  max-width: 460px;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 1.5rem;
}

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.logo { flex: none; filter: drop-shadow(0 2px 3px rgba(47, 58, 44, 0.2)); }
.titles { flex: 1; min-width: 0; }
.titles h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.45rem;
  line-height: 1.15;
}
.titles p { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.9rem; }
.icon-btn {
  flex: none;
  border: 0;
  background: none;
  color: var(--ink);
  padding: 0.4rem;
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn:hover { background: var(--card); }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 0.9rem;
}
.label, .eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--card-top);
  box-shadow: 0 10px 30px rgba(63, 143, 72, 0.18);
  text-align: center;
  padding-top: 1.1rem;
}
.eyebrow {
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--ink);
}
.flag-badge {
  position: relative;
  z-index: 2;
  width: 76px;
  height: 76px;
  margin: 0.9rem auto -38px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(47, 58, 44, 0.18);
  display: grid;
  place-items: center;
}
.flag-badge img {
  width: 44px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.haze {
  position: relative;
  /* Dark green "ground" that shows between the leaves; transparent at the very top
     so the leaf tips form the upper edge. */
  background: linear-gradient(180deg, transparent 0, transparent 28px, #9fd283 58px, #5fa857 110px, #2f6e37 75%, #1f4d27 100%);
  padding: 3.4rem 1rem 1.4rem;
}

.leaf-sea {
  position: absolute;
  left: 0;
  top: -40px;
  width: 100%;
  height: calc(100% + 40px);
  pointer-events: none;
  overflow: hidden;
}
.leaf-sea .sway {
  animation: sway 5s ease-in-out infinite alternate;
}
@keyframes sway {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(5deg); }
}

.hero-text { position: relative; z-index: 1; }
.hero-text h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(2rem, 9vw, 2.6rem);
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 2px 4px rgba(15, 45, 20, 0.55), 0 0 22px rgba(15, 45, 20, 0.55);
}
.hero-country {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #eaf7e1;
  text-shadow: 0 1px 6px rgba(15, 45, 20, 0.7);
}
.hero-also {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #f2fbec;
  min-height: 1.2em;
  text-shadow: 0 1px 6px rgba(15, 45, 20, 0.7);
}
.chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}
.chip {
  border: 0;
  font: inherit;
  font-size: 0.85rem;
  color: #fff;
  background: rgba(20, 55, 26, 0.55);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  backdrop-filter: blur(3px);
}
button.chip { cursor: pointer; }
button.chip:hover { background: rgba(20, 55, 26, 0.75); }
.hero.lit .chip#since-chip { background: #fff; color: var(--green-dark); font-weight: 700; }

/* ---------- next ---------- */
.next { padding: 1rem 1.1rem 1.1rem; }
.next-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.next-city {
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.next-in {
  margin: 0;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.55rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.progress {
  margin-top: 0.85rem;
  height: 8px;
  border-radius: 999px;
  background: #fbf9ef;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--haze-2), var(--haze-3));
  transition: width 0.9s linear;
}

.flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  flex: none;
}

/* ---------- you ---------- */
.you {
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.you-clock {
  margin: 0.15rem 0 0;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}
.you-next { margin: 0; text-align: right; color: var(--muted); font-size: 0.9rem; }
.you-next b { color: var(--ink); }

/* ---------- strains ---------- */
.strains { margin-top: 1.6rem; }
.strains h3, .timeline h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.2rem;
}
.strain-list {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border-radius: 20px;
  cursor: grab;
  user-select: none;
}
.strain-list:active { cursor: grabbing; }
.strain-list::-webkit-scrollbar { display: none; }
.strain-list:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.carousel-nav[hidden] { display: none; }
.nav-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.nav-btn:hover:not(:disabled) { background: #dfe3c7; }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.strain {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.85rem;
  background: var(--card);
  border-radius: 20px;
  padding: 0.9rem 1rem;
}
.strain-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--haze-2), var(--haze-3));
  box-shadow: 0 4px 10px rgba(63, 143, 72, 0.3);
}
.strain-icon.indica { background: linear-gradient(160deg, #8a7bd0, #5b4a9e); box-shadow: 0 4px 10px rgba(91, 74, 158, 0.3); }
.strain-icon.hybrid { background: linear-gradient(160deg, #e3b54a, #c0862a); box-shadow: 0 4px 10px rgba(192, 134, 42, 0.3); }
.strain-icon.ruderalis { background: linear-gradient(160deg, #9fb59a, #6d8467); }
.strain-icon img { width: 34px; height: 34px; }
.strain-origin {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.strain-origin .flag { width: 18px; height: 13px; }
.strain h4 {
  margin: 0.15rem 0 0;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.15rem;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.3rem 0 0; }
.tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--card-top);
  color: var(--green-dark);
}
.strain p.desc { margin: 0.45rem 0 0; font-size: 0.9rem; }
.strain-links { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.5rem; font-size: 0.85rem; font-weight: 700; }
.strain-links a { color: var(--green-dark); text-decoration: none; }
.strain-links a:hover { text-decoration: underline; }

/* ---------- timeline ---------- */
.timeline { margin-top: 1.6rem; }
.timeline h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.2rem;
}
.hint { margin: 0.15rem 0 0.8rem; color: var(--muted); font-size: 0.85rem; }
.timeline ol { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.35rem 0;
}
.time-pill {
  flex: none;
  min-width: 4.6rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--card);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
}
.places { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; padding-top: 0.2rem; font-size: 0.92rem; }
.place { display: inline-flex; align-items: center; gap: 0.3rem; }

.install-btn {
  display: block;
  width: 100%;
  margin: 1.5rem 0 0;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  cursor: pointer;
}
.install-btn:hover { background: var(--green-dark); }

.foot { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 1.5rem; }

/* ---------- settings dialog ---------- */
dialog {
  border: 0;
  border-radius: var(--radius);
  background: var(--card-top);
  color: var(--ink);
  padding: 1.3rem 1.4rem 1rem;
  width: min(340px, calc(100% - 2rem));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(47, 58, 44, 0.35); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 0.8rem; font-family: var(--serif); font-size: 1.15rem; }
fieldset { border: 0; margin: 0 0 0.8rem; padding: 0; }
legend { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.3rem; }
fieldset label { display: flex; align-items: center; gap: 0.55rem; padding: 0.3rem 0; cursor: pointer; }
input[type="radio"] { accent-color: var(--green); width: 18px; height: 18px; }
.dialog-actions { text-align: right; }
.dialog-actions button {
  border: 0;
  background: none;
  font: inherit;
  font-family: var(--serif);
  font-weight: 800;
  color: var(--green-dark);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .leaf-sea .sway { animation: none; }
}
