/*
 * theme.css — Wild Earth's design-system values.
 *
 * Direction: a field-guide for people who want to slow down. Deep moss green
 * as the one brand colour, warm paper neutrals, one amber accent kept for
 * large type on the dark band. Dark mode is a night forest, not an inversion:
 * the ground goes near-black green and the accent lifts to a pale sage.
 *
 * PALETTE (3-5 colours): moss green, paper, forest ink, sage, amber.
 */

:root {
  --canvas: #f6f4ec;
  --surface: #fffdf7;
  --surface-2: #ebe8dc;
  --border: #d9d5c4;
  --border-strong: #a9a58f;
  --ink: #14231a;
  --muted: #55625a;
  --accent: #2f5d46;
  --accent-hover: #254a37;
  --accent-ink: #fffdf7;
  --accent-text: #2f5d46;
  --accent-strong: #1f4a35;
  --accent-soft: #dcebe0;
  --accent-border: #a9c7b4;
  --success: #1f7a45;
  --success-ink: #ffffff;
  --success-soft: #dcefe3;
  --success-strong: #176036;
  --warning: #a35a0f;
  --warning-ink: #ffffff;
  --warning-soft: #f6e7d3;
  --warning-strong: #8a4a0a;
  --danger: #b42318;
  --danger-ink: #ffffff;
  --danger-soft: #f8e1de;
  --danger-strong: #a4281e;
  --chart-1: #2f5d46;
  --chart-2: #c9792b;
  --chart-3: #2f7f9a;
  --chart-4: #8a9a3a;
  --chart-5: #7a5a8a;
  --chart-6: #b5533c;

  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-weight: 700;
  --display-tracking: -0.03em;
  --eyebrow-tracking: 0.08em;

  --radius-btn: 999px;
  --radius-card: 1.5rem;
  --radius-input: 1rem;
  --shadow-card: 0 1px 2px color-mix(in srgb, var(--ink) 10%, transparent), 0 14px 32px -18px color-mix(in srgb, var(--ink) 35%, transparent);
  --shadow-raised: 0 2px 4px color-mix(in srgb, var(--ink) 12%, transparent), 0 24px 48px -20px color-mix(in srgb, var(--ink) 45%, transparent);

  /* Own tokens: the dark statement band and text that sits on photographs. */
  --x-band-bg: #16301f;
  --x-band-ink: #eef3ea;
  --x-band-muted: #a9c2b0;
  --x-band-line: #2c4a36;
  --x-sun: #e3a85b;
  --x-on-photo: #ffffff;
}

html[data-theme="dark"] {
  --canvas: #0e1812;
  --surface: #15241b;
  --surface-2: #1c2f23;
  --border: #29402f;
  --border-strong: #4a6a53;
  --ink: #eef3ea;
  --muted: #a2b3a6;
  --accent: #8fd1a3;
  --accent-hover: #a6dcb6;
  --accent-ink: #0e1812;
  --accent-text: #8fd1a3;
  --accent-strong: #b5e6c4;
  --accent-soft: #1d3a29;
  --accent-border: #2f5a40;
  --success: #2e9a5c;
  --success-ink: #06140c;
  --success-soft: #14301f;
  --success-strong: #7fd3a0;
  --warning: #d68a2f;
  --warning-ink: #1a0f02;
  --warning-soft: #33210f;
  --warning-strong: #e6a95e;
  --danger: #e0645a;
  --danger-ink: #1a0604;
  --danger-soft: #3a1613;
  --danger-strong: #f0a09a;
  --chart-1: #8fd1a3;
  --chart-2: #e0a05a;
  --chart-3: #6cb8d4;
  --chart-4: #b6c45e;
  --chart-5: #b99ad0;
  --chart-6: #e08a72;

  --x-band-bg: #07110b;
  --x-band-ink: #e4ecdf;
  --x-band-muted: #93a99a;
  --x-band-line: #1f3427;
  --x-sun: #e3a85b;
  --x-on-photo: #ffffff;
}

