/* global.css - custom utilities & animations for Genesis static site */

/* ── Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

h1, h2 { letter-spacing: -0.025em; }
h3 { letter-spacing: -0.015em; }

.font-serif { font-feature-settings: 'kern' 1, 'liga' 1, 'dlig' 1; }

/* ── Reveal animations ──────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.75s cubic-bezier(0.22,1,0.36,1), transform 0.75s cubic-bezier(0.22,1,0.36,1);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.75s cubic-bezier(0.22,1,0.36,1), transform 0.75s cubic-bezier(0.22,1,0.36,1);
}
.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.75s cubic-bezier(0.22,1,0.36,1), transform 0.75s cubic-bezier(0.22,1,0.36,1);
}
.reveal-scale {
  opacity: 0;
  transform: scale(0.93) translateY(10px);
  transition: opacity 0.75s cubic-bezier(0.22,1,0.36,1), transform 0.75s cubic-bezier(0.22,1,0.36,1);
}
.reveal.visible,
.reveal-left.visible,
.reveal-right.visible,
.reveal-scale.visible { opacity: 1; transform: none; }

/* ── Nav scroll glass ────────────────────────────────────────────────── */
#nav.scrolled {
  background: rgba(12, 10, 40, 0.88);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 4px 40px rgba(0,0,0,0.28);
}
#nav.scrolled #nav-menu {
  background: rgba(12, 10, 40, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: rgba(255,255,255,0.07);
}

/* Nav link underline */
.nav-link { position: relative; }
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0;
  width: 0; height: 1.5px;
  background: rgba(255,255,255,0.7);
  border-radius: 2px;
  transition: width 0.25s cubic-bezier(0.22,1,0.36,1);
}
.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

/* ── Grain overlay ───────────────────────────────────────────────────── */
.grain { position: relative; isolation: isolate; }
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 220px 220px;
  mix-blend-mode: overlay;
}

/* ── Card hover ──────────────────────────────────────────────────────── */
.card-hover {
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.22,1,0.36,1);
}
.card-hover:hover {
  border-color: rgba(91,77,184,0.35);
  box-shadow: 0 8px 32px rgba(30,27,75,0.1), 0 0 0 1px rgba(91,77,184,0.12);
  transform: translateY(-3px);
}

/* ── Shimmer ─────────────────────────────────────────────────────────── */
.shimmer-wrap { position: relative; overflow: hidden; }
.shimmer-wrap::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -75%;
  width: 50%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.07) 50%, transparent 100%);
  transform: skewX(-15deg);
  transition: left 0s;
}
.shimmer-wrap:hover::after { left: 150%; transition: left 0.65s ease-in-out; }

/* ── Float animations ────────────────────────────────────────────────── */
.animate-float-slow   { animation: float-slow   8s  ease-in-out infinite; }
.animate-float-medium { animation: float-medium 7s  ease-in-out infinite; }
.animate-float-drift  { animation: float-drift  11s ease-in-out infinite; }

/* ── Status pills ────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 9999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.status-pill::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 9999px;
  flex-shrink: 0;
}
.status-checking              { background: #F1F5F9; color: #64748B; }
.status-checking::before      { background: #94A3B8; }
.status-operational           { background: #F0FDF4; color: #15803D; }
.status-operational::before   { background: #22C55E; animation: pulse-green 2s infinite; }
.status-degraded              { background: #FFFBEB; color: #B45309; }
.status-degraded::before      { background: #F59E0B; }
.status-down                  { background: #FEF2F2; color: #B91C1C; }
.status-down::before          { background: #EF4444; }

#overall-banner.is-operational { border-color: #BBF7D0 !important; background: #F0FDF4 !important; }
#overall-banner.is-degraded    { border-color: #FDE68A !important; background: #FFFBEB !important; }
#overall-banner.is-down        { border-color: #FECACA !important; background: #FEF2F2 !important; }

/* ── FAQ accordion ───────────────────────────────────────────────────── */
.faq-body { overflow: hidden; transition: max-height 0.4s cubic-bezier(0.22,1,0.36,1); }

/* ── Keyframes ───────────────────────────────────────────────────────── */
@keyframes float-slow {
  0%, 100% { transform: translateY(0px) scale(1); }
  50%       { transform: translateY(-22px) scale(1.03); }
}
@keyframes float-medium {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-14px) rotate(3deg); }
  66%       { transform: translateY(9px) rotate(-2deg); }
}
@keyframes float-drift {
  0%, 100% { transform: translate(0,0) scale(1); }
  40%       { transform: translate(12px,-10px) scale(1.04); }
  75%       { transform: translate(-8px,6px) scale(0.97); }
}
@keyframes gradient-drift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(6px); }
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-left, .reveal-right, .reveal-scale {
    transition: none; opacity: 1; transform: none;
  }
  .animate-float-slow, .animate-float-medium, .animate-float-drift { animation: none; }
}
