/* ============================================================
   Ancient Trees of Cyprus — styles
   Visual concept: concentric tree-rings, cream paper, ink type.
   No shadows, no gradients (except the rings).
   ============================================================ */

:root {
  --cream:   #f5efe1;   /* aged paper */
  --cream-2: #ebe3d0;   /* deeper paper */
  --ink:     #1f1b15;   /* deep wood, body text */
  --ink-2:   #4a4136;   /* secondary text */
  --moss:    #5a6b3e;   /* leaf accent */
  --moss-2:  #7c8d57;
  --bark:    #8b6f47;
  --terra:   #a8543c;   /* trails / routes */
  --rule:    rgba(31, 27, 21, 0.18);
  --rule-2:  rgba(31, 27, 21, 0.08);
  --maxw:    1360px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* paper grain — very subtle radial dotting */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(31,27,21,0.025) 1px, transparent 1px);
  background-size: 3px 3px;
  z-index: 0;
}

main { flex: 1; position: relative; z-index: 1; }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); transition: border-color .2s ease, color .2s ease; }
a:visited { color: var(--ink); }
a:hover { color: var(--moss); border-bottom-color: var(--moss); }

/* Global keyboard focus indicator — mouse-only :focus stays clean */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
.tree-card:focus-visible,
.chip:focus-visible,
.rings-dot:focus-visible,
.ring-preview:focus-visible,
.cand button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 3px;
  border-radius: 2px;
}
.rings-dot:focus-visible { outline-offset: 2px; }
.tree-card:focus-visible { outline-offset: -2px; }

h1, h2, h3, h4 {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--ink);
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.85em; letter-spacing: 0; }

.muted { color: var(--ink-2); }

.smallcaps {
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-2);
}
/* Eyebrows that sit directly above a serif heading need room to breathe. */
.smallcaps + h1, .smallcaps + h2 { margin-top: 14px; }
p.smallcaps { margin: 0 0 14px; }

/* ===================== HEADER ===================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  /* solid cream — sticky header must be opaque so scrolled content doesn't bleed through */
  background: var(--cream);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-bottom: none;
  color: var(--ink);
  flex: 0 0 auto;
  min-width: 0;
}
.brand:hover { color: var(--moss); }
.brand-mark { width: 36px; height: 36px; color: var(--moss); flex: 0 0 36px; }
.brand-text { display: inline-flex; flex-direction: column; line-height: 1; white-space: nowrap; }
.brand-title { font-family: "Cormorant Garamond", serif; font-size: 1.25rem; font-weight: 600; }
.brand-sub   { font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); margin-top: 4px; }

.site-nav { display: flex; gap: 26px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  border-bottom: none;
  position: relative;
  padding: 4px 0;
  color: var(--ink-2);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.active { color: var(--ink); }
.site-nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--moss);
}

@media (max-width: 640px) {
  /* Stack on narrow phones: wordmark on row 1, nav on row 2.
     Avoids the awkward "ABOUT" orphan that wraps under the brand. */
  .site-header {
    padding: 10px 16px 8px;
    gap: 4px;
    flex-direction: column;
    align-items: stretch;
  }
  .brand { gap: 10px; align-self: flex-start; }
  .brand-mark { width: 26px; height: 26px; flex: 0 0 26px; }
  .brand-title { font-size: 1rem; }
  .brand-sub { display: none; }
  .site-nav {
    gap: 14px 18px;
    justify-content: flex-start;
    padding-bottom: 4px;
  }
  .site-nav a { font-size: 0.68rem; letter-spacing: 0.14em; padding: 2px 0; }
}

/* ===================== FOOTER ===================== */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 60px;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--cream);
}
.footer-rings { width: 56px; height: 56px; color: var(--moss); opacity: 0.7; flex: 0 0 56px; }
.footer-rings svg { width: 100%; height: 100%; }
.footer-meta { text-align: right; font-size: 0.85rem; color: var(--ink-2); }
.footer-meta p { margin: 2px 0; }

@media (max-width: 560px) {
  .site-footer { flex-direction: column; align-items: flex-start; padding: 24px 18px; gap: 16px; }
  .footer-meta { text-align: left; }
}

/* ===================== LAYOUT HELPERS ===================== */

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }

.section { padding: 60px 0; }

.lede {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.35rem;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 60ch;
}

hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 40px 0; }

/* ===================== LANDING ===================== */

.landing {
  position: relative;
  min-height: calc(100vh - 80px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 60px;
  padding: 40px 32px 60px;
  max-width: var(--maxw);
  margin: 0 auto;
}

.landing-copy h1 {
  font-size: clamp(2.6rem, 5.2vw, 4.6rem);
  line-height: 1.02;
  font-weight: 500;
  margin-bottom: 24px;
}
.landing-copy h1 em {
  font-style: italic;
  color: var(--moss);
}
.landing-copy .lede { margin-bottom: 32px; }

.tally {
  display: flex;
  gap: 36px;
  margin: 32px 0 36px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.tally-item .num {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--ink);
  font-weight: 500;
}
.tally-item .lbl {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 6px;
  display: block;
}

.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
  cursor: pointer;
}
.btn:hover { background: var(--ink); color: var(--cream); border-bottom-color: var(--ink); }
.btn.primary { background: var(--moss); color: var(--cream); border-color: var(--moss); }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); }

/* the giant rings */
.rings-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 560px;
  justify-self: end;
}
.rings-wrap { position: relative; }
.rings-wrap svg { width: 100%; height: 100%; display: block; }
.rings-ring { fill: none; stroke: var(--ink); }
/* SVG <a> wrapper around each dot — native link for click + keyboard nav.
   Removing the default border-bottom that all <a> get globally. */
.rings-dot-link { border-bottom: none; outline: none; }
.rings-dot-link:focus-visible .rings-dot {
  fill: var(--ink);
  r: 7;
  stroke: var(--moss);
  stroke-width: 2;
}
.rings-dot-link:focus { outline: none; }
/* Transparent oversized hit target. Sits BEHIND the visible dot in the SVG
   stacking order (we append it first), so we get a generous mouse/touch
   target while preserving the small ink dot aesthetic. */
.dot-target { cursor: pointer; }
.rings-dot-hit {
  /* never visible — geometry only */
  fill: transparent;
  stroke: none;
}
/* Visible dot. Animate `r` for crisp scale-up. pointer-events:none in the
   markup so the hit overlay always wins the hit-test (no transform-drift). */
.rings-dot {
  fill: var(--moss);
  transition: fill 0.18s ease, r 0.12s ease-out, stroke-width 0.12s ease;
  stroke: transparent;
  stroke-width: 0;
}
.rings-dot.terra { fill: var(--terra); }
/* Visual feedback when the surrounding hit overlay is hovered, or the dot
   is the currently-active one. We don't use :hover on .rings-dot itself
   because pointer-events:none means it never receives hover — instead we
   target via the dot-target group. */
.dot-target:hover .rings-dot,
.rings-dot.hovered {
  fill: var(--ink);
  r: 6.5;
  stroke: rgba(31,27,21,0.18);
  stroke-width: 1.2;
}
.rings-center {
  font-family: "Cormorant Garamond", serif;
  fill: var(--ink);
  text-anchor: middle;
}
/* Per-ring spinning groups — speed/direction is set inline in JS.
   Disable spin entirely if the user prefers reduced motion. */
.rings-spin { transform-origin: 50% 50%; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .rings-spin { animation: none !important; }
  .rings-dot { transition: fill 0.05s linear, r 0.05s linear; }
  .ring-preview { transition: opacity 0.08s linear, visibility 0s; }
}

/* Touch devices — bump the invisible hit overlay so taps land. */
@media (pointer: coarse) {
  .rings-dot-hit { r: 22 !important; }
}

