/* Shared timing for pointer feedback, state changes and optional entrances. */
:root {
  --m-ease: cubic-bezier(.4, 0, .2, 1);
  --m-in: 130ms;
  --m-out: 150ms;
  --m-press: 100ms;
  --m-state: 180ms;
  --m-sheet: 280ms;
  --m-fade: 300ms;
  --m-rise: 350ms;
  --m-reveal: 400ms;
}

@media screen and (prefers-reduced-motion: no-preference) {
  .m-reveal-wait:not(:focus-within, :target) { opacity: 0; }
  /* The starter sets m-enter before paint and releases it after 700ms even if the module fails.
     Hold only the opt-in groups so they cannot flash fully drawn before their first frame. */
  html.m-enter:not(.m-enter-done, [data-motion="off"]) .hero:is([data-enter="fade"], [data-enter="rise"]):not(.is-entered, :focus-within)
    :is([data-enter-copy], [data-enter-media], .hero-copy, .hero__copy, .hero__head, .hero__text, .hero__c,
        .hero__bg, .hero__media, .hero__stage, .hero__art, .hero__window, .hero-visual, .ly-collage) { opacity: 0; }
}

.m-arrow { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
html:not([data-motion="off"]) .btn--primary:hover { background: color-mix(in oklab, var(--action) 84%, var(--bg)); }
html:not([data-motion="off"]) .btn--secondary:hover { background: color-mix(in oklab, var(--bg) 92%, var(--ink)); border-color: var(--line-strong); }
:is(a.card, a.tile, .card:has(a), a.pill) { transition: border-color var(--m-out) var(--m-ease), background-color var(--m-out) var(--m-ease); }
:is(a.card, a.tile, .card:has(a), a.pill):hover { border-color: var(--line-strong); transition-duration: var(--m-in); }
:is(a.card, a.tile, .card:has(a)):hover :is(h2, h3) { text-decoration: underline; text-underline-offset: .15em; }
:is(.link, .m-link, p a:not([class]), .footer ul a) { text-decoration: underline; text-underline-offset: .16em; text-decoration-color: color-mix(in oklab, currentColor 45%, transparent); transition: text-decoration-color var(--m-out) var(--m-ease); }
:is(.link, .m-link, p a:not([class]), .footer ul a):is(:hover,:focus-visible) { text-decoration-color: currentColor; transition-duration: var(--m-in); }

/* ---------------------------------------------------------------- navigation */
/* the nav words take no pill (ST-08, ST-11): system.css draws the underline under a word from the left on hover and focus, and
   takes it away to the right; the page you are on keeps its still bar (system.css draws it, at the same inset) */
@media (min-width: 1024px) {
  /* the full-width panel: fades and settles 6px in 180ms with its columns together (one surface, read
     as one); it closes in 180ms. While one menu is open, the next word swaps the panel at once
     (motion.js .m-menu-open) */
  html:not([data-motion="off"]) .nav__menu {
    transform: translateY(-6px);
    transition: opacity var(--m-state) var(--m-ease), transform var(--m-state) var(--m-ease), visibility 0s linear var(--m-state);
  }
  html:not([data-motion="off"]) .nav__item:is(:hover, :focus-within) > .nav__menu {
    transform: none;
    transition: opacity var(--m-state) var(--m-ease) 150ms, transform var(--m-state) var(--m-ease) 150ms, visibility 0s linear 150ms;
  }
  /* .m-menu-open comes on when the first panel starts to show (150ms): from then the next word swaps
     the panel at once. Duration and delay go to 0, the properties stay listed, so the panel that is
     still fading in finishes its own 180ms instead of snapping */
  html:not([data-motion="off"]) .nav.m-menu-open .nav__item:hover > .nav__menu { transition-delay: 0s; }
  html:not([data-motion="off"]) .nav__item:has(:focus-visible) > .nav__menu { transition: none; }
  html:not([data-motion="off"]) .menu-col a { transition: color var(--m-out) var(--m-ease); }
  html:not([data-motion="off"]) .menu-col a:hover { transition-duration: var(--m-in); }
  html:not([data-motion="off"]) .menu-card .panel { transition: border-color var(--m-out) var(--m-ease); }
}
/* Keep the phone sheet laid out until its exit fades. The closed sheet is inert. */
@media (max-width: 1023px) {
  html:not([data-motion="off"]) .nav[data-m-nav] .nav__links {
    display: flex; flex-direction: column; position: fixed; inset: var(--nav) 0 0;
    padding: var(--s-4) var(--gut) calc(var(--btn-h) * 2 + 56px); background: var(--bg); overflow-y: auto; gap: 0;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--m-sheet) var(--m-ease), visibility 0s linear var(--m-sheet);
  }
  html:not([data-motion="off"]) .nav[data-m-nav].is-open .nav__links {
    opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--m-sheet) var(--m-ease);
    animation: m-sheet-in var(--m-sheet) var(--m-ease);
  }
  .nav[data-m-nav]:not(.is-open) .nav__links .nav__item { display: grid; grid-template-columns: 1fr auto; height: auto; border-bottom: 1px solid var(--line); }
  .nav[data-m-nav]:not(.is-open) .nav__links .nav__link { height: 56px; padding: 0; font-size: 20px; }
  .nav[data-m-nav]:not(.is-open) .nav__links .nav__expand { display: inline-grid; place-items: center; width: 44px; border: 0; background: none; color: inherit; }
  .nav[data-m-nav]:not(.is-open) .nav__links :is(.chev,.nav__menu) { display: none; }
  @keyframes m-sheet-in { from { transform: translateY(-8px); } to { transform: none; } }
}