/*
 * app.css — Wild Earth's own screens: the photographic hero, the place
 * explorer, the dark statement band, the mood matcher, the gallery with its
 * lightbox and the pledge list. Tokens only; colours live in theme.css.
 */

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
html.reduced-motion { scroll-behavior: auto; }
body { font-family: var(--font-body); }
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

.caps {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Bar */
.nav-link {
  display: inline-block;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover,
.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* Hero */
.hero {
  position: relative;
  display: grid;
  align-items: end;
  isolation: isolate;
  overflow: hidden;
  min-height: max(36rem, calc(100svh - 7rem));
  color: var(--x-on-photo);
}
.hero-photo { position: absolute; inset: 0; z-index: -2; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 45%; display: block; }
.hero-wash {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.74) 0%, rgba(0, 0, 0, 0.38) 45%, rgba(0, 0, 0, 0.08) 100%);
}
.hero-title { color: var(--x-on-photo); text-shadow: 0 2px 28px rgba(0, 0, 0, 0.35); }
.hero-sub { color: color-mix(in srgb, var(--x-on-photo) 90%, transparent); }
.hero-link {
  color: var(--x-on-photo);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.3em;
}
.hero-link:hover { text-decoration-thickness: 2px; }

/* Explorer */
.explorer-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface-2);
  box-shadow: var(--shadow-raised);
}
@media (min-width: 1024px) {
  .explorer-photo { aspect-ratio: auto; height: 100%; min-height: 36rem; }
}
.explorer-slide { position: absolute; inset: 0; margin: 0; }
.explorer-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.explorer-pin {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100% - 8.5rem);
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--x-on-photo);
  font-size: 0.875rem;
  font-weight: 500;
}
.explorer-pin span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-nav { position: absolute; right: 1rem; bottom: 1rem; z-index: 2; display: flex; gap: 0.5rem; }

.explorer-slide.is-entering { animation: slide-in 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.explorer-detail.is-entering,
.match-card.is-entering,
.gallery-item.is-entering { animation: detail-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes slide-in { from { opacity: 0.35; transform: scale(1.04); } to { opacity: 1; transform: none; } }
@keyframes detail-in { from { opacity: 0.4; transform: translateY(0.75rem); } to { opacity: 1; transform: none; } }

.fact {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  column-gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.fact-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.fact dd { margin-top: 0.25rem; font-size: 1.125rem; font-weight: 600; }

.explorer-tabs {
  position: relative;
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  padding: 0.25rem 0.25rem 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}
.explorer-tab {
  flex: none;
  width: 8rem;
  padding: 0.375rem;
  border: 2px solid transparent;
  border-radius: 1rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.explorer-tab img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.75rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.explorer-tab span { display: block; margin-top: 0.5rem; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.explorer-tab:hover img { opacity: 1; }
.explorer-tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.explorer-tab[aria-selected="true"] img { opacity: 1; }
.explorer-tab[aria-selected="true"] span { color: var(--accent-strong); }
@media (min-width: 768px) {
  .explorer-tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: visible; }
  .explorer-tab { width: auto; }
}

/* Statement bands */
.band { background: var(--x-band-bg); color: var(--x-band-ink); }
.band-muted { color: var(--x-band-muted); }
.band-number { color: var(--x-sun); line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.band-figure { border-top: 1px solid var(--x-band-line); padding-top: 1.5rem; }
[data-band-rule] { border-color: var(--x-band-line); }
.band-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: 999px;
  background: var(--x-sun);
  color: var(--x-band-bg);
  font-weight: 600;
  transition: transform 0.2s, filter 0.2s;
}
.band-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.band-link {
  color: var(--x-band-ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

/* Mood matcher */
.mood-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 640px) { .mood-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 639px) { .mood-chip:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.mood-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.875rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}
.mood-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.mood-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.match-card {
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}
.match-photo { aspect-ratio: 16 / 10; overflow: hidden; }
.match-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Gallery */
.filter-row { display: flex; flex-wrap: nowrap; gap: 0.5rem; padding-bottom: 0.5rem; overflow-x: auto; }
.filter-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.filter-chip small { font-size: 0.75rem; font-weight: 600; opacity: 0.75; }
.filter-chip:hover { border-color: var(--accent); }
.filter-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.gallery-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.75rem;
  margin-top: 1rem;
}
.gallery-search { display: grid; gap: 0.4rem; min-width: 0; }
.gallery-search-label { color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.gallery-search input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.9rem;
  background: var(--surface);
  color: var(--ink);
}
.gallery-search input::placeholder { color: var(--muted); opacity: 0.85; }
.gallery-search input:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.gallery-favorites { align-self: end; min-height: 2.9rem; }
@media (max-width: 520px) {
  .gallery-tools { grid-template-columns: 1fr; }
  .gallery-favorites { justify-self: start; }
}

.gallery-grid { list-style: none; padding: 0; margin-block: 0; }
.gallery-card { position: relative; }
.gallery-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  border-radius: 1.25rem;
  overflow: hidden;
  background: var(--surface-2);
  cursor: zoom-in;
}
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.gallery-tile:hover img { transform: scale(1.06); }
.gallery-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2rem 1rem 0.875rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.68), transparent);
  color: var(--x-on-photo);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
}
.gallery-save {
  position: absolute;
  z-index: 2;
  top: 0.65rem;
  right: 0.65rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid color-mix(in srgb, var(--x-on-photo) 65%, transparent);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.52);
  color: var(--x-on-photo);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}
