/* ==========================================================================
   Wagenlov Motion · "Couture" v1.0, on Meridian
   The designer's kit (wagenlov-motion-kit, 18 Nov 2026) as the designer
   applied it to the shop's own pages: a style sheet alone. The first band
   of a page plays as it opens; the others play as they scroll into view.
   Gold is only ever a 1px line. One easing family; nothing bounces.

   Loaded only for a shop whose Design › Motion is "wagenlov" (the
   storefront's lib/motion.ts), never in the admin's preview, and never
   for anyone else. Every rule is held to Meridian's own page (.meridian,
   #main), so nothing here can reach another engine either.

   Where the kit asked for classes in the templates, these rules find
   Meridian's own parts instead:
     a page's bands         #main > [data-block-type]
     its first band         the first that draws something (a "page
                            colours" block draws nothing, so it is passed over)
     black bands            section[data-ground="dark"]
     buttons                .m-btn (ghost buttons take the deeper gold)
     the header             the sticky header with the header row in it
     the gel curve          [data-curve-line] (sections/curve.tsx)
     the molecules          the paired cards' drawings
   A browser without scroll-linked animation (the @supports blocks) shows
   every band as it is: nothing waits to be revealed.
   ========================================================================== */

.meridian {
  --wl-gold: #B8925A;          /* hairlines on light grounds */
  --wl-gold-soft: #CDB89A;     /* hairlines on black */
  --wl-ease: cubic-bezier(.2, .7, .2, 1);       /* settle */
  --wl-ease-draw: cubic-bezier(.65, 0, .2, 1);  /* lines and unveils */
}

@keyframes wl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wl-mask {
  from { clip-path: inset(0 0 100% 0); translate: 0 45%; }
  to { clip-path: inset(0 0 -12% 0); translate: 0 0; }
}
@keyframes wl-up { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
@keyframes wl-unveil {
  from { clip-path: inset(100% 0 0 0); scale: 1.06; }
  to { clip-path: inset(0 0 0 0); scale: 1; }
}
@keyframes wl-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes wl-float { from { translate: 0 -2px; } to { translate: 0 2px; } }
@keyframes wl-header {
  to {
    background-color: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 1px 0 rgba(184, 146, 90, .35), 0 10px 30px rgba(26, 26, 24, .06);
  }
}
@keyframes wl-rule {
  0% { scale: 0 1; opacity: 1; }
  55% { scale: 1 1; opacity: 1; }
  100% { scale: 1 1; opacity: 0; }
}
@keyframes wl-bump { 35% { scale: 1.12; } 100% { scale: 1; } }
@keyframes wl-label { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

/* --- Arrivals ---------------------------------------------------------------
   Each ends where the page already is (fill "backwards"): once played,
   nothing of it stays on the element, so a hover may still move it. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* The page fades in. */
  .meridian #main { animation: wl-fade 1s ease backwards; }

  /* The first band, as the page opens: its label, then the headline
     rising from behind a mask, the pictures opening from the bottom one
     after another, the words, the buttons. */
  #main > [data-block-type]:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"])) :is(h1, h2) {
    animation: wl-mask 1.3s var(--wl-ease) .15s backwards;
  }
  #main > [data-block-type]:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"])) :is(.m-eyebrow, nav) {
    animation: wl-up 1s var(--wl-ease) .05s backwards;
  }
  /* With the words: a product's choice of format and its quantity. */
  #main > [data-block-type]:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"])) :is(p:not(.m-eyebrow), .m-feature-words li, fieldset, [role="group"]) {
    animation: wl-up 1.2s var(--wl-ease) .55s backwards;
  }
  /* With the buttons: a product's answers under them. */
  #main > [data-block-type]:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"])) :is(.m-btn, [data-part] h3) {
    animation: wl-up 1.1s var(--wl-ease) .7s backwards;
  }
  /* (The finder's answers open in their own way. :where keeps that
     exception from outweighing the delays below.) */
  #main > [data-block-type]:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"])) img:where(:not(.m-finder-reveal img)) {
    animation: wl-unveil 1.8s var(--wl-ease-draw) .2s backwards;
  }
  #main > [data-block-type]:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"])) figure + figure img { animation-delay: .4s; }
  #main > [data-block-type]:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"])) figure + figure + figure img { animation-delay: .6s; }
  #main > [data-block-type]:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"])) figure + figure + figure + figure img { animation-delay: .8s; }

  /* The molecules of the neutraliser drawings breathe. */
  .meridian .m-pair-card svg[role="img"] g circle { animation: wl-float 4.5s ease-in-out infinite alternate; }
}

/* Every other band, as it scrolls into view: headings from behind their
   mask, then cards, steps, pictures, words and buttons fading up. Tied
   to the scroll, as the designer set them: scrolled back, they wait to
   come in again. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    #main > [data-block-type]:not(:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"]))) h2 {
      animation: wl-mask linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 75%;
    }
    #main > [data-block-type]:not(:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"]))) :is(figure, article, ol > li, ul > li, .m-cards > a, img):not(article *, figure *, li *, button *, a *, details *) {
      animation: wl-up linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }
    #main > [data-block-type]:not(:nth-child(1 of [data-block-type]:not([data-block-type="page-colours"]))) :is(p, .m-btn):not(article *, figure *, li *, a *, button *, details *) {
      animation: wl-up linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 80%;
    }
  }
}

/* --- Figures: the gel's chart, the neutraliser drawings --------------------
   Played in turn, part by part, each time one comes into view
   (wagenlov-motion.js, "Figures"). Here only where each part turns and
   grows from: its own middle; the perfume's rings from their source. */
