/* =========================================================================
   Wizards Services — "beyond the third dimension"
   Self-contained. Decorative WebGL/4D layers degrade gracefully.
   ========================================================================= */

:root {
  --void:      #05030f;
  --void-2:    #0a0720;
  --ink:       #ece9ff;
  --muted:     #9d97c9;
  --violet:    #8b5cf6;
  --cyan:      #22d3ee;
  --magenta:   #ec4899;
  --glass:     rgba(20, 16, 48, 0.45);
  --glass-edge: rgba(160, 140, 255, 0.28);
  --max:       1120px;
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--void);
  color: var(--ink);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

/* Fallback animated background when WebGL is unavailable (.no-webgl on <body>
   is removed by scene.js once the GPU layer initialises). */
body.no-webgl {
  background:
    radial-gradient(60rem 40rem at 75% -10%, rgba(139, 92, 246, 0.35), transparent 60%),
    radial-gradient(50rem 35rem at 5% 15%, rgba(34, 211, 238, 0.20), transparent 55%),
    radial-gradient(45rem 35rem at 90% 90%, rgba(236, 72, 153, 0.18), transparent 55%),
    var(--void);
  background-attachment: fixed;
  animation: drift 24s var(--ease) infinite alternate;
}
@keyframes drift { to { background-position: 6% -4%, -4% 6%, 4% -6%, 0 0; } }

/* ---- Decorative layers --------------------------------------------------*/
#hyperspace {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
}
body.no-webgl #hyperspace { display: none; }

.grain {
  position: fixed;
  inset: -50%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

#cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 460px; height: 460px;
  margin: -230px 0 0 -230px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.06) 40%, transparent 70%);
  mix-blend-mode: screen;
  transition: opacity 0.4s var(--ease);
  opacity: 0;
  will-change: transform;
}

/* ---- Nav -----------------------------------------------------------------*/
.nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.6rem 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
}
.brand-glyph {
  font-size: 1.3rem;
  background: linear-gradient(120deg, var(--cyan), var(--violet), var(--magenta));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.6));
}
.brand-glyph.small { font-size: 1.1rem; }
.accent { color: var(--cyan); }
.nav-links { display: flex; align-items: center; gap: 1.8rem; font-size: 0.95rem; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color 0.25s var(--ease); }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  color: var(--ink) !important;
  border: 1px solid var(--glass-edge);
  padding: 0.45rem 1.05rem;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.nav-cta:hover { border-color: var(--cyan); box-shadow: 0 0 22px rgba(34, 211, 238, 0.35); }

/* ---- Hero ----------------------------------------------------------------*/
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem 6rem;
  overflow: hidden;
}
.tesseract {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -52%);
  width: min(760px, 96vw);
  height: min(760px, 96vw);
  z-index: 1;
  pointer-events: none;
  opacity: 0.92;
}
.hero-content { position: relative; z-index: 2; max-width: 46rem; }
/* Soft dark halo so hero text stays legible over any shader brightness */
.hero-content::before {
  content: "";
  position: absolute;
  inset: -22% -18%;
  z-index: -1;
  background: radial-gradient(60% 58% at 50% 48%, rgba(5, 3, 15, 0.78), rgba(5, 3, 15, 0.0) 72%);
  filter: blur(12px);
  pointer-events: none;
}
.kicker, .lede { text-shadow: 0 2px 18px rgba(5, 3, 15, 0.8); }
.title-line:first-child { text-shadow: 0 4px 30px rgba(5, 3, 15, 0.7); }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  color: var(--cyan);
  margin-bottom: 1.6rem;
  text-shadow: 0 0 18px rgba(34, 211, 238, 0.5);
}
.title {
  font-size: clamp(2.8rem, 11vw, 6.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.title-line { display: block; }
.title-line:nth-child(2) {
  background: linear-gradient(110deg, var(--cyan), var(--violet) 55%, var(--magenta));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 28px rgba(139, 92, 246, 0.45));
}
.title .accent { -webkit-text-fill-color: var(--cyan); }
.lede {
  margin: 1.8rem auto 0;
  max-width: 34rem;
  font-size: 1.18rem;
  color: var(--muted);
}
.lede em { color: var(--ink); font-style: normal; }

.cta-row { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 2.6rem; }

/* Buttons */
.btn {
  --b: 1px;
  position: relative;
  display: inline-block;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease);
  isolation: isolate;
}
.btn-lg { padding: 1.05rem 2.3rem; font-size: 1.1rem; letter-spacing: 0.01em; }
.btn-primary {
  color: #07041a;
  background: linear-gradient(110deg, var(--cyan), var(--violet) 60%, var(--magenta));
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 55px rgba(139, 92, 246, 0.6); }
.btn-ghost {
  color: var(--ink);
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--cyan); box-shadow: 0 0 30px rgba(34, 211, 238, 0.3); }

