/* ==========================================================================
   North Florida Equine Hub — v12 "Excite" layer
   Appended to styles.css. Green-and-brown palette (horse and grass),
   extended with the dusk theme, photographic hero, gallery, saved-list
   drawer, lightbox, scroll progress and mobile filter toggle.

   Trident v12.1 findings applied:
     T8  inline pre-paint theme script (see index.html) — no FOUC
     T11 one z-index scale
     T13 44x44 minimum touch targets
     T14 reduced motion disables EVERY motion effect
   ========================================================================== */

/* ---------- Dusk theme: the same hues at night, not a separate brand ----- */
html[data-theme="dusk-retired"] {
  --ink: #e9efe6;
  --slate: #cfe0d1;
  --navy: #12281b;
  --slate-2: #1a3826;
  --sand: #c98f52;
  --sand-light: #6b4a2a;
  --amber: #dfae6d;
  --cream: #0e1b12;
  --white: #16271a;
  --muted: #a8b3a4;
  --line: #2a4433;
  --teal: #7fc08d;
  --teal-dark: #5da572;
  --focus: #f0c14b;
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

html[data-theme="dusk-retired"] body {
  background: var(--cream);
  color: var(--ink);
}

html[data-theme="dusk-retired"] .site-header {
  background: rgba(14, 27, 18, 0.92);
  border-bottom-color: var(--line);
}

html[data-theme="dusk-retired"] .provider-card,
html[data-theme="dusk-retired"] .community-card,
html[data-theme="dusk-retired"] .event-card,
html[data-theme="dusk-retired"] .pricing-card,
html[data-theme="dusk-retired"] .safety-card,
html[data-theme="dusk-retired"] .cta-tile {
  background: var(--white);
  border-color: var(--line);
}

html[data-theme="dusk-retired"] .hero {
  background: var(--navy);
}

html[data-theme="dusk-retired"] .site-footer {
  background: var(--navy);
  color: var(--ink);
}

html[data-theme="dusk-retired"] .filter-bar,
html[data-theme="dusk-retired"] .drawer,
html[data-theme="dusk-retired"] .lightbox {
  background: var(--white);
  color: var(--ink);
}

html[data-theme="dusk-retired"] .chip {
  background: var(--slate-2);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dusk-retired"] .gallery-caption,
html[data-theme="dusk-retired"] .photo-credit {
  background: none;
  color: var(--muted);
}

/* ---------- One z-index scale (T11) ---------- */
:root {
  --z-progress: 60;
  --z-filter: 40;
  --z-header: 50;
  --z-drawer: 100;
  --z-dialog: 110;
  --header-h: 68px;
}

/* ---------- Condensing header + theme toggle ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.site-header.is-condensed {
  box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(18, 34, 24, 0.06);
}

.header-inner {
  min-height: var(--header-h);
  transition: min-height 0.2s ease;
}

.site-header.is-condensed .header-inner {
  min-height: 54px;
}

.site-header.is-condensed .logo-mark {
  transform: scale(0.88);
}

.logo-mark {
  transition: transform 0.2s ease;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Theme toggle — a real control, not a decorative switch */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(251, 248, 240, 0.35);
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.theme-toggle:hover {
  background: rgba(251, 248, 240, 0.14);
  border-color: rgba(251, 248, 240, 0.6);
}

.theme-toggle:active {
  transform: translateY(1px);
}

.theme-toggle__icon {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Saved-list counter badge */
.saved-count {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--sand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.saved-count.is-visible {
  display: inline-flex;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 12px;
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(251, 248, 240, 0.35);
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.saved-toggle:hover {
  background: rgba(251, 248, 240, 0.14);
  border-color: rgba(251, 248, 240, 0.6);
}

.saved-toggle:active {
  transform: translateY(1px);
}

.saved-toggle svg {
  width: 15px;
  height: 15px;
}

/* ---------- Photographic hero (F1, T10) ---------- */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 96px 0 68px;
  background: var(--navy);
}

.hero__photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(16, 34, 23, 0.56) 0%, rgba(16, 34, 23, 0.24) 44%, rgba(16, 34, 23, 0.62) 100%), linear-gradient(100deg, rgba(16, 34, 23, 0.86) 0%, rgba(16, 34, 23, 0.14) 64%);
}

.hero-content {
  position: relative;
  max-width: 760px;
}

.hero-eyebrow {
  color: var(--cream);
  letter-spacing: 0.16em;
}

.hero h1 {
  color: var(--cream);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
  text-wrap: balance;
}

.hero-lead {
  color: rgba(251, 248, 240, 0.9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

/* Every photo carries a persistent illustrative caption (T1) */
.photo-credit {
  position: static;
  display: inline-block;
  margin: 16px 0 0;
  max-width: 100%;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(16, 34, 23, 0.8);
  color: rgba(251, 248, 240, 0.96);
  font-size: 0.72rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
}
.hero .photo-credit {
  margin-top: 22px;
  background: rgba(16, 34, 23, 0.62);
  color: rgba(251, 248, 240, 0.96);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

/* ---------- Editorial chapter band (F2) — the single dealt moment ---------- */
.chapter-band {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.chapter-band__media {
  position: relative;
  min-height: 440px;
  display: flex;
  align-items: flex-end;
  padding: 44px 0;
  background: var(--navy);
}

.chapter-band__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chapter-band__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgba(16, 34, 23, 0.9) 0%, rgba(16, 34, 23, 0.25) 65%);
}

.chapter-band__copy {
  max-width: 640px;
  color: var(--cream);
}

.chapter-band__copy h2 {
  color: var(--cream);
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
  margin-bottom: 12px;
}

.chapter-band__copy p {
  color: rgba(251, 248, 240, 0.92);
  font-size: 1.05rem;
}

/* ---------- Gallery (F3) ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.gallery-frame {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--slate-2);
  cursor: zoom-in;
  aspect-ratio: 3 / 2;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.gallery-frame:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.gallery-frame:active {
  transform: translateY(0);
}

.gallery-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-frame:hover img {
  transform: scale(1.03);
}

.gallery-caption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(16, 34, 23, 0.8);
  color: rgba(251, 248, 240, 0.94);
  font-size: 0.7rem;
  line-height: 1.35;
  text-align: center;
}

.gallery-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Native <dialog> surfaces (T9) ---------- */
.lightbox,
.drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  background: var(--cream);
}

.lightbox {
  width: min(1040px, 94vw);
  max-width: 94vw;
  max-height: 92vh;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(9, 18, 12, 0.86);
  backdrop-filter: blur(3px);
}

.lightbox__stage {
  position: relative;
  background: #0b140e;
}

.lightbox__img {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  background: #0b140e;
}

.lightbox__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--cream);
}

.lightbox__caption {
  flex: 1;
  font-size: 0.88rem;
  color: var(--muted);
}

.lightbox__caption strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
}

