:root {
  --olive-dark: #3a4d1f;
  --olive: #6b7f3a;
  --olive-light: #a8b878;
  --stone: #ece6d8;
  --stone-dark: #d8cfb8;
  --ink: #2b2620;
  /* Sampled (median of fully-opaque core pixels) from images/2-glugs-glair/
     glug-1.png -- used to tie the tree-label pills back to the teal glaze
     icon color instead of using an arbitrary accent. */
  --glug-teal: #4f8079;
  --glug-teal-deep: #3c605d;
  /* A lighter step up from --glug-teal, used only for the hover-lit state
     of the label dot/border and connector line -- same hue family so a
     hovered tree still reads as "the same accent, brighter" rather than
     introducing an unrelated highlight color. */
  --glug-teal-bright: #7fb3aa;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Georgia", "Iowan Old Style", serif;
  color: var(--ink);
  background: var(--stone);
}

/* body is a flex column of [#site-header (if present), main] so main always
   gets exactly "the rest of the viewport" regardless of how tall the header
   actually renders -- including zero, on pages like index-garden.html and
   index-park-blocks.html that have no #site-header element in the DOM at
   all (they use a differently-positioned persistent title instead; see
   those files). main used to be sized via a hardcoded "height: calc(100% -
   78px)" that assumed every page's header rendered at the same fixed 78px
   -- true for the plain default header, but not for index-mylar-layer.html/
   index-garden.html's much shorter custom header, and definitely not for
   the header-less pages, where it left a genuine 78px-tall empty gap at the
   bottom of the screen (main was 78px short of the full viewport with
   nothing there to account for it). Flex sizing adapts automatically to
   each page's actual header height (or lack of one) instead of needing a
   per-page magic number. */
body {
  display: flex;
  flex-direction: column;
}

#site-header {
  padding: 1rem 1.5rem;
  background: var(--olive-dark);
  color: var(--stone);
  border-bottom: 3px solid var(--olive-light);
}

#site-header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--olive-light);
  font-style: italic;
}

main {
  display: flex;
  /* flex: 1 1 auto lets main (a flex item of body, see above) claim
     whatever's left of the viewport after #site-header's own natural
     height, instead of the old hardcoded "height: calc(100% - 78px)" that
     assumed every page's header was exactly 78px tall (or, on
     index-garden.html/index-park-blocks.html, assumed a header existed at
     all -- it doesn't on those pages, which is what left a genuine
     78px-tall empty gap at the bottom of the screen there). min-height
     stays an explicit 500px (unchanged from before) rather than the
     flex-item default of "auto" -- an explicit value is what avoids a
     classic flexbox trap where a column-flex child containing a
     height:100% descendant (#map, below) can otherwise refuse to shrink
     below its content's intrinsic size. */
  flex: 1 1 auto;
  min-height: 500px;
}

#map {
  flex: 1 1 auto;
  height: 100%;
}

/* Tint the base tiles toward the sepia/brown palette of the hand-drawn
   overlay (images/IMG_6754.JPG) instead of leaving them neutral gray, so the
   real map and the painted drawing feel like one consistent piece. Values
   were solved numerically against the overlay's actual average hue (~30deg)
   and saturation, not eyeballed. */
.leaflet-tile-pane {
  filter: grayscale(100%) sepia(35%) saturate(120%) hue-rotate(-12deg) brightness(0.9);
}

/* Leaflet's default zoom-transform transition (leaflet.css) uses an ease-out
   curve (cubic-bezier(0,0,0.25,1)): fast start, slow end. Continuous
   scroll-wheel zoom (see zoomSnap/wheelPxPerZoomLevel in js/app.js) fires a
   new burst roughly every 40ms, far faster than that curve's 0.25s duration,
   so each burst kept interrupting the last mid-"fast start" and restarting
   -- felt like constant acceleration/deceleration stutter. Forcing this to
   linear removes that shape entirely: a linear tween has no fast/slow phase
   to get yanked through when retriggered, so repeated bursts read as one
   continuous constant-speed motion instead, while keeping zoomAnimation
   (and the tile crossfade it's responsible for) turned on. */
