/* HNFL / HOME GROUND — editorial grid and scoped motion */

/* The gate and chant are fixed landmarks; only wordmark and lane change position. */
.page-start .start-chant,
.page-start:has(.start-layout [value="night"]:checked) .start-chant {
  left: 100%; top: 6%; translate: -100% 0; text-align: right; transition-property: none;
}
.page-start .start-chant p { font-size: clamp(1.25rem,2.8vw,3.3rem); }
.page-start .start-word { top: 24%; }
.page-start:has(.start-layout [value="night"]:checked) .start-word { top: 47%; }
.page-start .start-gate,
.page-start:has(.start-layout [value="night"]:checked) .start-gate {
  left: 0; translate: none; transition-property: none;
}
.page-start .start-link { min-inline-size: 12rem; justify-content: space-between; }
.page-start .start-track,
.page-start:has(.start-layout [value="night"]:checked) .start-track { top: 80%; }
.page-start .start-signal { display:none; }

/* Open on city choice, then one short guide to the two existing collections. */
.page-index .match-hero__body .hg-primary {
  display:inline-flex; align-items:center; justify-content:center;
  min-height:3rem; padding:.65rem 1.2rem; background:var(--signal);
  color:#100918; border:1px solid transparent; text-decoration:none;
}
.page-index:not(.theme-night) .match-hero__body .hg-primary { color:#fff; }
.page-index .match-hero__body .hg-primary:is(:hover,:focus-visible) {
  background:var(--ink); color:var(--paper);
}
.page-index .match-hero__body .hg-secondary { color:var(--ink); }
.hg-atlas-board { display:grid; gap:clamp(1.1rem,3vw,3rem); }
.page-index .city-selector .city-preview { margin-block-start:0; }
.page-index .city-selector .hg-atlas-board .city-grid { animation:none; }
.page-index .city-selector .hg-atlas-board .city-preview { animation:none; }
.hg-guide-grid { display:grid; gap:clamp(1.15rem,3vw,3.1rem); grid-template-columns:repeat(2,minmax(0,1fr)); }
.hg-guide-card { display:grid; gap:.45rem; padding-bottom:1.15rem; border-bottom:1px solid var(--line); }
.hg-guide-card > strong { font-size:clamp(1.22rem,2.35vw,2.5rem); letter-spacing:-.042em; line-height:1; }
.hg-guide-card > span:last-child { font-size:.9rem; }
.hg-guide-card:is(:hover,:focus-visible) { border-color:var(--signal); }
.hg-guide-photo { display:grid; place-items:center; background:var(--chapter-tint-soft,var(--paper)); height:clamp(14rem,29vw,29rem); overflow:hidden; margin-bottom:.65rem; }
.hg-guide-photo img { display:block; width:100%; height:100%; min-height:0; object-fit:contain; object-position:center; }

@media (min-width:961px) {
  .hg-atlas-board { grid-template-columns:minmax(0,1fr) minmax(0,1.26fr); align-items:stretch; }
  .page-index .city-selector .hg-atlas-board .city-grid {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 clamp(.6rem,1.2vw,1.35rem);
  }
  .page-index .city-selector .hg-atlas-board .city-card {
    min-width:0; min-height:0; padding:.4rem .5rem; display:flex; align-items:center;
    gap:clamp(.45rem,.85vw,1rem);
  }
  .page-index .city-selector .hg-atlas-board .city-card__code { flex:none; font-size:clamp(.86rem,1.25vw,1.35rem); }
  .page-index .city-selector .hg-atlas-board .city-card__text { display:grid; font-size:clamp(.63rem,.8vw,.9rem); line-height:1.1; }
  .page-index .city-selector .hg-atlas-board .city-preview {
    height:auto; min-height:clamp(23rem,37vw,33rem);
  }
  .page-index .city-selector .hg-atlas-board .city-scene.signal-stage { grid-template-columns:minmax(0,1fr); }
  .hg-atlas-board .signal-copy { position:relative; z-index:1; justify-content:end; padding-bottom:clamp(2rem,4vw,4rem); }
  .page-index .hg-atlas-board .signal-copy h3 { font-size:clamp(2.15rem,4vw,5.1rem); }
  .hg-atlas-board .signal-poster {
    position:absolute; inset:0; color:var(--signal-team); background:none; pointer-events:none;
    border-inline-start:0;
  }
  .hg-atlas-board .signal-poster .signal-letter {
    place-self:start end; margin:0; font-size:clamp(10rem,21vw,22rem); opacity:.23;
  }
  .hg-atlas-board .signal-poster__count { color:var(--ink); }
}

/* City pages share an identical format in day and night; photos retain their colors. */
.page-city .city-detail-panel .city-detail-hero.signal-stage {
  background:var(--paper); border-block:1px solid var(--line);
  min-height:clamp(14rem,25vw,25rem);
}
.page-city .city-detail-hero .signal-poster { background:none; color:var(--city-active); border:0; }
.page-city.theme-night .city-detail-hero .signal-poster { color:color-mix(in srgb,var(--city-active) 85%,var(--ink)); }
.page-city .city-detail-hero .signal-letter { opacity:.44; }
.page-city .city-detail-hero .signal-meta { border-inline-start:3px solid var(--city-active); padding-inline-start:.68rem; }
.page-city .city-detail-hero .signal-poster__count { color:var(--ink); }
.page-city .city-detail-panel > .city-kits-heading { border:0; margin-block-start:0; }
.page-city .city-detail-panel > :is(.city-kits-heading,.city-detail-products) { background:var(--paper); }
.page-city .city-detail-panel > .city-detail-products {
  grid-template-columns:minmax(0,1.88fr) minmax(0,1fr);
  --hg-gap:clamp(1rem,2.2vw,2.4rem); gap:var(--hg-gap);
  align-items:stretch; padding-block:1.3rem clamp(3.25rem,6.2vw,6.25rem);
}
.hg-kit-main,.hg-kit-side,.hg-decals { display:grid; min-width:0; gap:var(--hg-gap,1rem); }
.hg-kit-side { grid-template-rows:repeat(2,minmax(0,1fr)); }
.page-city .city-detail-products :is(.hg-kit-main,.hg-kit-side) > a {
  display:grid; align-content:start; grid-template-rows:minmax(0,1fr) auto;
  grid-column:auto; min-width:0; min-height:0; height:100%; overflow:hidden;
  border-block-end:1px solid var(--chapter-seam,var(--line));
}
.page-city .city-detail-products :is(.hg-kit-main,.hg-kit-side) > a > span { align-self:end; padding-block:.72rem; }
.page-city .city-detail-products .hg-kit-main img {
  height:clamp(30rem,58vw,58rem); max-height:none; width:100%; min-height:0;
  object-fit:contain;
}
.page-city .city-detail-products .hg-kit-side img {
  width:100%; height:100%; max-height:none; min-height:0; object-fit:contain;
}
.page-city .city-detail-products :is(.hg-kit-main,.hg-kit-side) img { aspect-ratio:auto; margin:0; }
@media (min-width:761px) {
  .page-city .city-detail-products { --hg-kit-height:clamp(32rem,59vw,59rem); }
  .hg-kit-main,.hg-kit-side { height:var(--hg-kit-height); }
  .page-city .city-detail-products .hg-kit-main img { height:100%; }
}
.page-city .city-detail-products a:is(:hover,:focus-visible) { border-bottom-color:var(--city-active); }
.page-city .city-goods { --hg-gap:clamp(.9rem,2vw,2rem); }
.page-city .city-goods__grid { grid-template-columns:minmax(0,1.44fr) minmax(0,1fr); gap:var(--hg-gap); }
.page-city .city-goods__grid--decals { grid-template-columns:minmax(0,1fr); }
.hg-decals { grid-template-columns:repeat(2,minmax(0,1fr)); }
.page-city .city-goods__head .hg-goods-note { margin:.8rem 0 0; font-size:.85rem; line-height:1.5; }
.page-city .city-goods__card--tote-bags .city-goods__media { aspect-ratio:1.35; }
.page-city .hg-city-end {
  display:grid; grid-template-columns:minmax(0,1fr) auto;
  gap:1rem 2rem; align-items:end;
}
.page-city .city-bottom > a.hg-next {
  display:grid; justify-self:start; gap:.28rem; max-width:100%;
  border-inline-start:3px solid var(--city-active); padding-inline-start:.85rem; text-decoration:none;
}
.hg-next strong { font-size:clamp(1.6rem,3.7vw,4rem); line-height:.97; letter-spacing:-.055em; overflow-wrap:anywhere; }
.hg-next span { font-size:.77rem; font-weight:750; }
.hg-next:is(:hover,:focus-visible) strong { text-decoration:underline; text-decoration-color:var(--city-active); text-underline-offset:.13em; }
.hg-city-end__links { display:flex; align-items:center; flex-wrap:wrap; gap:.85rem 1.2rem; }
.hg-city-end__links > a:not(.dark-button) { font-size:.85rem; text-decoration:underline; }

/* Departure and arrival still use the original line timing for major chapters only. */
@media(prefers-reduced-motion:no-preference) {
  html:not(:has(body.hg-major))::before { content:none; }
  html:not(:has(body.hg-major))::view-transition { background:transparent; }
  html:not(:has(body.hg-major))::view-transition-old(root) { animation:none; opacity:0; }
  html:not(:has(body.hg-major))::view-transition-new(root) { animation:none; }
  html:not(:has(body.hg-major))::view-transition-group(*) { animation-duration:0s; }
  .page-city .city-detail-panel:target .signal-letter { animation:hg-letter .43s cubic-bezier(.18,.72,.22,1) both; }
}
@keyframes hg-letter {
  from { translate:-.14em 0; clip-path:inset(0 100% 0 0); }
  to { translate:0 0; clip-path:inset(0); }
}
@supports(animation-timeline:view()) {
  @media(prefers-reduced-motion:no-preference) {
    .page-city main .city-detail-panel > :is(.city-kits-heading,.city-bottom) { animation:none; }
    .page-city :is(.city-kits-heading,.city-goods__head) .section-label {
      animation:hg-label linear both;
      animation-timeline:view(); animation-range:entry 0% entry 100%;
    }
    .page-city :is(.hg-kit-main img,.city-goods__card--tote-bags .city-goods__media),
    .page-index .hg-guide-photo {
      animation:hg-image linear both;
      animation-timeline:view(); animation-range:entry 2% entry 83%;
    }
    .page-city a:focus-visible :is(img,.city-goods__media),
    .page-index a:focus-visible .hg-guide-photo { animation:none; }
  }
}
@keyframes hg-label { from { opacity:.25; translate:0 9px; } to { opacity:1; translate:none; } }
@keyframes hg-image { from { opacity:.48; translate:0 18px; } to { opacity:1; translate:none; } }

@media (max-width:760px) {
  .page-city .city-detail-panel > .city-detail-products,
  .page-city .city-goods__grid,
  .page-city .hg-city-end { grid-template-columns:minmax(0,1fr); }
  .hg-kit-side { grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:auto; }
  .page-city .city-detail-products .hg-kit-main img { height:clamp(20rem,92vw,36rem); }
  .page-city .city-detail-products .hg-kit-side img { height:clamp(10rem,45vw,19rem); }
}
@media (max-width:650px) { .hg-guide-grid { grid-template-columns:minmax(0,1fr); } }
@media (max-width:540px) {
  .hg-decals { grid-template-columns:minmax(0,1fr); }
  .page-start:has(.start-layout [value="night"]:checked) .start-word { top:48%; }
  .page-city .city-detail-panel .city-detail-hero.signal-stage { min-height:13rem; }
  .page-city .city-detail-hero .signal-letter { font-size:clamp(4.6rem,20vw,6.7rem); }
}

/* CITY ATLAS / the light follows the selected city's palette. */
.page-index .city-selector .hg-atlas-board .city-scene.signal-stage {
  --hg-atlas-base: var(--paper);
  --hg-atlas-highlight: rgb(255 255 255 / .42);
  --hg-atlas-glint: color-mix(in srgb,var(--signal-team) 82%,var(--ink));
  background:
    radial-gradient(ellipse at 91% 6%,var(--hg-atlas-highlight),transparent 48%),
    linear-gradient(124deg,
      color-mix(in srgb,var(--signal-team) 12%,var(--hg-atlas-base)) 10%,
      color-mix(in srgb,var(--signal-team) 42%,var(--hg-atlas-base)) 60%,
      color-mix(in srgb,var(--signal-team) 77%,var(--hg-atlas-base)) 100%);
}
.page-index.theme-night .city-selector .hg-atlas-board .city-scene.signal-stage {
  --hg-atlas-base: #0c172d;
  --hg-atlas-highlight: rgb(182 215 255 / .17);
  --hg-atlas-glint: color-mix(in srgb,var(--signal-team) 48%,#e2ecff);
}
.page-index .hg-atlas-board .signal-copy p { color:var(--ink); }
@media (min-width:961px) {
  .page-index .hg-atlas-board .signal-poster .signal-letter {
    color:var(--hg-atlas-glint); opacity:.43;
  }
  .page-index .hg-atlas-board .signal-poster .signal-lanes {
    inset:46% -4% auto auto;
    width:64%; height:2.8rem;
    color:var(--hg-atlas-glint); opacity:.78;
    transform:rotate(-17deg) skewX(-18deg);
    background:
      linear-gradient(90deg,transparent,currentColor,transparent)
        90% 9% / 64% 1px no-repeat,
      linear-gradient(90deg,transparent,currentColor,transparent)
        93% 36% / 100% 2px no-repeat,
      linear-gradient(90deg,transparent,currentColor,transparent)
        74% 60% / 84% 1px no-repeat,
      linear-gradient(90deg,transparent,currentColor,transparent)
        38% 95% / 39% 1px no-repeat;
  }
}

/* Chapter headings stay static unless native view timelines are available. */
@supports (animation-timeline:view()) and (animation-range:entry 0% cover 18%) {
  @media (prefers-reduced-motion:no-preference) {
    body.page-index main :is(.atlas-heading,.field-gallery__intro,.section-heading),
    body.page-city main .city-detail-panel > .city-kits-heading {
      animation:none;
    }
    body[class]:not(.page-start) main h2 {
      position:relative;
      --hg-title-accent:var(--city-active,var(--signal,#c81c36));
      view-timeline:--hg-heading block;
      animation:hg-heading-cut linear both;
      animation-timeline:--hg-heading;
      animation-range:entry 0% cover 18%;
    }
    body[class]:not(.page-start) main h2::after {
      content:"";
      position:absolute; pointer-events:none;
      inset:34% auto auto 0;
      width:min(40%,14rem); height:clamp(.6rem,.32em,1.5rem);
      opacity:0;
      background:
        linear-gradient(90deg,transparent,var(--hg-title-accent))
          100% 10% / 68% 1px no-repeat,
        linear-gradient(90deg,transparent,var(--hg-title-accent))
          100% 48% / 100% 2px no-repeat,
        linear-gradient(90deg,transparent,var(--hg-title-accent))
          86% 94% / 78% 1px no-repeat;
      animation:hg-heading-lanes linear both;
      animation-timeline:--hg-heading;
      animation-range:entry 0% cover 18%;
    }
    body[class]:not(.page-start) main h2:is(:target,:focus-within),
    body[class]:not(.page-start) main h2:is(:target,:focus-within)::after { animation:none; }
  }
}
@keyframes hg-heading-cut {
  0% { clip-path:inset(-18% 95% -18% -2%); translate:-24px 10px; }
  25% { clip-path:inset(-18% 50% -18% -2%); translate:-11px 4px; }
  60% { clip-path:inset(-18% 8% -18% -2%); translate:-3px 1px; }
  86% { clip-path:inset(-18% -1% -18% -2%); translate:-.5px 0; }
  100% { clip-path:inset(-18% -2% -18% -2%); translate:0 0; }
}
@keyframes hg-heading-lanes {
  0% { opacity:0; transform:translateX(-90%) skewX(-18deg); }
  16% { opacity:1; transform:translateX(-18%) skewX(-18deg); }
  58% { opacity:.68; transform:translateX(132%) skewX(-18deg); }
  87%,100% { opacity:0; transform:translateX(168%) skewX(-18deg); }
}
