/* Sobriety Companion - Brand Stylesheet
   Brand colors pulled from logo: deep blue on cream/off-white. */

:root {
  --brand-blue: #1F4FAE;
  --brand-blue-dark: #163C85;
  --brand-blue-light: #E6EEFB;
  --cream: #FAF7EE;
  --cream-2: #F4EFE0;
  --ink: #1A2238;
  --ink-soft: #46506B;
  --muted: #6B7280;
  --border: #E3DFCF;
  --white: #ffffff;
  --max: 1100px;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(22, 60, 133, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(6px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--brand-blue);
  font-weight: 800;
  letter-spacing: 0.5px;
  min-width: 0;
  flex: 0 1 auto;
}

.brand img { flex: 0 0 auto; }

.brand img {
  height: 44px;
  width: 44px;
  object-fit: contain;
  /* Dissolve the logo's cream/white background into the page background.
     `darken` keeps the dark logo art and lets the lighter logo backdrop
     drop out into whatever page background sits behind it, producing a
     seamless blend on the cream header. */
  mix-blend-mode: darken;
}

.brand-name { font-size: 18px; }

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
  /* manipulation tells the browser to skip the 300ms double-tap-zoom wait
     and fire click immediately on tap-up. */
  touch-action: manipulation;
  cursor: pointer;
  /* No transition on idle nav links — keeps the first tap from feeling
     "sticky" while a color animation is still resolving on iOS. */
  transition: none;
  /* Promote to its own layer so the tap never has to wait on a paint. */
  transform: translateZ(0);
}

.nav a:hover { text-decoration: none; }

.nav a:not([aria-current="page"]):hover {
  color: var(--brand-blue);
}

/* Selected / current page */
.nav a[aria-current="page"] {
  color: var(--white);
  background-color: var(--brand-blue);
  box-shadow: 0 6px 18px rgba(31, 79, 174, 0.28);
}

/* On the Home page, fade the Home button's blue pill out after ~5s,
   leaving only the text.

   IMPORTANT iOS performance note: we deliberately animate ONLY `opacity`
   (on a pseudo-element pill) and `color` here. Animating background-color
   and box-shadow forces a full repaint each frame, which on iOS Safari
   queues behind tap hit-testing and makes nav buttons feel unresponsive
   for the duration of the animation. Opacity animations are GPU-composited
   and do not block tap response. */
.nav a[href="index.html"][aria-current="page"] {
  /* Strip the pill styling off the link itself — the ::before will own it
     so we can fade it via opacity. */
  background-color: transparent;
  box-shadow: none;
  /* Color fades on the link directly (cheap, small paint area). */
  animation: homeBtnTextFade 1.2s ease 5s forwards;
  /* Promote to its own compositor layer so the fade never touches the
     main thread paint path used for tap hit-testing. */
  will-change: opacity;
}
.nav a[href="index.html"][aria-current="page"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: var(--brand-blue);
  box-shadow: 0 6px 18px rgba(31, 79, 174, 0.28);
  z-index: -1;
  /* Fade the entire pill (bg + shadow) via opacity only. */
  animation: homeBtnPillFade 1.2s ease 5s forwards;
  will-change: opacity;
  pointer-events: none;
}
@keyframes homeBtnPillFade {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes homeBtnTextFade {
  from { color: var(--white); }
  to   { color: var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  .nav a,
  .nav a[href="index.html"][aria-current="page"]::before { animation: none; }
  /* Snap to the faded end-state immediately when motion is reduced. */
  .nav a[href="index.html"][aria-current="page"] { color: var(--ink); }
  .nav a[href="index.html"][aria-current="page"]::before { opacity: 0; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% -20%, var(--brand-blue-light) 0%, transparent 60%),
    var(--cream);
}

.hero img.hero-logo {
  width: 280px;
  height: 280px;
  margin: 0 auto 28px;
  object-fit: contain;
  /* Seamlessly blend the logo's white/cream backdrop into the hero's
     blue-to-cream radial gradient. `darken` drops the lighter logo
     background out so only the dark logo artwork remains visible. */
  mix-blend-mode: darken;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.1;
  margin: 0 0 16px;
  color: var(--brand-blue);
  letter-spacing: -0.5px;
}

.hero .tagline {
  font-size: clamp(17px, 2.2vw, 21px);
  color: var(--ink-soft);
  max-width: 720px;
  margin: 0 auto 32px;
}

/* ---------- Smart-link button ---------- */
.cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  background: var(--brand-blue);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn:hover { background: var(--brand-blue-dark); text-decoration: none; transform: translateY(-1px); }

.btn.btn-secondary {
  background: transparent;
  color: var(--brand-blue);
  border-color: var(--brand-blue);
  box-shadow: none;
}

.btn.btn-secondary:hover { background: var(--brand-blue-light); }

.btn[disabled],
.btn.is-disabled {
  background: #B7B7B7 !important;
  color: #ffffff !important;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  opacity: 0.85;
}

.btn small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 2px;
  letter-spacing: 0.5px;
}

.cta-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Sections ---------- */
section.block {
  padding: 64px 0;
}

section.block.alt {
  background: var(--cream-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: clamp(26px, 3.5vw, 36px);
  color: var(--brand-blue);
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}

.section-lead {
  color: var(--ink-soft);
  max-width: 760px;
  margin: 0 0 32px;
  font-size: 18px;
}

/* ---------- Feature grid ---------- */
.grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 8px;
  color: var(--brand-blue);
  font-size: 19px;
}

.card p { margin: 0; color: var(--ink-soft); }

.icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-bottom: 12px;
}

