/* ==========================================================================
   SINORA home — Apple-principle fixes.  PREVIEW OVERLAY ONLY.
   Loaded last, and scoped (.sh2-shell …) so it beats the page's inline
   <style id="sh2-hero-batch-2"> block on specificity, not just order.
   Numbers in comments map to the audit findings.
   ========================================================================== */

:root {
  --ap-focus: #f1c86a;
  --ap-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ap-menu-response: 0.34s;
}

/* --------------------------------------------------------------------------
   7 — Feedback on pointer-DOWN, and a keyboard ring that actually exists.
   The page had 11 :hover rules, 0 :active, 0 :focus-visible.
   -------------------------------------------------------------------------- */

/* The lift was the ONLY feedback, and on touch it either never fires or
   sticks after the tap. Gate it to real pointers. */
.sh2-shell .sh2-btn:hover { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .sh2-shell .sh2-btn:hover { transform: translateY(-2px); }
}

/* Press is instant and works on every device. 100ms, Apple's value. */
.sh2-shell .sh2-btn:active,
.site-header a:active,
.mobile-menu a:active,
.sh2-shell .sh2-feature:active {
  transform: scale(0.97);
  transition-duration: 100ms;
  transition-timing-function: ease-out;
}

/* A visible, branded focus ring for keyboard users, on the dark ground. */
.sh2-shell a:focus-visible,
.sh2-shell button:focus-visible,
.site-header a:focus-visible,
.site-header button:focus-visible,
.mobile-menu a:focus-visible,
.mobile-menu button:focus-visible {
  outline: 2px solid var(--ap-focus);
  outline-offset: 3px;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   2 — The closed mobile menu was still reachable by keyboard.
   It was only moved off-screen with translateY(-100%).
   -------------------------------------------------------------------------- */
.mobile-menu {
  visibility: hidden;
  transition:
    transform var(--ap-menu-response) var(--ap-ease-out),
    visibility 0s linear var(--ap-menu-response);
}
.mobile-menu.open {
  visibility: visible;
  transition:
    transform var(--ap-menu-response) var(--ap-ease-out),
    visibility 0s;
}

/* --------------------------------------------------------------------------
   9, 10 — Enter and exit now travel the same path, and the panel starts fast.
   Was: 0.5s ease-in-out, stagger 0.15s→0.43s on enter and none on exit,
   so the last link landed 930ms after the tap.
   -------------------------------------------------------------------------- */
.mobile-menu a {
  transition:
    opacity 0.24s ease,
    transform 0.24s var(--ap-ease-out);
}

/* exit — mirrored: the last link leaves first */
.mobile-menu a:nth-child(1)  { transition-delay: 0.135s; }
.mobile-menu a:nth-child(2)  { transition-delay: 0.120s; }
.mobile-menu a:nth-child(3)  { transition-delay: 0.105s; }
.mobile-menu a:nth-child(4)  { transition-delay: 0.090s; }
.mobile-menu a:nth-child(5)  { transition-delay: 0.075s; }
.mobile-menu a:nth-child(6)  { transition-delay: 0.060s; }
.mobile-menu a:nth-child(7)  { transition-delay: 0.045s; }
.mobile-menu a:nth-child(8)  { transition-delay: 0.030s; }
.mobile-menu a:nth-child(9)  { transition-delay: 0.015s; }
.mobile-menu a:nth-child(10) { transition-delay: 0s; }

/* enter — first link first, 15ms steps, everything on screen inside 300ms */
.mobile-menu.open a:nth-child(1)  { transition-delay: 0.045s; }
.mobile-menu.open a:nth-child(2)  { transition-delay: 0.060s; }
.mobile-menu.open a:nth-child(3)  { transition-delay: 0.075s; }
.mobile-menu.open a:nth-child(4)  { transition-delay: 0.090s; }
.mobile-menu.open a:nth-child(5)  { transition-delay: 0.105s; }
.mobile-menu.open a:nth-child(6)  { transition-delay: 0.120s; }
.mobile-menu.open a:nth-child(7)  { transition-delay: 0.135s; }
.mobile-menu.open a:nth-child(8)  { transition-delay: 0.150s; }
.mobile-menu.open a:nth-child(9)  { transition-delay: 0.165s; }
.mobile-menu.open a:nth-child(10) { transition-delay: 0.180s; }

/* --------------------------------------------------------------------------
   15 — Scroll edge instead of a 1px divider under the sticky header.
   -------------------------------------------------------------------------- */
.site-header.scrolled { border-bottom-color: transparent !important; }
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: linear-gradient(180deg, rgba(3, 8, 19, 0.5), rgba(3, 8, 19, 0));
}
.site-header.scrolled::after { opacity: 1; }

/* --------------------------------------------------------------------------
   14 — Material weight now encodes surface size.
   Both surfaces were blur(18px): a 178px chip and a full-width band.
   -------------------------------------------------------------------------- */
