/* =========================================================
   Chambers — motion layer (v2)
   Animation only: no layout changes. Active when <html> has
   .motion (set in <head>) and the visitor allows motion.
   ========================================================= */

:root {
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-soft: cubic-bezier(.33, 1, .68, 1);
}

/* Hover polish works for everyone (no hidden states) */
.btn { position: relative; overflow: hidden; }
.btn .arrow { display: inline-block; transition: transform .3s var(--ease-out); }
.btn:hover .arrow, .text-link:hover .arrow { transform: translateX(5px); }
.text-link .arrow { display: inline-block; transition: transform .3s var(--ease-out); }
.btn--peach::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: skewX(-20deg); pointer-events: none;
}
.btn--peach:hover::after { animation: m-shine .8s var(--ease-soft); }
@keyframes m-shine { to { left: 130%; } }

@media all {

  /* ---------- Page load / leave ---------- */
  html.motion body { animation: m-fade .6s ease both; }
  html.motion body.is-leaving { opacity: 0; transition: opacity .28s ease; }
  @keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }

  /* ---------- Header ---------- */
  html.motion .site-header { animation: m-drop .9s var(--ease-out) both; }
  @keyframes m-drop { from { transform: translateY(-100%); } to { transform: none; } }
  html.motion .nav-group .nav-link { animation: m-rise-sm .7s var(--ease-out) both; }
  html.motion .nav-group .nav-link:nth-child(1) { animation-delay: .25s; }
  html.motion .nav-group .nav-link:nth-child(2) { animation-delay: .3s; }
  html.motion .nav-group .nav-link:nth-child(3) { animation-delay: .35s; }
  html.motion .nav-group .nav-link:nth-child(4) { animation-delay: .4s; }
  html.motion .nav-group .nav-link:nth-child(5) { animation-delay: .45s; }
  html.motion .nav-group .nav-link:nth-child(6) { animation-delay: .5s; }
  html.motion .nav-group .nav-link:nth-child(7) { animation-delay: .55s; }
  html.motion .nav-group .nav-link:nth-child(8) { animation-delay: .6s; }
  html.motion .brand-mark { animation: m-swing 1.4s var(--ease-out) .2s both; transform-origin: 50% 0; }
  @keyframes m-swing { 0% { transform: rotate(-14deg); opacity: 0; } 50% { transform: rotate(6deg); opacity: 1; } 75% { transform: rotate(-2deg); } 100% { transform: none; } }
  @keyframes m-rise-sm { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

  /* ---------- Hero entrances ---------- */
  html.motion :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > * {
    animation: m-rise 1.1s var(--ease-out) both;
  }
  html.motion :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(1) { animation-delay: .35s; }
  html.motion :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(2) { animation-delay: .5s; }
  html.motion :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(3) { animation-delay: .65s; }
  html.motion :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(4) { animation-delay: .8s; }
  html.motion :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(5) { animation-delay: .95s; }
  html.motion :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(6) { animation-delay: 1.1s; }
  @keyframes m-rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

  /* Hero title (logo lettering) unveils left to right */
  html.motion .hero-title img { animation: m-unveil 1.4s var(--ease-out) .4s both; }
  @keyframes m-unveil { from { clip-path: inset(0 100% 0 0); opacity: .2; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
  html.motion .hero-featured { animation-name: m-slide-in; }
  @keyframes m-slide-in { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }

  /* Slow "Ken Burns" settle on hero photos; parallax uses `translate` from JS */
  html.motion :is(.hero .hero-media, .page-hero .hero-media, .story-hero-media, .split-hero .media, .photo-band .hero-media) img {
    scale: 1.12; animation: m-settle 9s var(--ease-soft) both; will-change: translate, scale;
  }
  @keyframes m-settle { from { scale: 1.24; } to { scale: 1.12; } }
  .split-hero .media { overflow: hidden; }

  /* Mosaic tile strips drift slowly (seamless: exactly 10 tiles per loop) */
  html.motion .mosaic-strip { animation: m-tile 70s linear infinite; }
  html.motion .mosaic-strip--peach { animation-name: m-tile-peach; animation-duration: 90s; }
  @keyframes m-tile { from { background-position: 0 0; } to { background-position: 0 -992px; } }
  @keyframes m-tile-peach { from { background-position: 0 0; } to { background-position: 0 -1550px; } }

  /* ---------- Scroll reveals (data-m set by motion.js) ---------- */
  html.motion [data-m] { transition: opacity 1s var(--ease-out), transform 1s var(--ease-out), clip-path 1.3s var(--ease-out); transition-delay: var(--d, 0s); }
  html.motion [data-m="up"]:not(.m-in) { opacity: 0; transform: translateY(34px); }
  html.motion [data-m="left"]:not(.m-in) { opacity: 0; transform: translateX(-40px); }
  html.motion [data-m="right"]:not(.m-in) { opacity: 0; transform: translateX(40px); }
  html.motion [data-m="fade"]:not(.m-in) { opacity: 0; }
  html.motion [data-m="img"] { overflow: hidden; }
  html.motion [data-m="img"]:not(.m-in) { clip-path: inset(0 0 100% 0); }
  html.motion [data-m="img"] img { transition: scale 1.6s var(--ease-out); transition-delay: var(--d, 0s); }
  html.motion [data-m="img"]:not(.m-in) img { scale: 1.18; }
  html.motion [data-m="img"].m-in img { scale: 1; }
  /* collage cards keep their tilt: animate opacity + drop only */
  html.motion .story-collage figure[data-m]:not(.m-in), html.motion .sc-note[data-m]:not(.m-in) { opacity: 0; translate: 0 40px; }
  html.motion .story-collage figure[data-m], html.motion .sc-note[data-m] { transition: opacity 1s var(--ease-out), translate 1.1s var(--ease-out), box-shadow .4s; transition-delay: var(--d, 0s); }

  /* Existing .reveal elements get a softer, staggered curve */
  html.motion .reveal { transition: opacity 1s var(--ease-out), transform 1s var(--ease-out); transition-delay: var(--d, 0s); }

  /* Eyebrow rules draw in */
  html.motion :is(.eyebrow--line, .journey-label)::after { transform: scaleX(0); transform-origin: left center; transition: transform 1.1s var(--ease-out) .25s; }
  html.motion :is(.eyebrow--line, .journey-label).m-in::after { transform: scaleX(1); }

  /* Our Journey: line draws, diamonds pop */
  html.motion .milestones .timeline::before { transform: scaleX(0); transform-origin: left center; transition: transform 1.6s var(--ease-out); }
  html.motion .milestones .timeline.m-in::before { transform: scaleX(1); }
  html.motion .milestones .milestone::before { scale: 0; transition: scale .6s cubic-bezier(.34, 1.56, .64, 1); transition-delay: calc(var(--d, 0s) + .5s); }
  html.motion .milestones .milestone.is-in::before { scale: 1; }

  /* Pull-quote mark & diamonds */
  html.motion .pull-quote.is-in .qmark { animation: m-pop .8s cubic-bezier(.34, 1.56, .64, 1) .2s both; }
  html.motion .pull-quote.is-in .diamond { animation: m-spin-in 1s var(--ease-out) .5s both; }
  @keyframes m-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
  @keyframes m-spin-in { from { opacity: 0; transform: rotate(-135deg) scale(.4); } to { opacity: 1; transform: rotate(45deg); } }
  html.motion .diamond-mark { transition: transform .6s var(--ease-out); }
  html.motion .split-copy:hover .diamond-mark, html.motion .link-with-mark:hover .diamond-mark { transform: rotate(225deg); }

  /* Icons draw a gentle bob on hover; arrive with a bounce */
  html.motion .feature svg { transition: transform .5s cubic-bezier(.34, 1.56, .64, 1); }
  html.motion .feature:hover svg { transform: translateY(-6px) scale(1.06); }

  /* ---------- Hover motion on imagery & cards ---------- */
  :is(.split-media, .place .ph, .menu-img, .visit-block .media, .welcome-media) img { transition: transform 1.2s var(--ease-soft), scale 1.6s var(--ease-out); }
  :is(.split-media, .place .ph, .menu-img, .visit-block .media, .welcome-media):hover img { transform: scale(1.05); }
  .split-media.inset:hover img { transform: none; } /* framed photos stay put so they never cover the border */
  .story-collage figure { transition: transform .5s var(--ease-out), box-shadow .5s; }
  .story-collage figure:hover { box-shadow: 0 22px 44px rgba(1, 58, 63, .3); z-index: 4; }
  .sc-street:hover { transform: rotate(-1deg) translateY(-6px); }
  .sc-board:hover { transform: rotate(0deg) translateY(-6px); }
  .sc-door:hover { transform: translateY(-6px); }
  .loc-card, .contact-card, .review-card, .dish-card { transition: transform .5s var(--ease-out), box-shadow .5s, opacity 1s var(--ease-out); }
  .loc-card:hover, .contact-card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(1, 58, 63, .22); }
  .review-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(1, 58, 63, .12); }
  .dish-card:hover { transform: translateY(-6px); }
  .social a { transition: background .2s, transform .35s cubic-bezier(.34, 1.56, .64, 1); }
  .social a:hover { transform: translateY(-3px) scale(1.1); }

  /* ---------- Mobile menu ---------- */
  html.motion .mobile-nav { transition: opacity .35s ease, visibility .35s, clip-path .55s var(--ease-out); clip-path: circle(0 at calc(100% - 40px) 38px); }
  html.motion .nav-open .mobile-nav { clip-path: circle(150% at calc(100% - 40px) 38px); }
  html.motion .nav-open .mobile-nav > * { animation: m-rise .6s var(--ease-out) both; }
  html.motion .nav-open .mobile-nav > :nth-child(1) { animation-delay: .12s; }
  html.motion .nav-open .mobile-nav > :nth-child(2) { animation-delay: .16s; }
  html.motion .nav-open .mobile-nav > :nth-child(3) { animation-delay: .2s; }
  html.motion .nav-open .mobile-nav > :nth-child(4) { animation-delay: .24s; }
  html.motion .nav-open .mobile-nav > :nth-child(5) { animation-delay: .28s; }
  html.motion .nav-open .mobile-nav > :nth-child(6) { animation-delay: .32s; }
  html.motion .nav-open .mobile-nav > :nth-child(7) { animation-delay: .36s; }
  html.motion .nav-open .mobile-nav > :nth-child(8) { animation-delay: .4s; }
  html.motion .nav-open .mobile-nav > :nth-child(9) { animation-delay: .44s; }
  html.motion .nav-open .mobile-nav > :nth-child(10) { animation-delay: .48s; }

  /* ---------- Menu popup ---------- */
  html.motion .menu-modal.is-open .backdrop { animation: m-fade .35s ease both; }
  html.motion .menu-modal.is-open .menu-dialog { animation: m-dialog .5s var(--ease-out) both; }
  @keyframes m-dialog { from { opacity: 0; transform: translateY(28px) scale(.97); } to { opacity: 1; transform: none; } }
  html.motion .menu-pages img { animation: m-rise .6s var(--ease-out) both; }
  html.motion .menu-pages img:nth-child(2) { animation-delay: .12s; }
}

/* Soft mode: visitor's device asks for reduced motion -> gentle fades only, nothing slides or moves */
html.motion-soft body { animation: m-fade .5s ease both; }
html.motion-soft [data-m] { transition: opacity 1.1s ease; transition-delay: var(--d, 0s); }
html.motion-soft [data-m]:not(.m-in) { opacity: 0; }
html.motion-soft :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > * { animation: m-fade 1s ease both; }
html.motion-soft :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(2) { animation-delay: .15s; }
html.motion-soft :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(3) { animation-delay: .3s; }
html.motion-soft :is(.hero-content, .page-hero-content, .story-hero-content, .split-hero .panel-inner) > :nth-child(n+4) { animation-delay: .45s; }
html.motion-soft .menu-modal.is-open .menu-dialog { animation: m-fade .3s ease both; }
@media (prefers-reduced-motion: reduce) {
  .btn--peach:hover::after { animation: none; }
}

/* Home hero: less zoom on the photo (still leaves room for the gentle parallax) */
@media all {
  html.motion .hero .hero-media img { scale: 1.05; animation-name: m-settle-home; }
  @keyframes m-settle-home { from { scale: 1.12; } to { scale: 1.05; } }
}
