/**
 * FastUTM shared chrome (v1.15.0)
 *
 * The top bar (logo and water menu), the tool strip and button hovers.
 * Loaded last in every <head> by includes/chrome-head.php, and written
 * against #mainNav and #toolRail so these rules win over older copies
 * still inside page stylesheets.
 */

/* ------------------------------------------------------------------
 * Logo: glass reveal canvas over the plain mark
 * ------------------------------------------------------------------ */
#mainNav .logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  position: relative;
  z-index: 2;
}
#mainNav .fu-logo {
  position: relative;
  display: inline-block;
  width: 33px;
  height: 40px;
  flex: none;
}
#mainNav .fu-logo-still {
  display: block;
  width: 33px;
  height: 40px;
  transition: transform 0.35s cubic-bezier(.3, 1.6, .5, 1);
}
#mainNav .logo:hover .fu-logo-still { transform: translateY(-2px) rotate(-4deg); }
/* The canvas paints the page colour, so a soft round mask hides its square edge */
#mainNav .fu-logo-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 74%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 74%, transparent 100%);
}
#mainNav .fu-logo.is-live .fu-logo-still { visibility: hidden; }
#mainNav .logo-text {
  display: none;
  position: relative;
  z-index: 1;   /* above the reveal canvas, which overhangs the mark */
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
#mainNav .logo-text .accent { color: var(--accent); }
@media (min-width: 1100px) { #mainNav .logo-text { display: inline; } }
/* Older page styles animate or hide these; the partial no longer uses them */
#mainNav .logo-main, #mainNav #logoTextFallback { display: none !important; }

/* ------------------------------------------------------------------
 * Water menu
 * ------------------------------------------------------------------ */
#mainNav .nav-links.fu-water {
  --n-tint: rgba(255, 255, 255, .34);
  --n-fg: #0b132b;
  --n-fg-soft: rgba(11, 19, 43, .62);
  --n-rim: rgba(255, 255, 255, .75);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 2px;
  padding: 5px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
          backdrop-filter: none;
  isolation: isolate;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] #mainNav .nav-links.fu-water {
  --n-tint: rgba(10, 18, 40, .42);
  --n-fg: #f1f7ff;
  --n-fg-soft: rgba(241, 247, 255, .66);
  --n-rim: rgba(255, 255, 255, .30);
}
#mainNav .fu-water-glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -2;
  overflow: hidden;
  background: var(--n-tint);
  -webkit-backdrop-filter: blur(10px) saturate(1.2) brightness(1.08);
          backdrop-filter: blur(10px) saturate(1.2) brightness(1.08);
  box-shadow: inset 0 1px 1px var(--n-rim), inset 0 0 0 1px rgba(255, 255, 255, .22),
              0 12px 32px -14px rgba(0, 40, 90, .45), 0 2px 6px rgba(0, 40, 90, .08);
  pointer-events: none;
}
#mainNav .fu-water[data-refract="on"] .fu-water-glass {
  -webkit-backdrop-filter: url(#fu-refract) blur(2px) saturate(1.2) brightness(1.08);
          backdrop-filter: url(#fu-refract) blur(2px) saturate(1.2) brightness(1.08);
}
#mainNav .fu-water-canvas {
  position: absolute;
  left: -14px;
  top: -14px;
  z-index: -1;
  pointer-events: none;
}
#mainNav .fu-water[data-gl="off"] .fu-water-canvas { display: none; }
/* CSS drop for browsers without WebGL */
#mainNav .fu-water-drop {
  display: none;
  position: absolute;
  top: 5px;
  left: 0;
  height: 36px;
  border-radius: 999px;
  z-index: -1;
  pointer-events: none;
  will-change: transform, width;
  background: radial-gradient(120% 140% at 30% 0%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 55%), rgba(255, 255, 255, .42);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .95), inset 0 -2px 6px rgba(0, 162, 255, .22),
              inset 0 0 0 1px rgba(255, 255, 255, .55), 0 6px 16px -6px rgba(0, 70, 140, .45);
}
#mainNav .fu-water[data-gl="off"] .fu-water-drop { display: block; }
#mainNav .fu-svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Menu items */
#mainNav .fu-water .nav-item { position: relative; display: inline-flex; align-items: center; }
#mainNav .fu-water .nav-link-pill {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: none !important;
  color: var(--n-fg-soft);
  font-family: 'Nunito', sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transform: none !important;
  transition: color .25s;
}
#mainNav .fu-water .nav-link-pill:hover,
#mainNav .fu-water .nav-link-pill.active { color: var(--n-fg); }
#mainNav .fu-water .nav-link-pill.active { color: var(--accent); }
[data-theme="dark"] #mainNav .fu-water .nav-link-pill.active { color: #9cc0ff; }
#mainNav .fu-water .nav-link-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#mainNav .fu-water .nav-link-pill.has-dropdown::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 1px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: .6;
}

