/* NOMAD HOKKAIDO — motion.
   Paired with motion.js. Three kinds, kept apart so the cost is readable:

     continuous   clock, live dot, weather glyph, marquee
     scroll       parallax, header, progress line
     one-time     reveals, route draw, the WhatsApp nudge

   All of it stops under prefers-reduced-motion, at the bottom of this file.
   Nothing here carries information on its own. */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Scroll progress ----------
   Two pixels. It marks position; it is not a loading bar. */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 60;
  background: #3e8e5a;
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
  pointer-events: none;
}

/* ---------- Header ---------- */
#site-header {
  transition:
    background-color 0.35s var(--ease-out),
    color 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out);
}
#site-header.is-solid {
  background: rgba(246, 250, 251, 0.92);
  color: #0a2b20;
  box-shadow: 0 1px 0 rgba(10, 43, 32, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
#site-header:not(.is-solid) {
  color: #f6fafb;
}
#logo-plate {
  transition:
    background-color 0.35s var(--ease-out),
    backdrop-filter 0.35s var(--ease-out);
}
#logo-plate.is-bare {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ---------- Reveal ----------
   Softer and slightly longer than before. Grouped by section rather than
   fired per element, so the page has rhythm instead of chatter. */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.8s var(--ease-out),
    transform 0.8s var(--ease-out);
}
.js .reveal.in {
  opacity: 1;
  transform: none;
}
/* Line by line, used on the closing headline only. */
.display .line {
  display: block;
}

/* ---------- Card image settle ----------
   The photograph eases out of a slight zoom as its card arrives. One
   movement, 900ms, then finished for good. Parallax layers opt out: they
   are already moving. */
.js .reveal .ph img {
  transform: scale(1.05);
  transition: transform 0.9s var(--ease-out);
}
.js .reveal.in .ph img {
  transform: none;
}
/* Parallax layers opt out: they are already moving, and the two transforms
   would fight over the same property. */
.js .reveal .ph.px img,
.js .ph.px img {
  transform: none;
  transition: none;
}

/* ---------- Parallax ----------
   The container keeps its own transform for hover; only the media inside
   moves. It is oversized so the travel never exposes an edge. Where a still
   and a film are stacked, both are sized and moved together, so the handover
   between them is not visible. */
.px.px-on img,
.px.px-on video {
  height: 124%;
  top: -12%;
  will-change: transform;
}
.hero-media.px.px-on img,
.hero-media.px.px-on video {
  height: 118%;
  top: -9%;
}

/* ---------- Live pill and dot ---------- */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #8fcba4;
}
.live-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: #3e8e5a;
  animation: live-pulse 2.4s ease-out infinite;
}
.live-dot--quiet {
  animation-duration: 3.6s;
  opacity: 0.7;
}
.is-live .live-dot {
  background: #8fcba4;
  animation-duration: 1.6s;
}
.is-done .live-dot {
  background: #6f7c7a;
  animation: none;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 142, 90, 0.5); }
  70% { box-shadow: 0 0 0 0.5rem rgba(62, 142, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 142, 90, 0); }
}

/* ---------- Clock ----------
   Hours and minutes hold still. Only the seconds move, and only just, so
   the number you are reading is never the one in motion. */
.clock {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.clock-sep {
  margin: 0 0.08em;
  opacity: 0.55;
}
.clock.is-beating .clock-sep {
  animation: beat 1s ease-in-out infinite;
}
@keyframes beat {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
.clock-ss {
  display: inline-block;
  opacity: 0.75;
}
.clock-ss.is-ticking {
  animation: tick 0.45s var(--ease-out);
}
@keyframes tick {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 0.75; transform: none; }
}

/* The temperature cross-fades rather than swapping, so a refresh reads as a
   reading that changed rather than a glitch. */
#weather-temp {
  transition: opacity 0.18s linear;
}
#weather-temp.is-changing {
  opacity: 0;
}

/* ---------- Weather glyph ----------
   Four states, three elements each. No particle system, no canvas. */
.wx {
  position: relative;
  display: block;
  width: 1.6rem;
  height: 1.6rem;
  flex: none;
}
.wx i {
  position: absolute;
  display: block;
}

