/*
 * Enhancement layer for the Trust Women mirror.
 *
 * Readymag positions every widget absolutely at authored coordinates, so this
 * file only ever changes paint -- colour, radius, shadow, transform, outline.
 * Nothing here may alter a widget's width, height, margin, padding or position,
 * because neighbouring widgets do not reflow and would end up overlapping.
 */

:root {
  --enh-purple: #d0a4f7;
  --enh-purple-deep: #b581ef;
  --enh-green: #0a3c25;
  --enh-ink: #282828;
  --enh-radius: 14px;
  --enh-shadow: 0 10px 30px -12px rgba(10, 60, 37, 0.28);
  --enh-shadow-soft: 0 4px 16px -8px rgba(10, 60, 37, 0.22);
  --enh-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Text rendering only -- never font-size, which would overflow fixed boxes. */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--enh-purple);
  color: var(--enh-green);
}

:focus-visible {
  outline: 3px solid var(--enh-green);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Depth cue under the sticky header, faded in once the page is scrolled. */
.enh-header-shade {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--enh-ease);
  box-shadow: 0 8px 24px -14px rgba(10, 60, 37, 0.55);
}

.enh-header-shade.is-on {
  opacity: 1;
}

/* --- Active-page pill -----------------------------------------------------
 * Drawn as a pseudo-element bleeding outside the widget box rather than as
 * padding, so the nav item keeps the exact size Readymag gave it and its
 * neighbours stay where they were authored. The widget's inline z-index makes
 * it a stacking context, so `z-index: -1` sits behind its own label without
 * falling behind the header.
 */
.enh-nav-active::before {
  content: "";
  position: absolute;
  inset: -8px -14px;
  border-radius: 999px;
  background: var(--enh-purple);
  z-index: -1;
  pointer-events: none;
}

/* Nav labels are dark green at partial alpha; the active one goes solid.
 * Opacity is scoped to visible top-level items only — forcing opacity on hidden
 * dropdown children would reveal closed menus (they use opacity: 0, not display). */
.above-pages-container .enh-nav-active:not(.enh-nav-child),
.above-pages-container .enh-nav-active:not(.enh-nav-child) a,
.above-pages-container .enh-nav-active:not(.enh-nav-child) span,
.above-pages-container .enh-nav-active:not(.enh-nav-child) div {
  color: var(--enh-green) !important;
  opacity: 1 !important;
}

/* --- Nav hover -----------------------------------------------------------
 * Opacity lift on hover for all nav items. Scoped to the bar's own widgets
 * (direct children) because Readymag also parks the newsletter popup in this
 * container, and to non-active items so the active pill is unaffected. Hidden dropdown children (opacity: 0) stay hidden
 * because their own opacity is already 0 — !important won't surface them.
 */
.above-pages-container > .rmwidget {
  cursor: pointer;
}

.above-pages-container > .rmwidget a,
.above-pages-container > .rmwidget span,
.above-pages-container > .rmwidget div {
  transition: opacity 0.18s var(--enh-ease), color 0.18s var(--enh-ease);
}

.above-pages-container > .rmwidget:not(.enh-nav-active):hover a,
.above-pages-container > .rmwidget:not(.enh-nav-active):hover span,
.above-pages-container > .rmwidget:not(.enh-nav-active):hover div {
  opacity: 1 !important;
  color: var(--enh-green) !important;
}

/* --- Dropdown hover ------------------------------------------------------
 * JS adds this class to child widgets when the user hovers a parent nav item.
 */
.enh-dropdown-visible {
  opacity: 1 !important;
  transition: opacity 0.18s var(--enh-ease) !important;
}

@media (prefers-reduced-motion: no-preference) {
  .enh-nav-active::before {
    animation: enh-pill-in 0.32s var(--enh-ease) both;
  }
  @keyframes enh-pill-in {
    from {
      transform: scale(0.72);
      opacity: 0;
    }
    to {
      transform: scale(1);
      opacity: 1;
    }
  }
}
