/* Arcane Runic Sanctum — Matched to Galactic Watcher Iris (#35f0ff, #9d5cff, #f2b632) */
:root {
  --iris-cyan: #35f0ff;
  --iris-blue: #2b8cff;
  --iris-violet: #9d5cff;
  --iris-gold: #f2b632;
  --arcane-void: #07060b;
}

#realm {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 100svh;
  padding: clamp(72px, 8.5vh, 96px) clamp(16px, 4vw, 44px) clamp(40px, 5.5vh, 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 72% 55% at 50% 54%, rgba(53, 240, 255, 0.06), transparent 68%),
    radial-gradient(ellipse 56% 48% at 50% 56%, rgba(157, 92, 255, 0.07), transparent 72%),
    #07060b;
}

/* Full-bleed live spell canvas behind the emblems */
#arcane-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.realm-head {
  position: relative;
  z-index: 4;
  text-align: center;
  max-width: 780px;
  margin: 0 auto clamp(24px, 3.4vh, 38px);
}

.realm-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--m);
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--iris-cyan);
  margin-bottom: 8px;
  opacity: 0.88;
  text-shadow: 0 0 12px rgba(53, 240, 255, 0.5);
}

.realm-kicker::before,
.realm-kicker::after {
  content: "";
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--iris-cyan));
}
.realm-kicker::after {
  background: linear-gradient(90deg, var(--iris-cyan), transparent);
}

.realm-head h2 {
  font-family: var(--f);
  font-weight: 300;
  font-size: clamp(1.75rem, 3.8vw, 2.9rem);
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  text-transform: uppercase;
  color: #f3f6ff;
  text-shadow: 0 0 28px rgba(53, 240, 255, 0.25);
}

.realm-head p {
  font-family: var(--m);
  font-size: clamp(0.68rem, 1.05vw, 0.78rem);
  letter-spacing: 0.24em;
  color: var(--mute);
  text-transform: uppercase;
  margin: 0;
}

/* Sanctum constellation stage */
.arcane-sanctum {
  position: relative;
  z-index: 3;
  width: min(1140px, 100%);
  margin: 0 auto;
  padding: clamp(6px, 1vh, 14px) 0;
}

/* Background central pulsing spell seal */
.sanctum-core-seal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, 84vw);
  height: min(520px, 84vw);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.3;
  transition: opacity 0.6s ease, transform 0.8s ease;
}

.arcane-sanctum.cast-active .sanctum-core-seal {
  opacity: 0.52;
}

.sanctum-core-ring-cw {
  transform-origin: 200px 200px;
  animation: arcaneSpinCW 68s linear infinite;
}

.sanctum-core-ring-ccw {
  transform-origin: 200px 200px;
  animation: arcaneSpinCCW 46s linear infinite;
}

/* Constellation layout: 3 upper arc + 2 lower anchored arc on desktop */
.arcane-constellation {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(14px, 2.2vh, 28px) clamp(18px, 3.4vw, 48px);
  max-width: 1040px;
  margin: 0 auto;
}

/* Individual Spell-Forged Emblem Link */
.arcane-emblem {
  --float-dur: 6.2s;
  --float-delay: 0s;
  --emblem-delay: 0.1s;
  position: relative;
  flex: 0 1 clamp(210px, 27%, 280px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  padding: 16px 10px 10px;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  opacity: 0;
  transform: translateY(24px) scale(0.92);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--emblem-delay);
}

/* Gentle organic arc stagger on wide screens (homepage pentad only) */
@media (min-width: 860px) {
  #realm .arcane-emblem[data-slot="1"],
  #realm .arcane-emblem[data-slot="3"] {
    margin-top: 22px;
  }
  #realm .arcane-emblem[data-slot="2"] {
    margin-top: 0;
  }
  #realm .arcane-emblem[data-slot="4"],
  #realm .arcane-emblem[data-slot="5"] {
    flex-basis: clamp(230px, 31%, 295px);
    margin-top: -6px;
  }
}

