/* HNFL motion system: a transient navy veil and eleven moving strokes. */
:root {
  --hnfl-pass-time:1.04s;
  --hnfl-veil:#f7f6f2;
  --hnfl-stroke:#c81c36;
  --hnfl-mark-unit:clamp(6px,1.14vw,11px);
  --hnfl-mark-stem:max(1px,.135em);
}
:root:has(body.theme-night,body.page-start .start-layout input[value="night"]:checked) {
  --hnfl-veil:#0c172d;
  --hnfl-stroke:#ff5269;
}
@property --hnfl-drift {
  syntax:"<number>";
  inherits:false;
  initial-value:0;
}

@media (prefers-reduced-motion:no-preference) {
  @view-transition { navigation:auto; }

  .hnfl-stitch {
    position:fixed;
    z-index:200;
    inset:50% auto auto 50%;
    translate:-50% -50%;
    font-size:var(--hnfl-mark-unit);
    width:min(54em,100vw);
    height:26em;
    pointer-events:none;
    view-transition-name:hnfl-stitch;
  }
  .hnfl-stitch::before {
    content:"";
    position:absolute;
    inset:0;
    animation:hnfl-stitch-pass var(--hnfl-pass-time) linear both,
      hnfl-stitch-alpha var(--hnfl-pass-time) linear both;
  }
  /* Direct file opening: play a single incoming-page veil when there is no
     outgoing snapshot. It is purely decorative and cannot capture clicks. */
  html::before {
    content:"";
    position:fixed; inset:0; z-index:199;
    background:var(--hnfl-veil);
    pointer-events:none;
    animation:hnfl-veil-in var(--hnfl-pass-time) linear both;
  }
  /* In a cross-document transition the moving strokes are painted on the
     snapshot pseudo. Hide, rather than restart, the fallback animations. */
  html:active-view-transition::before,
  html:active-view-transition .hnfl-stitch::before { visibility:hidden; }
  ::view-transition { pointer-events:none; background:var(--hnfl-veil); }
  ::view-transition-group(hnfl-stitch) { z-index:1000; animation-duration:var(--hnfl-pass-time); }
  ::view-transition-old(hnfl-stitch) { display:none; }
  ::view-transition-new(hnfl-stitch) {
    font-size:var(--hnfl-mark-unit);
    animation:hnfl-stitch-pass var(--hnfl-pass-time) linear both,
      hnfl-stitch-alpha var(--hnfl-pass-time) linear both;
    mix-blend-mode:normal;
  }
  .hnfl-stitch::before,
  ::view-transition-new(hnfl-stitch) {
    color:var(--hnfl-stroke);
    /* Three bars for H; two posts and a diagonal for N; three for F; two for L. */
    background-image:
      linear-gradient(currentColor,currentColor), linear-gradient(currentColor,currentColor), linear-gradient(currentColor,currentColor),
      linear-gradient(currentColor,currentColor), linear-gradient(currentColor,currentColor),
      linear-gradient(55deg,transparent 48.65%,currentColor 49.05% 50.95%,transparent 51.35%),
      linear-gradient(currentColor,currentColor), linear-gradient(currentColor,currentColor), linear-gradient(currentColor,currentColor),
      linear-gradient(currentColor,currentColor), linear-gradient(currentColor,currentColor);
    background-repeat:no-repeat;
    background-size:var(--hnfl-mark-stem) 5em,var(--hnfl-mark-stem) 5em,3.55em var(--hnfl-mark-stem),
      var(--hnfl-mark-stem) 5em,var(--hnfl-mark-stem) 5em,3.5em 5em,
      var(--hnfl-mark-stem) 5em,3.55em var(--hnfl-mark-stem),2.65em var(--hnfl-mark-stem),
      var(--hnfl-mark-stem) 5em,3.55em var(--hnfl-mark-stem);
    background-position:
      calc(50% - 9em + var(--hnfl-drift) * -8em) calc(50% + var(--hnfl-drift) * -5em),
      calc(50% - 5.5em + var(--hnfl-drift) * -2em) calc(50% + var(--hnfl-drift) * 4em),
      calc(50% - 7.25em + var(--hnfl-drift) * -11em) calc(50% + var(--hnfl-drift) * 2em),
      calc(50% - 3.75em + var(--hnfl-drift) * 1em) calc(50% + var(--hnfl-drift) * -6em),
      calc(50% - .25em + var(--hnfl-drift) * 3em) calc(50% + var(--hnfl-drift) * 5em),
      calc(50% - 2em + var(--hnfl-drift) * -5em) calc(50% + var(--hnfl-drift) * 4em),
      calc(50% + 1.5em + var(--hnfl-drift) * 5em) calc(50% + var(--hnfl-drift) * -5em),
      calc(50% + 3.2em + var(--hnfl-drift) * 12em) calc(50% - 2.43em + var(--hnfl-drift) * -2em),
      calc(50% + 2.75em + var(--hnfl-drift) * 10em) calc(50% - .25em + var(--hnfl-drift) * 2em),
      calc(50% + 6.75em + var(--hnfl-drift) * 7em) calc(50% + var(--hnfl-drift) * 5em),
      calc(50% + 8.45em + var(--hnfl-drift) * 12em) calc(50% + 2.43em + var(--hnfl-drift) * 3em);
  }
  ::view-transition-group(root) { animation-duration:var(--hnfl-pass-time); }
  ::view-transition-old(root) { animation:hnfl-page-out var(--hnfl-pass-time) linear both; mix-blend-mode:normal; }
  ::view-transition-new(root) { animation:hnfl-page-in var(--hnfl-pass-time) linear both; mix-blend-mode:normal; }
  .page-index .match-hero__figure { view-transition-name:none; }
}
@keyframes hnfl-stitch-pass {
  0% { --hnfl-drift:1.68; animation-timing-function:cubic-bezier(.12,.69,.22,1); }
  42%,56% { --hnfl-drift:0; }
  56% { animation-timing-function:cubic-bezier(.54,0,.82,.4); }
  100% { --hnfl-drift:-1.68; }
}
@keyframes hnfl-stitch-alpha {
  0% { opacity:0; }
  12%,76% { opacity:1; }
  100% { opacity:0; }
}
@keyframes hnfl-veil-in {
  0% { opacity:0; }
  8% { opacity:.55; animation-timing-function:cubic-bezier(.23,.64,.35,1); }
  36%,54% { opacity:1; }
  54% { animation-timing-function:cubic-bezier(.44,.04,.38,1); }
  91%,100% { opacity:0; }
}
@keyframes hnfl-page-out {
  0%,5% { opacity:1; }
  5% { animation-timing-function:cubic-bezier(.23,.62,.42,1); }
  36%,100% { opacity:0; }
}
@keyframes hnfl-page-in {
  0%,54% { opacity:0; translate:0 1.1rem; }
  54% { animation-timing-function:cubic-bezier(.44,.04,.38,1); }
  92%,100% { opacity:1; translate:0 0; }
}