.scroll-hint {
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  z-index: 2;
}
.scroll-hint span {
  position: absolute; left: 50%; top: 8px;
  width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--cyan);
  animation: scrolldot 1.8s var(--ease) 6;  /* pulses a few times, then stops — no perpetual repaint */
}
@keyframes scrolldot { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(16px); } }

/* ---- Sections ------------------------------------------------------------*/
section { position: relative; z-index: 2; }
.section-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.72rem;
  color: var(--violet);
  text-align: center;
  margin-bottom: 0.9rem;
}
.section-title {
  text-align: center;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 3rem;
}

.capabilities { max-width: var(--max); margin: 0 auto; padding: 7rem 1.5rem; }

/* 3D tilt grid */
.tilt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.6rem;
  perspective: 1200px;
}
.card {
  position: relative;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform-style: preserve-3d;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
  will-change: transform;
  outline: none;
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(34,211,238,0.6), transparent 40%, transparent 60%, rgba(236,72,153,0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.card:hover, .card:focus-visible {
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.25);
  border-color: transparent;
}
.card:hover::before, .card:focus-visible::before { opacity: 1; }
.card-depth { padding: 2.2rem; transform: translateZ(40px); transform-style: preserve-3d; }
.card-rune {
  font-size: 2rem;
  margin-bottom: 1.1rem;
  background: linear-gradient(120deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.5));
}
.card h3 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.card-sub { color: var(--cyan); font-size: 0.85rem; letter-spacing: 0.04em; margin-bottom: 0.9rem; }
.card p:last-child { color: var(--muted); }

/* Manifesto */
.manifesto { max-width: 52rem; margin: 0 auto; padding: 5rem 1.5rem; }
.manifesto blockquote {
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  line-height: 1.5;
  text-align: center;
  font-weight: 300;
  color: var(--ink);
}
.accent-text {
  background: linear-gradient(110deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-weight: 600;
}

/* ---- Clients (names) -----------------------------------------------------*/
.clients { max-width: var(--max); margin: 0 auto; padding: 6rem 1.5rem 4rem; }
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.4rem;
}
.client-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 150px;
  padding: 1.8rem 1.4rem;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: center;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.client-box:hover {
  transform: translateY(-4px);
  border-color: var(--cyan);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 30px rgba(34, 211, 238, 0.22);
}
.client-name { font-size: 1.3rem; font-weight: 700; color: var(--ink); line-height: 1.25; }
.client-tag {
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan);
  padding: 0.12rem 0.55rem; border: 1px solid var(--glass-edge); border-radius: 999px;
}
.clients-note { text-align: center; color: var(--muted); margin-top: 2.4rem; font-size: 1.05rem; }
.clients-note a { color: var(--cyan); text-decoration: none; }
.clients-note a:hover { text-decoration: underline; }

/* ---- Story lede ----------------------------------------------------------*/
.story-lede {
  max-width: 40rem; margin: 0 auto 3rem; text-align: center;
  font-size: 1.18rem; color: var(--muted); line-height: 1.7;
}