/* Hover preview card — interactive, clickable, hover-keep zone.
   Default placement is ABOVE the dot. Edge cases handled with classes:
     · .below          → flipped under the dot
     · .offset-left    → horizontal shift left (right edge clearance)
     · .offset-right   → horizontal shift right (left edge clearance)
   Horizontal shift is communicated via the `--preview-shift` custom prop,
   composed into the transform so the card stays attached to its dot's x.
*/
.ring-preview {
  position: absolute;
  z-index: 10;
  width: 240px;
  background: var(--cream);
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(31,27,21,0.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  --preview-shift: 0px;
  transform: translate(calc(-50% + var(--preview-shift)), calc(-100% - 16px))
             translateY(4px);
  transition: opacity 0.12s ease-out, transform 0.12s ease-out,
              visibility 0s linear 0.1s;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--ink); /* override the global a-tag border */
}
.ring-preview.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(calc(-50% + var(--preview-shift)), calc(-100% - 16px));
  transition: opacity 0.12s ease-out, transform 0.12s ease-out;
}
.ring-preview:hover { box-shadow: 0 8px 22px rgba(31,27,21,0.22); }
.ring-preview.below {
  transform: translate(calc(-50% + var(--preview-shift)), 16px) translateY(-4px);
}
.ring-preview.below.visible {
  transform: translate(calc(-50% + var(--preview-shift)), 16px);
}
.ring-preview:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 2px;
}
.ring-preview img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
  filter: saturate(0.92);
}
.ring-preview-meta {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--rule);
}
.ring-preview:not(:has(img)) .ring-preview-meta { border-top: none; }
.ring-preview-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.18;
  color: var(--ink);
  margin-bottom: 4px;
}
.ring-preview-species {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  color: var(--moss);
  font-size: 0.95rem;
  line-height: 1.3;
}

@media (max-width: 880px) {
  .landing { grid-template-columns: 1fr; }
  /* Cap the rings on phones so they never produce horizontal scroll */
  .rings-wrap { justify-self: center; max-width: min(420px, calc(100vw - 32px)); }
}

/* ===================== CATALOG ===================== */

.page-head {
  padding: 50px 32px 30px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.page-head h1 {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  margin-bottom: 12px;
}
.page-head .lede { margin-bottom: 4px; }

.filter-bar {
  max-width: var(--maxw);
  margin: 0 auto 24px;
  padding: 0 32px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar .filter-lbl {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-right: 8px;
}
.chip {
  /* &lt;button&gt; doesn't inherit body font — set it explicitly. */
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.78rem;
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--ink-2);
  transition: all .15s ease;
  user-select: none;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
/* Italicise Latin binomials inside chips when we tag them */
.chip .sp-name { font-style: italic; }

.search-input {
  appearance: none;
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  width: 220px;
  margin-left: auto;
}
.search-input:focus { outline: none; border-color: var(--moss); }

/* Grid frame:
   - The grid itself draws the outer top rule and clips trailing borders.
   - Each card draws its own bottom + right rule; the grid's overflow:hidden
     trims the rightmost column's dangling right border. */
/* Catalog: side-by-side cards — vertical photo strip on the left,
   text column on the right. Cards have a uniform height regardless of
   photo presence (no broken layout). Portrait photos display naturally. */
.catalog-grid {
  max-width: var(--maxw);
  margin: 0 auto 60px;
  padding: 0 32px;
  display: grid;
  /* Larger card minimum so text column breathes. 3 cards-per-row on
     1440 px screens, gracefully falling to 2 on narrower widths. */
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
}
.tree-card {
  position: relative;
  display: grid;
  /* Photo column is now ~1/3 of card width (was ~1/4). Card min-width
     in the parent grid stays 360 px so three cards still fit per row
     at the 1180-px content max. */
  grid-template-columns: 165px 1fr;
  gap: 0;
  /* Fixed height so every row of the catalog grid is uniform — otherwise
     CSS-grid sizes each row to its tallest card, and rows with long
     descriptions become much taller than rows of "Unnamed pin" cards. */
  height: 290px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  transition: background .15s ease;
  overflow: hidden;
}
.tree-card:hover { background: var(--cream-2); color: var(--ink); }
@media (max-width: 620px) {
  .tree-card { border-right: none; grid-template-columns: 115px 1fr; height: 240px; }
}

/* Left strip — photo OR a decorative placeholder */
.tree-card .card-side {
  position: relative;
  overflow: hidden;
  background: var(--cream-2);
  border-right: 1px solid var(--rule);
}
.tree-card.has-photo .card-side { background: var(--cream); }
.tree-card .card-side img {
  position: absolute; inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.85) contrast(0.96);
  transition: transform 0.45s ease, filter 0.3s ease;
}
.tree-card:hover .card-side img {
  transform: scale(1.04);
  filter: saturate(0.95) contrast(1);
}
/* Decorative placeholder for no-photo cards — concentric ring sigil + id */
.tree-card .side-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--moss);
  opacity: 0.55;
}
.tree-card .side-placeholder svg { width: 44%; height: auto; max-width: 56px; }