.arcane-sanctum.is-conjured .arcane-emblem {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.arcane-emblem-float {
  position: relative;
  width: clamp(144px, 13.5vw, 174px);
  height: clamp(144px, 13.5vw, 174px);
  display: grid;
  place-items: center;
  animation: arcaneLevitate var(--float-dur) ease-in-out infinite;
  animation-delay: var(--float-delay);
  will-change: transform;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.arcane-emblem:hover .arcane-emblem-float,
.arcane-emblem:focus-visible .arcane-emblem-float {
  transform: translateY(-10px) scale(1.08);
}

/* Iris aura bloom behind each emblem (pure radial-gradient, zero expensive CSS blur) */
.arcane-aura {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(53, 240, 255, 0.34) 0%,
    rgba(157, 92, 255, 0.22) 38%,
    rgba(242, 182, 50, 0.08) 58%,
    transparent 74%
  );
  opacity: 0.52;
  transform: scale(0.92);
  will-change: transform, opacity;
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.arcane-emblem:hover .arcane-aura,
.arcane-emblem:focus-visible .arcane-aura {
  opacity: 1;
  transform: scale(1.22);
}

/* Main interactive Sigil SVG (compositor-clean, zero animated SVG drop-shadow filter) */
.arcane-sigil {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sigil-ring-outer {
  transform-origin: 100px 100px;
  will-change: transform;
  animation: arcaneSpinCW 36s linear infinite;
}

.sigil-ring-inner {
  transform-origin: 100px 100px;
  will-change: transform;
  animation: arcaneSpinCCW 22s linear infinite;
}

.arcane-emblem:hover .sigil-ring-outer,
.arcane-emblem:focus-visible .sigil-ring-outer {
  animation-duration: 9s;
}

.arcane-emblem:hover .sigil-ring-inner,
.arcane-emblem:focus-visible .sigil-ring-inner {
  animation-duration: 6s;
}

/* Stroke-draw conjuration effect */
.sigil-draw {
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  transition: stroke-dashoffset 1.35s cubic-bezier(0.25, 1, 0.5, 1);
  transition-delay: calc(var(--emblem-delay) + 0.15s);
}

.arcane-sanctum.is-conjured .sigil-draw {
  stroke-dashoffset: 0;
}

/* Orbiting mini runic crown words */
.arcane-rune-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.floating-rune-tag {
  position: absolute;
  font-family: var(--m);
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  color: rgba(53, 240, 255, 0.72);
  text-shadow: 0 0 10px rgba(53, 240, 255, 0.7), 0 0 18px rgba(157, 92, 255, 0.4);
  white-space: nowrap;
  opacity: 0.65;
  transition: opacity 0.3s ease, color 0.3s ease, transform 0.4s ease;
}

.floating-rune-tag.rune-top {
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
}

.floating-rune-tag.rune-left {
  left: -18px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  color: rgba(157, 92, 255, 0.85);
}

.floating-rune-tag.rune-right {
  right: -18px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  color: rgba(242, 182, 50, 0.8);
}

.arcane-emblem:hover .floating-rune-tag,
.arcane-emblem:focus-visible .floating-rune-tag {
  opacity: 1;
  color: #e6fcff;
}

/* Emblem Typography */
.arcane-label {
  position: relative;
  z-index: 3;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.arcane-index {
  font-family: var(--m);
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--iris-cyan);
  text-shadow: 0 0 10px rgba(53, 240, 255, 0.55);
  transition: color 0.3s ease;
}

.arcane-emblem:hover .arcane-index,
.arcane-emblem:focus-visible .arcane-index {
  color: var(--iris-gold);
  text-shadow: 0 0 12px rgba(242, 182, 50, 0.65);
}

.arcane-title {
  margin: 0;
  font-family: var(--f);
  font-weight: 500;
  font-size: clamp(1.08rem, 1.55vw, 1.3rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #eef5ff;
  text-shadow: 0 2px 14px rgba(7, 6, 11, 0.9), 0 0 18px rgba(53, 240, 255, 0.2);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.arcane-emblem:hover .arcane-title,
.arcane-emblem:focus-visible .arcane-title {
  color: #ffffff;
  text-shadow: 0 0 18px rgba(53, 240, 255, 0.65), 0 0 32px rgba(157, 92, 255, 0.45);
}

.arcane-spell-cta {
  font-family: var(--m);
  font-size: 0.68rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(190, 215, 245, 0.62);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  transition: color 0.3s ease, letter-spacing 0.3s ease;
}

.arcane-emblem:hover .arcane-spell-cta,
.arcane-emblem:focus-visible .arcane-spell-cta {
  color: var(--iris-cyan);
  letter-spacing: 0.32em;
  text-shadow: 0 0 10px rgba(53, 240, 255, 0.65);
}

.arcane-emblem:focus-visible {
  outline: none;
}

.arcane-emblem:focus-visible .arcane-sigil {
  outline: 1px dashed rgba(53, 240, 255, 0.7);
  outline-offset: 8px;
  border-radius: 50%;
}

/* Subtle incantation status line at the bottom */
.sanctum-whisper {
  position: relative;
  z-index: 3;
  margin-top: clamp(16px, 2.5vh, 28px);
  font-family: var(--m);
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(53, 240, 255, 0.68);
  text-align: center;
  min-height: 1.4em;
  text-shadow: 0 0 12px rgba(53, 240, 255, 0.38);
  transition: opacity 0.35s ease, color 0.35s ease;
}

/* Keyframes */
@keyframes arcaneSpinCW {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes arcaneSpinCCW {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes arcaneLevitate {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-9px); }
}

/* Mobile Layout */
@media (max-width: 720px) {
  #realm {
    padding: 76px 14px 56px;
  }
  .realm-kicker {
    font-size: 0.58rem;
    letter-spacing: 0.2em;
  }
  .arcane-constellation {
    gap: 28px 12px;
  }
  .arcane-emblem {
    flex: 0 1 calc(50% - 8px);
    min-width: 150px;
    padding: 20px 6px 12px;
  }
  #realm .arcane-emblem[data-slot="5"] {
    flex-basis: 72%;
  }
  .arcane-emblem-float {
    width: 136px;
    height: 136px;
  }
  .floating-rune-tag.rune-left,
  .floating-rune-tag.rune-right {
    display: none;
  }
  .arcane-title {
    font-size: 0.94rem;
  }
}

/* ============================================================================
   Site-Wide Cosmic Hub & Embedded Compact Spell Constellations
   ============================================================================ */

body.arcane-hub-page {
  background:
    radial-gradient(ellipse 75% 60% at 50% 42%, rgba(53, 240, 255, 0.055), transparent 68%),
    radial-gradient(ellipse 60% 52% at 50% 58%, rgba(157, 92, 255, 0.065), transparent 72%),
    #04050e;
  color: #eef5ff;
  min-height: 100svh;
  margin: 0;
  font-family: var(--f, 'Space Grotesk', system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

/* Hub & compact emblems render immediately above the fold without waiting for scroll reveal */
body.arcane-hub-page .arcane-emblem,
.arcane-sanctum--compact .arcane-emblem {
  opacity: 1;
  transform: none;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
body.arcane-hub-page .sigil-draw,
.arcane-sanctum--compact .sigil-draw {
  stroke-dashoffset: 0;
}

.arcane-ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

main[data-arcane-stage="hub"] {
  position: relative;
  z-index: 2;
  padding: clamp(92px, 12vh, 124px) clamp(16px, 4vw, 44px) clamp(48px, 6vh, 72px);
  max-width: 1180px;
  margin: 0 auto;
  min-height: calc(100svh - 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hub-header {
  position: relative;
  z-index: 3;
  text-align: center;
  margin-bottom: clamp(22px, 3.8vh, 42px);
}

.hub-header h1 {
  margin: 0;
  font-family: var(--f, 'Space Grotesk', system-ui, sans-serif);
  font-weight: 300;
  font-size: clamp(1.75rem, 3.6vw, 2.75rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f3f6ff;
  text-shadow: 0 0 26px rgba(53, 240, 255, 0.25);
}

.arcane-sanctum--hub .arcane-constellation {
  max-width: 1120px;
  gap: clamp(22px, 3.5vh, 38px) clamp(20px, 3.5vw, 48px);
}

.arcane-sanctum--hub .arcane-constellation--grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  justify-items: center;
  align-items: start;
}

.arcane-sanctum--hub .arcane-constellation--grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 320px));
  justify-content: center;
  justify-items: center;
  align-items: start;
}

.arcane-sanctum--hub .arcane-constellation--grid4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  justify-items: center;
  align-items: start;
}

@media (max-width: 960px) {
  .arcane-sanctum--hub .arcane-constellation--grid4 {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 820px) {
  .arcane-sanctum--hub .arcane-constellation--grid3 {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 560px) {
  .arcane-sanctum--hub .arcane-constellation--grid2,
  .arcane-sanctum--hub .arcane-constellation--grid3,
  .arcane-sanctum--hub .arcane-constellation--grid4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 10px;
  }
  .arcane-sanctum--hub .arcane-emblem-float {
    width: 112px;
    height: 112px;
  }
  .arcane-sanctum--hub .arcane-desc {
    font-size: 0.72rem;
    max-width: 100%;
  }
  .arcane-sanctum--hub .arcane-constellation--triad .arcane-emblem:last-child {
    grid-column: 1 / -1;
  }
}

/* Compact Embedded Spell Navigation Strip (used inside Welcome, Symphony, Timer, Seraph) */
.arcane-sanctum--compact {
  position: relative;
  z-index: 4;
  padding: 12px 0 8px;
}

.arcane-sanctum--compact .sanctum-core-seal {
  width: min(360px, 76vw);
  height: min(360px, 76vw);
  opacity: 0.18;
}

.arcane-sanctum--compact .arcane-constellation {
  gap: 20px clamp(12px, 2.5vw, 30px);
  max-width: 100%;
}

.arcane-sanctum--compact .arcane-emblem {
  flex: 1 1 155px;
  max-width: 210px;
  padding: 10px 8px 12px;
}

.arcane-sanctum--compact .arcane-emblem-float {
  width: clamp(106px, 11vw, 128px);
  height: clamp(106px, 11vw, 128px);
}

.arcane-sanctum--compact .floating-rune-tag {
  font-size: 0.54rem;
  letter-spacing: 0.2em;
}

.arcane-sanctum--compact .floating-rune-tag.rune-left,
.arcane-sanctum--compact .floating-rune-tag.rune-right {
  display: none;
}

.arcane-sanctum--compact .arcane-index {
  font-size: 0.58rem;
  letter-spacing: 0.22em;
}

.arcane-sanctum--compact .arcane-title {
  font-size: clamp(0.84rem, 1.25vw, 0.98rem);
}

.arcane-sanctum--compact .arcane-spell-cta {
  font-size: 0.58rem;
  letter-spacing: 0.22em;
}

/* Support Light Mode (e.g. TIM3R Light Theme) */
[data-theme="light"] .arcane-title,
body.light .arcane-title {
  color: #161826;
  text-shadow: 0 1px 10px rgba(53, 180, 220, 0.2);
}
[data-theme="light"] .arcane-index,
body.light .arcane-index {
  color: #0b7a8c;
  text-shadow: none;
}
[data-theme="light"] .arcane-spell-cta,
body.light .arcane-spell-cta {
  color: #4b5169;
}
[data-theme="light"] .arcane-emblem:hover .arcane-title,
body.light .arcane-emblem:hover .arcane-title {
  color: #0a0b12;
  text-shadow: 0 0 14px rgba(53, 240, 255, 0.45);
}

/* Reduced motion */
.rm .arcane-emblem,
.rm .arcane-sanctum .arcane-emblem {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}
.rm .sigil-draw {
  stroke-dashoffset: 0 !important;
  transition: none !important;
}
.rm .arcane-emblem-float,
.rm .sigil-ring-outer,
.rm .sigil-ring-inner,
.rm .sanctum-core-ring-cw,
.rm .sanctum-core-ring-ccw {
  animation: none !important;
}

/* ============================================================================
   Pyramid Architecture: Overview Strip, Descriptions, Parent Links & CRT Sheen
   ============================================================================ */

/* Subtle cyber-noir CRT phosphor scanlines on sanctum hubs */
.arcane-hub-page::after,
#realm::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0px,
    rgba(255, 255, 255, 0) 2px,
    rgba(0, 0, 0, 0.16) 3px,
    rgba(0, 0, 0, 0.16) 4px
  );
  opacity: 0.35;
}
#realm::after {
  position: absolute;
  z-index: 1;
}

.hub-sub {
  margin: 10px auto 0;
  max-width: 560px;
  font-family: var(--m, 'Share Tech Mono', monospace);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(190, 215, 245, 0.72);
  line-height: 1.5;
}

.hub-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-family: var(--m, 'Share Tech Mono', monospace);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(53, 240, 255, 0.78);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid rgba(53, 240, 255, 0.24);
  border-radius: 4px;
  background: rgba(7, 8, 18, 0.55);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.hub-back:hover {
  color: #fff;
  border-color: rgba(242, 182, 50, 0.65);
  background: rgba(53, 240, 255, 0.08);
}

.arcane-desc {
  margin: 4px 0 2px;
  max-width: 240px;
  font-family: var(--f, 'Space Grotesk', sans-serif);
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(212, 224, 242, 0.72);
  text-align: center;
  font-weight: 300;
}

/* Homepage Overview & Protocol Strip */
.forge-manifesto {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 960px;
  box-sizing: border-box;
  margin: 0 auto clamp(28px, 4.5vh, 48px);
  padding: 20px clamp(18px, 3vw, 32px);
  background: rgba(7, 8, 18, 0.66);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(53, 240, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(53, 240, 255, 0.08);
}
.forge-manifesto-lead {
  text-align: center;
  font-family: var(--f, 'Space Grotesk', sans-serif);
  font-weight: 300;
  font-size: clamp(1rem, 1.8vw, 1.28rem);
  letter-spacing: 0.02em;
  color: #eef5ff;
  margin: 0 0 16px;
}
.forge-manifesto-lead span {
  color: #35f0ff;
  text-shadow: 0 0 14px rgba(53, 240, 255, 0.35);
}
.forge-tenets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  border-top: 1px solid rgba(53, 240, 255, 0.12);
  padding-top: 14px;
}
.forge-tenet {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.forge-tenet-id {
  font-family: var(--m, 'Share Tech Mono', monospace);
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  color: #f2b632;
  text-transform: uppercase;
}
.forge-tenet-copy {
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(236, 235, 242, 0.78);
}
@media (max-width: 720px) {
  .forge-tenets {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