.leaflet-zoom-anim .leaflet-zoom-animated {
  transition-timing-function: linear !important;
}

#info-panel {
  width: 320px;
  flex: 0 0 320px;
  background: var(--stone);
  border-left: 1px solid var(--stone-dark);
  padding: 1.25rem;
  overflow-y: auto;
}

#info-panel h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--olive-dark);
}

#info-panel h3 {
  margin-top: 0;
  color: var(--olive-dark);
}

#info-panel p {
  line-height: 1.5;
  font-size: 0.95rem;
}

.hidden {
  display: none;
}

.tree-meta {
  font-size: 0.85rem;
  color: #6b6355;
  margin-bottom: 0.75rem;
}

.leaflet-popup-content h3 {
  margin: 0 0 0.35rem 0;
  color: var(--olive-dark);
}

.tree-marker {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
  transition: filter 0.15s ease;
  cursor: pointer;
}

/* Hover state (toggled in js/app.js on marker mouseover/mouseout) --
   brightens the icon itself and adds a soft warm glow around it, on top of
   (not instead of) the existing drop shadow, so it still looks grounded on
   the map rather than flattening out. */
.tree-marker.tree-marker-hover {
  filter: brightness(1.25) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 7px rgba(255, 246, 214, 0.85));
}

/* Always-on tree name labels (used by index-labeled.html via
   window.SHOW_LABELS -- see js/app.js). Leaflet's permanent tooltip is a
   plain <div>, so it's restyled here as a small pill -- bold uppercase
   sans-serif, fully rounded -- but tinted to feel like it belongs on this
   particular map rather than a generic floating UI chip: background is a
   translucent warm parchment (the same paper tone as the rest of the site,
   --stone, so the map shows faintly through it) instead of flat white, and
   both the text and a small leader dot are colored with --glug-teal, sampled
   from the actual teal glaze-icon artwork (images/2-glugs-glair/), so each
   label visually ties back to its own marker's color rather than reading as
   an unrelated interface element dropped on top of the drawing. */
.tree-label {
  background: rgba(243, 237, 223, 0.92);
  border: 1px solid rgba(79, 128, 121, 0.35);
  border-radius: 16px;
  box-shadow: 0 2px 5px rgba(43, 38, 32, 0.16);
  color: var(--glug-teal-deep);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 14px;
  white-space: nowrap;
  /* Was pointer-events: none (labels were purely informational) until
     hovering the label itself needed to trigger the same lit-up state as
     hovering the icon -- see the tooltipEl mouseover/mouseout listeners in
     js/app.js. cursor: pointer signals that it's now hoverable/part of the
     same interactive marker, even though it's not a separate click
     target. */
  pointer-events: auto;
  cursor: pointer;
  /* Stacks the name and (optional) coordinates line -- see .tree-label-name/
     -coords below -- instead of the single line of text this pill was
     originally built for. border-radius dropped from a full 999px pill to
     16px above since a two-line box that tall would make a true pill look
     like a stretched-out oval; 16px keeps the same rounded-capsule feel for
     either a one-line (name only, e.g. Holy Hug/Source below) or two-line
     label. align-items: flex-start keeps both lines left-edge-aligned
     rather than each centering independently at different widths. */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  /* No position: relative here -- Leaflet's own .leaflet-tooltip rule
     already sets position: absolute (that's what places the tooltip at its
     computed map coordinate at all); redeclaring it as relative here would
     override that at equal specificity (this stylesheet loads after
     leaflet.css) and drop every label back into normal document flow
     instead of its anchored position. The ::before dot below still gets a
     valid positioning context from that inherited absolute positioning. */
}

/* .tree-label-name inherits the bold/uppercase/letter-spacing look straight
   from .tree-label above (all inheritable properties) -- no rules needed of
   its own, just a hook for the flex layout above to lay it out as a line.
   .tree-label-coords dials the same inherited properties back down (smaller,
   lighter weight, not all-caps, slightly muted) so it reads as secondary
   metadata under the name rather than a second, equally-loud label. */
.tree-label-coords {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  opacity: 0.78;
}