.wx--snow i {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: #dce9f1;
  animation: drift 4.5s linear infinite;
}
.wx--snow i:nth-child(1) { left: 20%; animation-delay: 0s; }
.wx--snow i:nth-child(2) { left: 50%; animation-delay: 1.5s; }
.wx--snow i:nth-child(3) { left: 78%; animation-delay: 3s; }
@keyframes drift {
  0% { top: -10%; opacity: 0; transform: translateX(0); }
  20% { opacity: 0.9; }
  80% { opacity: 0.9; }
  100% { top: 100%; opacity: 0; transform: translateX(-4px); }
}

.wx--rain i {
  width: 1.5px;
  height: 6px;
  border-radius: 999px;
  background: #8fb5cc;
  animation: fall 1.6s linear infinite;
}
.wx--rain i:nth-child(1) { left: 24%; animation-delay: 0s; }
.wx--rain i:nth-child(2) { left: 50%; animation-delay: 0.5s; }
.wx--rain i:nth-child(3) { left: 74%; animation-delay: 1s; }
@keyframes fall {
  0% { top: -20%; opacity: 0; }
  25% { opacity: 0.85; }
  100% { top: 100%; opacity: 0; }
}

.wx--cloud i {
  top: 42%;
  height: 4px;
  border-radius: 999px;
  background: #c7dae5;
  opacity: 0.55;
  animation: sail 9s ease-in-out infinite;
}
.wx--cloud i:nth-child(1) { width: 14px; left: 6%; }
.wx--cloud i:nth-child(2) { width: 9px; left: 30%; top: 62%; animation-delay: -3s; opacity: 0.35; }
.wx--cloud i:nth-child(3) { width: 6px; left: 55%; top: 26%; animation-delay: -6s; opacity: 0.25; }
@keyframes sail {
  0%, 100% { transform: translateX(-2px); }
  50% { transform: translateX(3px); }
}

.wx--clear i:nth-child(1) {
  inset: 30%;
  border-radius: 999px;
  background: #f6fafb;
  opacity: 0.9;
}
.wx--clear i:nth-child(2) {
  inset: 14%;
  border-radius: 999px;
  border: 1px solid rgba(246, 250, 251, 0.35);
  animation: halo 4s ease-in-out infinite;
}
.wx--clear i:nth-child(3) {
  display: none;
}
@keyframes halo {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.12); opacity: 0.15; }
}

/* ---------- Countdown ---------- */
.countdown-unit {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
}
.countdown-unit b {
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.countdown-unit small {
  color: rgba(246, 250, 251, 0.45);
}

/* ---------- Map ----------
   The route draws once, when the section first arrives. Distance closing is
   the one thing a line animation here can honestly say. */
.js #map-route.is-drawing {
  animation: draw 1.4s var(--ease-out) both;
}
/* The line is dashed, so the dashes run once toward Sapporo rather than the
   stroke drawing itself. Same idea, one property, no path measuring. */
@keyframes draw {
  from { stroke-dashoffset: 48; opacity: 0; }
  to { stroke-dashoffset: 0; opacity: 1; }
}
#map-sapporo circle {
  transition: opacity 0.3s var(--ease-out);
}
#map-sapporo.is-hot circle:first-child {
  opacity: 0.9;
}

/* ---------- Connector nudge ----------
   One pulse, the first time the cards are seen. It never repeats, and it
   never implies anybody is online. */
.is-nudging {
  animation: nudge 1.1s var(--ease-out) 1;
}
@keyframes nudge {
  0%, 100% { transform: none; }
  30% { transform: translateY(-2px); }
  60% { transform: none; }
}

/* ---------- Reduced motion ----------
   Everything above stops. None of it carried meaning on its own, so the
   page loses nothing. */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress {
    display: none;
  }
  .live-dot,
  .clock.is-beating .clock-sep,
  .clock-ss.is-ticking,
  .wx i,
  .is-nudging,
  .js #map-route.is-drawing {
    animation: none !important;
  }
  .js .reveal .ph img,
  .js .reveal.in .ph img {
    transform: none !important;
    transition: none !important;
  }
  .px.px-on img,
  .px.px-on video {
    height: 100%;
    top: 0;
  }
  #weather-temp {
    transition: none;
  }
}
.motion-off .scroll-progress {
  display: none;
}