.gallery-save svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gallery-save:hover { transform: scale(1.08); }
.gallery-save[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.gallery-save[aria-pressed="true"] svg { fill: currentColor; }
.gallery-empty {
  margin-top: 1.5rem;
  padding: 3rem 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: 1.25rem;
  background: var(--surface);
  text-align: center;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.9);
}
.lightbox-close { position: absolute; top: 1rem; right: 1rem; z-index: 2; }
.lightbox-figure { display: grid; gap: 0.75rem; justify-items: center; margin: 0; min-width: 0; }
.lightbox-figure img { max-width: 100%; max-height: 78svh; border-radius: 1rem; object-fit: contain; }
.lightbox-figure figcaption { color: var(--x-on-photo); font-weight: 500; text-align: center; }
body.lb-open { overflow: hidden; }

/* Pledge */
.pledge-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.pledge-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.pledge-box {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.125rem;
  border: 2px solid var(--border-strong);
  border-radius: 0.5rem;
  color: transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.pledge-item[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-border); }
.pledge-item[aria-pressed="true"] .pledge-box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pledge-track { height: 0.75rem; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); }
.pledge-fill { display: block; height: 100%; width: calc(var(--p, 0) * 1%); border-radius: 999px; background: var(--accent); transition: width 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.pledge-done {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  background: var(--success-soft);
  color: var(--success-strong);
  font-weight: 600;
}

/* Weekly eco checklist: a calm, visual progress summary. */
.pledge-summary { display: flex; align-items: center; gap: 1.25rem; }
.pledge-ring {
  --pledge-progress: 0;
  flex: none;
  display: grid;
  place-items: center;
  width: 7.25rem;
  height: 7.25rem;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pledge-progress) * 1%), var(--border) 0);
  transition: background 0.45s ease;
}
.pledge-ring-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 5.8rem;
  height: 5.8rem;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
}
.pledge-ring-inner strong { font-size: 1.4rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pledge-ring-inner span { margin-top: 0.2rem; color: var(--muted); font-size: 0.75rem; }
[data-pledge-feedback] { overflow-wrap: anywhere; color: var(--accent-text); }
@media (max-width: 420px) {
  .pledge-summary { align-items: flex-start; gap: 1rem; }
  .pledge-ring { width: 5.75rem; height: 5.75rem; }
  .pledge-ring-inner { width: 4.6rem; height: 4.6rem; }
}

html.reduced-motion .explorer-slide.is-entering,
html.reduced-motion .explorer-detail.is-entering,
html.reduced-motion .match-card.is-entering,
html.reduced-motion .gallery-item.is-entering { animation: none; }
html.reduced-motion .pledge-fill,
html.reduced-motion .pledge-ring,
html.reduced-motion .gallery-save,
html.reduced-motion .gallery-tile img { transition: none; }
