/* ==========================================================================
   INTELA — theme chrome
   Theme-AGNOSTIC pieces shared by the dark demo (demo5) and the day/night
   toggle build (demo6): the scroll-progress bar and the toggle control.
   These must render correctly in BOTH light and dark, so nothing here is
   scoped to [data-theme]. The dark art direction proper lives in noir.css.
   Loaded only in themed builds, so it never touches the plain light launch.
   ========================================================================== */

/* --- scroll progress: geometry here, visibility gated to the dark theme --- */
.noir-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  /* --navy is navy in light, gold in dark — the bar recolours with the theme */
  background: linear-gradient(90deg, transparent, var(--navy) 55%, var(--steel, var(--navy)));
  opacity: 0;
  transition: opacity .45s ease;
  z-index: 300;
  pointer-events: none;
}
[data-theme="dark"] .noir-progress { opacity: 1; }

/* --- nav: group links + toggle to the right so the button never scatters --- */
.nav__links { margin-left: auto; }

/* --- day / night toggle (injected by theme.js) ---------------------------- */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  margin-left: 1.1rem;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  flex: 0 0 auto;
  transition: color .35s ease, border-color .35s ease, background .35s ease, transform .35s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { color: var(--navy); border-color: var(--navy); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
/* Show the icon of the mode you'll switch TO. */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .noir-progress { transition: none; }
}

/* On mobile the links collapse into the hamburger menu; keep the toggle
   visible beside the hamburger rather than hidden inside the menu. */
@media (max-width: 860px) {
  .theme-toggle { margin-left: auto; margin-right: 0.6rem; }
}