/* ---------------------------------------------------------------- tabs: the indicator slides */
html:not([data-motion="off"]) .tabs.m-has-ind { position: relative; isolation: isolate; }
html:not([data-motion="off"]) .tabs.m-has-ind .tab { position: relative; z-index: 1; }
html:not([data-motion="off"]) .tabs.m-has-ind .tab[aria-selected="true"] { background: transparent; border-color: transparent; }
/* the pill takes its new size at once and travels by transform alone (motion.js: it starts scaled to
   the old tab's size at the old place and settles to scale 1 at the new one), so nothing is laid out
   again while it moves and its corners are true at rest */
.m-tab-ind {
  position: absolute; left: 0; top: 0; z-index: 0; width: var(--w, 0px); height: var(--h, 0px);
  border-radius: var(--r-btn); background: var(--ink); pointer-events: none;
  transform: translate(var(--x, 0px), var(--y, 0px)) scale(var(--sx, 1), var(--sy, 1)); transform-origin: 0 0;
  transition: transform var(--m-state) var(--m-ease);
}
.m-tab-ind.is-jump { transition: none; }
html:not([data-motion="off"]) .tab { transition: color var(--m-state) var(--m-ease), border-color var(--m-out) var(--m-ease), background-color var(--m-out) var(--m-ease); }