.icon-circle svg {
  width: 28px;
  height: 28px;
  display: block;
}

/* ---------- Long-form pages (FAQ, Terms, Privacy, Support) ---------- */
.page {
  padding: 56px 0 80px;
}

.page h1 {
  color: var(--brand-blue);
  font-size: clamp(28px, 4vw, 42px);
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}

.page .updated {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 32px;
}

.page h2 {
  color: var(--brand-blue);
  font-size: 24px;
  margin: 40px 0 12px;
  letter-spacing: -0.2px;
}

.page h3 {
  color: var(--ink);
  font-size: 19px;
  margin: 24px 0 8px;
}

.page p, .page li {
  color: var(--ink-soft);
}

.page ul { padding-left: 22px; }
.page li { margin-bottom: 8px; }

.page .callout {
  background: var(--brand-blue-light);
  border-left: 4px solid var(--brand-blue);
  padding: 16px 20px;
  border-radius: 8px;
  margin: 20px 0;
  color: var(--ink);
}

.page .callout strong { color: var(--brand-blue-dark); }

.page .danger {
  background: #FFF1F1;
  border-left: 4px solid #C0392B;
  padding: 16px 20px;
  border-radius: 8px;
  margin: 20px 0;
  color: #6B1C14;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: #C8CFE0;
  padding: 40px 0 28px;
  margin-top: 40px;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer a { color: #C8CFE0; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

.site-footer .foot-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: #fff;
}

.site-footer .foot-brand img {
  height: 40px;
  width: 40px;
  /* Logo has a cream background, so frame it as an intentional badge on the dark footer */
  background: var(--cream);
  border-radius: 50%;
  padding: 4px;
  object-fit: contain;
}

.foot-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
}

.foot-copy {
  width: 100%;
  border-top: 1px solid #2C3553;
  margin-top: 24px;
  padding-top: 18px;
  font-size: 13px;
  color: #8A93AD;
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .nav {
    gap: 4px 6px;
    font-size: 14px;
    width: 100%;
    /* CRITICAL: do NOT make the nav horizontally scrollable on mobile.
       iOS Safari adds a ~300ms tap-vs-scroll detection delay inside any
       scrollable container, which is what made the menu feel "sticky".
       Letting the links wrap onto a second line keeps every tap instant. */
    flex-wrap: wrap;
    overflow: visible;
  }
  .nav a {
    padding: 10px 12px;
    min-height: 44px;
    font-size: 15px;
    /* Each link is its own tap target — no scroll container around it,
       so iOS fires the click as soon as the finger lifts. */
    touch-action: manipulation;
  }
  .hero { padding: 56px 0 40px; }
  .hero img.hero-logo { width: 220px; height: 220px; }
  section.block { padding: 48px 0; }
  .page { padding: 40px 0 60px; }
}

/* On touch devices, disable ALL hover/active color repaints on nav links so
   the first tap registers immediately on iOS Safari. Any color change in
   :hover or :active forces a paint that iOS queues behind tap detection,
   producing the "sticky"/delayed first-tap feel. */
@media (hover: none) {
  .nav a,
  .nav a:hover,
  .nav a:focus,
  .nav a:active,
  .nav a:not([aria-current="page"]):hover {
    color: var(--ink);
    background: transparent;
    text-decoration: none;
    transition: none;
  }
  /* Preserve the selected-page pill styling — but NOT for the Home button on
     the home page, which uses the opacity-fade pseudo-element pill. Forcing
     a solid background here would hide the ::before pill and break the fade. */
  .nav a[aria-current="page"]:not([href="index.html"]),
  .nav a[aria-current="page"]:not([href="index.html"]):hover,
  .nav a[aria-current="page"]:not([href="index.html"]):focus,
  .nav a[aria-current="page"]:not([href="index.html"]):active {
    color: var(--white);
    background-color: var(--brand-blue);
  }
}