/* Leaflet's default pointer triangle (::before) is replaced with a small
   solid dot in the same teal as the tree icons, sitting just inside the
   pill on whichever side faces the marker -- a subtler, color-based way of
   linking label to icon than a speech-bubble arrow. Padding on that side is
   widened to make room for it. */
.tree-label::before {
  content: "";
  position: absolute;
  /* Normally the vertical center (50%) -- matches the connector line's
     fixed endpoint (see connectorEndpoints in js/app.js) exactly when the
     box's height is its natural, intrinsic one. Expanding a label grows
     its height downward only (top edge fixed -- see expandLabel), so 50%
     would otherwise drift down away from that fixed line as the box gets
     taller; expandLabel sets --label-dot-top to the box's *original*
     center (in px) for the duration it's expanded, overriding this
     fallback, then clears it again on collapse. */
  top: var(--label-dot-top, 50%);
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border: none;
  border-radius: 50%;
  background: var(--glug-teal);
}
.tree-label.leaflet-tooltip-right {
  padding-left: 22px;
}
.tree-label.leaflet-tooltip-right::before {
  left: 10px;
}
.tree-label.leaflet-tooltip-left {
  padding-right: 22px;
  /* Growing a "left" label (see expandLabel/collapseLabel in js/app.js)
     only ever pushes its far (left) edge outward -- the near (right) edge,
     with the dot above and the connector line's endpoint, stays fixed.
     flex-end keeps the name/coordinates text hugging that same fixed right
     edge as the box widens, instead of drifting left with it. */
  align-items: flex-end;
}
.tree-label.leaflet-tooltip-left::before {
  right: 10px;
}

/* Hover state (toggled in js/app.js alongside the icon's own hover glow
   and the connector line's, below -- all three light up together so a
   hovered tree reads as one connected thing, not three independently
   reacting elements). Brightens the pill itself and switches the dot to
   --glug-teal-bright to match the also-brightened connector line. */
