/* Shared layer for every nkweb.gr page: page curtain, grain, sound toggle, cursor.
   Loaded by the story pages (with main.css) and injected into the Next.js pages. */

/* ---------- page curtain (arrival = pure CSS, departure = .nk-leave) ---------- */
html::after {
  content: ""; position: fixed; inset: 0; z-index: 2147483000; pointer-events: none;
  background: #0c0c0c url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 444 200'%3E%3Cpath fill='%23f1f2f2' d='M0 0H46V200H0ZM0 0H58L196 200H138ZM150 0H196V200H150ZM196 120V168L350 0H292ZM196 86V138L283 200H356Z'/%3E%3Ccircle cx='420' cy='177' r='23' fill='%23eaff52'/%3E%3C/svg%3E") center / 110px auto no-repeat;
  transform: translateY(101%);
}
html.nk-arrive::after { animation: nk-curtain-out .9s cubic-bezier(.76, 0, .24, 1) .12s both; }
html.nk-leave::after { animation: nk-curtain-in .5s cubic-bezier(.76, 0, .24, 1) both; }
@keyframes nk-curtain-out { from { transform: translateY(0); } to { transform: translateY(-101%); } }
@keyframes nk-curtain-in { from { transform: translateY(101%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  html.nk-arrive::after, html.nk-leave::after { animation: none; transform: translateY(101%); }
}

/* ---------- film grain + vignette ---------- */
.nk-grain {
  position: fixed; inset: -50%; z-index: 5; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: nk-grain 1s steps(6) infinite;
}
@keyframes nk-grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-4%, 3%); } 40% { transform: translate(3%, -5%); }
  60% { transform: translate(-6%, -2%); } 80% { transform: translate(5%, 4%); } 100% { transform: translate(0, 0); }
}

/* ---------- particle background behind the Next.js pages ---------- */
#nk-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 1.4s ease; }
#nk-bg.is-on { opacity: 1; }
html.nk-inner body { background: #0c0c0c; }
html.nk-inner .section-light, html.nk-inner .section-light-2, html.nk-inner .section-dark { background-color: transparent !important; }

/* ---------- sound toggle ---------- */
.nk-sound {
  position: fixed; z-index: 40; left: clamp(1rem, 4vw, 3.5rem); bottom: 1.5rem;
  display: inline-flex; align-items: center; gap: .7rem; height: 2.6rem; padding: 0 1rem;
  border: 1px solid rgba(241, 242, 242, .22); border-radius: 999px; background: rgba(12, 12, 12, .6);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #f1f2f2; cursor: pointer;
  font: 500 .68rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .14em; text-transform: uppercase;
  transition: border-color .3s, color .3s;
}
.nk-sound:hover { border-color: #eaff52; }
.nk-sound.is-playing { color: #eaff52; }
.nk-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.nk-eq i { width: 2px; height: 100%; background: currentColor; transform-origin: bottom; transform: scaleY(.25); }
.nk-sound.is-playing .nk-eq i { animation: nk-eq 1s cubic-bezier(.76, 0, .24, 1) infinite; }
.nk-eq i:nth-child(2) { animation-delay: -.3s !important; }
.nk-eq i:nth-child(3) { animation-delay: -.6s !important; }
.nk-eq i:nth-child(4) { animation-delay: -.15s !important; }
@keyframes nk-eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@media (max-width: 520px) { .nk-sound__label { display: none; } }

/* ---------- cursor (shared with the home page) ---------- */
#cursor-canvas { position: fixed; inset: 0; z-index: 2147482000; pointer-events: none; }
#cursor-glow {
  position: fixed; top: 0; left: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 255, 82, .12), rgba(234, 255, 82, .04) 45%, transparent 70%);
  z-index: 1; pointer-events: none; opacity: 0; transition: opacity .5s; will-change: transform;
}
#cursor-glow.is-active { opacity: 1; }
.cursor-label {
  position: fixed; top: 0; left: 0; z-index: 2147482001; pointer-events: none;
  padding: .45rem .8rem; border-radius: 999px; background: #eaff52; color: #0c0c0c;
  font: 500 .65rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .14em; text-transform: uppercase;
  transform: translate(-50%, -50%) scale(0); transition: transform .35s cubic-bezier(.16, 1, .3, 1);
}
.cursor-label.is-on { transform: translate(-50%, -50%) scale(1); }
html.has-cursor, html.has-cursor * { cursor: none !important; }

@media (prefers-reduced-motion: reduce) { .nk-grain, .nk-eq i { animation: none !important; } }