.meridian [data-figure] [data-part] { transform-box: fill-box; transform-origin: center; }
.meridian [data-figure="spread"] [data-part="ring"] { transform-box: view-box; transform-origin: 40px 72px; }

/* --- The header: once the page scrolls, a frosted ground and a gold hairline */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .meridian header[data-noprint]:has(> .m-header-row) {
      animation: wl-header linear both;
      animation-timeline: scroll();
      animation-range: 0 160px;
    }
  }
}

/* --- The announcement ticker rests under the pointer ---------------------- */
.meridian [data-announcement]:hover [data-m] { animation-play-state: paused; }

/* --- Buttons: a gold hairline draws under the label, the lettering opens ---
   A Meridian button sets its spacing and transition on itself, so these
   two are marked important, as the theme's own hover colours are. */
.meridian .m-btn {
  position: relative;
  transition: letter-spacing .7s var(--wl-ease), background .7s var(--wl-ease), border-color .7s var(--wl-ease), color .7s var(--wl-ease) !important;
}
.meridian .m-btn:hover:not(:disabled) { transform: none; letter-spacing: .23em !important; }
.meridian .m-btn:active:not(:disabled) { scale: .99; }
.meridian .m-btn:not(.m-btn-quiet)::before {
  content: ""; position: absolute; left: 18px; right: 18px; bottom: 20%; height: 1px;
  background: var(--wl-gold-soft); scale: 0 1; transform-origin: right;
  transition: scale .7s var(--wl-ease-draw); pointer-events: none;
}
.meridian .m-btn-ghost::before { background: var(--wl-gold); }
.meridian section[data-ground="dark"] .m-btn-ghost::before { background: var(--wl-gold-soft); }
.meridian .m-btn:hover:not(:disabled)::before,
.meridian .m-btn:focus-visible::before { scale: 1 1; transform-origin: left; }
/* An arrow in a button or link nudges forward. */
.meridian svg path[d^="M5 12h14"] { transition: translate .6s var(--wl-ease); }
.meridian :is(a, button):hover svg path[d^="M5 12h14"] { translate: 4px 0; }

/* --- Links: a gold underline draws in ---------------------------------------
   The header's links have their own hairline, which turns gold; the
   footer's and the page's own small menus (not its page numbers) draw
   one. Long-hand, so a link's own ground is left as it is. */
.meridian .m-nav-link::after { background: var(--wl-gold); transition: transform .6s var(--wl-ease-draw); }
.meridian :is(.m-foot-link, #main nav[aria-label]:not([aria-label="Pagination"]) a) {
  background-image: linear-gradient(var(--wl-gold), var(--wl-gold));
  background-position: 0 100%;
  background-size: 0 1px;
  background-repeat: no-repeat;
  transition: background-size .6s var(--wl-ease-draw), color .6s var(--wl-ease);
}
.meridian .m-foot-link { background-image: linear-gradient(var(--wl-gold-soft), var(--wl-gold-soft)); }
.meridian :is(.m-foot-link, #main nav[aria-label]:not([aria-label="Pagination"]) a):is(:hover, :focus-visible) { background-size: 100% 1px; }

/* --- Cards: the photograph eases closer, a gold line under the name -------- */
.meridian #main :is(article, .m-cards > a) img { transition: scale 1.6s var(--wl-ease); }
.meridian #main :is(article, .m-cards > a):hover img { scale: 1.04; }
.meridian #main :is(article a, .m-cards > a) h3 {
  background-image: linear-gradient(var(--wl-gold), var(--wl-gold));
  background-position: 0 100%;
  background-size: 0 1px;
  background-repeat: no-repeat;
  transition: background-size .7s var(--wl-ease-draw);
}
.meridian #main :is(article, .m-cards > a):hover h3 { background-size: 100% 1px; }

/* --- Film grain on the black bands ---------------------------------------- */
.meridian section[data-ground="dark"] { position: relative; isolation: isolate; }
.meridian section[data-ground="dark"]::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("wagenlov-grain.png") 0 0 / 180px; opacity: .35; mix-blend-mode: overlay;
}

/* --- Added to the bag (wagenlov-motion.js marks them) ---------------------
   A single gold line draws under the button that added it, and the
   header's Bag lifts a moment as its count goes up. */
.meridian [data-wl-ack] { position: relative; }
.meridian [data-wl-ack]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 1px;
  background: var(--wl-gold); transform-origin: left; pointer-events: none;
  animation: wl-rule 1.2s var(--wl-ease-draw) both;
}
.meridian [data-bag][data-wl-bump] { animation: wl-bump .9s var(--wl-ease) both; }
/* A shop that stays on the page: the button's "Added to bag" rises in. */
@media (prefers-reduced-motion: no-preference) {
  .meridian [data-added-label] { display: inline-block; animation: wl-label .7s var(--wl-ease) both; }
}
.meridian [data-bag] { position: relative; }
.meridian [data-bag][data-wl-bump]::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 6px; height: 1px;
  background: var(--wl-gold); transform-origin: left; pointer-events: none;
  animation: wl-rule .9s var(--wl-ease-draw) both;
}

@media (prefers-reduced-motion: reduce) {
  .meridian [data-wl-ack]::after, .meridian [data-bag][data-wl-bump]::after { display: none; }
}