/* Panels sharing a frame overlap during the exit. Hidden panels leave the layout after 180ms. */
.m-tab-stack { display: grid; }
.m-tab-stack > [role="tabpanel"] { grid-area: 1 / 1; transition: opacity var(--m-state) var(--m-ease), display 180ms allow-discrete; }
.m-tab-stack > [role="tabpanel"][hidden] { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- focus */
/* the ring (system.css) is drawn in full in the frame the focus lands; no transition */

/* ---------------------------------------------------------------- inputs, switches, checks */
html:not([data-motion="off"]) .field :is(input, select, textarea), .m-input {
  transition: border-color var(--m-state) var(--m-ease), box-shadow var(--m-state) var(--m-ease), background-color var(--m-out) var(--m-ease);
}
html:not([data-motion="off"]) .field :is(input, select, textarea):hover, .m-input:hover { border-color: color-mix(in oklab, var(--ink) 48%, transparent); }
html:not([data-motion="off"]) .field :is(input, select, textarea):focus, .m-input:focus {
  /* the field's own ring in place of the outline: a 2px line in --action (3:1 on the ground) and a soft halo,
     there at once like every focus ring (the hover's fade does not apply to focus) */
  outline: none; border-color: var(--action);
  box-shadow: 0 0 0 1px var(--action), 0 0 0 4px color-mix(in oklab, var(--action) 20%, transparent); transition-duration: 140ms;
}
/* a switch: <button class="m-switch" role="switch" aria-checked="false" aria-label="..."></button>
   (motion.js flips aria-checked on click unless the page handles it). The knob slides in 180ms and
   stretches 4px while pressed, both by transform (a scaleX from its left edge; on, the 12px shift
   keeps its right edge where it rests). The off track is ink at 48% (3.3:1 or more against the knob
   and the ground, the 3:1 a control needs) */
.m-switch {
  position: relative; flex: none; width: 40px; height: 24px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: color-mix(in oklab, var(--ink) 48%, var(--bg));
  transition: background-color 180ms var(--m-ease);
}
.m-switch::before {
  content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 999px;
  background: var(--bg); box-shadow: 0 1px 3px rgb(0 0 0 / .25);
  transform-origin: 0 50%; transition: transform 180ms var(--m-ease);
}
.m-switch[aria-checked="true"] { background: var(--action); }
.m-switch[aria-checked="true"]::before { transform: translateX(16px); background: var(--action-ink); }
.m-switch:active::before { transform: scaleX(1.22); transition-duration: var(--m-press); }
.m-switch[aria-checked="true"]:active::before { transform: translateX(12px) scaleX(1.22); }
.m-switch:hover:not([aria-checked="true"]) { background: color-mix(in oklab, var(--ink) 58%, var(--bg)); }
/* a check box: <input type="checkbox" class="m-check">, the tick fades in as it grows from 70% to full size, 160ms */
.m-check {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; width: 20px; height: 20px; border-radius: 6px; cursor: pointer;
  border: 1px solid color-mix(in oklab, var(--ink) 48%, var(--bg)); background: var(--bg) no-repeat center / 14px 14px;
  display: inline-grid; place-items: center;
  transition: background-color var(--m-in) var(--m-ease), border-color var(--m-in) var(--m-ease);
}
.m-check::before {
  content: ""; width: 10px; height: 6px; margin-top: -2px; border: solid var(--action-ink); border-width: 0 0 2px 2px;
  opacity: 0; transform: rotate(-45deg) scale(.7); transform-origin: 50% 50%;
  transition: transform 160ms var(--m-ease), opacity 100ms var(--m-ease);
}
.m-check:hover:not(:checked) { border-color: color-mix(in oklab, var(--ink) 64%, var(--bg)); }
.m-check:checked { background-color: var(--action); border-color: var(--action); }
.m-check:checked::before { opacity: 1; transform: rotate(-45deg) scale(1); }

/* ---------------------------------------------------------------- FAQ
   Every answer stays open (ST-47, system.css): nothing here opens, closes or animates its height. */

/* ---------------------------------------------------------------- numbers that tick once */
[data-m-count] { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- loops inside a card's panel */
/* a CSS loop the page writes inside [data-m-loop] runs one cycle in --m-cycle (2.5-4 s) and repeats
   while on screen; motion.js pauses it off screen and restarts it on hover (motion.md) */
[data-m-loop] { --m-cycle: 3.2s; --m-still: 0.6; --m-safe: 48px; }
/* the pause button (a 32px disc 12px in from the bottom-right corner) gets a clear band: content in
   the flow ends --m-safe (48px) above the bottom edge, and a fading stage dissolves above that band,
   never under the button. Size the panel so the loop's subject sits above the fade */
[data-m-loop]:not(:has(> .stage)) { padding-bottom: var(--m-safe); }
[data-m-loop] > .stage:is(.stage--fade-b, .stage--fade-br) { bottom: var(--m-safe); }
/* on a phone (as ui.js does) and under reduced motion a loop holds its finished picture: the frame at
   --m-still (0-1) of the cycle, set on the loop where the picture is complete */
@media (max-width: 639px) {
  [data-m-loop] * { animation-duration: var(--m-cycle) !important; animation-delay: calc(-1 * var(--m-still) * var(--m-cycle)) !important;
                    animation-play-state: paused !important; }
}
[data-m-loop].is-m-off, [data-m-loop].is-m-paused, [data-m-loop].is-m-off *, [data-m-loop].is-m-paused * { animation-play-state: paused !important; }

/* Word masks and covers belong to the two loud entrances only. */
html[data-temper="loud"] .hero .m-w { display: inline-block; overflow: clip; vertical-align: bottom; }
html[data-temper="loud"] .hero .m-w__in { display: inline-block; }
.hero[data-enter="line-blocks"] h1 { position: relative; }
.m-block { position: absolute; pointer-events: none; background: var(--m-block, var(--accent)); transform-origin: right; }

/* ---------------------------------------------------------------- swatches that change the photograph
   <div class="m-swatches" data-m-swatches="#jacket-photo" role="group" aria-label="Colour">
     <button type="button" class="m-swatch" style="--sw:#2f3a2c" data-src="olive.jpg" data-alt="..." aria-pressed="true" aria-label="Olive"></button> ...
   a click or tap crossfades the photograph (260ms, motion.js); the pressed swatch wears a ring */
.m-swatches { display: flex; flex-wrap: wrap; gap: var(--s-2, 8px); }
.m-swatch { width: 28px; height: 28px; border-radius: 999px; border: 0; padding: 0; cursor: pointer; background: var(--sw, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 18%, transparent), 0 0 0 2px var(--bg), 0 0 0 3px transparent;
  transition: box-shadow var(--m-out) var(--m-ease), transform var(--m-press) var(--m-ease); }
.m-swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 18%, transparent), 0 0 0 2px var(--bg), 0 0 0 3px var(--ink); }