/* Right text column */
.tree-card .card-text {
  padding: 22px 22px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;   /* allow inner items to shrink and ellipsis */
  overflow: hidden;
}
.tree-card .num {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--ink-2);
}
.tree-card h3 {
  font-size: 1.32rem;
  line-height: 1.18;
  font-weight: 500;
}
.tree-card .card-subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  margin-top: -2px;
}
.tree-card .species {
  font-style: italic;
  color: var(--moss);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.02rem;
  line-height: 1.25;
}
.tree-card .species.empty { color: var(--ink-2); font-style: normal; opacity: 0.55; font-family: "Inter", sans-serif; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }

.tree-card .coords {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tree-card .ringlet {
  width: 18px; height: 18px;
  color: var(--moss);
  opacity: 0.6;
}
.tree-card .coords .ll { font-family: "JetBrains Mono", monospace; font-size: 0.7rem; color: var(--ink-2); }

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 60px 32px;
  text-align: center;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
}
.empty-state h3 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.6rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--ink);
}
.empty-state p { margin: 4px 0 16px; }
.empty-state .reset {
  appearance: none;
  font-family: inherit;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  padding: 8px 18px;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
}
.empty-state .reset:hover { background: var(--ink); color: var(--cream); }

/* ===================== MAP ===================== */

.map-wrap {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  border-top: 1px solid var(--rule);
}
#map {
  height: calc(100vh - 80px - 100px);
  min-height: 520px;
  background: var(--cream-2);
}
.map-side {
  border-left: 1px solid var(--rule);
  max-height: calc(100vh - 80px - 100px);
  overflow-y: auto;
  padding: 24px;
  background: var(--cream);
}
.map-side h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}
.map-side .item {
  padding: 10px 12px;
  margin: 0 -12px;
  border-bottom: 1px solid var(--rule-2);
  cursor: pointer;
  font-size: 0.92rem;
  transition: background 0.12s ease, color 0.12s ease;
  border-left: 2px solid transparent;
}
.map-side .item:hover {
  color: var(--ink);
  background: var(--cream-2);
  border-left-color: var(--moss);
}
.map-side .item.active {
  color: var(--ink);
  background: var(--cream-2);
  border-left-color: var(--moss);
}
.map-side .item .sp { display: block; font-style: italic; color: var(--moss); font-size: 0.8rem; font-family: "Cormorant Garamond", serif; }
.map-side .item .region { display: block; font-size: 0.7rem; color: var(--ink-2); font-family: "JetBrains Mono", monospace; margin-top: 2px; }

/* Map legend — small floating card */
.map-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 500;
  background: rgba(245, 239, 225, 0.95);
  border: 1px solid var(--rule);
  padding: 10px 14px;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 220px;
}
.map-legend .lg-row {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 0;
}
.map-legend .lg-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--moss);
  flex: 0 0 10px;
  border: 1px solid var(--cream);
  box-shadow: 0 0 0 1px var(--moss);
}
.map-legend .lg-dot.unverified { background: #b8a980; box-shadow: 0 0 0 1px #b8a980; }
.map-legend .lg-line {
  width: 16px; height: 2px;
  background: var(--terra);
  flex: 0 0 16px;
}
.map-legend .lg-line.dashed { background: transparent; border-top: 2px dashed var(--terra); height: 0; }

@media (max-width: 880px) {
  .map-wrap { grid-template-columns: 1fr; }
  .map-side { max-height: 320px; border-left: none; border-top: 1px solid var(--rule); }
}

/* leaflet popup tuning */
.leaflet-popup-content-wrapper {
  background: var(--cream);
  color: var(--ink);
  border-radius: 0;
  box-shadow: 0 4px 14px rgba(31,27,21,0.12);
}
.leaflet-popup-tip { background: var(--cream); }
.leaflet-popup-content { margin: 14px 18px; font-family: "Inter", sans-serif; font-size: 0.88rem; }
.leaflet-popup-content h4 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.15rem;
  font-weight: 500;
  margin: 0 0 4px;
}
.leaflet-popup-content .sp { font-style: italic; color: var(--moss); font-family: "Cormorant Garamond", serif; font-size: 0.95rem; }

/* Popup card layout — photo strip on the left, text on the right, mirroring
   the catalog card pattern. */