.lightbox__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s ease;
}

.lightbox__nav:hover {
  background: var(--line);
}

.lightbox__nav:active {
  transform: translateY(1px);
}

.lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(11, 20, 14, 0.72);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox__close:hover {
  background: rgba(11, 20, 14, 0.92);
}

/* Saved-list drawer */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(440px, 94vw);
  max-width: 94vw;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  border-left: 1px solid var(--line);
  overflow-y: auto;
}

.drawer::backdrop {
  background: rgba(9, 18, 12, 0.6);
}

.drawer__head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 14px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}

.drawer__head h2 {
  margin: 0 0 4px;
  font-size: 1.24rem;
}

.drawer__caveat {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.drawer__close {
  width: 44px;
  height: 44px;
  margin-left: auto;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-size: 1.2rem;
  cursor: pointer;
}

.drawer__body {
  padding: 16px 20px 28px;
}

.drawer__list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.drawer__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.drawer__item-main {
  flex: 1;
  min-width: 0;
}

.drawer__item-name {
  font-weight: 700;
  color: var(--ink);
}

.drawer__item-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.drawer__remove {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
}

.drawer__remove:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.drawer__empty {
  color: var(--muted);
  font-size: 0.95rem;
}

.drawer__actions {
  display: grid;
  gap: 10px;
}

.drawer__notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(163, 103, 42, 0.12);
  border: 1px solid rgba(163, 103, 42, 0.34);
  color: var(--ink);
  font-size: 0.84rem;
}

/* ---------- Save-to-list control on provider cards (T2: bookmark, never a star) ---------- */
.provider-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.provider-save svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.provider-save:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.provider-save[aria-pressed="true"] {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(163, 103, 42, 0.1);
}

.provider-save[aria-pressed="true"] svg {
  fill: currentColor;
}

/* ---------- "What we checked" disclosure (F16) ---------- */
.provider-evidence {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.provider-evidence summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal);
  list-style: none;
}

.provider-evidence summary::-webkit-details-marker {
  display: none;
}

.provider-evidence summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.18s ease;
}

.provider-evidence[open] summary::before {
  transform: rotate(90deg);
}

.provider-evidence__body {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
  padding-top: 4px;
}