@media (hover: hover) and (pointer: fine) {
  .m-swatch:hover:not([aria-pressed="true"]) { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 18%, transparent), 0 0 0 2px var(--bg), 0 0 0 3px var(--line-strong); transition-duration: var(--m-in); }
}

/* ---------------------------------------------------------------- open now: a dot that breathes twice
   system.js writes "Open now, until 16:00" into [data-open-now]; motion.js marks it .m-open, and the first time it is
   seen its green dot sends out a soft ring twice (2 x 2.4 s), then rests. Closed: no dot */
[data-open-now].m-open::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: .5em; vertical-align: .06em; border-radius: 999px;
  background: var(--ok, #2f8a57); box-shadow: 0 0 0 0 color-mix(in oklab, var(--ok, #2f8a57) 40%, transparent);
}
/* ---------------------------------------------------------------- a line that draws inside a card's picture
   inside a [data-m-loop] panel, any kind: a route on a map, a signature, steam over a cup, a delivery path.
   <path class="m-draw" pathLength="1" d="..."/>: it draws in the first 55% of the cycle, holds, dims and draws
   again; the finished line is the still (--m-still .6) */
[data-m-loop] .m-draw { fill: none; stroke-dasharray: 1; animation: m-draw var(--m-cycle) var(--m-ease) infinite; }
@keyframes m-draw {
  0% { stroke-dashoffset: 1; opacity: 1; }
  55%, 86% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: .3; }
}

