/* =============================================================
   ITI Design System — Shared shell primitives
   Loaded SITE-WIDE, alongside iti-header.css / iti-footer.css.

   The header and footer appear on every page, but the primitives they
   rely on used to live in iti-base.css, which is enqueued only on the
   front page. Everywhere else the shell was therefore unconstrained —
   .iti-wrap had no max-width and no gutters, so the logo sat hard against
   the left edge and the language switcher against the right, and the type
   fell back to the browser's default stack.

   Nothing here sets a global element rule: pages that have not been
   redesigned must look exactly as they did before.
   ============================================================= */

/* ---------- Container ---------- */
.iti-wrap {
  width: 100%;
  max-width: var(--iti-wrap);
  margin-inline: auto;
  padding-inline: var(--iti-gutter);
}

/* ---------- Shell typography ----------
   Scoped to the shell components on purpose. Putting this on `body` would
   restyle the whole of every page that has not been redesigned yet. */
.iti-util,
.iti-head,
.iti-nav,
.iti-drawer,
.iti-search,
.iti-foot,
.iti-totop {
  font-family: var(--iti-font-sans);
}

/* ---------- Focus ----------
   The shell's own ring. The global pair below now covers these too, but this
   stays: it is what the shell components are tested against. */
.iti-util :focus-visible,
.iti-head :focus-visible,
.iti-drawer :focus-visible,
.iti-search :focus-visible,
.iti-foot :focus-visible,
.iti-totop:focus-visible {
  outline: 2px solid var(--iti-electric);
  outline-offset: 3px;
}

/* ---------- Focus, everywhere else ----------
   A deliberate exception to the rule at the top of this file, and the only
   global element rule in it.

   Astra ships `a:focus { outline: thin dotted }` — written before browsers
   could tell a keyboard from a mouse. So every link, menu entry and card you
   CLICKED kept a dotted box around it until focus moved on. The ring above
   never reached them: it is scoped to the shell, and the matching global rule
   lives in css/iti-base.css, which loads on the front page only. That is why
   the home page behaved and nothing else did.

   Deleting the outline and stopping there would trade a cosmetic annoyance
   for an accessibility fault — somebody tabbing through the site has to see
   where they are. :focus-visible is exactly the distinction Astra's rule
   could not draw: the browser shows it for keyboard and assistive navigation
   and withholds it for a plain click.

   This changes no layout, no spacing and no colour — only what a focused
   element shows, which is why it is an acceptable exception to "pages that
   have not been redesigned must look exactly as they did before". */
a:focus,
button:focus,
[tabindex]:focus {
  outline: none;
}

/* Astra has a second one of these for the search box, and its attribute
   selector outranks a plain `input:focus-visible`, so the pair below has to
   be written at the same weight to be heard at all. */
input[type="search"]:focus,
input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--iti-electric);
  outline-offset: 3px;
}

input[type="search"]:focus-visible,
input[type="text"]:focus-visible,
input[type="email"]:focus-visible {
  outline: 2px solid var(--iti-electric);
  outline-offset: 3px;
}

/* =========================================================
   Masthead effects
   The two ornaments carried over from the home page's hero: a trace
   sweeping across, and pulses running along the board. js/iti-mast-fx.js
   inserts the markup into every masthead; this sizes them for a band
   rather than for a full-height hero.

   The keyframes are named apart from the hero's own (iti-sweep,
   iti-pulse-run) on purpose. Both sheets load together on the home page,
   and identically named keyframes would have the later sheet silently
   redefine the hero's.
   ========================================================= */

.iti-fx {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
/* The copy keeps above them. */
.iti-mast__inner,
.ann-head__inner,
.art .breadcrumbs.overlay > .container { position: relative; z-index: 2; }

/* ---- trace sweep ---- */
.iti-fx__sweep {
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 34vw;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--iti-electric-rgb), .05) 45%,
    rgba(var(--iti-electric-rgb), .15) 50%,
    rgba(var(--iti-electric-rgb), .05) 55%,
    transparent 100%);
  animation: iti-fx-sweep 10s var(--iti-ease) infinite;
}
@keyframes iti-fx-sweep {
  0%, 60%  { transform: translateX(-40vw); opacity: 0; }
  66%      { opacity: 1; }
  100%     { transform: translateX(140vw); opacity: 0; }
}

/* ---- circuit pulses ---- */
.iti-fx__pulses {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* Held to the right of the copy, as on the hero: a bright head sliding
     behind a line of type pulls the eye off it. */
  mask-image: linear-gradient(90deg,
    transparent 0%, transparent 34%, #000 54%, #000 100%);
}
.iti-fx__pulses span {
  position: absolute;
  left: 0;
  height: 2px;
  width: 160px;
  opacity: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--iti-electric-rgb), .10) 55%,
    rgba(var(--iti-electric-rgb), .85) 96%,
    var(--iti-electric) 100%);
  box-shadow: 0 0 12px rgba(var(--iti-electric-rgb), .75);
  animation-name: iti-fx-pulse;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes iti-fx-pulse {
  0%   { transform: translateX(-170px); opacity: 0; }
  7%   { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateX(102vw); opacity: 0; }
}
/* Spread across a band roughly 200-250px tall, and out of step with each
   other so they never run as a block. */
.iti-fx__pulses span:nth-child(1) { top: 20%; width: 190px; animation-duration:  9s; animation-delay:  0s; }
.iti-fx__pulses span:nth-child(2) { top: 38%; width: 130px; animation-duration: 13s; animation-delay: 2.5s; }
.iti-fx__pulses span:nth-child(3) { top: 56%; width: 210px; animation-duration: 11s; animation-delay:  6s; }
.iti-fx__pulses span:nth-child(4) { top: 72%; width: 120px; animation-duration: 15s; animation-delay: 1.2s; }
.iti-fx__pulses span:nth-child(5) { top: 87%; width: 170px; animation-duration: 10s; animation-delay:  8s; }

@media (prefers-reduced-motion: reduce) {
  .iti-fx { display: none; }
}