.provider-evidence__body p {
  margin: 0 0 8px;
}

.provider-evidence__source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--teal);
  font-weight: 600;
  word-break: break-all;
}

/* ---------- Sticky filter bar (F10) + mobile collapse (T11) ---------- */
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: var(--z-filter);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cream);
  box-shadow: var(--shadow-soft);
}

.filter-bar__group {
  display: grid;
  gap: 5px;
}

.filter-bar__group label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-bar__actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.filter-collapse {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}

/* Share button */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--teal);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--teal);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.share-btn:hover {
  background: var(--teal);
  color: var(--cream);
}

.share-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- Add to calendar (F9) ---------- */
.event-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ics-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.ics-btn:hover {
  border-color: var(--teal);
  background: rgba(61, 122, 78, 0.08);
}

.ics-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- Toast for copy feedback ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: var(--z-dialog);
  transform: translate(-50%, 14px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--cream);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- Anchor offset so headings never land under pinned chrome (T12) ---------- */
section[id],
[id^="directory"],
[id^="calendar"],
[id^="community"] {
  scroll-margin-top: calc(var(--header-h) + 64px);
}

/* ---------- Hover layer (F4) ---------- */
.provider-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.provider-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.btn,
.cta-tile,
.chip,
.gallery-frame,
.theme-toggle,
.saved-toggle,
.provider-save,
.share-btn,
.ics-btn,
.back-to-top,
.lightbox__nav,
.drawer__remove {
  transition-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ---------- 44px touch targets (T13) ---------- */
.main-nav a,
.provider-contact a,
.footer-tag {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.main-nav a {
  padding: 0 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .filter-bar {
    position: static;
    display: none;
  }

  .filter-bar.is-open {
    display: flex;
  }

  .filter-collapse {
    display: flex;
  }

  .filter-bar__actions {
    margin-left: 0;
    width: 100%;
  }

  .filter-bar__actions .btn,
  .filter-bar__actions .share-btn {
    flex: 1;
    justify-content: center;
  }

  .hero {
    padding: 64px 0 52px;
  }

  .chapter-band__media {
    min-height: 340px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 560px) {
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .gallery-caption {
    font-size: 0.64rem;
    left: 6px;
    right: 6px;
    bottom: 6px;
    padding: 4px 7px;
  }

  .header-tools .saved-toggle span,
  .header-tools .theme-toggle span {
    display: none;
  }

  .saved-toggle,
  .theme-toggle {
    padding: 6px 10px;
  }
}

/* ---------- Reduced motion: EVERY effect off (T14) ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .hero-content,
  .chapter-band__copy,
  .gallery-frame,
  .gallery-frame img,
  .provider-card,
  .toast {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .gallery-frame:hover img {
    transform: none !important;
  }

  .provider-card:hover {
    transform: none !important;
  }

}


/* ---------- v12 additions: .section-legend ---------- */
.section-legend{font-size:.875rem;line-height:1.55;color:var(--muted);background:rgba(61,122,78,.07);border-left:3px solid var(--teal);padding:.75rem .9rem;border-radius:0 6px 6px 0;margin:0 0 1rem}

/* ---------- v12 additions: .save-btn ---------- */
.save-btn{display:inline-flex;align-items:center;gap:.4rem;min-height:44px;padding:.45rem .85rem;border:1px solid var(--line);border-radius:999px;background:transparent;color:var(--slate);font:inherit;font-size:.8125rem;cursor:pointer;margin-top:.5rem}
.save-btn svg{width:16px;height:16px;flex:none}
.save-btn:hover{background:rgba(61,122,78,.09)}
.save-btn.is-saved{border-color:var(--teal);background:rgba(61,122,78,.14);color:var(--teal-dark)}

.safety-lead { color: var(--sand-light); }

.cta-tile h3 { color: var(--sand-light); }

.footer-title { color: var(--sand-light); }

.community-card a { color: var(--sand-light); }

.verify-step-number { background: var(--sand-light); color: var(--ink); }

.drawer .btn-ghost { color: var(--ink); border-color: var(--line); }

/* ---------- v12.1: header tools must not overflow the tablet breakpoint ---------- */
@media (max-width: 900px) {
  .header-inner { flex-wrap: wrap; row-gap: 10px; }
  .header-tools { flex-wrap: wrap; justify-content: flex-start; row-gap: 8px; }
  .header-tools .btn, .header-tools button { flex: 0 0 auto; }
}
@media (max-width: 620px) {
  .header-tools { width: 100%; justify-content: space-between; }
}
