/* =======================================================================
 * Low-Stim Extension — Content Stylesheet
 *
 * All rules are scoped behind CSS classes toggled on <html> so they
 * can be enabled / disabled instantly from the content script.
 * ======================================================================= */

/* -----------------------------------------------------------------------
 * FEATURE: Motion Reduction
 *   Class: html.lowstim-motion-reduced
 *   Disables CSS animations, transitions, and parallax-style motion
 *   per PDF spec: animation: none !important; transition: none !important;
 * ----------------------------------------------------------------------- */

html.lowstim-motion-reduced *,
html.lowstim-motion-reduced *::before,
html.lowstim-motion-reduced *::after {
  animation: none !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition: none !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
}

/* Disable smooth scrolling (reduces motion when navigating or in menus) */
html.lowstim-motion-reduced,
html.lowstim-motion-reduced * {
  scroll-behavior: auto !important;
}

/* Disable scroll-driven animation/snapping that can feel like autoscroll */
html.lowstim-motion-reduced * {
  scroll-snap-type: none !important;
}

/* Reduce parallax-style motion (background-attachment: fixed can cause motion) */
html.lowstim-motion-reduced * {
  background-attachment: scroll !important;
}

/* -----------------------------------------------------------------------
 * FEATURE: Autoplay & Dynamic Content Suppression
 *   Class: html.lowstim-autoplay-off
 * ----------------------------------------------------------------------- */

/* Ensure media controls remain interactive even when paused by the extension */
html.lowstim-autoplay-off video,
html.lowstim-autoplay-off audio {
  pointer-events: auto !important;
}

/* Prevent GIFs from animating via an image-rendering hint (some browsers) */
html.lowstim-autoplay-off img[src$=".gif"],
html.lowstim-autoplay-off img[src*=".gif?"] {
  animation-play-state: paused !important;
}

/* Dim paused video overlays slightly so users know they're suppressed */
html.lowstim-autoplay-off video[data-lowstim-paused] {
  opacity: 0.85;
}

/* -----------------------------------------------------------------------
 * FEATURE: Color intensity slider
 *   Class: html.lowstim-color-intensity
 *   Saturation set via --lowstim-saturation in content.js (0–1).
 * ----------------------------------------------------------------------- */
html.lowstim-color-intensity {
  filter: saturate(var(--lowstim-saturation, 1)) !important;
}

/* -----------------------------------------------------------------------
 * FEATURE: Layout Simplification & Visual Noise Reduction
 *   Class: html.lowstim-layout-simple
 * ----------------------------------------------------------------------- */

/* --- Hide sidebars --- */
html.lowstim-layout-simple aside,
html.lowstim-layout-simple [role="complementary"],
html.lowstim-layout-simple .sidebar,
html.lowstim-layout-simple #sidebar,
html.lowstim-layout-simple .side-bar,
html.lowstim-layout-simple .right-rail,
html.lowstim-layout-simple .left-rail {
  display: none !important;
}

/* --- Hide common ad containers --- */
html.lowstim-layout-simple [class*="ad-container"],
html.lowstim-layout-simple [class*="ad-wrapper"],
html.lowstim-layout-simple [class*="ad-slot"],
html.lowstim-layout-simple [class*="ad-banner"],
html.lowstim-layout-simple [id*="ad-container"],
html.lowstim-layout-simple [id*="ad-wrapper"],
html.lowstim-layout-simple [id*="ad-slot"],
html.lowstim-layout-simple [id*="ad-banner"],
html.lowstim-layout-simple ins.adsbygoogle,
html.lowstim-layout-simple iframe[src*="ads"],
html.lowstim-layout-simple iframe[src*="doubleclick"],
html.lowstim-layout-simple iframe[src*="googlesyndication"],
html.lowstim-layout-simple [class*="sponsored"],
html.lowstim-layout-simple [class*="promo-banner"],
html.lowstim-layout-simple [data-ad],
html.lowstim-layout-simple [data-ad-slot] {
  display: none !important;
}

/* --- Collapse secondary nav elements (keep first/primary nav) --- */
html.lowstim-layout-simple nav ~ nav {
  display: none !important;
}

/* --- Hide cookie banners / consent popups (common patterns) --- */
html.lowstim-layout-simple [class*="cookie-banner"],
html.lowstim-layout-simple [class*="cookie-consent"],
html.lowstim-layout-simple [class*="consent-banner"],
html.lowstim-layout-simple [id*="cookie-banner"],
html.lowstim-layout-simple [id*="cookie-consent"],
html.lowstim-layout-simple [id*="consent-banner"],
html.lowstim-layout-simple [class*="CookieBanner"],
html.lowstim-layout-simple [class*="gdpr"] {
  display: none !important;
}

/* --- Hide notification / toast elements --- */
html.lowstim-layout-simple [class*="notification-bar"],
html.lowstim-layout-simple [class*="alert-banner"],
html.lowstim-layout-simple [class*="announcement-bar"],
html.lowstim-layout-simple [class*="top-bar"],
html.lowstim-layout-simple [class*="promo-bar"] {
  display: none !important;
}

/* --- Recenter and improve readability of main content --- */
html.lowstim-layout-simple main,
html.lowstim-layout-simple article,
html.lowstim-layout-simple [role="main"],
html.lowstim-layout-simple #content,
html.lowstim-layout-simple #main-content,
html.lowstim-layout-simple .main-content {
  max-width: 48rem !important;
  margin-left: auto !important;
  margin-right: auto !important;
  line-height: 1.7 !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

/* Make body allow the centered layout */
html.lowstim-layout-simple body {
  overflow-x: hidden !important;
}

/* --- Reduce visual weight of non-essential decorations --- */
html.lowstim-layout-simple [class*="badge"],
html.lowstim-layout-simple [class*="ribbon"],
html.lowstim-layout-simple [class*="marquee"] {
  display: none !important;
}

/* --- Suppress scroll-to-top floating buttons and chat widgets --- */
html.lowstim-layout-simple [class*="scroll-to-top"],
html.lowstim-layout-simple [class*="back-to-top"],
html.lowstim-layout-simple [class*="chat-widget"],
html.lowstim-layout-simple [class*="chat-bubble"],
html.lowstim-layout-simple [class*="intercom"],
html.lowstim-layout-simple [id*="intercom"],
html.lowstim-layout-simple [class*="drift-"],
html.lowstim-layout-simple [class*="helpshift"] {
  display: none !important;
}
