/* SmartGoalie marketing LP — production styles.
   Section layout is expressed inline in index.html for 1:1 fidelity with
   the design handoff (docs/design/.../design_handoff_smartgoalie_lp).
   This file carries the concerns inline styles can't express: the
   bilingual toggle, hover/focus states, the single responsive
   breakpoint, smooth-scroll + reduced-motion, and sticky-header offsets. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: #f5f9fe;
  color: #0e1b2c;
  font-family: 'IBM Plex Sans', 'Noto Sans JP', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: #2f7fe0;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Bilingual visibility — JA is the default; toggling body.lang-en swaps. */
.en {
  display: none;
}
body.lang-en .en {
  display: revert;
}
body.lang-en .ja {
  display: none;
}

/* Visible keyboard focus (never removed). */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid #2f7fe0;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Anchor targets clear the sticky header. */
section[id] {
  scroll-margin-top: 76px;
}

/* Header nav link colours live here so :hover can override them
   (an inline colour would beat a stylesheet :hover rule). */
.site-nav .nav-link {
  color: #5a7089;
}
.site-nav .nav-link:hover {
  color: #0e1b2c;
}

/* Hover affordances the design left to implementation. */
.lang-toggle {
  transition: border-color 0.15s ease;
}
.lang-toggle:hover {
  border-color: #2f7fe0;
}
.btn-primary {
  transition: background 0.15s ease;
}
.btn-primary:hover {
  background: #2569c2 !important;
  text-decoration: none;
}
.btn-invert:hover {
  background: #eef5ff !important;
  text-decoration: none;
}
.card {
  transition: border-color 0.15s ease;
}
.card:hover {
  border-color: #c9dcf0 !important;
}

/* ------------------------------------------------------------------ */
/* Motion — subtle, opt-in.                                            */
/* JS adds body.anim ONLY when IntersectionObserver exists AND the     */
/* user does not prefer reduced motion. Without body.anim (no JS,      */
/* reduced motion, old browsers) everything renders fully visible.     */
/* ------------------------------------------------------------------ */
body.anim .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
body.anim .reveal.in {
  opacity: 1;
  transform: none;
}
/* Small stagger inside a card grid / story rows. */
body.anim .reveal:nth-child(2) { transition-delay: 0.07s; }
body.anim .reveal:nth-child(3) { transition-delay: 0.14s; }
body.anim .reveal:nth-child(4) { transition-delay: 0.21s; }

/* Card hover lift (guarded so reduced-motion users get no movement). */
@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: border-color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
  }
  .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(20, 60, 110, 0.1);
  }
}

/* Story section: mini heatmap cells light up in sequence once .in.    */
/* Default (no body.anim) = final state, fully visible.                */
body.anim .story-cell {
  opacity: 0;
  transform: scale(0.85);
}
body.anim .in .story-cell {
  animation: cellIn 0.35s ease forwards;
}
body.anim .in .story-cell:nth-child(1) { animation-delay: 0.05s; }
body.anim .in .story-cell:nth-child(2) { animation-delay: 0.13s; }
body.anim .in .story-cell:nth-child(3) { animation-delay: 0.21s; }
body.anim .in .story-cell:nth-child(4) { animation-delay: 0.29s; }
body.anim .in .story-cell:nth-child(5) { animation-delay: 0.37s; }
body.anim .in .story-cell:nth-child(6) { animation-delay: 0.45s; }
body.anim .in .story-cell:nth-child(7) { animation-delay: 0.53s; }
body.anim .in .story-cell:nth-child(8) { animation-delay: 0.61s; }
body.anim .in .story-cell:nth-child(9) { animation-delay: 0.69s; }
@keyframes cellIn {
  to {
    opacity: 1;
    transform: none;
  }
}
/* The weak cell (blocker high) pulses once the grid has lit up,        */
/* drawing the eye to "the red zone" the caption talks about.           */
body.anim .in .story-cell--weak {
  animation: cellIn 0.35s ease forwards, cellPulse 0.55s ease 1.05s 2;
}
@keyframes cellPulse {
  0%, 100% { transform: none; }
  50% { transform: scale(1.12); }
}

/* Story section: each row is [moment | without | arrow | with] on
   desktop and stacks vertically (arrow rotates down) on mobile,
   keeping the before→after pairing intact. */
@media (max-width: 680px) {
  .story-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .story-arrow {
    transform: rotate(90deg);
    margin: -4px auto !important;
  }
  .story-data {
    grid-template-columns: 1fr !important;
    justify-items: center;
    text-align: center;
  }
}

/* Single breakpoint (per handoff §Responsive). */
@media (max-width: 680px) {
  .nav-links {
    display: none;
  }
  .mock-body {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .mock-left {
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto !important;
    height: auto !important;
  }
  .mock-left > div:nth-child(1),
  .mock-left > div:nth-child(2) {
    min-height: 78px;
  }
  .mock-undo {
    grid-column: 1 / -1;
  }
}