/* Weighted reveals: scroll position stays native; only the content eases. */
@supports (animation-timeline:view()) and (animation-range:entry 0% entry 90%) {
  @media (prefers-reduced-motion:no-preference) {
    body:not(.page-start) main :is(
      .atlas-heading,.section-heading,.field-gallery__intro,.match-hero__body,
      .collection-hero__layout,.catalog-toolbar,.city-kits-heading,
      .custom-hero-copy,.custom-home__copy,.custom-products > h2,
      .split-hero__copy,.news-section-heading,.matchday > h2,.black-section > h2
    ) {
      --hnfl-lift:clamp(1.9rem,3.4vw,3.65rem);
      animation:hnfl-weighted-entry 1s linear both;
      animation-timeline:view(block);
      animation-range:entry 0% entry 94%;
    }
    body:not(.page-start) main :is(
      .match-hero__figure,.field-card,.media-feature,.signal-match-poster,
      .support-home-grid > a,.goods-home-grid > a,.news-home__photo,
      .city-detail-products > a,.product-card,.product-gallery,.custom-home__stage,
      .custom-preview,.custom-product-grid > *,.split-hero__graphic,
      .feature-row > *,.news-feature,.news-photo,.matchday-grid > *
    ) {
      --hnfl-lift:clamp(2.35rem,6vw,5.75rem);
      animation:hnfl-weighted-image 1s linear both;
      animation-timeline:view(block);
      animation-range:entry 10% entry 100%;
    }
    body:not(.page-start) main :is(
      .city-grid,.city-preview,.home-feature-copy,.news-home > div,.city-index,.city-bottom,
      .product-buy,.design-story,.builder-panel,.news-longread > article,.news-row
    ) {
      --hnfl-lift:clamp(1.65rem,3.15vw,3.05rem);
      animation:hnfl-weighted-entry 1s linear both;
      animation-timeline:view(block);
      animation-range:entry 8% entry 100%;
    }
    body:not(.page-start) main :is(.product-card,.field-card,.city-detail-products > a):nth-child(3n + 2),
    body:not(.page-start) main .support-home-grid > a:nth-child(2) { animation-range-start:entry 18%; }
    body:not(.page-start) main :is(.product-card,.field-card,.city-detail-products > a):nth-child(3n + 3) { animation-range-start:entry 26%; }

    /* Keep the page start, direct-jump content and focused controls immediately usable. */
    body:not(.page-start) main > :first-child :is(.match-hero__body,.collection-hero__layout,.custom-hero-copy) { animation:none; }
    body:not(.page-start) main :is(:focus-within,:target,:target > :first-child) { animation:none!important; }
    .page-index main :is(#official-home,#supporter-home,#custom-home) :is(.section-heading,.signal-match-poster,.support-home-grid>a,.custom-home__copy,.custom-home__stage),
    .page-index main .news-home > :is(div,.news-home__photo),
    .page-city main .city-detail-products > a { animation-name:hnfl-weighted-entry; }
    .page-index main :is(#official-home,#supporter-home,#custom-home) :is(.signal-match-poster,.support-home-grid>a,.custom-home__stage),
    .page-index main .news-home > .news-home__photo,
    .page-city main .city-detail-products > a { animation-name:hnfl-weighted-image; }
  }
}
@keyframes hnfl-weighted-entry {
  0% { opacity:.12; translate:0 var(--hnfl-lift,2.2rem); animation-timing-function:cubic-bezier(.51,.04,.59,.91); }
  45% { opacity:.59; translate:0 calc(var(--hnfl-lift,2.2rem) * .45); animation-timing-function:cubic-bezier(.15,.73,.21,1); }
  100% { opacity:1; translate:0 0; }
}
@keyframes hnfl-weighted-image {
  0% { opacity:.17; translate:0 var(--hnfl-lift,4rem); scale:.952; animation-timing-function:cubic-bezier(.55,0,.63,.85); }
  48% { opacity:.65; translate:0 calc(var(--hnfl-lift,4rem) * .5); scale:.983; animation-timing-function:cubic-bezier(.17,.69,.22,1); }
  100% { opacity:1; translate:0 0; scale:1; }
}
@media (prefers-reduced-motion:reduce) {
  .hnfl-stitch { display:none; }
  @view-transition { navigation:none; }
}

/* Chapter boundaries: alternating paper bands and one rule at each boundary. */
body:not(.page-start) {
  --chapter-tint:#edeae2;
  --chapter-tint-soft:#f2efe8;
  --chapter-seam:#cbc5b9;
  --chapter-cue:var(--signal,#bd3028);
  --chapter-gap:clamp(3.4rem,7.2vw,7.75rem);
}
body.theme-night {
  --chapter-tint:#14223b;
  --chapter-tint-soft:#111f35;
  --chapter-seam:#40516d;
}
.page-index main > .city-selector,
.page-index.theme-night main > .city-selector,
.page-index main > .home-collections > #official-home,
.page-index.theme-night main > .home-collections > #official-home,
.page-index main > .news-home,
.page-index.theme-night main > .news-home {
  background-color:var(--chapter-tint);
}
.page-index main > .field-gallery,
.page-index main > .home-collections > #supporter-home,
.page-index.theme-night main > .home-collections > #supporter-home {
  background-color:var(--paper);
}
.page-index main > :is(.city-selector,.field-gallery,.home-section,.news-home),
.page-index main > .home-collections > :is(#official-home,#supporter-home) {
  border-block-start:1px solid var(--chapter-seam);
  padding-block:var(--chapter-gap);
}
.page-index main > .home-collections > #custom-home,
.page-index.theme-night main > .home-collections > #custom-home {
  margin-inline:0;
  background-color:var(--chapter-tint-soft);
  border-block:1px solid var(--chapter-seam);
  padding:var(--chapter-gap) var(--gutter);
}
.page-index main > .home-collections + .home-section { border-block-start:0; }
.page-index .city-selector .city-card { border-bottom-color:var(--chapter-seam); }
.page-index .city-selector .city-preview { outline:1px solid var(--chapter-seam); outline-offset:-1px; }

/* One short accent at the chapter lead, not around every component. */
.page-index main :is(.atlas-heading,.field-gallery__intro,.section-heading),
.page-index main > .news-home > div:first-child,
.page-index main #custom-home .custom-home__copy {
  background-image:linear-gradient(var(--chapter-cue),var(--chapter-cue));
  background-repeat:no-repeat;
  background-size:2.25rem 2px;
  padding-block-start:1.35rem;
}