.tree-label {
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.tree-label.tree-label-hover {
  background: rgba(255, 250, 235, 0.97);
  border-color: var(--glug-teal-bright);
  box-shadow: 0 2px 6px rgba(43, 38, 32, 0.22), 0 0 0 1px rgba(127, 179, 170, 0.5);
}
.tree-label.tree-label-hover::before {
  background: var(--glug-teal-bright);
}

/* Thin leader line between each label's dot and its tree icon (positioned
   and sized in js/app.js -- see createLabelConnectors/refreshLabels/
   animateConnectors). Lives inside connectorPane, a custom Leaflet pane
   (see map init in js/app.js), rather than document.body -- position:
   absolute + left:0/top:0 here because js/app.js positions it via
   Leaflet's own L.DomUtil.setPosition (a CSS transform), the same
   mechanism Leaflet uses for markers and tooltips themselves. Same teal as
   the dot/label text so it reads as one continuous accent instead of a
   separate line element, and a lower opacity so it stays a quiet
   connective thread rather than competing with the label or icon for
   attention. connectorPane's own z-index (649, just under tooltipPane's
   650) is set in js/app.js where the pane is created. */
.tree-label-connector {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  background: var(--glug-teal);
  opacity: 0.55;
  border-radius: 1px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

/* Hover state -- see the matching .tree-marker-hover/.tree-label-hover
   comments above; toggled together with those two. */
.tree-label-connector.tree-label-connector-hover {
  background: var(--glug-teal-bright);
  opacity: 0.9;
}

/* .leaflet-zoom-animated (added to each connector div in
   createLabelConnectors) already gets "transition: transform 0.25s ..."
   from leaflet.css, plus the linear-timing override above -- that alone
   animates the connector's *position* (set via L.DomUtil.setPosition,
   i.e. a transform) smoothly. This extends the same transition to
   width/height too, since animateConnectors() also updates the line's
   length and its zoom-scaled thickness at the same moment -- without this
   those two would still jump instantly even though position glides. */
.leaflet-zoom-anim .tree-label-connector {
  transition-property: transform, width, height;
}

/* -----------------------------------------------------------------------
   Tree label expansion (js/app.js: expandLabel/collapseLabel). No separate
   panel element at all -- clicking a marker or its label widens that same
   .tree-label pill in place (width transition only, see the long comment
   above expandLabel), so it inherits all of .tree-label's normal look
   (background, border, radius, padding, font) automatically. This rule
   just bumps stacking order while expanded, so a widened label reliably
   draws over any neighboring icon/label it now reaches across instead of
   possibly sitting under one. */
.tree-label.tree-label-expanded {
  z-index: 2;
  /* Belt-and-suspenders alongside the height math in js/app.js
     (sizeSlideshowViewport/resizePanelToActiveFrame/expandLabel): if a
     photo's measured height and the panel's own animated height are ever
     out of sync for a moment, this clips the overflow to the panel's own
     rounded border instead of letting it visibly spill past it. */
  overflow: hidden;
}

/* Close button for an expanded label (js/app.js: ensureLabelCloseButton).
   No font/size/color rules here at all -- being a plain child of
   .tree-label, it inherits those straight from it (the same rule that
   already gives .tree-label-name its look), which is what guarantees it
   always matches the name exactly. Hidden until expanded; `top` is set
   inline per-instance in JS (matches the name's own vertical position,
   which doesn't move once expanded -- see expandLabel). left/right (the
   *far* side from the name -- opposite of the near-edge padding rules
   above) come from whichever direction class Leaflet already put on this
   same element. */
.tree-label-close-x {
  display: none;
  position: absolute;
  cursor: pointer;
  line-height: 1;
  /* `top` (set inline in JS) marks the *center* of the name text, not a
     corner -- shift up by half this element's own rendered height so it's
     actually centered there instead of hanging below it. */
  transform: translateY(-50%);
  /* Stays invisible through the box's own width/height grow animation --
     see the matching .tree-label-header-ready rule below and the comment
     in js/app.js's expandLabel (the setTimeout that adds that class) for
     why: this element's left/right: 14px position tracks the box's
     *current* (still-animating, narrower-than-final) edges the whole time,
     which can put it overlapping the name text for the ~380ms it takes to
     reach full width. Hidden here, then faded in only once that's done. */
  opacity: 0;
  transition: opacity 0.15s ease;
}
.tree-label.tree-label-expanded .tree-label-close-x {
  display: block;
}
.tree-label.tree-label-header-ready .tree-label-close-x {
  opacity: 1;
}
.tree-label.leaflet-tooltip-left .tree-label-close-x {
  left: 14px;
}
.tree-label.leaflet-tooltip-right .tree-label-close-x {
  right: 14px;
}

/* Photo slideshow for an expanded label (js/app.js: ensureLabelSlideshow).
   A normal flex child of .tree-label, appended after the name/coords
   spans, so it just falls in below them in the column -- no absolute
   positioning needed, unlike the close button. flex: 0 0 auto (not
   1 1 auto) deliberately keeps this at its own intrinsic size rather than
   stretching to fill the box -- expandLabel sizes the *box* around this
   element's natural size (measuring it before deciding targetWidth/
   targetHeight), not the other way around, so this should never need to
   stretch or get squeezed. Hidden until expanded, same pattern as the
   close button. The prev/next row (js/app.js: ensureLabelSlideshow) still
   lives inside here in the DOM, but is position: absolute in the header
   instead (see .tree-label-slide-nav), so it doesn't actually occupy any
   space in this column -- the photo viewport is the only element that
   does.

   align-self: stretch here only actually matters for a placeholder tree
   (no real photos yet): it makes this span .tree-label's own content
   width exactly like before this ever grew photo-size-aware, matching the
   original, unchanged placeholder look. A real photo instead gets an
   explicit width (js/app.js: sizeSlideshowViewport/resizePanelToActiveFrame)
   that overrides stretch entirely, sized to the photo itself
   (MAX_PHOTO_EDGE), plus left/right margins (applyPhotoEdgeMargins) that
   pull it back out of .tree-label's own text-oriented padding -- 14px
   normally, 36px on whichever edge carries the connector dot (see
   .tree-label.leaflet-tooltip-left/-right below) -- to land it at a
   uniform PHOTO_EDGE_PAD (6px) gap from the panel's border on every side,
   matching the top gap here (margin-top) exactly. */
.tree-label-slideshow {
  display: none;
  flex-direction: column;
  align-self: stretch;
  gap: 6px;
  flex: 0 0 auto;
  margin-top: 6px;
  white-space: normal;
}
.tree-label.tree-label-expanded .tree-label-slideshow {
  display: flex;
}

/* The viewport clips everything but the one frame currently "in view" to
   its own width; the track inside it lays every placeholder frame out in
   a single row and is what actually moves (see moveSlideTrack in
   js/app.js) -- sliding the track left/right by a frame's-width-worth of
   translateX is what makes switching photos read as a slide instead of an
   instant swap.

   Height is the one thing that now varies per photo -- js/app.js
   (sizeSlideshowViewport) sets an explicit inline px height here, computed
   from *that specific slide's* own natural aspect ratio at the panel's
   current width, so a portrait photo gets a taller box than a landscape
   one instead of both being force-cropped into the same fixed shape. No
   transition on that height, deliberately -- the photo itself still
   slides horizontally (the track's own transform transition, below), but
   the box around it snaps straight to each photo's own size rather than
   easing into it. */
.tree-label-slide-viewport {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}

/* Prev/next buttons, overlaid directly on the photo's own left/right edges
   (position: absolute within .tree-label-slide-viewport, which is sized to
   exactly match the current photo -- see sizeSlideshowViewport in
   js/app.js) rather than sitting in a separate row below it. White glyph
   with a black outline (via -webkit-text-stroke, plus a layered
   text-shadow fallback for any engine that doesn't support text-stroke) so
   the arrow stays legible over a photo of any color. Both call the same
   step() closure the ArrowLeft/ArrowRight keydown listener uses -- see
   ensureLabelSlideshow in js/app.js. */
.tree-label-slide-prev,
.tree-label-slide-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 4px 10px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 1.7rem;
  line-height: 1;
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 1.5px #000;
  text-stroke: 1.5px #000;
  text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000;
  cursor: pointer;
  z-index: 2;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.tree-label-slide-prev:hover,
.tree-label-slide-next:hover {
  opacity: 1;
}
.tree-label-slide-prev {
  left: 4px;
}
.tree-label-slide-next {
  right: 4px;
}
.tree-label-slide-track {
  display: flex;
  height: 100%;
}

/* Each frame: a plain bordered box, height: 100% of the viewport (so every
   frame -- on-screen or not -- always matches whatever height
   sizeSlideshowViewport last set there for the *currently active* slide;
   only the active one is ever actually visible, clipped by the viewport's
   own overflow: hidden). flex: 0 0 100% makes each frame exactly one
   viewport-width wide, which is what translateX(-N * 100%) in
   moveSlideTrack relies on to land exactly on frame N. */
.tree-label-slide-frame {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  border: 1px solid rgba(79, 128, 121, 0.35);
  background: rgba(255, 255, 255, 0.35);
  box-sizing: border-box;
  /* Belt-and-suspenders alongside object-fit: contain below -- a photo can
     never spill past its own frame's border into the rest of the panel,
     even for the one tick before a freshly-loaded image's real aspect
     ratio has been measured and applied. */
  overflow: hidden;
}
.tree-label-slide-x {
  display: block;
  width: 100%;
  height: 100%;
}
.tree-label-slide-x line {
  stroke: var(--glug-teal);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
/* Real photo frames (js/app.js: ensureLabelSlideshow, once a tree has an
   entry in window.TREE_PHOTOS) swap the placeholder X for a plain <img>
   here instead. object-fit: contain -- not cover -- so the whole photo is
   always visible, nothing cropped off: the frame's own size
   (sizeSlideshowViewport/clampPhotoSizeToHeight) is always computed to
   exactly match the photo's own real aspect ratio (narrower when a tall
   photo's height gets capped to fit the browser window, not just
   shorter), so contain and cover render identically here -- contain is
   the safer choice since nothing should ever need cropping. */
.tree-label-slide-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tree-label-slide-frame-num {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--glug-teal-deep);
  opacity: 0.55;
}

@media (max-width: 720px) {
  main {
    flex-direction: column;
  }
  #info-panel {
    width: 100%;
    flex: 0 0 auto;
    max-height: 200px;
  }
}
