/* Shared styles for the orb templates (shadow-ball + hatch-*). */

body {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
}

/* faint dot matrix, fading out from the centre */
.dots {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(180, 109, 255, 0.16) 1px, transparent 1.4px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 38%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 38%, #000 0%, transparent 75%);
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#hud { z-index: 0; transition: transform 0.08s; }
#fx  { z-index: 1; }

header, main, footer { position: relative; z-index: 2; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 2.75rem);
}
.brand {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
}
.brand span { color: var(--eye); }

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1rem 2.25rem;
  text-align: center;
}

/* the orb is drawn on the canvases, centred on this box */
.stage {
  position: relative;
  align-self: stretch;
  flex: 1;
  min-height: clamp(280px, 52vh, 600px);
}

.core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 110px;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.core.on { opacity: 1; }
.core .eye { transition: fill 0.15s; }
.core.flash .eye { fill: var(--tooth); }
.core .pupil { transition: none; }

body.glitching .core {
  transform: translate(calc(-50% + 5px), -50%) skewX(-12deg);
  filter: drop-shadow(-4px 0 rgba(255, 46, 85, 0.9)) drop-shadow(4px 0 rgba(180, 109, 255, 0.9));
}
body.glitching #hud { transform: translateX(-4px); }
body.glitching h1 { text-shadow: -3px 0 rgba(255, 46, 85, 0.7), 3px 0 rgba(180, 109, 255, 0.7); }

h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2.1rem, 6.4vw, 4.2rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
  cursor: default;
}
h1 strong {
  font-weight: 800;
  background: linear-gradient(90deg, var(--gengar-light), var(--neon) 50%, var(--eye));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.scr { color: var(--neon); }

.lead {
  margin: 0 0 1.6rem;
  max-width: 30rem;
  line-height: 1.6;
  color: var(--muted);
}

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.chip {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: var(--surface);
  backdrop-filter: blur(6px);
}
.chip b { color: var(--gengar-light); font-weight: 500; }
.chip b.red { color: var(--eye); }

.hint { margin: 1.25rem 0 0; opacity: 0.6; font-size: 0.62rem; }

/* HUD chrome */
.corner {
  position: fixed;
  z-index: 3;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(180, 109, 255, 0.4);
  pointer-events: none;
}
.corner.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.corner.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

.side {
  position: fixed;
  z-index: 3;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0.55;
  pointer-events: none;
}
@media (max-width: 760px), (max-height: 620px) { .side { display: none; } }

/* pointer reticle */
.reticle {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
body.has-pointer .reticle { opacity: 1; }
.reticle i {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border: 1px solid var(--neon);
  transform: rotate(45deg);
  transition: left 0.25s, top 0.25s, width 0.25s, height 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.reticle.lock i {
  left: -17px;
  top: -17px;
  width: 34px;
  height: 34px;
  border-color: var(--eye);
  box-shadow: 0 0 12px var(--eye-glow);
  animation: lock-spin 4s linear infinite;
}
@keyframes lock-spin { from { transform: rotate(45deg); } to { transform: rotate(405deg); } }
.reticle span {
  position: absolute;
  left: 16px;
  top: 9px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
  transition: left 0.25s, color 0.25s;
}
.reticle.lock span { left: 30px; color: var(--eye); }
@media (pointer: coarse) { .reticle { display: none; } }

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 2.75rem);
  border-top: 1px solid var(--line);
}

/* full-screen light burst when the orb hatches */
.flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at var(--fx, 50%) var(--fy, 40%), rgba(255, 250, 255, 0.95), rgba(180, 109, 255, 0.45) 22%, rgba(7, 5, 12, 0) 65%);
  transition: opacity 1.6s ease-out;
}
.flash.on { opacity: 1; transition: none; }
