/* ==========================================================================
   Base — reset, ground, the three scene layers
   ========================================================================== */
*{box-sizing:border-box}
[hidden]{display:none !important}
html{scroll-behavior:smooth}
body{
  margin:0;
  background:var(--ils-black);
  color:var(--ils-ivory);
  font-family:var(--ils-serif);
  font-weight:300;
  font-size:var(--ils-text);
  line-height:1.7;
  overflow-x:hidden;
}
::selection{background:var(--ils-gold);color:#000}
a{color:var(--ils-gold-bright)}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
.gold{color:var(--ils-gold-bright)}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ---- layer 0 : the scene (the lattice IS the page) ---- */
.scene{position:fixed;inset:0;width:100%;height:100%;z-index:var(--z-scene);pointer-events:none}
.scene-fallback{
  position:fixed;inset:0;z-index:var(--z-scene);pointer-events:none;
  background:
    radial-gradient(ellipse 60% 45% at 50% 46%, rgba(201,162,39,.14), transparent 70%),
    var(--ils-black);
}
.scene-fallback img{
  position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);
  width:min(480px,84vw);height:auto;opacity:.8;
  animation:ils-lattice-breathe var(--ils-breath) ease-in-out infinite;
}

/* ---- layer 1 : the veil (keeps type legible over the scene) ---- */
.veil{
  position:fixed;inset:0;z-index:var(--z-veil);pointer-events:none;
  background:linear-gradient(to bottom,
    rgba(5,5,5,.35), rgba(5,5,5,0) 26%, rgba(5,5,5,0) 62%, rgba(5,5,5,.6));
}

/* inside a space the veil deepens behind the reading column */
body:not([data-space="home"]) .veil{
  background:
    radial-gradient(ellipse 46% 58% at 50% 48%, rgba(5,5,5,.62), rgba(5,5,5,0) 100%),
    linear-gradient(to bottom, rgba(5,5,5,.45), rgba(5,5,5,0) 26%, rgba(5,5,5,0) 62%, rgba(5,5,5,.7));
}

/* ---- layer 2 : content ---- */
main{position:relative;z-index:var(--z-content);transition:opacity 1.4s ease}

/* ---- the waking : words arrive after the light ---- */
html.ils-waking main,
html.ils-waking .hud{opacity:0;pointer-events:none}
html.ils-waking .veil{opacity:0}
.veil{transition:opacity 1.6s ease}

.noscript{max-width:var(--ils-measure);margin:20vh auto;padding:0 var(--ils-gutter);text-align:center;color:var(--ils-ivory-dim)}

/* ---- shared keyframes ---- */
@keyframes ils-breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.1)}}
@keyframes ils-lattice-breathe{0%,100%{transform:translate(-50%,-50%) scale(1)}50%{transform:translate(-50%,-50%) scale(1.045)}}
@keyframes ils-live-pulse{
  0%  {box-shadow:0 0 0 0 rgba(201,162,39,.45)}
  70% {box-shadow:0 0 0 11px rgba(201,162,39,0)}
  100%{box-shadow:0 0 0 0 rgba(201,162,39,0)}
}
@keyframes ils-descend{from{opacity:0;transform:scale(.93) translateY(14px)}to{opacity:1;transform:none}}

@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto}
  *,*::before,*::after{animation:none !important;transition:none !important}
}
