/* ============================================
   SindByte 3D Enhancements — shared styles
   ============================================
   The sb3d rules are inert until JS adds the
   `sb3d` class to <html> (after successful init)
   plus per-effect classes to target elements.
   The "Accessibility and robustness block" at the
   end of this file is the one exception: it applies
   to every page that links this stylesheet.
   ============================================ */

/* --- Hero 3D scene --- */
.sb3d-hero {
  position: relative;
  overflow: hidden;
}
.sb3d-hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}
/* The scene starts after the page has loaded (see sindbyte-3d.js): fade it in
   instead of popping in. The end state is whatever opacity the element has. */
.sb3d-hero-canvas,
.sb3d-hero-overlay {
  animation: sb3d-fade-in 0.9s ease-out;
}
@keyframes sb3d-fade-in {
  from { opacity: 0; }
}
.sb3d-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(6, 9, 18, 0) 0%, rgba(6, 9, 18, .55) 75%),
    linear-gradient(180deg, rgba(6, 9, 18, .35) 0%, rgba(6, 9, 18, .15) 40%, rgba(6, 9, 18, .6) 100%);
}
/* Page-sized heroes: the scene is a fixed, viewport-sized backdrop
   behind the content (next to the starfield) instead of one giant canvas. */
.sb3d-hero-canvas.sb3d-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: .6;
}
/* Subtle mode (documentation pages): lighter overlay, scene is faint anyway */
.sb3d-hero.sb3d-subtle > .sb3d-hero-overlay {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(6, 9, 18, 0) 0%, rgba(6, 9, 18, .35) 80%),
    linear-gradient(180deg, rgba(6, 9, 18, .2) 0%, rgba(6, 9, 18, .1) 50%, rgba(6, 9, 18, .35) 100%);
}
/* JS sets position:relative + z-index:2 inline on hero content wrappers;
   this is only a safety net for direct children. */
html.sb3d .sb3d-hero > .sb3d-hero-content {
  position: relative;
  z-index: 2;
}

/* --- 3D tilt cards --- */
.sb3d-tilt-wrap {
  perspective: 1200px;
}
html.sb3d .sb3d-tilt {
  position: relative;
  transform-style: preserve-3d;
  transition: transform .18s ease-out, border-color .3s, box-shadow .3s;
  will-change: transform;
}
html.sb3d .sb3d-tilt > * {
  transform-style: preserve-3d;
}
/* Direct children get a subtle lift; JS does not touch them. */
html.sb3d .sb3d-tilt.sb3d-tilting > * {
  transform: translateZ(18px);
}
.sb3d-tilt-glare {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  transition: opacity .25s ease;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%),
    rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .05) 35%, transparent 65%);
  mix-blend-mode: screen;
}
html.sb3d .sb3d-tilt.sb3d-tilting > .sb3d-tilt-glare {
  opacity: 1;
}

/* --- Scroll depth reveal --- */
.sb3d-reveal-stage {
  perspective: 1000px;
}
html.sb3d .sb3d-reveal {
  opacity: 0;
  transform: translateY(34px) translateZ(-60px) rotateX(6deg);
  transform-origin: 50% 100%;
  transition: opacity .7s ease-out, transform .7s cubic-bezier(.22, .8, .32, 1);
  will-change: opacity, transform;
}
html.sb3d .sb3d-reveal.sb3d-revealed {
  opacity: 1;
  transform: translateY(0) translateZ(0) rotateX(0);
}
/* Blocks inside very tall parents: own perspective, same movement. */
html.sb3d .sb3d-reveal.sb3d-reveal-solo {
  transform: perspective(1000px) translateY(34px) translateZ(-60px) rotateX(6deg);
}
html.sb3d .sb3d-reveal.sb3d-reveal-solo.sb3d-revealed {
  transform: perspective(1000px) translateY(0) translateZ(0) rotateX(0);
}