/* ============================================================
   Neon "Get the App" Button
   - Color cycles through 5 non-pink neon colors
   - On hover: hearts radiate from center outward (left + right)
     until they fully cover the button
   ============================================================ */

@property --neon-now {
  syntax: '<color>';
  inherits: true;
  initial-value: #39FF14;
}

/* Drives the auto-play hover phase on touch devices: 0 = idle, 1 = "hovered".
   Registered as a number so it interpolates and can be used in calc().
   Lives at root so the keyframe and the static box-shadow rule share it. */
@property --btn-on {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

@keyframes neonCycle {
  0%   { --neon-now: #39FF14; } /* neon lime green */
  20%  { --neon-now: #39FF14; }
  25%  { --neon-now: #00FFFF; } /* electric cyan */
  45%  { --neon-now: #00FFFF; }
  50%  { --neon-now: #BF00FF; } /* electric purple */
  70%  { --neon-now: #BF00FF; }
  75%  { --neon-now: #FF6A00; } /* neon orange */
  90%  { --neon-now: #FF6A00; }
  95%  { --neon-now: #FAFF00; } /* electric yellow */
  100% { --neon-now: #39FF14; }
}

.btn.btn-neon {
  --neon-now: #39FF14;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--neon-now);
  color: #0b0b0b;
  border: 2px solid rgba(255,255,255,0.55);
  text-shadow: 0 0 6px rgba(255,255,255,0.55);
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.08) inset,
    0 0 12px var(--neon-now),
    0 0 28px var(--neon-now),
    0 8px 24px rgba(0,0,0,0.18);
  /* Idle: stay neon lime green. Color cycle only runs on hover. */
  animation: none;
  transition: transform 0.15s ease, box-shadow 0.25s ease, color 0.2s ease;
}

.btn.btn-neon:hover {
  animation: neonCycle 12s linear infinite;
}

.btn.btn-neon .btn-neon-label,
.btn.btn-neon small {
  position: relative;
  z-index: 2;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.btn.btn-neon small {
  color: rgba(0,0,0,0.7);
  opacity: 1;
}

.btn.btn-neon:hover {
  transform: translateY(-1px) scale(1.02);
  background: var(--neon-now);
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.15) inset,
    0 0 18px var(--neon-now),
    0 0 44px var(--neon-now),
    0 0 80px var(--neon-now),
    0 10px 28px rgba(0,0,0,0.22);
}

.btn.btn-neon:hover .btn-neon-label {
  color: #ffffff;
  text-shadow:
    -1px -1px 0 #0b1a3a,
     1px -1px 0 #0b1a3a,
    -1px  1px 0 #0b1a3a,
     1px  1px 0 #0b1a3a,
     0 0 8px rgba(0,0,0,0.55),
     0 0 14px var(--neon-now);
}
.btn.btn-neon:hover small {
  color: #ffffff;
  text-shadow:
    -1px -1px 0 #0b1a3a,
     1px -1px 0 #0b1a3a,
    -1px  1px 0 #0b1a3a,
     1px  1px 0 #0b1a3a,
     0 0 6px rgba(0,0,0,0.6);
}

/* Heart layer: tiled hearts that "radiate" from the center outward
   by animating clip-path from a centered slit to the full button. */
.btn.btn-neon::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%231F4FAE' d='M12 21s-7.5-4.6-9.6-9.2C.7 8.1 3 4 6.7 4c2.1 0 3.7 1.2 4.6 2.6l.7 1 .7-1C13.6 5.2 15.2 4 17.3 4 21 4 23.3 8.1 21.6 11.8 19.5 16.4 12 21 12 21z'/></svg>");
  background-repeat: repeat-x;
  background-position: center center;
  background-size: 26px 26px;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(31,79,174,0.85));
  /* Closed at the center: 50% from left + 50% from right = 0px wide slit */
  clip-path: inset(0 50% 0 50%);
  transition:
    clip-path 900ms cubic-bezier(.22,.61,.36,1),
    opacity 220ms ease;
}

.btn.btn-neon:hover::before {
  opacity: 1;
  clip-path: inset(0 0 0 0);
  animation: heartPulse 1.6s ease-in-out infinite;
}

@keyframes heartPulse {
  0%, 100% { background-size: 26px 26px; filter: drop-shadow(0 0 4px rgba(31,79,174,0.85)); }
  50%      { background-size: 30px 30px; filter: drop-shadow(0 0 10px rgba(31,79,174,1));   }
}

/* ECG / vital sign line: red heartbeat trace that scrolls across the button
   through the hearts on hover, with a glowing red drop-shadow. */
.btn.btn-neon::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'><path d='M0 20 H58 L66 18 L72 22 L78 6 L84 34 L90 14 L96 22 L102 20 H132 L140 16 L148 20 H200' fill='none' stroke='%23ff1a1a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: repeat-x;
  background-position: 0 center;
  background-size: 200px 70%;
  opacity: 0;
  filter:
    drop-shadow(0 0 3px rgba(255,30,30,0.95))
    drop-shadow(0 0 8px rgba(255,30,30,0.75))
    drop-shadow(0 0 16px rgba(255,30,30,0.45));
  transition: opacity 280ms ease;
}

.btn.btn-neon:hover::after {
  opacity: 1;
  animation: ecgScroll 2.2s linear infinite;
}

@keyframes ecgScroll {
  from { background-position: 200px center; }
  to   { background-position: 0 center; }
}

@media (prefers-reduced-motion: reduce) {
  .btn.btn-neon,
  .btn.btn-neon:hover { animation: none; }
  .btn.btn-neon::before,
  .btn.btn-neon:hover::before,
  .btn.btn-neon::after,
  .btn.btn-neon:hover::after { transition: none; animation: none; }
}

/* ============================================================
   Auto-play the neon "Get the App" hover effect on touch devices
   (which don't have a real hover state).
   Cycle: ~10s OFF, ~10s ON, repeating forever.
   We use 20s stacked keyframe animations that fade between the
   idle and "hovered" visual state for each layer of the effect.
   ============================================================ */
@media (hover: none) {
  /* Drive the button itself: color cycle + on/off phase.
     The aura (box-shadow) and lift (transform) are STATIC rules below
     using calc(var(--btn-on)) so they re-evaluate every paint and pick up
     the live --neon-now color as it cycles. (Keyframes that bake
     var(--neon-now) directly into box-shadow only sample the color at the
     keyframe stops, which here happen to all land on lime green — that's
     why the aura wasn't matching the button color.) */
  .btn.btn-neon,
  .btn.btn-neon:hover {
    animation:
      neonAutoColor 20s linear      infinite,
      neonAutoOn    20s ease-in-out infinite;
    /* Lift scales smoothly with the on/off phase. */
    transform:
      translateY(calc(-1px * var(--btn-on)))
      scale(calc(1 + 0.02 * var(--btn-on)));
    /* Aura: each shadow's blur/spread scales with --btn-on, color is
       always the live --neon-now so it changes hue as the button cycles. */
    box-shadow:
      0 0 0 2px rgba(255,255,255, calc(0.08 + 0.07 * var(--btn-on))) inset,
      0 0 calc(12px + 6px  * var(--btn-on)) var(--neon-now),
      0 0 calc(28px + 16px * var(--btn-on)) var(--neon-now),
      0 0 calc(80px * var(--btn-on))        var(--neon-now),
      0 calc(8px + 2px * var(--btn-on))
        calc(24px + 4px * var(--btn-on))
        rgba(0,0,0, calc(0.18 + 0.04 * var(--btn-on)));
  }
  /* Hearts radiate-in layer */
  .btn.btn-neon::before,
  .btn.btn-neon:hover::before {
    /* Stack the reveal cycle with the existing pulse so the hearts
       still pulse while they're visible. */
    animation:
      heartAutoReveal 20s ease-in-out infinite,
      heartPulse      1.6s ease-in-out infinite;
    /* Reset the inline transition that fades clip-path on real hover —
       the keyframes own the timing now. */
    transition: none;
  }
  /* ECG/heartbeat trace layer */
  .btn.btn-neon::after,
  .btn.btn-neon:hover::after {
    animation:
      ecgAutoReveal 20s ease-in-out infinite,
      ecgScroll     2.2s linear infinite;
    transition: none;
  }
  /* Label + subtitle text styling */
  .btn.btn-neon .btn-neon-label,
  .btn.btn-neon:hover .btn-neon-label {
    animation: neonLabelAuto 20s ease-in-out infinite;
  }
  .btn.btn-neon small,
  .btn.btn-neon:hover small {
    animation: neonSmallAuto 20s ease-in-out infinite;
  }
}

/* ---- Auto-cycle keyframes (touch-device hover simulation) ----
   Timeline (20s total):
     0%  .. 45%  → fully OFF (idle)            (~9s)
     45% .. 50%  → fade IN                     (~1s)
     50% .. 95%  → fully ON (hover state)      (~9s)
     95% .. 100% → fade OUT                    (~1s)
*/

@keyframes neonAutoColor {
  /* Idle = lime green; "on" phase cycles through the 5 neon colors. */
  0%,  50% { --neon-now: #39FF14; }
  60%      { --neon-now: #00FFFF; }
  70%      { --neon-now: #BF00FF; }
  80%      { --neon-now: #FF6A00; }
  90%      { --neon-now: #FAFF00; }
  95%, 100%{ --neon-now: #39FF14; }
}

/* Pure numeric on/off phase. Static box-shadow/transform rules above
   read var(--btn-on) via calc() so the aura matches the live neon color. */
@keyframes neonAutoOn {
  0%,  45% { --btn-on: 0; }
  50%, 95% { --btn-on: 1; }
  100%     { --btn-on: 0; }
}

@keyframes heartAutoReveal {
  0%,  45% { opacity: 0; clip-path: inset(0 50% 0 50%); }
  50%, 95% { opacity: 1; clip-path: inset(0 0 0 0); }
  100%     { opacity: 0; clip-path: inset(0 50% 0 50%); }
}

@keyframes ecgAutoReveal {
  0%,  45% { opacity: 0; }
  50%, 95% { opacity: 1; }
  100%     { opacity: 0; }
}

@keyframes neonLabelAuto {
  0%, 45% {
    color: #0b0b0b;
    text-shadow: 0 0 6px rgba(255,255,255,0.55);
  }
  50%, 95% {
    color: #ffffff;
    text-shadow:
      -1px -1px 0 #0b1a3a,
       1px -1px 0 #0b1a3a,
      -1px  1px 0 #0b1a3a,
       1px  1px 0 #0b1a3a,
       0 0 8px rgba(0,0,0,0.55),
       0 0 14px var(--neon-now);
  }
  100% {
    color: #0b0b0b;
    text-shadow: 0 0 6px rgba(255,255,255,0.55);
  }
}

@keyframes neonSmallAuto {
  0%, 45% {
    color: rgba(0,0,0,0.7);
    text-shadow: none;
  }
  50%, 95% {
    color: #ffffff;
    text-shadow:
      -1px -1px 0 #0b1a3a,
       1px -1px 0 #0b1a3a,
      -1px  1px 0 #0b1a3a,
       1px  1px 0 #0b1a3a,
       0 0 6px rgba(0,0,0,0.6);
  }
  100% {
    color: rgba(0,0,0,0.7);
    text-shadow: none;
  }
}

/* While the user is actively touching the screen, pause every heavy
   animation on the page. On iOS Safari, a queued non-composited paint
   (box-shadow blur, drop-shadow filter, background-position scroll) can
   defer tap hit-testing by 1–2 frames, which is exactly the "sometimes"
   first-tap delay on the nav. Pausing while a finger is down frees the
   main thread so the tap registers immediately, then resumes on touchend.
   Visually undetectable because the user can't perceive a ~200ms pause
   during their own tap. */
:root.is-touching .btn.btn-neon,
:root.is-touching .btn.btn-neon::before,
:root.is-touching .btn.btn-neon::after,
:root.is-touching .btn.btn-neon .btn-neon-label,
:root.is-touching .btn.btn-neon small,
:root.is-touching .nav a[href="index.html"][aria-current="page"],
:root.is-touching .nav a[href="index.html"][aria-current="page"]::before {
  animation-play-state: paused !important;
}

/* Respect reduced-motion on touch devices too — disable the auto cycle. */
@media (hover: none) and (prefers-reduced-motion: reduce) {
  .btn.btn-neon,
  .btn.btn-neon:hover,
  .btn.btn-neon::before,
  .btn.btn-neon:hover::before,
  .btn.btn-neon::after,
  .btn.btn-neon:hover::after,
  .btn.btn-neon .btn-neon-label,
  .btn.btn-neon:hover .btn-neon-label,
  .btn.btn-neon small,
  .btn.btn-neon:hover small { animation: none; }
}

/* ============================================================
   Page-wipe overlay (newpeace.jp-style transition on click)
   ============================================================ */
.page-wipe {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--wipe-color, #39FF14);
  transform: translateX(-100%);
  pointer-events: none;
  will-change: transform;
  box-shadow: 0 0 60px var(--wipe-color, #39FF14) inset;
}

.page-wipe.is-in {
  transform: translateX(0);
  transition: transform 700ms cubic-bezier(.77,0,.18,1);
}

.page-wipe.is-out {
  transform: translateX(100%);
  transition: transform 700ms cubic-bezier(.77,0,.18,1);
}