/* Press lives on its own transform component, independent of an icon or photo inside. */
html:root:not([data-motion="off"]) :is(.btn,.tab,.nav__toggle,a.card,.pill,.m-swatch,summary,.press) {
  transition: scale var(--m-press) var(--m-ease), color var(--m-colour-time, var(--m-out)) var(--m-ease),
    background-color var(--m-colour-time, var(--m-out)) var(--m-ease),
    border-color var(--m-colour-time, var(--m-out)) var(--m-ease), box-shadow var(--m-colour-time, var(--m-out)) var(--m-ease);
}
html:root:not([data-motion="off"]) :is(.btn,.tab,.nav__toggle,a.card,.pill,.m-swatch,summary,.press):hover { --m-colour-time: var(--m-in); transition-duration: var(--m-press), var(--m-in), var(--m-in), var(--m-in), var(--m-in); }
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="off"]) .btn:active { transform: none; }
  html:root:not([data-motion="off"]) :is(.btn,.tab,.nav__toggle,a.card,.pill,.m-swatch,summary,.press):active {
    scale: .98; transition-duration: var(--m-press), var(--m-in), var(--m-in), var(--m-in), var(--m-in);
  }
  html:not([data-motion="off"]) :is(.faq--fold,[data-own]) details::details-content {
    interpolate-size: allow-keywords; block-size: 0; overflow: clip; opacity: 0;
    transition: block-size var(--m-state) var(--m-ease), opacity var(--m-state) var(--m-ease), content-visibility var(--m-state) allow-discrete;
  }
  html:not([data-motion="off"]) :is(.faq--fold,[data-own]) details[open]::details-content { block-size: auto; opacity: 1; }
}
html:not([data-motion="off"]) .field__error { opacity: 1; transition: opacity var(--m-state) var(--m-ease), display 150ms allow-discrete; }
html:not([data-motion="off"]) .field__error[hidden] { opacity: 0; }
@starting-style { html:not([data-motion="off"]) .field__error:not([hidden]) { opacity: 0; } }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="off"]) .card:hover, html:not([data-motion="off"]) .card--open:hover > .panel,
  html:not([data-motion="off"]) :is(a, .card:has(a), .m-zoom):hover :is(.frame__img, .tile__media > img, img, video),
  html:not([data-motion="off"]) .btn:is(:hover, :active), html:not([data-motion="off"]) :is(.btn--arrow, .link):hover::after,
  :is(a, button):hover > .m-arrow :is(.m-arrow__head, .m-arrow__stem) { transform: none !important; }
  .m-arrow__stem { opacity: 1; transform: none; }
  html:not([data-motion="off"]) .nav__menu { transform: none !important; }
  /* the controls keep their state and their colour change, without travel: the tab pill and the switch
     knob jump, the tick fades in at full size, the underline is drawn at once */
  .m-tab-ind { transition: none; }
  html:not([data-motion="off"]) .nav[data-m-nav].is-open .nav__links { animation: none; }
  html:not([data-motion="off"]) :is(.btn,.card):hover > * { translate: none; }
  .m-switch::before { transition-property: background-color; }
  .m-switch:active::before { transform: none; }
  .m-switch[aria-checked="true"]::before, .m-switch[aria-checked="true"]:active::before { transform: translateX(16px); }
  .m-check::before { transform: rotate(-45deg) scale(1); transition-property: opacity; }
  html:not([data-motion="off"]) :is(.link, .m-link, p a:not([class]), .footer ul a, .footer .link) { transition-property: color, opacity, background-color, border-color; }
  /* a press still shows, as a deeper tone instead of a move */
  html:not([data-motion="off"]) .btn--primary:active { background: color-mix(in oklab, var(--action) 74%, var(--bg)); }
  html:not([data-motion="off"]) .btn--secondary:active { background: color-mix(in oklab, var(--bg) 86%, var(--ink)); }
  [data-m-loop] * { animation-duration: var(--m-cycle) !important; animation-iteration-count: infinite !important;
                    animation-delay: calc(-1 * var(--m-still) * var(--m-cycle)) !important; animation-play-state: paused !important; }
  /* the row's line and the rolling label appear at once; the swatch keeps its ring and only crossfades */
  html:not([data-motion="off"]) .rows > li::after, .m-swap__w > span { transition: none; }
  .m-swatch:active { transform: none; }
}