/* ---- Sign-book (guestbook) ----------------------------------------------*/
.signbook { max-width: 52rem; margin: 0 auto; padding: 5rem 1.5rem; }
.signbook-lede { text-align: center; color: var(--muted); font-size: 1.1rem; margin-bottom: 2.4rem; }
.gb-form {
  max-width: 36rem; margin: 0 auto 3.5rem;
  display: flex; flex-direction: column; gap: 0.9rem;
}
.gb-row input, .gb-row textarea {
  width: 100%;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  background: rgba(10, 7, 32, 0.55);
  border: 1px solid var(--glass-edge);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.gb-row input::placeholder, .gb-row textarea::placeholder { color: var(--muted); }
.gb-row input:focus, .gb-row textarea:focus {
  outline: none; border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.gb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.gb-actions { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.gb-actions .btn { cursor: pointer; border: none; }
.gb-status { color: var(--cyan); font-size: 0.92rem; margin: 0; }

.gb-entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
}
.gb-empty { text-align: center; color: var(--muted); grid-column: 1 / -1; }
.gb-card {
  margin: 0;
  padding: 1.6rem;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.gb-msg { color: var(--ink); font-size: 1.02rem; line-height: 1.55; margin-bottom: 1rem; }
.gb-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.gb-name { color: var(--cyan); font-weight: 600; }
.gb-date { color: var(--muted); font-size: 0.8rem; }

/* ---- Story / timeline ----------------------------------------------------*/
.story { max-width: 60rem; margin: 0 auto; padding: 5rem 1.5rem; }
.timeline {
  list-style: none;
  position: relative;
  margin: 0 auto;
  padding-left: 2rem;
  max-width: 46rem;
}
.timeline::before {
  content: "";
  position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--cyan), var(--violet), var(--magenta));
  opacity: 0.5;
}
.tl-item { position: relative; padding: 0 0 2.6rem 0.4rem; }
.tl-item::before {
  content: "";
  position: absolute; left: -2rem; top: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--void);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.6);
}
.tl-item:last-child { padding-bottom: 0; }
.tl-era {
  display: inline-block;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 0.4rem;
}
.tl-item h3 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.tl-item p { color: var(--muted); }

/* Contact */
.contact { max-width: 46rem; margin: 0 auto; padding: 6rem 1.5rem 8rem; text-align: center; }
.contact-lede { color: var(--muted); font-size: 1.15rem; margin-bottom: 2.4rem; }
.ct-form { max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column; gap: 0.9rem; text-align: left; }
.ct-form input, .ct-form textarea {
  width: 100%;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  background: rgba(10, 7, 32, 0.55);
  border: 1px solid var(--glass-edge);
  color: var(--ink);
  font: inherit; font-size: 1rem; resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.ct-form input::placeholder, .ct-form textarea::placeholder { color: var(--muted); }
.ct-form input:focus, .ct-form textarea:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.ct-form .btn { align-self: flex-start; cursor: pointer; border: none; margin-top: 0.3rem; }
.ct-status { color: var(--cyan); font-size: 0.92rem; margin: 0.2rem 0 0; min-height: 1.2em; }

/* Footer */
.site-footer {
  position: relative; z-index: 2;
  border-top: 1px solid rgba(160, 140, 255, 0.14);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  padding: 3rem 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.noscript-note {
  position: relative; z-index: 5;
  max-width: var(--max); margin: 0.5rem auto;
  padding: 0.75rem 1.5rem; color: var(--muted); font-size: 0.85rem; text-align: center;
}

/* ---- Custom scrollbar ----------------------------------------------------*/
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--violet), var(--cyan)); border-radius: 999px; }

/* ---- Reduced motion ------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .scroll-hint span { display: none; }
}

/* ---- Small screens -------------------------------------------------------*/
@media (max-width: 640px) {
  .nav-links { gap: 1rem; font-size: 0.85rem; }
  .nav-links a:not(.nav-cta) { display: none; }
  .tesseract { opacity: 0.7; }
  .card-depth { padding: 1.7rem; }
}