@media (prefers-reduced-motion: reduce) {
  html.sb3d .sb3d-reveal,
  html.sb3d .sb3d-reveal.sb3d-reveal-solo {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html.sb3d .sb3d-tilt {
    transition: border-color .3s, box-shadow .3s;
  }
  .sb3d-hero-canvas,
  .sb3d-hero-overlay {
    animation: none;
  }
}

/* ============================================
   Accessibility and robustness block (2026-10)
   KEEP IN SYNC with the same block at the end of
   sindbyte-shared.css: a page loads one or both
   files. (Only difference: .text-muted is listed
   here; shared.css already has it further up.)
   ============================================ */

/* Bootstrap's .text-muted is dark grey; on the dark pages it must be the site's muted blue-grey. */
.text-muted {
  color: var(--muted, #9fb1c8) !important;
}

/* Images with width/height attributes keep their aspect ratio when CSS narrows them.
   Zero specificity: any class rule that sets a height (.brand-logo ...) still wins. */
:where(img[width][height]) {
  height: auto;
}

/* Visible keyboard focus (WCAG 2.4.7) in the site's accent colour */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--cyan, #00f3ff);
  outline-offset: 2px;
}
/* targets of scripted focus (skip link, in-page anchors, main with tabindex="-1") get no ring */
:where([tabindex="-1"]):focus-visible {
  outline: none;
}
.btn:focus-visible,
.btn-main:focus-visible,
.btn-holo:focus-visible,
.navbar-toggler:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--cyan, #00f3ff);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 243, 255, 0.25);
}
.sb-accordion .accordion-button:focus-visible {
  outline: 2px solid var(--cyan, #00f3ff);
  outline-offset: -2px;
}
canvas:focus-visible {
  outline: 2px dashed var(--cyan, #00f3ff);
  outline-offset: -3px;
}

/* Skip link: a link with class "skip-link" and href "#main-content" as the first child of the
   body, plus id="main-content" on the main element. Invisible until it receives keyboard focus. */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10000;
  padding: 10px 16px;
  border: 2px solid var(--cyan, #00f3ff);
  border-radius: 8px;
  background: var(--bg, #060912);
  color: var(--cyan, #00f3ff);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-300%);
  transition: transform 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--gold, #ffb51f);
  outline-offset: 2px;
}

/* Brand purple (#bc13fe) stays for borders, glows and large display text. As small
   TEXT on the dark panels it measures only about 4.0:1, so these small-text uses
   (chips, tags, outline buttons) get a lighter purple (>= 5:1). The selectors are
   deliberately a little stronger than the page rules (.badge-chip.purple ...)
   but weaker than the hover rules, so hover states keep working. */
:root {
  --purple-text: #cc55ff;
}
a.btn-purple,
button.btn-purple,
.badge-chip.badge-chip.purple,
.history-badge.history-badge.purple,
.purple-tag.purple-tag {
  color: var(--purple-text);
}

/* .btn-alt: pages that style it paint border and text with var(--purple). The variable is
   re-pointed on the button itself, so only pages that really use .btn-alt that way change (a
   .btn-alt without a rule, next to .btn-main, keeps its cyan look). On hover the brand purple
   returns, so the white text keeps its contrast on the filled button. */
a.btn-alt,
button.btn-alt {
  --purple: var(--purple-text);
}
a.btn-alt:hover,
button.btn-alt:hover {
  --purple: inherit;
}

/* Footer links the page does not style fall back to Bootstrap's default blue (about 3.2:1 on
   the dark footer). Bootstrap draws that blue from these two variables; re-pointing them for
   the footer changes only links that still use the default, every rule of a page keeps winning
   (footer a { ... }, a { color: inherit } ...). */
footer {
  --bs-link-color-rgb: 0, 243, 255;
  --bs-link-hover-color-rgb: 255, 181, 31;
}

/* Decorative motion off for visitors who asked for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .back-to-top,
  .scroll-progress,
  img[loading="lazy"] {
    transition: none;
  }
  .glow-hover,
  .glow-hover:hover {
    transform: none;
    transition: none;
  }
  .img-zoom img,
  .img-zoom:hover img {
    transform: none;
    transition: none;
  }
}
