/* Liquid glass buttons, shared by every page (linked after each page's inline <style>).
   Covers .btn (+ .btn-primary / .btn-ghost), .nav-cta and the admin .icon-btn.

   Ported from the supplied "start-btn" glass box: a stack of inset rim-light shadows, a dark
   offset ring (:before) and diagonal corner glints (:after). Colours are retuned for this
   dark theme, and the .fx-layer { filter: contrast(3) } wrapper is left out — it was there to
   punch up a light page and would blow out every colour on a dark one. */

.btn, .nav-cta, .icon-btn {
  --tr: 14%;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-hover: rgba(255, 255, 255, 0.02);
  --edge: rgba(0, 0, 0, 0.30);
  --rim: rgba(255, 255, 255, 0.10);
  position: relative;
  isolation: isolate;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  border-radius: 9999px;
  border: 1px double var(--rim);
  background: var(--glass);
  -webkit-backdrop-filter: blur(4px) saturate(150%);
  backdrop-filter: blur(4px) saturate(150%);
  box-shadow:
    inset 2px -2px 1px -1px rgba(255, 255, 255, 0.9),
    inset -2px 2px 1px -1px rgba(255, 255, 255, 0.9),
    inset 6px -6px 1px -6px rgba(255, 255, 255, 0.55),
    inset -6px 6px 1px -6px rgba(255, 255, 255, 0.55),
    inset 0 0 2px rgba(0, 0, 0, 0.8),
    0 4px 8px var(--edge);
  transition: transform 0.25s, background 0.25s, box-shadow 0.25s, border-color 0.25s;
}

/* the page's own hover rules set a solid background; re-assert the glass one on every state */
.btn, .nav-cta, .icon-btn { background: var(--glass); }
.btn:hover, .nav-cta:hover, .icon-btn:hover, .icon-btn.save:hover {
  background: var(--glass-hover);
  border-color: var(--rim);
  transform: translateY(-3px);
  color: var(--wool);
}
.btn:active, .nav-cta:active, .icon-btn:active {
  transform: scale(0.94);
}

/* dark offset ring sitting under the button, behind its text */
.btn::before, .nav-cta::before, .icon-btn::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.9);
  filter: blur(8px);
  pointer-events: none;
}

/* soft diagonal corner glints */
.btn::after, .nav-cta::after, .icon-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 9999px;
  filter: blur(7px);
  pointer-events: none;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.5) 0%,
    transparent var(--tr),
    transparent calc(100% - var(--tr)),
    rgba(255, 255, 255, 0.5) 100%
  );
}

/* variants: same neutral glass, just a bit more fill on the emphasised buttons */
.btn.btn-primary {
  --glass: rgba(255, 255, 255, 0.16);
  --glass-hover: rgba(255, 255, 255, 0.09);
  --rim: rgba(255, 255, 255, 0.22);
  color: var(--wool);
}

.nav-cta {
  --glass: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.04);
  --rim: rgba(255, 255, 255, 0.16);
}

.icon-btn.save {
  --glass: rgba(255, 255, 255, 0.12);
  --glass-hover: rgba(255, 255, 255, 0.06);
  --rim: rgba(255, 255, 255, 0.20);
  color: var(--wool);
}

.btn:focus-visible, .nav-cta:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.65);
  outline-offset: 3px;
}

/* browsers without backdrop-filter: a touch more fill so it still reads as a pane */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .btn, .nav-cta, .icon-btn { --glass: rgba(255, 255, 255, 0.10); }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .nav-cta, .icon-btn { transition: none; }
  .btn:hover, .nav-cta:hover, .icon-btn:hover, .btn:active, .nav-cta:active, .icon-btn:active { transform: none; }
}
