/* ============================================================================
   Mirrento — shared design-system primitives (SINGLE SOURCE OF TRUTH)
   ----------------------------------------------------------------------------
   The pieces that must look identical on every surface: the iridescent palette,
   the ambient world/grain, the liquid-glass primitive, and the island nav.
   Loaded by index.html (landing) AND by the blog + FAQ pages, so neither keeps
   a private copy. Copies had already drifted — the blog nav lost position:fixed
   because .glass/.island were pasted in the wrong order on the copy.

   ⚠️ TOKEN INVERSION. index.html's :root uses --ink for LIGHT text on a dark
   --bg; blog.css's :root uses --ink for the DARK ground. So nothing here may
   lean on the page's :root for --ink. The .island scopes the light values it
   needs onto itself, so the nav renders the same in both worlds.

   ⚠️ ORDER. .glass{position:relative} must be declared BEFORE .island so that
   .island{position:fixed} wins at equal specificity. Do not reorder.
   ========================================================================== */

:root {
  --iridescent:      linear-gradient(120deg, #0a84ff 0%, #b78bff 38%, #ff6aa5 70%, #f4b454 100%);
  --iridescent-soft: linear-gradient(120deg, rgba(10,132,255,0.22), rgba(183,139,255,0.22) 45%, rgba(255,106,165,0.22) 75%, rgba(244,180,84,0.22));
}

/* ============== AMBIENT WORLD ============== */
/* The animated iridescent backdrop that gives glass something to refract. */
.world {
  position: fixed; inset: -10vh -10vw;
  z-index: -2; pointer-events: none;
  background:
    radial-gradient(50vw 50vh at 12% 8%,  rgba(10,132,255,0.40), transparent 60%),
    radial-gradient(50vw 50vh at 88% 22%, rgba(255,106,165,0.34), transparent 65%),
    radial-gradient(60vw 50vh at 25% 96%, rgba(183,139,255,0.38), transparent 70%),
    radial-gradient(45vw 40vh at 78% 88%, rgba(244,180,84,0.28), transparent 65%),
    #07070a;
  filter: saturate(120%);
  animation: drift 30s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-4%, -3%) scale(1.06); }
}
.grain {
  position: fixed; inset: 0;
  z-index: -1; pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .15 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============== VIVID LIQUID GLASS PRIMITIVE ============== */
.glass {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(var(--sat)) brightness(var(--bright));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat)) brightness(var(--bright));
  border: 1px solid var(--glass-edge);
  border-radius: 22px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.22) inset,
    0 -1px 0 rgba(255,255,255,0.04) inset,
    0 24px 56px -22px rgba(0,0,0,0.65),
    0 2px 6px -2px rgba(0,0,0,0.30);
  overflow: hidden;
  isolation: isolate;
}
.glass::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 50% at var(--mx, 30%) var(--my, 10%), rgba(255,255,255,0.28), transparent 60%),
    linear-gradient(135deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 30%);
  pointer-events: none;
  mix-blend-mode: screen;
  transition: background .25s;
}
/* Iridescent edge ring */
.glass::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--iridescent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.55;
  pointer-events: none;
}

/* ============== ISLAND NAV ============== */
/* Self-contained tokens so the pill renders identically on light-:root (home)
   and dark-:root (blog). Each page keeps its OWN island @media (the home hides
   the nav below 920px; the blog keeps it) — that divergence is real config, not
   duplication. */
.island {
  --ink:   #f5f5f7;
  --ink-2: rgba(245,245,247,0.78);
  --rec:   #ff3b30;
  --glass-bg: rgba(255,255,255,0.045);
  --glass-edge: rgba(255,255,255,0.16);
  --blur: 30px; --sat: 200%; --bright: 110%;
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex; align-items: center;
  padding: 8px 8px 8px 22px;
  border-radius: 999px;
  height: 54px;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.island a { text-decoration: none; }
.island .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter Tight", "Segoe UI", system-ui, sans-serif;
  font-weight: 600; font-size: 15px;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--ink);
  margin-right: 22px;
  white-space: nowrap;
}
.island .brand .rec {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rec);
  box-shadow: 0 0 0 3px rgba(255,59,48,0.22), 0 0 14px rgba(255,59,48,0.6);
  animation: rec 1.6s ease-in-out infinite;
}
.island nav { display: flex; gap: 2px; }
.island nav a {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.island nav a:hover { background: rgba(255,255,255,0.08); color: var(--ink); }

@keyframes rec { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

@media (prefers-reduced-motion: reduce) {
  .world { animation: none; }
  .island .brand .rec { animation: none; opacity: 1; }
}