.sh2-shell .sh2-features {
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  box-shadow:
    0 34px 78px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.sh2-shell .sh2-perf {
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

/* --------------------------------------------------------------------------
   16 — Vibrancy: text over a blurred surface is not flat low-opacity gray.
   -------------------------------------------------------------------------- */
.sh2-shell .sh2-perf small {
  color: rgba(216, 222, 232, 0.94);
  font-weight: 500;
  letter-spacing: 0.012em;
}
.sh2-shell .sh2-perf-line span {
  color: rgba(250, 251, 253, 0.96);
  letter-spacing: 0.012em;
}

/* --------------------------------------------------------------------------
   17 — The single #80f2a4 green in a navy/gold palette, used exactly once.
   -------------------------------------------------------------------------- */
.sh2-shell .sh2-perf-line span em { color: var(--sh2-gold-light, #f1c86a); }

/* --------------------------------------------------------------------------
   11 — Tracking is size-specific. It was -.06em at every size; the kicker
   already varied by breakpoint, the title did not.
   -------------------------------------------------------------------------- */
.sh2-shell .sh2-title { letter-spacing: -0.035em; }
@media (max-width: 1180px) { .sh2-shell .sh2-title { letter-spacing: -0.028em; } }
@media (max-width: 820px)  { .sh2-shell .sh2-title { letter-spacing: -0.02em; } }

/* --------------------------------------------------------------------------
   13 — prefers-reduced-transparency: zero occurrences in the whole theme,
   on a page built out of backdrop-filter.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-transparency: reduce) {
  .site-header.scrolled,
  .mobile-menu,
  .sh2-shell .sh2-features,
  .sh2-shell .sh2-perf,
  .sh2-shell .sh2-btn.sh2-secondary {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .site-header.scrolled { background: rgb(3, 8, 19) !important; }
  .mobile-menu { background: rgb(3, 8, 19); }
  .sh2-shell .sh2-features { background: #0a0e15; }
  .sh2-shell .sh2-perf { background: #0b0f16; }
  .sh2-shell .sh2-btn.sh2-secondary { background: rgba(10, 14, 21, 0.97); }
}

/* 13 — prefers-contrast: also zero occurrences in the whole theme. */
@media (prefers-contrast: more) {
  .sh2-shell .sh2-subtitle { color: #fff; }
  .sh2-shell .sh2-note { color: rgba(238, 241, 246, 0.98); }
  .sh2-shell .sh2-perf small { color: #fff; }
  .sh2-shell .sh2-btn { border-color: rgba(255, 255, 255, 0.55); }
  .site-header.scrolled { background: rgb(3, 8, 19) !important; }
  .sh2-shell a:focus-visible,
  .sh2-shell button:focus-visible,
  .site-header a:focus-visible,
  .mobile-menu a:focus-visible { outline-width: 3px; }
}

/* --------------------------------------------------------------------------
   1, 8 — Reduced motion. header-footer.css had no such block at all, so a
   full-screen panel slid 100vh for users who asked for less movement.
   Reduced motion means a gentler equivalent, not no feedback: the press
   scale and the colour changes stay.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sh2-shell,
  .sh2-shell *,
  .sh2-shell *::before,
  .sh2-shell *::after {
    animation: none !important;
    transition-property: opacity, color, background-color, border-color, box-shadow !important;
    transition-duration: 0.16s !important;
  }

  /* the scroll-driven fade on a full-width background image */
  .sh2-shell .sh2-photo { opacity: 1 !important; }

  /* the panel cross-fades in place instead of travelling the viewport */
  .mobile-menu {
    transform: none !important;
    opacity: 0;
    transition: opacity 0.18s ease, visibility 0s linear 0.18s !important;
  }
  .mobile-menu.open {
    opacity: 1;
    transition: opacity 0.18s ease, visibility 0s !important;
  }
  .mobile-menu a {
    transform: none !important;
    transition: opacity 0.18s ease !important;
    transition-delay: 0s !important;
  }

  .site-header { transition: background-color 0.16s ease, border-color 0.16s ease !important; }
}

/* --------------------------------------------------------------------------
   DEMO ONLY — mirrors the @media (prefers-reduced-motion: reduce) block above
   so the comparison harness can show that behaviour without you changing a
   system setting. Nothing sets this attribute except /_compare.html.
   This block is not part of the fix and must NOT be ported to the theme.
   -------------------------------------------------------------------------- */
html[data-rm-demo] .sh2-shell,
html[data-rm-demo] .sh2-shell *,
html[data-rm-demo] .sh2-shell *::before,
html[data-rm-demo] .sh2-shell *::after {
  animation: none !important;
  transition-property: opacity, color, background-color, border-color, box-shadow !important;
  transition-duration: 0.16s !important;
}
html[data-rm-demo] .sh2-shell .sh2-photo { opacity: 1 !important; }
html[data-rm-demo] .mobile-menu {
  transform: none !important;
  opacity: 0;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s !important;
}
html[data-rm-demo] .mobile-menu.open {
  opacity: 1;
  transition: opacity 0.18s ease, visibility 0s !important;
}
html[data-rm-demo] .mobile-menu a {
  transform: none !important;
  transition: opacity 0.18s ease !important;
  transition-delay: 0s !important;
}
