/* ==========================================================================
   Trail card

   Responsive by container, not by screen: the card adapts to the width of the
   space it is placed in (full-width page, narrow sidebar, grid cell...).

     under 380px   single column, stats in 2 x 2
     380 - 599px   single column, stats in a row of 4
     600 - 759px   image left / content right, stats in 2 x 2
     760px and up  image left / content right, stats in a row of 4

   Type and spacing scale smoothly in between using clamp() and cqi units
   (1cqi = 1% of the card's width). Each fluid value has a fixed fallback
   line above it for older browsers.

   Change --tc-accent to re-theme the whole card.
   ========================================================================== */

.trail-card,
.trail-card * {
  box-sizing: border-box;
}

.trail-card {
  --tc-accent: #1B5E45;
  --tc-accent-tint: color-mix(in srgb, var(--tc-accent) 9%, white);
  --tc-accent-strong: color-mix(in srgb, var(--tc-accent) 82%, black);
  --tc-ink: #14231C;
  --tc-muted: #4D5B54;
  --tc-line: #E3E9E5;
  --tc-chip-line: #C5D0CA;
  --tc-surface: #FFFFFF;
  --tc-warn-bg: #FCF3DC;
  --tc-warn-ink: #6A3E00;
  --tc-warn-icon: #A15C00;
  --tc-display: "Bricolage Grotesque", "DM Sans", system-ui, sans-serif;
  --tc-text: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  container-type: inline-size;
  width: 100%;
  margin-inline: auto;
  overflow: hidden;
  background: var(--tc-surface);
  color: var(--tc-ink);
  font-family: var(--tc-text);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(20, 35, 28, 0.06), 0 12px 32px rgba(20, 35, 28, 0.10);
}

.trail-card svg {
  flex-shrink: 0;
}

/* ---- Layout (single column by default) -------------------------------- */

.trail-card__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

/* ---- Banner ------------------------------------------------------------ */

.trail-card__media {
  position: relative;
  margin: 0;
  aspect-ratio: 2 / 1;
  background: var(--tc-accent);
}

.trail-card__image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trail-card__park {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 32px);
  padding: 7px 12px 7px 10px;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--tc-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
}

.trail-card__park svg {
  color: var(--tc-accent);
}

/* ---- Body -------------------------------------------------------------- */

.trail-card__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  gap: clamp(16px, 0.75rem + 2cqi, 24px);
  padding: 24px;
  padding: clamp(18px, 12px + 3cqi, 36px);
}

.trail-card__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trail-card__location {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--tc-accent);
  font-size: 0.875rem;
  font-weight: 600;
}