.leaflet-popup-content .popup-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.leaflet-popup-content .popup-card.has-photo {
  grid-template-columns: 92px 1fr;
  gap: 14px;
  min-height: 130px;
}
.leaflet-popup-content .popup-photo {
  margin: -14px 0 -14px -18px; /* bleed against the popup-card-wrapper padding */
  background: var(--cream-2);
  overflow: hidden;
}
.leaflet-popup-content .popup-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) contrast(0.96);
}
.leaflet-popup-content .popup-text { display: flex; flex-direction: column; }
.leaflet-popup-content .popup-text h4 { margin-bottom: 4px; }
.leaflet-popup-content .popup-cta { margin-top: 10px; }
.leaflet-popup-content a {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--moss);
  border-bottom: 1px solid var(--moss);
}
.leaflet-popup-content a:hover { color: var(--ink); border-bottom-color: var(--ink); }
/* Override Leaflet defaults that introduce orphan blues */
.leaflet-container a { color: var(--moss); }

.tree-marker {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--moss);
  border: 2px solid var(--cream);
  box-shadow: 0 0 0 1px var(--moss);
}
.tree-marker.terra      { background: var(--terra); box-shadow: 0 0 0 1px var(--terra); }
.tree-marker.unverified { background: #b8a980; box-shadow: 0 0 0 1px #b8a980; }
.tree-marker.error      { background: var(--terra); box-shadow: 0 0 0 1px var(--terra); border-color: rgba(245,239,225,0.75); }

/* ===================== ROUTES ===================== */

.routes-list {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 32px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
.route-card {
  border: 1px solid var(--rule);
  background: var(--cream);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  overflow: hidden;
}
.route-card .info { padding: 28px; }
.route-card h2 {
  font-size: 1.9rem;
  margin-bottom: 10px;
}
.route-card .stats {
  display: flex;
  gap: 28px;
  margin: 18px 0;
}
.route-card .stats div span {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.6rem;
}
.route-card .stats div small {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.route-mini { min-height: 280px; background: var(--cream-2); }

@media (max-width: 720px) {
  .route-card { grid-template-columns: 1fr; }
}

/* ===================== TREE DETAIL ===================== */

.tree-detail {
  max-width: 820px;
  margin: 0 auto;
  padding: 50px 32px 60px;
}
.tree-detail .back {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: none;
}
.tree-detail .back:hover { color: var(--moss); }
.tree-detail h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 18px 0 8px;
  font-weight: 500;
  line-height: 1.05;
}
.tree-detail .species-line {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  color: var(--moss);
  font-size: 1.4rem;
  margin-bottom: 30px;
}
.tree-detail .species-line.empty { color: var(--ink-2); font-style: normal; opacity: 0.6; font-family: "Inter", sans-serif; font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; }
.tree-detail .detail-subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink-2);
  margin: -4px 0 12px;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  margin: 30px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.fact-grid .fact {
  padding: 18px 22px 18px 0;
  border-right: 1px solid var(--rule-2);
}
.fact-grid .fact + .fact { padding-left: 22px; }
.fact-grid .fact:last-child { border-right: none; }
@media (max-width: 560px) {
  .fact-grid .fact { padding: 14px 0; border-right: none; border-bottom: 1px solid var(--rule-2); }
  .fact-grid .fact:last-child { border-bottom: none; }
  .fact-grid .fact + .fact { padding-left: 0; }
}
.fact-grid .fact dt {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.fact-grid .fact dd {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.3rem;
  color: var(--ink);
  font-weight: 500;
}
.fact-grid .fact dd.mono { font-family: "JetBrains Mono", monospace; font-size: 0.95rem; font-weight: 400; }

.tree-detail .notes {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ink);
  border-left: 2px solid var(--moss);
  padding-left: 20px;
  margin: 28px 0;
}
.tree-detail .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.tree-detail #detail-map {
  height: 380px;
  margin-top: 30px;
  border: 1px solid var(--rule);
}
.tree-detail .see-on-full-map {
  margin: 14px 0 0;
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  text-align: right;
}
.tree-detail .see-on-full-map a {
  color: var(--moss);
  border-bottom: 1px solid var(--rule);
  font-weight: 500;
}
.tree-detail .see-on-full-map a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ===================== ABOUT ===================== */