/* Reuse the same seams on the catalog, city, kit, lab and news pages. */
main > :is(.catalog-toolbar,.catalog,.red-editorial,.black-section,.custom-builder,.custom-products,.news-longread,.latest-news,.matchday),
.product-detail-panel > .design-story,
.city-detail-panel > .city-kits-heading {
  border-block-start:1px solid var(--chapter-seam);
}
body:not(.page-index) main > :is(.catalog-toolbar,.custom-products,.news-longread),
body:not(.page-index) .product-detail-panel > .design-story,
.page-city .city-detail-panel > :is(.city-kits-heading,.city-detail-products) {
  background-color:var(--chapter-tint-soft);
}
body:not(.page-index) main > :is(.custom-products,.news-longread,.latest-news,.matchday) {
  padding-block:clamp(2.75rem,6.2vw,6.5rem);
}
.page-city .city-detail-panel > .city-kits-heading {
  margin-block-start:clamp(2rem,4.5vw,4.8rem);
  padding-block-start:clamp(2.5rem,5vw,5rem);
}
.page-city .city-detail-panel > .city-detail-products { padding-block-end:clamp(2rem,4vw,4.5rem); }
.page-city .city-detail-panel > .city-bottom {
  border-block-start:1px solid var(--chapter-seam);
  padding-block:clamp(1.25rem,3vw,2.75rem);
}
@media (max-width:760px) {
  body:not(.page-start) { --chapter-gap:clamp(2.4rem,7vw,4rem); }
  .page-index main :is(.atlas-heading,.field-gallery__intro,.section-heading) { padding-block-start:1rem; }
}