.trail-card__title {
  margin: 0;
  color: rgb(41, 55, 38);
  font-family: var(--tc-display);
  font-size: 2rem;
  font-size: clamp(1.625rem, 0.9rem + 4.5cqi, 2.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.trail-card__desc {
  margin: 6px 0 0;
  color: var(--tc-muted);
  font-size: 0.9375rem;
  font-size: clamp(0.9375rem, 0.84rem + 0.45cqi, 1.0625rem);
  line-height: 1.55;
  text-wrap: pretty;
}

/* ---- Stats ------------------------------------------------------------- */

.trail-card__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 16px 8px;
  background: var(--tc-accent-tint);
  border-radius: 18px;
}

/* Markup order is label then value (best for screen readers);
   column-reverse shows the value first. */
.trail-stat {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.trail-stat__label {
  color: var(--tc-muted);
  font-size: 0.75rem;
  font-size: clamp(0.75rem, 0.7rem + 0.3cqi, 0.8125rem);
}

.trail-stat__value {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-family: var(--tc-display);
  font-size: 1.0625rem;
  font-size: clamp(1rem, 0.7rem + 1.5cqi, 1.25rem);
  font-weight: 700;
  line-height: 1.2;
}

.trail-stat__value svg {
  color: var(--tc-accent);
}

/* ---- Landmarks --------------------------------------------------------- */

.trail-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trail-card__tags li {
  padding: 8px 14px;
  border: 1px solid var(--tc-chip-line);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ---- Trailhead + facilities ------------------------------------------- */

.trail-card__practical {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--tc-line);
}

.trail-card__trailhead {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
}

.trail-card__trailhead svg {
  margin-top: 2px;
  color: var(--tc-accent);
}

.trail-card__trailhead-label {
  display: block;
  color: var(--tc-muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.trail-card__trailhead-place {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.trail-card__facilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trail-card__facilities li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.trail-card__facilities svg {
  color: var(--tc-accent);
}

/* ---- Call to action ---------------------------------------------------- */

.trail-card__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border-radius: 14px;
  background: var(--tc-accent);
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.trail-card__cta:hover {
  background: var(--tc-accent-strong);
}

.trail-card__cta:focus-visible {
  outline: 3px solid var(--tc-accent);
  outline-offset: 3px;
}

/* ==========================================================================
   Responsive rules (order matters: later rules win)
   ========================================================================== */

/* Very narrow: stats wrap to two rows instead of squeezing. */
@container (max-width: 379px) {
  .trail-card__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 16px;
  }
}

/* Roomy: image moves to the left, content to the right. */
@container (min-width: 600px) {
  .trail-card__layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }

  .trail-card__media {
    aspect-ratio: auto;
    min-height: 340px;
  }

  .trail-card__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 16px;
  }
}

/* Wide: enough room for all four stats in one row again. */
@container (min-width: 760px) {
  .trail-card__stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    row-gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trail-card__cta {
    transition: none;
  }
}


/* ---- Route map (collapsed by default) ---------------------------------- */
 
.trail-card__map-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--tc-chip-line);
  border-radius: 14px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
 
.trail-card__map-toggle::-webkit-details-marker {
  display: none;
}
 
.trail-card__map-toggle svg:first-child {
  color: var(--tc-accent);
}
 
.trail-card__map-chevron {
  margin-left: auto;
  color: var(--tc-muted);
  transition: transform 0.2s ease;
}
 
.trail-card__map[open] .trail-card__map-chevron {
  transform: rotate(180deg);
}
 
.trail-card__map-toggle:focus-visible {
  outline: 3px solid var(--tc-accent);
  outline-offset: 3px;
}
 
.trail-card__map-figure {
  margin: 12px 0 0;
}
 
.trail-card__map-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--tc-line);
  border-radius: 14px;
  background: var(--tc-accent-tint);
}

/* ---- Important info ---------------------------------------------------- */
 
.trail-card__alert {
  padding: 16px 18px;
  background: var(--tc-warn-bg);
  border-radius: 18px;
}
 
.trail-card__alert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--tc-warn-ink);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}
 
.trail-card__alert-title svg {
  color: var(--tc-warn-icon);
}
 
.trail-card__alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  line-height: 1.5;
}
 
.trail-card__alert-list strong {
  font-weight: 600;
}


/* ==========================================================================
   Next-hike header (sits above the trail card)
 
   Applied through a class so it doesn't touch other <cz-card> elements.
   Custom elements are inline by default, hence the display: flex.
   If you move the accent colour to :root, delete --nh-accent here.
   ========================================================================== */
 
.next-hike,
.next-hike * {
  box-sizing: border-box;
}
 
.next-hike {
  --nh-accent: #12949d;
  --nh-bg: color-mix(in srgb, var(--nh-accent) 68%, black);
  --nh-display: "Bricolage Grotesque", "DM Sans", system-ui, sans-serif;
 
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin: 0 auto 12px;
  padding: 14px 20px 14px 14px;
  background: var(--nh-bg);
  color: #FFFFFF;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  border-radius: 20px;
}
 
/* Calendar tile */
.next-hike__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: #FFFFFF;
  line-height: 1;
}
 
.next-hike__month {
  color: var(--nh-accent);
  font-size: 0.8125rem;
  font-weight: 600;
}
 
.next-hike__day {
  margin-top: 3px;
  color: #14231C;
  font-family: var(--nh-display);
  font-size: 1.75rem;
  font-weight: 700;
}
 
.next-hike__text {
  min-width: 0;
}
 
.next-hike__title {
  margin: 0;
  font-family: var(--nh-display);
  font-size: 1.25rem;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
 
.next-hike__when {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9375rem;
  line-height: 1.4;
}