/* ============================================================
   glass.css  — frosted-glass surfaces + z-planes (the v3 layer)
   Rules:
   3 z-planes:
     - z0: ink + drifting gradient blobs (ambient-blobs)
     - z1: glass panels (frosted, tinted gold or teal by mood)
     - z2: foreground text + CTAs (no blur over them; full opacity)
   WCAG AA: small/body text never sits over a heavy blur without
   a solid-enough backing — glass panels use rgba >= 0.40 ink base
   layered with the frost, or text sits on solid ink behind glass.
   ============================================================ */

/* Core frosted-glass panel */
.glass {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03) 40%, rgba(255,255,255,0.02)),
    var(--ink-700); /* solid-enough backing keeps text AA-legible */
  background-blend-mode: screen, normal;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  backdrop-filter: blur(28px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.15),    /* top inner highlight */
    inset 0 -1px 0 rgba(255,255,255,0.04),
    0 18px 48px -24px rgba(0,0,0,0.7);       /* depth shadow */
}

/* ---- LIGHT theme adjustments ----
   Cream surface + dark inner edge (sunken-glass feel) so dark text reads. */
:root[data-theme="light"] .glass {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.55) 40%, rgba(255,255,255,0.40)),
    var(--ink-700);
  background-blend-mode: normal, normal;
  border-color: rgba(168, 133, 58, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.7),
    inset 0 -1px 0 rgba(168, 133, 58, 0.10),
    0 18px 44px -28px rgba(110, 86, 33, 0.35);
}

/* Mood variants — faint accent tint */
.glass--gold {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
    var(--glass-gold-tint),
    rgba(var(--ink-700-rgb), 0.72);
  background-blend-mode: screen, normal, normal;
  border-color: rgba(255,255,255,0.14);
}
.glass--teal {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
    var(--glass-teal-tint),
    rgba(var(--ink-700-rgb), 0.72);
  background-blend-mode: screen, normal, normal;
  border-color: rgba(var(--silver-rgb), 0.28);
}

/* Lighter variant for chips/pills where ink backing is enough */
.glass--thin {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.10);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
}

/* Convex edge sheen for "physical pane of glass" feel */
.glass--sheen::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.14), transparent 30%, transparent 70%, rgba(255,255,255,0.06));
  mix-blend-mode: overlay;
  opacity: 0.7;
}

/* Nav bar — frosted from scroll 0, low opacity at top, intensifies on scroll.
   .is-scrolled toggled by JS at scrollY > 24px */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: background var(--dur) var(--ease-soft),
              box-shadow var(--dur) var(--ease-soft),
              border-color var(--dur) var(--ease-soft);
  background: linear-gradient(180deg, rgba(var(--ink-900-rgb),0.55), rgba(var(--ink-900-rgb),0.20));
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav.is-scrolled {
  background: linear-gradient(180deg, rgba(var(--ink-800-rgb),0.78), rgba(var(--ink-800-rgb),0.62));
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  border-bottom-color: rgba(255,255,255,0.10);
  box-shadow: 0 10px 30px -18px rgba(0,0,0,0.8);
}

/* Glass buttons */
.btn {
  --btn-pad-y: 0.85em;
  --btn-pad-x: 1.6em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: transform var(--dur-fast) var(--ease-precise),
              background var(--dur-fast) var(--ease-precise),
              box-shadow var(--dur) var(--ease-soft),
              border-color var(--dur-fast) var(--ease-precise);
  cursor: pointer;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn--primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--ink-900);
  box-shadow: 0 8px 24px -8px rgba(var(--silver-rgb), 0.35),
              inset 0 1px 0 rgba(255,255,255,0.4);
}
/* In dark theme the primary "ink" accent is near-white, so the button
   background reads light — its text must invert to dark. */
:root:not([data-theme="light"]) .btn--primary { color: #0E0E0F; }
:root[data-theme="light"] .btn--primary { color: #FAFAFA; }

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -10px rgba(var(--silver-rgb), 0.5),
              inset 0 1px 0 rgba(255,255,255,0.5);
}

.btn--ghost {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.18);
  color: var(--fg-100);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
}
:root[data-theme="light"] .btn--ghost {
  background: rgba(26,26,26,0.04);
  border-color: rgba(26,26,26,0.22);
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(var(--silver-rgb), 0.55);
  transform: translateY(-2px);
}
:root[data-theme="light"] .btn--ghost:hover {
  background: rgba(26,26,26,0.08);
  border-color: rgba(26,26,26,0.55);
}

/* Contact chips (mailto/tel/instagram) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.7em 1.1em;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  color: var(--fg-200);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform var(--dur-fast) var(--ease-precise),
              border-color var(--dur-fast) var(--ease-precise),
              background var(--dur-fast) var(--ease-precise);
}
.chip:hover {
  transform: translateY(-2px);
  border-color: rgba(228,201,122,0.45);
  background: rgba(255,255,255,0.07);
  color: var(--fg-100);
}

/* ============================================================
   Approach panel — extended glass surface
   No special "sticky" tier: just a heavier corner radius and a
   slightly denser blur layer over ink-700. Inherits mood tint
   from .glass--gold / --teal where applied via class.
   ============================================================ */
.glass--sticky {
  border-radius: 22px;
  -webkit-backdrop-filter: blur(32px) saturate(170%);
  backdrop-filter: blur(32px) saturate(170%);
  padding: clamp(1.5rem, 3vw, 2.6rem);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.14),
    inset 0 -1px 0 rgba(var(--silver-rgb), 0.10),
    0 22px 56px -28px rgba(0,0,0,0.75);
}

/* ============================================================
   Palette constraints — keep surfaces monochrome only
   These rules act AFTER mood tint: regardless of which tint or
   blend mode is applied on .glass--gold / --teal, the brand
   palette restricts both surfaces and decorative elements to
   ink / silver / white. No gold-warmth leak, no teal leak.
   ============================================================ */

/* Forced-contrast users: pin to ink-700 (black on light,
   near-black on dark) so text never sits on a tinted wash. */
@media (prefers-contrast: more) {
  .glass, .glass--gold, .glass--teal, .glass--sticky {
    background: var(--ink-700) !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-blend-mode: normal;
  }
}

/* Touch devices: keep blur — cheap enough on modern mobile —
   surfaces remain ink-anchored for legibility. */
@media (hover: none) and (pointer: coarse) {
  .glass, .glass--gold, .glass--teal, .nav, .glass--sticky {
    /* no overrides — blur kept; tint remains subtle silver wash */
  }
}

/* ============================================================
   Reduced motion — palette + accessibility, no special tint
   Blob drift stops; blur layers are *flattened* (no frost) but
   the surface itself stays a clean ink-700 panel so text stays
   AA-legible without the need for "warm-tinted fallbacks".
   Renders as: dark theme -> near-black panel; light theme ->
   near-white panel. Pure brand monochrome.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; opacity: 0.35; }
  .blob--gold2 { display: none; }
  .glass, .glass--gold, .glass--teal, .glass--sticky,
  .nav, .btn--ghost, .chip, .glass--thin {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--ink-700);
    background-blend-mode: normal;
  }
  .glass--gold { background: var(--ink-700); }
  .glass--teal { background: var(--ink-700); }
  /* keep brand-appropriate border accent — silver hairline */
  .glass--gold { border-color: rgba(var(--silver-rgb), 0.35); }
  .glass--teal { border-color: rgba(var(--silver-rgb), 0.35); }
  .nav.is-scrolled { background: var(--ink-800); }
}