.about-page {
  max-width: 740px;
  margin: 0 auto;
  padding: 60px 32px;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.25rem;
  line-height: 1.65;
  color: var(--ink);
}
.about-page h1 {
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  margin-bottom: 30px;
}
.about-page p { margin: 0 0 22px; }
.about-page p.smallcaps { font-size: 0.72rem; }

/* ===================== ENRICHED FIELDS ===================== */

/* Age chip on catalog cards */
.age-pill {
  display: inline-block;
  align-self: flex-start;
  margin-top: 2px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: transparent;
}
.tree-card:hover .age-pill { border-color: var(--moss); color: var(--moss); }

/* Description preview on catalog cards — clamp to 3 lines so the card
   stays uniform-height regardless of source-text length. */
.card-desc {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.02rem;
  line-height: 1.42;
  color: var(--ink-2);
  margin: 6px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Detail-page photograph */
.tree-photo {
  margin: 18px 0 30px;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--cream-2);
}
.tree-photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
  filter: saturate(0.92) contrast(0.98);
}
.tree-photo figcaption {
  padding: 10px 14px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-top: 1px solid var(--rule);
}

/* Detail-page description (research blurb) */
.tree-lede {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.32rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 6px 0 28px;
  max-width: 62ch;
}

/* Sources block */
.sources-block {
  margin-top: 38px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.sources-block .smallcaps { margin-bottom: 14px; }
.sources-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sources-list li {
  font-size: 0.92rem;
  border-left: 2px solid var(--rule);
  padding-left: 14px;
}
.sources-list li a {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  letter-spacing: 0;
  border-bottom: 1px dotted var(--rule);
  color: var(--ink);
}
.sources-list li a:hover { color: var(--moss); border-bottom-color: var(--moss); }

/* Photo provenance footnote */
.photo-credit {
  margin: -18px 0 26px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  font-style: italic;
}
.photo-credit a { font-family: "JetBrains Mono", monospace; font-size: 0.82rem; font-style: normal; border-bottom: 1px dotted var(--rule); }

/* Plaque block */
.plaque-block {
  margin-top: 32px;
  padding: 22px 22px;
  border: 1px solid var(--rule);
  background: var(--cream-2);
}
.plaque-block .smallcaps { margin-bottom: 12px; }
.plaque-note {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 14px;
}

/* Source note next to URL */
.sources-list .src-note {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-2);
  margin-top: 4px;
  line-height: 1.45;
  max-width: 70ch;
}

/* ===================== VERIFICATION FLAGS ===================== */

/* Pill used in catalog cards + as label inside the banner */
.verify-pill {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--terra);
  background: rgba(168, 84, 60, 0.08);
  border: 1px solid rgba(168, 84, 60, 0.4);
}
.verify-pill.verify-duplicate { color: #876335; background: rgba(135,99,53,0.08); border-color: rgba(135,99,53,0.4); }
.verify-pill.verify-unknown   { color: var(--ink-2); background: rgba(74,65,54,0.06); border-color: rgba(74,65,54,0.3); }

/* Catalog card hover state for pill */
.tree-card:hover .verify-pill { filter: brightness(0.95); }

/* Banner on tree-detail page — more contrast than before so it actually reads */
.verify-banner {
  margin: 0 0 26px;
  padding: 16px 20px;
  border: 1px solid rgba(168, 84, 60, 0.6);
  background: rgba(168, 84, 60, 0.16);
}
.verify-banner.verify-error { border-color: rgba(168,84,60,0.7); background: rgba(168,84,60,0.22); border-left-width: 3px; }
.verify-banner.verify-duplicate { border-color: rgba(135,99,53,0.6); background: rgba(135,99,53,0.14); }
.verify-banner.verify-coords    { border-color: rgba(168,84,60,0.55); background: rgba(168,84,60,0.13); }
.verify-banner.verify-age       { border-color: rgba(135,99,53,0.55); background: rgba(135,99,53,0.13); }
.verify-banner.verify-unknown   { border-color: rgba(74,65,54,0.4);  background: rgba(74,65,54,0.08); }
.verify-banner .verify-pill { margin-top: 0; }
.verify-banner p {
  margin: 10px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1rem;
  line-height: 1.45;
  color: var(--ink);
}
.verify-banner p.verify-cta {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  font-style: italic;
}

/* ===================== UTILS ===================== */

.hidden { display: none !important; }
