/*
 * The Gear Grove: a woodcut-print woodland around a clean, cream shop.
 *
 * Palette from the storyboard: cream paper, forest green, ochre and rust,
 * with a near-black ink for outlines. Serif headlines (Fraunces), clean
 * sans-serif controls (Inter). The woodland art lives in canvases drawn by
 * js/woodcut.js; this file keeps the shop itself calm and legible.
 */
:root {
  --cream: #f4ecd8;
  --paper: #fbf6e8;
  --linen: #ece2c9;
  --forest: #1f4a35;
  --forest-deep: #163828;
  --sage: #7c9a6b;
  --moss: #6e8a3c;
  --ochre: #dfa13b;
  --rust: #b0502b;
  --rust-deep: #7a3418;
  --ink: #1b271f;
  --ink-soft: #5a6356;

  --bg: var(--cream);
  --surface: var(--paper);
  --media: var(--linen);
  --line: #dccfb1;
  --line-strong: #c8b994;
  --chip: #efe6cf;
  --text: var(--ink);
  --muted: var(--ink-soft);
  --heading: var(--ink);
  --accent: var(--forest);
  --accent-deep: var(--forest-deep);
  --accent-ink: #fbf6e8;
  --pine: var(--forest);
  --orange: var(--ochre);
  --crimson: var(--rust);
  --gold: var(--ochre);
  --shadow: 0 1px 2px rgba(27, 39, 31, 0.08), 0 6px 18px rgba(27, 39, 31, 0.07);

  --radius: 10px;
  --radius-sm: 6px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --tabbar-h: 62px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14201a;
    --surface: #1b2a21;
    --media: #22342a;
    --line: #2f4337;
    --line-strong: #3d5446;
    --chip: #213128;
    --text: #efe7d2;
    --muted: #a9b4a3;
    --heading: #f4ecd8;
    --accent: #4f8a5f;
    --accent-deep: #63a073;
    --accent-ink: #fbf6e8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14201a;
  --surface: #1b2a21;
  --media: #22342a;
  --line: #2f4337;
  --line-strong: #3d5446;
  --chip: #213128;
  --text: #efe7d2;
  --muted: #a9b4a3;
  --heading: #f4ecd8;
  --accent: #4f8a5f;
  --accent-deep: #63a073;
  --accent-ink: #fbf6e8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.45;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
h1, h2, h3 { font-family: var(--font-head); color: var(--heading); margin: 0; font-optical-sizing: auto; }
a { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: #9fcb9f; } }
button { font: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

.sr-only, .skip:not(:focus) {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip:focus { position: fixed; top: 8px; left: 8px; background: var(--surface); padding: 8px 12px; z-index: 200; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }

/* ---------- wooden trail signs (scene, hero, morph) ---------- */
.trail-sign {
  position: relative; display: inline-flex; align-items: center; gap: 0.35em; isolation: isolate;
  font-family: var(--font-head); font-weight: 600; font-size: 17px; line-height: 1; letter-spacing: 0.005em; white-space: nowrap;
  color: #fbf3e2; text-shadow: 0 1px 0 rgba(27, 39, 31, 0.45);
  padding: 0.62em 1.5em 0.66em 0.85em; border: 0; background: none; cursor: pointer;
}
.trail-sign::after {
  content: ""; position: absolute; inset: 0; z-index: -1; background: center / 100% 100% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M1.5 3.5 L83 1.5 L98.5 20 L83 38.5 L1.5 36.5 Z' fill='%23a9482a' stroke='%237c321c' stroke-width='2.4' vector-effect='non-scaling-stroke' stroke-linejoin='round'/%3E%3Cpath d='M7 11 H58 M4 19.5 H40 M46 20 H76 M9 29 H62' stroke='%23c4623a' stroke-width='1.2' vector-effect='non-scaling-stroke' stroke-linecap='round'/%3E%3C/svg%3E");
}
.trail-sign.sign-shop::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M1.5 3.5 L83 1.5 L98.5 20 L83 38.5 L1.5 36.5 Z' fill='%2324452f' stroke='%23142a1d' stroke-width='2.4' vector-effect='non-scaling-stroke' stroke-linejoin='round'/%3E%3Cpath d='M7 11 H58 M4 19.5 H40 M46 20 H76 M9 29 H62' stroke='%23355f42' stroke-width='1.2' vector-effect='non-scaling-stroke' stroke-linecap='round'/%3E%3C/svg%3E");
}
.trail-sign .arrow { font-family: var(--font-body); font-weight: 600; }
/* a chickadee rides on the Donate sign, in the woods and in the shop */
.sign-donate::before {
  content: ""; position: absolute; width: 2.2em; height: 1.56em; right: 1.9em; bottom: calc(100% - 0.28em); pointer-events: none;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 34'%3E%3Cpath d='M30 26 L44 30 L42 24 Z' fill='%235d6460'/%3E%3Cpath d='M8 15 C8 8 13 4 19 5 C25 6 28 11 29 15 C32 18 33 23 30 27 C25 31 15 31 11 27 C8 24 8 20 8 15 Z' fill='%23e9dcc0'/%3E%3Cpath d='M14 18 C19 15 27 16 31 21 C30 26 25 29 19 28 C21 25 19 21 14 18 Z' fill='%238a918a'/%3E%3Cpath d='M8.5 14 C9 8 13 4.6 19 5 C23 5.4 25 8 25.5 10.5 C20 9.5 13 11 8.5 14 Z' fill='%231b271f'/%3E%3Cpath d='M10 16 C12 19 15 20 17 19 C15 22 12 22 10.5 20 Z' fill='%231b271f'/%3E%3Cpath d='M8.6 13 L4 14.6 L8.8 15.6 Z' fill='%231b271f'/%3E%3Ccircle cx='12.6' cy='12.2' r='1.3' fill='%23f6efe0'/%3E%3Cpath d='M15 31 L14 34 M20 31 L20.5 34' stroke='%231b271f' stroke-width='1.3'/%3E%3C/svg%3E");
}

/* ---------- first-visit entrance ---------- */
.entrance { display: none; }
html.entering .entrance {
  display: block; position: fixed; inset: 0; z-index: 100; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  background: #203529 center / cover no-repeat;
}
html.entering .entrance:not(.poster-ready):not(.ready) .entrance-headline { opacity: 0 !important; }
/* failsafe: if the script never runs, the shop still appears */
html.entering .entrance { animation: entrance-failsafe 0.3s 9s forwards; }
html.entering .entrance[data-frozen] { animation: none; }
@keyframes entrance-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.entrance-scene { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 180ms ease-out; }
.entrance.ready .entrance-scene { opacity: 1; }
.entrance[data-frozen] .entrance-scene { transition: none; }
.entrance-top {
  position: absolute; left: 38%; right: 4%; top: calc(env(safe-area-inset-top, 0px) + 28px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.entrance-mark { font-size: clamp(9px, 2.7vw, 12px); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #102f28; white-space: nowrap; }
.entrance-skip {
  font-size: clamp(11px, 2.9vw, 14px); font-weight: 600; color: #102f28; background: #fbf2dd; border: 0; border-radius: 6px;
  padding: 8px 6px; min-height: 44px; cursor: pointer; white-space: nowrap;
}
.entrance-headline {
  position: absolute; left: 12%; right: 2%; top: 24%; margin: 0;
  font-family: 'Times New Roman', Georgia, serif; font-weight: 700; font-size: clamp(30px, 13.3vw, 84px); line-height: 1.03; letter-spacing: -0.045em; white-space: nowrap;
  color: #fbf3e2; text-shadow: 0 2px 6px #102f28;
}
.entrance-next { position: absolute; left: 35%; top: 10%; right: 4%; margin: 0; opacity: 0; font: 700 clamp(30px, 8.5vw, 72px)/1.03 Georgia, 'Times New Roman', serif; letter-spacing: -0.035em; color: #101e18; }
@media (max-width: 360px) { .entrance-top { left: 28%; gap: 6px; } .entrance-headline { left: 8%; font-size: 10.8vw; } }
@media (orientation: landscape) {
  .entrance-top { left: 45%; right: 4%; }
  .entrance-headline { left: 29%; top: 28%; font-size: clamp(40px, 5.5vw, 84px); }
  .entrance-next { left: 35%; top: 8%; font-size: clamp(28px, 2.5vw, 38px); }
}
/* the shop arriving as the entrance resolves */
@keyframes canopy-in { from { opacity: 0; transform: scale(1.14); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes tile-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
html.arriving .canopy { animation: canopy-in 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) both; transform-origin: 50% 0; }
html.arriving .hero-copy { animation: rise 0.55s 0.12s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
html.arriving .filters { animation: rise 0.55s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
html.arriving .tabbar { animation: rise 0.5s 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
html.arriving .grid > .card { animation: tile-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(0.3s + var(--i, 8) * 70ms); }
.grid > .card:nth-child(1) { --i: 0; }
.grid > .card:nth-child(2) { --i: 1; }
.grid > .card:nth-child(3) { --i: 2; }
.grid > .card:nth-child(4) { --i: 3; }
.grid > .card:nth-child(5) { --i: 4; }
.grid > .card:nth-child(6) { --i: 5; }
.grid > .card:nth-child(7) { --i: 6; }
.grid > .card:nth-child(8) { --i: 7; }
@media (prefers-reduced-motion: reduce) {
  html.arriving * { animation: none !important; }
  .sheet[open] { animation: none !important; }
}

/* ---------- header & hero ---------- */
.site-top { position: relative; isolation: isolate; overflow: hidden; }
.canopy { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.topbar {
  display: grid; grid-template-columns: 44px minmax(0,1fr) 88px; align-items: center; gap: 6px;
  max-width: 1120px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 0;
}
.icon-btn {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--bg); color: var(--text); cursor: pointer; font-size: 1.05rem;
}
.header-actions { display:flex; align-items:center; }
.account-link { text-decoration:none; }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--forest); color: var(--paper);
  font: 700 11px/18px var(--font-body); text-align: center; font-variant-numeric: tabular-nums;
}
.cart-btn .badge { position: absolute; top: 3px; right: 1px; }
.badge.bump { animation: bump 0.35s ease; }
@keyframes bump { 50% { transform: scale(1.25); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { background: var(--ochre); color: var(--ink); } }

.brand {
  justify-self: center; display: grid; justify-items: center; gap: 1px; text-decoration: none; color: var(--forest); padding: 4px 8px;
}
.brand .pines-mark { width: 38px; height: 24px; }
.brand-name { font-family: var(--font-head); font-weight: 600; font-size: clamp(16px, 3.8vw, 24px); line-height: 1.15; letter-spacing: -0.01em; color: var(--forest); text-align:center; }
.brand-sub { font-size: 11px; line-height:1.4; color: var(--text); text-align:center; }
.brand-mobile-break { display:none; }
@media(max-width:520px) { .brand-mobile-break { display:initial; } .brand { padding:4px 0; } }
@media(max-width:520px) { .site-top > .canopy, .vol-hero > .canopy { display:none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand, :root:not([data-theme="light"]) .brand-name { color: #cfe3c4; } }

/* the shop's front room: each station is a way in */
.hub {
  position: relative; max-width: 1092px; margin: 2px 14px 0; aspect-ratio: 3 / 2; border-radius: 14px; overflow: hidden;
  background: #8e5d33; isolation: isolate;
}
@media (min-width: 720px) { .hub { aspect-ratio: 3 / 2; max-width: 1000px; margin: 6px auto 0; width: calc(100% - 48px); } }
.hub-art { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hub-spot {
  position: absolute; bottom: 0; display: flex; justify-content: center; align-items: flex-start;
  padding: 0; border: 0; background: none; cursor: pointer; text-decoration: none; color: inherit; border-radius: 10px;
}
.spot-donate { left: 3%; width: 30%; top: 24%; }
.spot-shop { left: 34%; width: 32%; top: 3%; }
.spot-volunteer { left: 67%; width: 32%; top: 50%; }
.hub-spot .trail-sign { font-size: 14px; transition: transform 0.15s ease; }
#donate-sign { transform: rotate(-4deg); }
#shop-sign { transform: rotate(2deg); }
#volunteer-sign { transform: rotate(-3deg); margin-top: 16%; }
.hub-spot:hover .trail-sign { filter: brightness(1.08); }
.hub-spot:focus-visible { outline: 3px solid var(--ochre); outline-offset: -3px; }
@media (min-width: 720px) { .hub-spot .trail-sign { font-size: 18px; } }
.trail-sign.sign-volunteer::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M1.5 3.5 L83 1.5 L98.5 20 L83 38.5 L1.5 36.5 Z' fill='%23d8992f' stroke='%23a8701c' stroke-width='2.4' vector-effect='non-scaling-stroke' stroke-linejoin='round'/%3E%3Cpath d='M7 11 H58 M4 19.5 H40 M46 20 H76 M9 29 H62' stroke='%23ecc475' stroke-width='1.2' vector-effect='non-scaling-stroke' stroke-linecap='round'/%3E%3C/svg%3E");
}
.trail-sign.sign-volunteer { color: #1b271f; text-shadow: none; }

.hero { max-width: 1120px; margin: 0 auto; padding: 16px 18px 10px; }
.hero h1 { font-weight: 700; font-size: clamp(28px, 7.8vw, 50px); line-height: 1.04; letter-spacing: -0.02em; }
.hero-sub { margin: 6px 0 0; font-size: 15px; color: var(--text); }
.impact { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.impact strong { color: var(--rust); font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .impact strong { color: var(--ochre); } }
@media (min-width: 720px) { .hero { padding: 22px 24px 14px; } }

/* ---------- filters ---------- */
.shop { max-width: 1120px; margin: 0 auto; padding: 0 14px; }
.filters { display: grid; gap: 10px; padding: 4px 0 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 38px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: var(--paper); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); } }
.chip small { display: none; }
.filter-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 10px; }
@media (max-width: 480px) { .filter-row { grid-template-columns: minmax(0, 1fr); } }
.select, .search { position: relative; display: block; }
.select select, .search input, .sort select {
  width: 100%; min-height: 44px; font: inherit; font-size: 14.5px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px;
}
.select select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%231b271f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.search svg { position: absolute; left: 11px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; }
.search input::placeholder { color: var(--muted); }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.count { margin: 0; font-size: 13px; color: var(--muted); }
.sort { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.sort select { width: auto; min-height: 34px; font-size: 13px; padding: 0 8px; }
.source { margin: -4px 0 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.source:empty { display: none; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--moss); flex: none; }
.dot.stale { background: var(--ochre); }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1020px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card {
  display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.grid > .card:nth-child(n + 9) { content-visibility: auto; contain-intrinsic-size: auto 300px; }
.card.skeleton { min-height: 290px; background: var(--surface); }
.card.skeleton::before { content: ""; display: block; aspect-ratio: 1 / 0.86; background: var(--media); }
.card-media { position: relative; aspect-ratio: 1 / 0.86; background: var(--media); display: grid; place-items: center; overflow: hidden; }
.gear-art { width: 84%; height: 84%; }
.card-photo { position: absolute; inset: 0; display: block; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-type {
  position: absolute; left: 8px; top: 8px; z-index: 1; max-width: calc(100% - 52px);
  font-family: var(--font-body); font-size: 12px; line-height: 1.3; font-weight: 700; color: #3b4639; background: #f2e8d0;
  border-radius: 6px; padding: 5px 7px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.photo-btn {
  position: absolute; right: 6px; top: 6px; z-index: 1; width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: #f2e8d0; color: #3b4639; cursor: pointer;
}
.photo-btn svg { width: 17px; height: 17px; }
.hold-badge {
  position: absolute; left: 8px; bottom: 8px; z-index: 1; font-size: 11.5px; font-weight: 700; color: #fbf3e2;
  background: var(--rust); border-radius: 999px; padding: 3px 9px;
}
.card-body { display: flex; flex-direction: column; gap: 9px; padding: 12px; flex: 1; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-title {
  margin: 0; font-family: var(--font-head); color: var(--heading); font-weight: 600; font-size: 16px; line-height: 1.3; letter-spacing: -0.005em; min-width: 0; overflow-wrap: anywhere;
}
.card-description { margin:0; font-size:12px; line-height:1.45; color:var(--muted); overflow-wrap:anywhere; }
.price { font-family: var(--font-head); font-weight: 700; font-size: 16px; white-space: nowrap; font-variant-numeric: lining-nums; }
.card-sizing { display: grid; gap: 7px; margin: 0; padding: 9px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.card-sizing div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 6px; align-items: baseline; }
.card-sizing dt { font-size: 11px; line-height: 1.4; color: var(--muted); }
.card-sizing dd { margin: 0; font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; font-size: 12px; color: var(--muted); line-height: 1.45; }
.facts li { white-space: nowrap; }
.facts li:not(:last-child)::after { content: "·"; margin: 0 5px; }
.card .facts { margin-bottom: 10px; }
.card .add-btn { margin-top: auto; align-self: stretch; }

.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 14px;
  border-radius: 8px; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; border: 1.5px solid var(--accent);
}
.btn { background: var(--accent); color: var(--accent-ink); }
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn svg { width: 17px; height: 17px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.btn:disabled { background: var(--chip); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.card.in-bag .add-btn { background: transparent; color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card.in-bag .add-btn { color: #9fcb9f; } }
.card.on-hold .card-media { filter: saturate(0.6); }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- how it works ---------- */
.how { margin: 0 0 18px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.how summary { padding:14px 16px; min-height:48px; cursor:pointer; font-weight:600; color:var(--heading); }
.how-content { padding:0 16px 16px; }
.how summary:focus-visible { outline:3px solid var(--ochre); outline-offset:3px; border-radius:var(--radius); }
@media(max-width:380px) { .card-type { left:6px; max-width:calc(100% - 46px); padding:4px; font-size:10px; } .brand-name { font-size:14px; } .brand-sub { font-size:10px; } }
.how ol { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
.how li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; }
.how li::before {
  content: counter(step); grid-row: span 2; width: 28px; height: 28px; display: grid; place-items: center;
  background: var(--forest); color: var(--paper); font-weight: 700; font-size: 13px; border-radius: 4px 4px 14px 14px;
}
.how li span { color: var(--muted); font-size: 14px; }
.about { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
@media (min-width: 720px) { .how ol { grid-template-columns: repeat(3, 1fr); } }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 16px 28px; }
.footer-logo { width: 64px; height: auto; margin: 0 auto 8px; display: block; background: #fff; border-radius: 8px; padding: 4px 6px; }
.footer p { margin: 0; }

/* ---------- bottom navigation ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding: 0 34px env(safe-area-inset-bottom, 0px);
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabbar::before, .tabbar::after {
  content: ""; position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 3px); width: 32px; height: 52px;
  background: var(--pine-art, none) bottom / contain no-repeat; pointer-events: none;
}
.tabbar::before { left: 2px; }
.tabbar::after { right: 2px; transform: scaleX(-1); }
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.tab svg { width: 24px; height: 24px; }
.tab.is-active { color: var(--forest); }
.tab.is-active::after { content: ""; position: absolute; bottom: 6px; width: 46px; height: 3px; border-radius: 3px; background: var(--forest); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab.is-active { color: #cfe3c4; } :root:not([data-theme="light"]) .tab.is-active::after { background: #cfe3c4; } }
#tab-donate svg { color: var(--rust); }
.tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); }

/* ---------- sheets (menu, donate, cart) ---------- */
.sheet {
  border: 0; padding: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow);
  width: min(560px, 100vw); max-width: 100vw; max-height: min(88vh, 760px); margin: auto auto 0; border-radius: 16px 16px 0 0;
}
@media (min-width: 720px) { .sheet { margin: auto; border-radius: 16px; } }
.sheet::backdrop { background: rgba(20, 32, 26, 0.5); }
.sheet[open] { animation: sheet-up 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } }
.sheet-inner { padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head h2 { font-size: 22px; }
.sheet p { margin: 0; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-actions .btn, .sheet-actions .btn-ghost { flex: 1 1 auto; }
.donate-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.menu nav { display: grid; }
.menu nav a, .menu nav button {
  display: block; text-align: left; padding: 14px 4px; border: 0; border-top: 1px solid var(--line); background: none;
  color: var(--text); text-decoration: none; font-size: 16px; font-weight: 500; cursor: pointer;
}

.bag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bag-list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--chip); border-radius: 8px; padding: 10px 12px; }
.bag-list li > div { min-width: 0; }
.bag-list .meta { font-size: 12px; color: var(--muted); }
.bag-list button { border: 0; background: none; color: var(--rust); font-weight: 600; cursor: pointer; }
.bag-total { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.bag-total:empty { display: none; }
.bag-empty { color: var(--muted); }
.bag-fields { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.bag-fields label { display: grid; gap: 4px; font-weight: 600; font-size: 13.5px; }
.bag-fields .check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.bag-fields input:not([type="checkbox"]), .bag-fields textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px;
}
.opt { font-weight: 400; color: var(--muted); }
.bag-status { font-size: 13.5px; color: var(--rust); font-weight: 600; min-height: 1.2em; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.bag-done { text-align: center; justify-items: center; }
.done-mark { width: 46px; height: 46px; border-radius: 50%; background: var(--forest); display: grid; place-items: center; }
.done-mark svg { width: 26px; height: 26px; fill: none; stroke: var(--paper); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- practice mode bar ---------- */
.demo-bar {
  background: color-mix(in srgb, var(--ochre) 22%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--ochre) 50%, var(--line));
  padding: 10px 16px; display: grid; gap: 8px; font-size: 13px;
}
.demo-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; max-width: 1120px; width: 100%; margin: 0 auto; }
.demo-label { margin: 0; min-width: 0; flex: 1 1 320px; }
.demo-links { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.demo-link { font-weight: 700; }
.demo-pin code, .demo-hint code { font-size: 0.95em; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; user-select: all; }
.demo-outbox, .demo-tools { max-width: 1120px; width: 100%; margin: 0 auto; }
.demo-outbox summary { cursor: pointer; font-weight: 600; }
.demo-outbox[open] { display: grid; gap: 8px; }
.demo-mail { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.demo-mail p { margin: 0; }
.demo-mail-head { color: var(--muted); font-size: 12px; }
.demo-mail-subject { font-weight: 700; }
.demo-mail pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 12.5px; }
.demo-empty, .demo-warn { margin: 6px 0 0; color: var(--muted); }
.demo-warn { color: var(--rust); }
.demo-tools { display: flex; justify-content: flex-end; gap: 10px; align-items: center; flex-wrap: wrap; }
.demo-reset { font: inherit; font-size: 12px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--muted); cursor: pointer; }
.demo-hint { margin: 0; color: var(--muted); }

.entrance .trail-sign { position: absolute; left: 0; top: 0; transform-origin: 0 0; opacity: 0; will-change: transform, opacity; }
.hub-spot .trail-sign { min-height: 44px; }
.spot-shop { top: 6%; }
.spot-donate { top: 24%; }
.spot-volunteer { top: 50%; }

.entrance-mark { color: #fff3d5; text-shadow: 0 1px 4px #102f28; }
.hub-spot .sign-donate::before { display: none; }

.entrance-next { left: 25%; top: 12%; right: 5%; color: #fff3d5; font-size: clamp(28px, 7.5vw, 55px); text-shadow: 0 2px 8px #102f28; }
@media (min-width: 720px) { .entrance-next { left: 35%; right: 25%; top: 12%; font-size: 48px; } }