/* Icons and their little scenes (played on hover and tap) */
#mainNav .nv-ico { position: relative; display: inline-flex; flex: none; }
#mainNav .nv-ico svg { transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
#mainNav .nav-link-pill.active .nv-ico svg { transform: translateY(-1px) scale(1.08); }
#mainNav .nv-door { fill: transparent; }
#mainNav .nv-ico[data-play="pop"] svg { animation: fuPop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
#mainNav .nv-ico[data-play="spin"] svg { animation: fuSpin 1s cubic-bezier(.2, .75, .25, 1) both; }
#mainNav .nv-ico[data-play="glow"] svg { animation: fuHop .8s cubic-bezier(.3, 1.4, .5, 1) both; transform-origin: 50% 100%; }
#mainNav .nv-ico[data-play="glow"] .nv-door { animation: fuDoor 1.3s ease both; }
#mainNav .nv-ico[data-play="wave"] svg { animation: fuWave .9s ease-in-out both; transform-origin: 50% 92%; }
@keyframes fuPop { 0% { transform: scale(.72); } 60% { transform: scale(1.2); } 100% { transform: translateY(-1px) scale(1.08); } }
@keyframes fuSpin { 0% { transform: perspective(80px) rotateY(0); } 100% { transform: perspective(80px) rotateY(360deg) translateY(-1px) scale(1.08); } }
@keyframes fuHop { 0% { transform: none; } 30% { transform: translateY(-5px) scale(1.04, .96); } 55% { transform: translateY(0) scale(1.12, .88); } 75% { transform: translateY(-2px) scale(.98, 1.04); } 100% { transform: translateY(-1px) scale(1.08); } }
@keyframes fuDoor { 0% { fill: transparent; } 30% { fill: #fff3a8; } 100% { fill: rgba(126, 232, 255, .6); } }
@keyframes fuWave { 0% { transform: none; } 20% { transform: rotate(-15deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(4deg); } 100% { transform: translateY(-1px) scale(1.08); } }

/* Dropdowns: glass to match the pill */
#mainNav .fu-water .nav-dropdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 40px -18px rgba(0, 40, 90, .45), 0 2px 8px rgba(0, 0, 0, .06);
}

/* Account link (also on pages that carry their own styles) */
#mainNav .nav-account {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .82rem; text-decoration: none; white-space: nowrap;
  color: var(--accent, #2563eb); background: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .07); transition: background .2s, color .2s;
}
#mainNav .nav-account:hover { background: var(--accent, #2563eb); color: #fff; }
[data-theme="dark"] #mainNav .nav-account { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); }

/* Small screens: icons only, the pill scrolls if it must */
@media (max-width: 760px) {
  #mainNav .nav-links.fu-water { display: inline-flex !important; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  #mainNav .nav-links.fu-water::-webkit-scrollbar { display: none; }
  #mainNav .fu-water .nav-link-pill { padding: 0 12px; flex: 0 0 auto; }
  #mainNav .fu-water .nav-link-pill.has-dropdown::after { display: none; }
  #mainNav .fu-water .nv-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  #mainNav .fu-water .nav-dropdown { display: none !important; }
}
@media (max-width: 480px) {
  #mainNav .nav-account { height: 32px; padding: 0 10px; font-size: .78rem; }
  #mainNav .fu-water .nav-link-pill { height: 34px; padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #mainNav .nv-ico svg, #mainNav .nv-door, #mainNav .fu-logo-still { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------
 * Tool strip (includes/tool-rail.php)
 * ------------------------------------------------------------------ */
#toolRail {
  position: relative;
  z-index: 2;
  max-width: 1040px;
  margin: 0 auto 1.2rem;
  padding: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  opacity: 1;
  transform: none;
  animation: none;
  isolation: isolate;
  text-align: left;
}
/* main.css keeps the strip compact (names only, label and blurbs hidden
   with !important). They stay in the markup in case they are switched
   back on. */
#toolRail .tool-rail-label {
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  margin: 0 0 0.65rem;
}
#toolRail .tool-rail-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}
#toolRail .tool-rail-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.14rem;
  min-height: 0;
  padding: 0.75rem 0.6rem;
  text-align: center;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg2);
  color: var(--text-2);
  text-decoration: none;
  transition: border-color .2s, background .2s, transform .2s;
}
#toolRail .tool-rail-card:hover,
#toolRail .tool-rail-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
}
#toolRail .tool-rail-card strong { display: block; color: var(--text); font-size: 0.76rem; font-weight: 900; line-height: 1.2; }
#toolRail .tool-rail-card span { display: none; color: var(--text-2); font-size: 0.64rem; font-weight: 700; line-height: 1.25; }
#toolRail .tool-rail-card:hover strong, #toolRail .tool-rail-card:hover span,
#toolRail .tool-rail-card.active strong, #toolRail .tool-rail-card.active span { color: var(--accent); }
@media (max-width: 900px) {
  #toolRail { padding: 0.65rem; }
  #toolRail .tool-rail-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(140px, 1fr);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  #toolRail .tool-rail-grid::-webkit-scrollbar { display: none; }
  #toolRail .tool-rail-card { scroll-snap-align: start; }
}

/* ------------------------------------------------------------------
 * Buttons: the hover sweeps in a brighter accent behind the text
 * ------------------------------------------------------------------ */
.btn-primary, .btn-secondary { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary::before, .btn-secondary::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  transform: translateX(-101%);
  transition: transform .4s ease;
}
.btn-primary:hover::before, .btn-secondary:hover::before,
.btn-primary:focus-visible::before, .btn-secondary:focus-visible::before { transform: translateX(0); }
/* Solid blue buttons sweep to blue-violet, so the change is plain to see */
.btn-primary::before { background: linear-gradient(110deg, #1d4ed8 0%, #4f46e5 55%, #7c3aed 100%); }
.btn-primary:hover:not(:disabled) { color: #fff; box-shadow: 0 8px 22px -6px rgba(79, 70, 229, .55); }
/* Grey buttons sweep to a pale accent with accent text */
.btn-secondary::before { background: var(--accent-light); }
.btn-secondary:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.btn-secondary.btn-copy::before { background: #0891b2; }
.btn-secondary.btn-copy:hover { color: #fff; }
.btn-secondary.btn-reset::before { background: var(--red); }
.btn-secondary.btn-reset:hover { color: #fff; }
@media (prefers-reduced-motion: reduce) {
  .btn-primary::before, .btn-secondary::before { transition: none; }
}
