/* ---------- The glowing search bar ----------
   The search in the header (.search-launch) and the field of the search window (#site-search .search-field), after
   "Search input" by Lakshay-art on Uiverse.io (MIT). Rings of conic gradients sit behind the bar, each a little
   larger and more blurred than the last; they turn when the pointer is over it and turn further (slower) while it has
   focus. The key hint on the right has its own ring that keeps turning.

   Markup (js/chrome.cjs): the bar holds <i class="gs-layers"> (the rings), <i class="gs-fill"> (its face), <i
   class="gs-pink"> (the pink light on the left), the gradient search icon, its words and <kbd class="gs-key">. The rings
   turn with the rotate property alone, so their centring (translate) never has to be repeated per state. */

.glow-search{
  --gs-fill:light-dark(#fff,#010201);
  --gs-text:light-dark(#6c6370,#c0b9c0);
  --gs-ink:light-dark(#2a2330,#fff);
  --gs-base:light-dark(#ebe6ee,#1c191c);
  --gs-glow-base:light-dark(rgb(255 255 255 / 0),#000);
  --gs-key-a:light-dark(#f3f1fb,#161329);
  --gs-key-b:light-dark(#fff,#000);
  --gs-key-c:light-dark(#ecebf9,#1d1b4b);
  --gs-key-ring:light-dark(#c9c4d8,#3d3a4f);
  --gs-glow-opacity:.4;
  --gs-pink-opacity:.8;
  --gs-i1:light-dark(#9a8a9c,#f8e7f8);
  --gs-i2:light-dark(#6f6372,#b6a9b7);
  --gs-i3:light-dark(#4f4452,#837484);
  --gs-r:999px;
  --gs-glow:12px;
  --gs-glow-blur:18px;
  position:relative;
  isolation:isolate;
  overflow:visible;
  color:var(--gs-text);
}
/* The rings, the face and the pink light are pictures only: the bar's own content sits above them. */
.glow-search>:not(.gs-layers,.gs-fill,.gs-pink,.sr-only){position:relative;z-index:1}
/* Light: a white bar, its glow and pink light softer. (Numbers can't follow light-dark(), so the theme says.) */
:root[data-theme=light] .glow-search{--gs-glow-opacity:.28;--gs-pink-opacity:.45}
.glow-search .gs-layers{position:absolute;inset:0;z-index:-1;pointer-events:none}
.glow-search .gs-layers>i{position:absolute;overflow:hidden;border-radius:var(--gs-r)}
.glow-search :where(.gs-layers>i)::before{
  content:"";position:absolute;top:50%;left:50%;width:600px;height:600px;
  translate:-50% -50%;rotate:0deg;background-repeat:no-repeat;
  transition:rotate 2s;
}
.glow-search .gs-border{inset:-1.5px -1px;filter:blur(.5px)}
.glow-search .gs-border::before{rotate:70deg;filter:brightness(1.3);background-image:conic-gradient(var(--gs-base),#402fb5 5%,var(--gs-base) 14%,var(--gs-base) 50%,#cf30aa 60%,var(--gs-base) 64%)}
.glow-search .gs-white{inset:-3.5px -3px;filter:blur(2px)}
.glow-search .gs-white::before{rotate:83deg;filter:brightness(1.4);background-image:conic-gradient(rgb(0 0 0 / 0) 0%,#a099d8,rgb(0 0 0 / 0) 8%,rgb(0 0 0 / 0) 50%,#dfa2da,rgb(0 0 0 / 0) 58%)}
.glow-search .gs-dark{inset:-4.5px -5.5px;filter:blur(3px)}
.glow-search .gs-dark::before{rotate:82deg;background-image:conic-gradient(rgb(0 0 0 / 0),#18116a,rgb(0 0 0 / 0) 10%,rgb(0 0 0 / 0) 50%,#6e1b60,rgb(0 0 0 / 0) 60%)}
.glow-search .gs-glow{inset:calc(-1 * var(--gs-glow)) calc(-1.4 * var(--gs-glow));filter:blur(var(--gs-glow-blur));opacity:var(--gs-glow-opacity)}
.glow-search .gs-glow::before{width:999px;height:999px;rotate:60deg;background-image:conic-gradient(var(--gs-glow-base),#402fb5 5%,var(--gs-glow-base) 38%,var(--gs-glow-base) 50%,#cf30aa 60%,var(--gs-glow-base) 87%)}
/* Pointer over it: the rings turn back; focus: they go round, slower. */
.glow-search:hover .gs-dark::before{rotate:-98deg}
.glow-search:hover .gs-glow::before{rotate:-120deg}
.glow-search:hover .gs-white::before{rotate:-97deg}
.glow-search:hover .gs-border::before{rotate:-110deg}
.glow-search:focus-within .gs-layers>i::before,.glow-search:focus-visible .gs-layers>i::before{transition-duration:4s}
.glow-search:is(:focus-within,:focus-visible) .gs-dark::before{rotate:442deg}
.glow-search:is(:focus-within,:focus-visible) .gs-glow::before{rotate:420deg}
.glow-search:is(:focus-within,:focus-visible) .gs-white::before{rotate:443deg}
.glow-search:is(:focus-within,:focus-visible) .gs-border::before{rotate:430deg}

/* The face of the bar, and the pink light on its left that fades while the pointer is over it. */
.glow-search .gs-fill{position:absolute;inset:0;z-index:0;border-radius:var(--gs-r);background:var(--gs-fill);pointer-events:none}
.glow-search .gs-pink{position:absolute;top:22%;left:5px;z-index:0;width:30px;height:56%;background:#cf30aa;filter:blur(14px);opacity:var(--gs-pink-opacity);pointer-events:none;transition:opacity 2s}
.glow-search:hover .gs-pink{opacity:0}

/* The search icon in its gradient: the gradient shows through the icon's shape (a mask), which keeps working on
   pages with <base href="/">, where an SVG gradient named by #id would point at another page. */
.glow-search .gs-icon{
  --gs-search:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M22 22l-5.35-5.35'/%3E%3C/svg%3E");
  flex:none;display:block;width:18px;height:18px;
  background:linear-gradient(140deg,var(--gs-i1),var(--gs-i2) 55%,var(--gs-i3));
  -webkit-mask:var(--gs-search) center/contain no-repeat;mask:var(--gs-search) center/contain no-repeat;
}

/* The key hint, in a frame with a ring that keeps turning. */
.glow-search .gs-key{
  position:relative;z-index:1;isolation:isolate;overflow:hidden;
  display:inline-grid;place-items:center;min-width:34px;height:26px;padding:0 8px;
  border:0;border-radius:9px;background:none;box-shadow:none;
  color:var(--gs-text);font:500 .6875rem var(--font-mono,ui-monospace,monospace);letter-spacing:.02em;
}
.glow-search .gs-key::before{
  content:"";position:absolute;top:50%;left:50%;z-index:-2;width:200px;height:200px;
  translate:-50% -50%;rotate:90deg;filter:brightness(1.35);
  background-image:conic-gradient(rgb(0 0 0 / 0),var(--gs-key-ring),rgb(0 0 0 / 0) 50%,rgb(0 0 0 / 0) 50%,var(--gs-key-ring),rgb(0 0 0 / 0) 100%);
  animation:gs-turn 4s linear infinite;
}
.glow-search .gs-key::after{content:"";position:absolute;inset:1px;z-index:-1;border-radius:8px;background:linear-gradient(180deg,var(--gs-key-a),var(--gs-key-b),var(--gs-key-c))}
@keyframes gs-turn{to{rotate:450deg}}

/* ---- In the header ---- */
.search-launch.glow-search{
  height:38px;gap:9px;padding:0 6px 0 13px;
  border:0;border-radius:var(--gs-r);background:none;box-shadow:none;
  color:var(--gs-text);
}
.search-launch.glow-search:hover{background:none;color:var(--gs-ink)}
.search-launch.glow-search kbd.gs-key{margin-left:14px}
/* Narrow screens and the collapsed header show the icon alone, in a round bar. */
.site-header.nav-collapsed .search-launch.glow-search{padding:0;justify-content:center}
.site-header.nav-collapsed .search-launch.glow-search .gs-key{display:none}
@media (max-width:1180px){
  .search-launch.glow-search{padding:0;justify-content:center}
  .search-launch.glow-search .gs-key{display:none}
}

/* ---- In the search window ---- */
/* Its glow spills past the field; the window never scrolls sideways for it. */
#site-search:has(.glow-search){overflow-x:hidden}
#site-search .search-field.glow-search{--gs-r:16px;--gs-glow:18px;--gs-glow-blur:26px;margin:4px 6px 0;gap:12px;padding:0 9px 0 16px;min-height:52px}
#site-search .search-field.glow-search>.gs-icon{width:20px;height:20px}
#site-search .search-field.glow-search #site-query{flex:1;min-width:0;min-height:52px;margin:0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;color:var(--gs-ink);font-size:1rem;outline:none}
#site-search .search-field.glow-search #site-query::placeholder{color:var(--gs-text);opacity:1}
#site-search .search-field.glow-search #site-query:focus-visible{outline:none;box-shadow:none}

/* Without motion: the rings stay where they are, and the key's ring stops turning. */
@media (prefers-reduced-motion:reduce){
  .glow-search .gs-layers>i::before,.glow-search .gs-pink{transition:none!important}
  .glow-search .gs-key::before{animation:none!important}
}
