/* ╔════════════════════════════════════════════════════════════════╗
   ║ Motion layer — scroll reveals, hero entrance, hover feedback,  ║
   ║ form micro-interactions, sticky nav shadow, mobile menu open.  ║
   ║ Respects prefers-reduced-motion.                               ║
   ╚════════════════════════════════════════════════════════════════╝ */

/* ── Scroll reveal ──────────────────────────────────────────────── */
.to-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.to-reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── Hero entrance (no-JS friendly — runs once on load) ─────────── */
.hero__copy > * {
  animation: fadeUp 700ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.hero__copy > *:nth-child(1) { animation-delay: 60ms; }
.hero__copy > *:nth-child(2) { animation-delay: 160ms; }
.hero__copy > *:nth-child(3) { animation-delay: 260ms; }
.hero__copy > *:nth-child(4) { animation-delay: 360ms; }
.hero__copy > *:nth-child(5) { animation-delay: 460ms; }
.hero__copy > *:nth-child(6) { animation-delay: 560ms; }

.page-hero__copy > * {
  animation: fadeUp 700ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.page-hero__copy > *:nth-child(1) { animation-delay: 60ms; }
.page-hero__copy > *:nth-child(2) { animation-delay: 160ms; }
.page-hero__copy > *:nth-child(3) { animation-delay: 260ms; }
.page-hero__copy > *:nth-child(4) { animation-delay: 360ms; }
.page-hero__copy > *:nth-child(5) { animation-delay: 460ms; }

.hero__image,
.page-hero__img {
  animation: fadeIn 900ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: 200ms;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Sticky nav: shadow + tightened on scroll ───────────────────── */
.nav {
  transition:
    box-shadow 220ms ease,
    background-color 220ms ease,
    padding-block 220ms ease;
}
.nav.is-scrolled {
  box-shadow: 0 1px 12px rgba(14, 35, 48, 0.10);
  background: rgba(251, 246, 236, 0.97);
}
.nav.is-scrolled .nav__inner { padding-block: 10px; }

/* ── Live indicator: gentle ring pulse ──────────────────────────── */
.swatch--live {
  animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 122, 60, 0.55); }
  50%      { box-shadow: 0 0 0 5px rgba(224, 122, 60, 0); }
}

/* ── Card image zoom on hover ───────────────────────────────────── */
.card .img__photo,
.region-card .img__photo,
.page-hero__img .img__photo,
.reso-week__img .img__photo,
.news__feature .img__photo,
.picks__feature .img__photo {
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover .img__photo,
.region-card:hover .img__photo,
.event-row:hover .img__photo,
.news-row:hover .img__photo,
.cat-card:hover .img__photo {
  transform: scale(1.04);
}

/* ── Smooth caption pill animation in ───────────────────────────── */
.img__cap {
  transition: opacity 240ms ease, transform 240ms ease;
}
.card:hover .img__cap,
.event-row:hover .img__cap,
.news-row:hover .img__cap {
  transform: translateY(-2px);
}

/* ── Filter pill ── tap feedback ────────────────────────────────── */
.filter-pill {
  transition:
    background-color 180ms ease,
    color 180ms ease,
    transform 80ms ease;
}
.filter-pill:active:not(:disabled) {
  transform: scale(0.96);
}

/* ── Buttons ── press feedback + subtle hover lift ──────────────── */
.btn {
  transition:
    transform 90ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    box-shadow 200ms ease;
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn--accent:hover, .btn--primary:hover, .btn--sound:hover {
  box-shadow: 0 4px 14px rgba(14, 35, 48, 0.12);
}

/* ── Town chip ── hover bump ────────────────────────────────────── */
.town-chip {
  transition: transform 120ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.town-chip:hover { transform: translateY(-1px); }

/* ── Cat-card medal: gentle continuous shimmer ──────────────────── */
.cat-card__medal {
  position: relative;
  overflow: hidden;
}
.cat-card__medal::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, transparent 0%, rgba(255,255,255,0.45) 20%, transparent 40%);
  opacity: 0;
  animation: medalShine 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes medalShine {
  0%, 65% { opacity: 0; transform: rotate(0deg); }
  72%     { opacity: 0.7; }
  100%    { opacity: 0; transform: rotate(360deg); }
}

/* ── Mobile menu open ───────────────────────────────────────────── */
@media (max-width: 920px) {
  .nav { position: relative; }
  .nav__links {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--paper);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 16px;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    box-shadow: 0 8px 24px rgba(14, 35, 48, 0.08);
    z-index: 100;
  }
  .nav__links.is-open { display: flex; animation: slideDown 220ms cubic-bezier(0.16, 1, 0.3, 1); }
  .nav__link {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    width: 100%;
    border-top: 0;
  }
  .nav__link:last-child { border-bottom: 0; }
  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ── Toast (newsletter success) ─────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%; bottom: 32px;
  transform: translateX(-50%) translateY(24px);
  padding: 14px 22px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  box-shadow: 0 16px 32px rgba(14, 35, 48, 0.24), 0 4px 8px rgba(14, 35, 48, 0.12);
  font-family: var(--ff-display);
  font-size: var(--fs-15);
  line-height: 1.4;
  letter-spacing: 0.005em;
  opacity: 0;
  transition: opacity 220ms ease, transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
  max-width: calc(100vw - 32px);
  text-align: center;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--positive);
  color: var(--paper);
  display: inline-grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ── Inline form success state ──────────────────────────────────── */
.field.is-success input,
.field.is-success input:disabled {
  color: var(--positive);
  background: var(--positive-bg);
  -webkit-text-fill-color: var(--positive);
  opacity: 1;
}
.field.is-success .btn {
  background: var(--positive) !important;
  border-color: var(--positive) !important;
  color: #fff !important;
  cursor: default;
}

/* ── Bestof leader: gold rank breathe ───────────────────────────── */
.bestof-leader__rank {
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 220ms ease;
}
.bestof-leader:hover .bestof-leader__rank {
  transform: scale(1.06);
  box-shadow:
    0 6px 14px rgba(196, 89, 32, 0.30),
    inset 0 -3px 6px rgba(196, 89, 32, 0.20),
    inset 0 2px 3px rgba(255, 255, 255, 0.55);
}

/* ── Section subtle accent on hover (cat-card etc.) ─────────────── */
.cat-card { transition: border-color 180ms ease, box-shadow 220ms ease, transform 180ms ease, background-color 220ms ease; }
.cat-card:hover { background: rgba(255, 255, 255, 0.65); }

/* ── Skeleton shimmer (utility — drops in when content loads) ───── */
.shimmer {
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
}
.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.6) 50%, transparent 70%);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ── Number count flicker on update ─────────────────────────────── */
[data-count].is-counting { font-variant-numeric: tabular-nums; }

/* ── Search input ── focus accent ───────────────────────────────── */
.filter-bar__search input { transition: background 160ms ease, box-shadow 160ms ease, border-color 160ms ease; }
.filter-bar__search input:focus { box-shadow: 0 0 0 3px rgba(224, 122, 60, 0.18); }

/* ── Back to top button ─────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  right: 20px; bottom: 84px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 22px;
  font-family: var(--ff-display);
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease, background 160ms ease;
  z-index: 50;
  box-shadow: 0 6px 16px rgba(14, 35, 48, 0.12), 0 2px 4px rgba(14, 35, 48, 0.08);
}
.back-to-top:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
@media (max-width: 700px) {
  .back-to-top { right: 12px; bottom: 84px; }
}

/* ── REDUCED MOTION: respect user preference ────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .to-reveal { opacity: 1 !important; transform: none !important; }
  .swatch--live { animation: none !important; }
  .cat-card__medal::after { animation: none !important; }
}
