/* ============================================================
   ethereal.css — Glass Circuits Travel
   Drop-in companion to map.css.
   Adds: floating-mote canvas layer, glowing cursor,
         bloom-on-scroll reveals, breathing halos, aurora dividers.
   Uses your existing CSS variables. Zero edits to your files.
   ============================================================ */


/* ---- Floating mote canvas ---- */
/* The canvas is injected by ethereal.js and sits between the
   page background and your content. Screen blend mode makes
   particles add light instead of muddy pixels. */

#ethereal-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
  opacity: 0.95;
  transition: opacity 0.5s ease;
}

/* Dim the motes while the Atlas map overlay is open —
   they shouldn't fight the cartography. */
.atlas-open #ethereal-canvas { opacity: 0.28; }


/* ---- Custom cursor (desktop only) ---- */
/* A soft ivory dot with a rose halo. Becomes a triple-ringed
   beacon over interactive elements. Mobile is untouched. */

@media (hover: hover) and (pointer: fine) {
  body {
    cursor:
      url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'><circle cx='11' cy='11' r='2.6' fill='%23fff7f1' opacity='0.95'/><circle cx='11' cy='11' r='6' fill='%23d4b4b4' opacity='0.35'/><circle cx='11' cy='11' r='9.5' fill='%239db2a1' opacity='0.14'/></svg>") 11 11,
      auto;
  }

  a, button, .rune-pin, [role="button"],
  summary, label[for], select,
  input[type="submit"], input[type="button"], input[type="checkbox"], input[type="radio"] {
    cursor:
      url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'><circle cx='14' cy='14' r='3.6' fill='%23fff7f1'/><circle cx='14' cy='14' r='7' fill='%23d4b4b4' opacity='0.55'/><circle cx='14' cy='14' r='11' fill='%239db2a1' opacity='0.28'/><circle cx='14' cy='14' r='13' fill='%23d4b4b4' opacity='0.14'/></svg>") 14 14,
      pointer;
  }

  /* Don't override text input cursors — that hurts usability. */
  input[type="text"], input[type="email"], input[type="search"],
  input[type="password"], input[type="tel"], input[type="url"],
  textarea {
    cursor: text;
  }
}


/* ---- Bloom-on-scroll reveals ---- */
/* Elements start slightly lowered and invisible, then fade up
   with a single gold/rose halo pulse. Runs once per element. */

.bloom-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 1.1s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}

.bloom-visible {
  opacity: 1;
  transform: translateY(0);
  animation: bloom-halo 1.8s ease-out 1;
}

@keyframes bloom-halo {
  0% {
    box-shadow: 0 0 0 rgba(214, 174, 182, 0);
    filter: brightness(1);
  }
  45% {
    box-shadow:
      0 0 24px rgba(214, 174, 182, 0.38),
      0 0 52px rgba(157, 178, 161, 0.22),
      0 4px 12px rgba(139, 125, 107, 0.10);
    filter: brightness(1.05);
  }
  100% {
    box-shadow: 0 4px 12px rgba(139, 125, 107, 0.10);
    filter: brightness(1);
  }
}


/* ---- Lazy image fade-in ---- */
/* Images blur-fade in instead of popping. The .loaded class
   is added by ethereal.js on image load. */

img[loading="lazy"] {
  transition: opacity 0.9s ease, filter 0.9s ease;
}
img[loading="lazy"]:not(.loaded) {
  opacity: 0;
  filter: blur(6px);
}


/* ---- Optional opt-in classes ---- */

/* Slow breathing halo — perfect for hero titles, logos, pins.
   Usage: class="halo-breathe" */
.halo-breathe {
  animation: halo-breathe 7s ease-in-out infinite;
}
@keyframes halo-breathe {
  0%, 100% {
    filter:
      drop-shadow(0 0 8px rgba(214, 174, 182, 0.22))
      drop-shadow(0 0 18px rgba(157, 178, 161, 0.16));
  }
  50% {
    filter:
      drop-shadow(0 0 14px rgba(214, 174, 182, 0.44))
      drop-shadow(0 0 30px rgba(157, 178, 161, 0.28))
      drop-shadow(0 0 48px rgba(255, 247, 241, 0.18));
  }
}

/* Aurora divider — drifting bands of rose + sage light
   between sections. Usage: <div class="aurora-divider"></div> */
.aurora-divider {
  position: relative;
  height: 140px;
  margin: 2rem 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora-divider::before,
.aurora-divider::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: -120px;
  height: 380px;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(212, 180, 180, 0.22),
    rgba(157, 178, 161, 0.14) 40%,
    transparent 72%
  );
  filter: blur(32px);
  animation: aurora-drift 14s ease-in-out infinite alternate;
}
.aurora-divider::after {
  animation-duration: 19s;
  animation-delay: -5s;
  opacity: 0.65;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(157, 178, 161, 0.22),
    rgba(212, 180, 180, 0.12) 40%,
    transparent 72%
  );
}
@keyframes aurora-drift {
  0%   { transform: translateX(-6%) scaleY(0.92); }
  100% { transform: translateX(6%)  scaleY(1.10); }
}

/* Ornamental rune divider — three glowing glyphs with a thin line.
   Usage: <div class="rune-divider" aria-hidden="true"></div> */
.rune-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem auto;
  max-width: 28rem;
  color: var(--dusty-mauve, #b39e9d);
  font-family: var(--font-atlas, "Uncial Antiqua", serif);
}
.rune-divider::before,
.rune-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(179, 158, 157, 0.45),
    transparent
  );
}
.rune-divider span {
  letter-spacing: 0.5em;
  font-size: 1.1rem;
  text-shadow:
    0 0 8px rgba(214, 174, 182, 0.4),
    0 0 16px rgba(157, 178, 161, 0.25);
}


/* ---- Accessibility: respect reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  .bloom-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .bloom-visible { animation: none; }
  .halo-breathe { animation: none; }
  .aurora-divider::before,
  .aurora-divider::after { animation: none; }
  img[loading="lazy"]:not(.loaded) { opacity: 1; filter: none; }
  #ethereal-canvas { display: none; }
}