/* Header: theme button beside the logo, and an animated light travelling around the logo. */

/* Theme button in the logo row (far right). */
header.top .brand-row, header.top .product-lockup { flex:1 1 auto; min-width:0; }
header.top .product-mark-row { width:100%; }
header.top .header-theme-toggle { margin-left:auto; }
#themeToggle { display:none !important; }
@media (min-width:861px) {
  header.top .title-row { position:relative; }
  /* Level with the 76 px logo, at the right edge, above the draft-charts badge. */
  header.top .header-theme-toggle { position:absolute; right:0; top:15px; }
}

/* Animated light ring around the logo.
   The logo image is 3:2 with transparent margins: the coloured disc is about 63% of the box
   width, centred, slightly above the middle. The ring hugs that disc. */
@property --logo-spin { syntax:'<angle>'; inherits:false; initial-value:0deg; }
header.top .plate-mark { position:relative; isolation:isolate; }
header.top .plate-mark img { position:relative; z-index:1; }
header.top .plate-mark::before,
header.top .plate-mark::after {
  content:''; position:absolute; left:15%; right:15%; top:13.6%; bottom:16.4%; border-radius:50%; pointer-events:none;
  background:conic-gradient(from var(--logo-spin),
    color-mix(in srgb, var(--brand) 16%, transparent) 0deg,
    color-mix(in srgb, var(--brand) 16%, transparent) 190deg,
    color-mix(in srgb, var(--brand) 60%, transparent) 255deg,
    var(--brand) 300deg, #ffffff 330deg, #E19BBA 346deg,
    color-mix(in srgb, var(--brand) 16%, transparent) 360deg);
  -webkit-mask:radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
          mask:radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation:logo-spin 3.6s linear infinite;
  z-index:2;
}
/* Soft glow that follows the light, behind the logo. */
header.top .plate-mark::after {
  left:12%; right:12%; top:10.6%; bottom:13.4%; filter:blur(6px); opacity:.8; z-index:0;
  background:conic-gradient(from var(--logo-spin), transparent 0deg, transparent 230deg,
    color-mix(in srgb, var(--brand) 70%, transparent) 290deg, #ffffff 330deg, #E19BBA 346deg, transparent 360deg);
  -webkit-mask:none; mask:none;
}
@keyframes logo-spin { to { --logo-spin:360deg; } }
@media (prefers-reduced-motion: reduce) {
  header.top .plate-mark::before, header.top .plate-mark::after { animation:none; }
  header.top .plate-mark::after { opacity:.3; }
}

/* Cover poster as the header background: TSI, LIA, SIM, catalase, citrate and urease drawn from
   the BioIDz reading guides (transparent PNG/WebP). It sits behind the logo, name and theme button,
   fades out towards the brand side and the edges so text stays crisp, fades in on load and drifts
   very slowly. Decorative only (aria-hidden). */
header.top .header-cover { position:absolute; inset:0; z-index:0; overflow:hidden; pointer-events:none; user-select:none; }
header.top .top-inner { position:relative; z-index:1; }
header.top .header-cover img {
  position:absolute; right:calc(clamp(18px,4vw,52px) + 230px); bottom:-2%; height:61%; width:auto; max-width:none;
  opacity:.92; transform-origin:70% 80%;
  animation:cover-in 1.8s cubic-bezier(.2,.8,.2,1) both, cover-drift 28s ease-in-out 1.8s infinite alternate;
}
html[data-theme="dark"] header.top .header-cover img { opacity:.72; }
/* Veils: solid header colour on the brand side fading to clear, plus soft top, bottom and right edges. */
header.top .header-cover::after {
  content:''; position:absolute; inset:0;
  background:
    linear-gradient(90deg, var(--product-header-bg) 0%, var(--product-header-bg) 22%, color-mix(in srgb, var(--product-header-bg) 70%, transparent) 38%, transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--product-header-bg) 55%, transparent) 0%, transparent 22%, transparent 72%, var(--product-header-bg) 100%),
    linear-gradient(270deg, color-mix(in srgb, var(--product-header-bg) 60%, transparent) 0%, transparent 10%);
}
@keyframes cover-in { from { opacity:0; transform:translateX(3%) scale(1.04); } }
@keyframes cover-drift { from { transform:translateX(0) scale(1); } to { transform:translateX(-2.5%) scale(1.035); } }

@media (max-width:860px) {
  /* Phones and tablets: bottom-right corner, under the theme button and clear of the brand text. */
  header.top .header-cover img { right:12px; bottom:-2%; height:59%; opacity:.8; transform-origin:80% 90%; }
  html[data-theme="dark"] header.top .header-cover img { opacity:.62; }
  header.top .header-cover::after {
    background:
      linear-gradient(90deg, var(--product-header-bg) 0%, var(--product-header-bg) 38%, transparent 62%),
      linear-gradient(180deg, transparent 0%, transparent 75%, color-mix(in srgb, var(--product-header-bg) 70%, transparent) 100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  header.top .header-cover img { animation:none; }
}
/* Tablets: the theme button shows its label, so keep the poster to its left. */
@media (min-width:601px) and (max-width:860px) { header.top .header-cover img { right:calc(clamp(18px,4vw,52px) + 210px); } }

/* Account buttons in the header's top row on wide screens. */
header.top .top-actions .header-account { display:flex; align-items:center; gap:10px; margin:0; }
header.top .top-actions .header-account[hidden] { display:none; }
header.top .top-actions .home-account-button { min-height:44px; }
