/*
 * Summit Techniques: animated loaders, matte glassmorphism, retro, and navbar
 * patterns. These build on the design tokens in docs.css and the `s-` component
 * classes in components.css. Everything is token-themed and works in both
 * light and dark.
 */

/* ---- Animated logo loaders ------------------------------------------ */
.s-logo-loader { display: inline-grid; place-items: center; }
.s-logo-loader svg { width: 100%; height: 100%; display: block; overflow: visible; }
.s-logo-loader { width: 48px; height: 48px; }
.s-logo-loader.s-lg { width: 72px; height: 72px; }
.s-logo-loader.s-sm { width: 32px; height: 32px; }

/* Pulse: the mountain breathes while the peak star bobs. */
.s-logo-pulse .peak { fill: var(--logo); animation: s-peak-pulse 1.5s ease-in-out infinite; transform-origin: center bottom; }
.s-logo-pulse .sun { fill: var(--accent); animation: s-sun-bob 1.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes s-peak-pulse { 0%, 100% { opacity: 1; transform: scaleY(1); } 50% { opacity: 0.55; transform: scaleY(0.94); } }
@keyframes s-sun-bob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-2.5px) rotate(8deg); } }

/* Draw: the mountain outline redraws itself on a loop. */
.s-logo-draw .peak-outline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 66; animation: s-draw 2.4s ease-in-out infinite; }
.s-logo-draw .sun { fill: var(--accent); opacity: 0; animation: s-sun-blink 2.4s ease-in-out infinite; }
@keyframes s-draw { 0% { stroke-dashoffset: 66; } 55%, 100% { stroke-dashoffset: -66; } }
@keyframes s-sun-blink { 0%, 45% { opacity: 0; transform: scale(0.4); } 60% { opacity: 1; transform: scale(1); } 100% { opacity: 1; transform: scale(1); } }

/* Orbit: a ring sweeps around the resting mark. */
.s-logo-orbit { position: relative; }
.s-logo-orbit .peak { fill: var(--logo); }
.s-logo-orbit .sun { fill: var(--accent); }
.s-logo-orbit::after { content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent); animation: s-spin 0.9s linear infinite; }
@keyframes s-spin { to { transform: rotate(360deg); } }

/* ---- Dot and bar loaders -------------------------------------------- */
.s-dots { display: inline-flex; gap: 0.35rem; align-items: center; }
.s-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: s-dot-bounce 1.2s ease-in-out infinite; }
.s-dots span:nth-child(2) { animation-delay: 0.15s; }
.s-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes s-dot-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-6px); opacity: 1; } }

.s-bar { position: relative; width: 100%; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.s-bar::after { content: ""; position: absolute; top: 0; left: 0; height: 100%; width: 40%; border-radius: 999px;
  background: var(--accent); animation: s-bar-slide 1.3s ease-in-out infinite; }
@keyframes s-bar-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* ---- Skeleton helpers (pulse, no gradient) -------------------------- */
.s-skel-text { height: 0.8rem; border-radius: 6px; background: var(--surface-2); animation: s-skel 1.5s ease-in-out infinite; }
.s-skel-title { height: 1.15rem; border-radius: 7px; background: var(--surface-2); animation: s-skel 1.5s ease-in-out infinite; }
.s-skel-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); animation: s-skel 1.5s ease-in-out infinite; flex: none; }
.s-skel-block { height: 120px; border-radius: 12px; background: var(--surface-2); animation: s-skel 1.5s ease-in-out infinite; }
@keyframes s-skel { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---- Matte glassmorphism -------------------------------------------- */
.s-glass { background: color-mix(in srgb, var(--surface) 55%, transparent); backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18); }
/* Matte: heavier frost, lower saturation, a faint top hairline. No gloss. */
.s-glass-matte { background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(22px) saturate(1.05) brightness(1.02);
  -webkit-backdrop-filter: blur(22px) saturate(1.05) brightness(1.02); border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: 16px; box-shadow: 0 1px 0 color-mix(in srgb, #fff 25%, transparent) inset, 0 16px 44px rgba(15, 23, 42, 0.16); }
:root[data-theme="dark"] .s-glass-matte { box-shadow: 0 1px 0 color-mix(in srgb, #fff 8%, transparent) inset, 0 16px 44px rgba(0, 0, 0, 0.45); }
/* A stage to show the blur against: solid color blobs, no gradients. */
.s-glass-stage { position: relative; overflow: hidden; border-radius: 16px; padding: 2.2rem 1.5rem; background: var(--surface-2); isolation: isolate; }
.s-glass-stage .blob { position: absolute; border-radius: 50%; filter: blur(2px); z-index: -1; opacity: 0.85; }
.s-glass-stage .b1 { width: 140px; height: 140px; background: #0d9488; top: -30px; left: -20px; }
.s-glass-stage .b2 { width: 120px; height: 120px; background: #e11d48; bottom: -30px; right: 10px; }
.s-glass-stage .b3 { width: 90px; height: 90px; background: #f59e0b; top: 20px; right: 30%; opacity: 0.7; }

/* ---- Retro -------------------------------------------------------- */
.s-retro { border: 2px solid var(--text); border-radius: 6px; background: var(--surface); box-shadow: 6px 6px 0 var(--accent);
  padding: 1.1rem 1.25rem; font-family: var(--mono); }
.s-retro-btn { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--mono); font-weight: 700; font-size: 0.9rem;
  padding: 0.5rem 1rem; border: 2px solid var(--text); border-radius: 6px; background: var(--accent); color: #06211d; cursor: pointer;
  box-shadow: 4px 4px 0 var(--text); transition: transform 0.05s ease, box-shadow 0.05s ease; }
.s-retro-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--text); }
.s-retro-tag { display: inline-block; font-family: var(--mono); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem; border: 2px solid var(--text); border-radius: 4px; background: var(--surface); }
.s-neon { color: var(--accent-2); text-shadow: 0 0 6px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 16px color-mix(in srgb, var(--accent) 40%, transparent); font-family: var(--mono); font-weight: 700; }

/* ---- Navbar patterns ------------------------------------------------ */
.s-navbar { display: flex; align-items: center; gap: 1rem; padding: 0.6rem 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.s-navbar-brand { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font); font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.s-navbar-brand svg { width: 22px; height: 18px; }
.s-navbar-brand .dot { color: var(--accent); }
.s-navbar-links { display: flex; align-items: center; gap: 0.3rem; margin-left: 0.5rem; }
.s-navbar-link, a.s-navbar-link { padding: 0.35rem 0.6rem; border-radius: 8px; color: var(--muted); font-size: 0.9rem; font-weight: 550; cursor: pointer; }
.s-navbar-link:hover, a.s-navbar-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.s-navbar-link.is-active, a.s-navbar-link.is-active { color: var(--accent-2); background: var(--accent-soft); }
.s-navbar-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 0.5rem; }
.s-navbar-toggle { display: none; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; color: var(--text); }
.s-navbar-mobile { display: none; flex-direction: column; gap: 0.2rem; padding: 0.5rem; margin-top: 0.4rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.s-navbar-mobile.is-open { display: flex; }
/* Collapse into a mobile menu on narrow screens. */
@media (max-width: 560px) {
  .s-navbar-links { display: none; }
  .s-navbar-toggle { display: inline-grid; place-items: center; }
}

/* ---- Loader gallery ------------------------------------------------- */
/* Dual ring */
.s-load-dual { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent); border-bottom-color: var(--accent); animation: s-spin 1s linear infinite; }
/* Dashed ring */
.s-load-dash { width: 38px; height: 38px; border-radius: 50%; border: 3px dashed var(--accent); animation: s-spin 3s linear infinite; }
/* Arc ring (solid half-accent border) */
.s-load-arc { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent); border-right-color: var(--accent); animation: s-spin 0.85s linear infinite; }
/* Equalizer bars */
.s-load-bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 32px; }
.s-load-bars span { width: 5px; height: 100%; background: var(--accent); border-radius: 2px; transform-origin: bottom; animation: s-eq 1s ease-in-out infinite; }
.s-load-bars span:nth-child(2) { animation-delay: 0.15s; }
.s-load-bars span:nth-child(3) { animation-delay: 0.3s; }
.s-load-bars span:nth-child(4) { animation-delay: 0.45s; }
.s-load-bars span:nth-child(5) { animation-delay: 0.2s; }
@keyframes s-eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
/* Pulse circle */
.s-load-pulse { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); animation: s-pulse-scale 1.2s ease-in-out infinite; }
@keyframes s-pulse-scale { 0%, 100% { transform: scale(0.55); opacity: 0.6; } 50% { transform: scale(1); opacity: 1; } }
/* Ripple */
.s-load-ripple { position: relative; width: 44px; height: 44px; }
.s-load-ripple span { position: absolute; inset: 0; border: 3px solid var(--accent); border-radius: 50%; animation: s-ripple 1.4s cubic-bezier(0, 0.2, 0.8, 1) infinite; }
.s-load-ripple span:nth-child(2) { animation-delay: 0.7s; }
@keyframes s-ripple { 0% { transform: scale(0.1); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
/* Orbiting dot */
.s-load-orbit { position: relative; width: 40px; height: 40px; animation: s-spin 1.1s linear infinite; }
.s-load-orbit::before { content: ""; position: absolute; top: 0; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--accent); }
/* Nine-square grid */
.s-load-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 38px; height: 38px; }
.s-load-grid span { background: var(--accent); border-radius: 2px; animation: s-fade 1.3s ease infinite; }
.s-load-grid span:nth-child(1) { animation-delay: 0s; }
.s-load-grid span:nth-child(2), .s-load-grid span:nth-child(4) { animation-delay: 0.1s; }
.s-load-grid span:nth-child(3), .s-load-grid span:nth-child(5), .s-load-grid span:nth-child(7) { animation-delay: 0.2s; }
.s-load-grid span:nth-child(6), .s-load-grid span:nth-child(8) { animation-delay: 0.3s; }
.s-load-grid span:nth-child(9) { animation-delay: 0.4s; }
@keyframes s-fade { 0%, 70%, 100% { opacity: 0.2; } 35% { opacity: 1; } }
/* Wave dots */
.s-load-wave { display: inline-flex; gap: 4px; align-items: center; }
.s-load-wave span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: s-wave 1s ease-in-out infinite; }
.s-load-wave span:nth-child(2) { animation-delay: 0.1s; }
.s-load-wave span:nth-child(3) { animation-delay: 0.2s; }
.s-load-wave span:nth-child(4) { animation-delay: 0.3s; }
.s-load-wave span:nth-child(5) { animation-delay: 0.4s; }
@keyframes s-wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
/* Flip square */
.s-load-flip { width: 32px; height: 32px; background: var(--accent); border-radius: 3px; animation: s-flip 1.2s ease-in-out infinite; }
@keyframes s-flip { 0% { transform: perspective(90px) rotateX(0) rotateY(0); } 50% { transform: perspective(90px) rotateX(180deg) rotateY(0); } 100% { transform: perspective(90px) rotateX(180deg) rotateY(180deg); } }
/* Bounce two */
.s-load-bounce { position: relative; width: 40px; height: 40px; }
.s-load-bounce span { position: absolute; inset: 0; border-radius: 50%; background: var(--accent); opacity: 0.6; animation: s-bounce2 2s ease-in-out infinite; }
.s-load-bounce span:nth-child(2) { animation-delay: -1s; }
@keyframes s-bounce2 { 0%, 100% { transform: scale(0); } 50% { transform: scale(1); } }
/* Typing dots (chat) */
.s-load-typing { display: inline-flex; gap: 4px; padding: 0.55rem 0.75rem; background: var(--surface-2); border-radius: 999px; }
.s-load-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: s-type 1.2s ease-in-out infinite; }
.s-load-typing span:nth-child(2) { animation-delay: 0.2s; }
.s-load-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes s-type { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---- Neumorphism (soft UI) ------------------------------------------ */
.s-neu-surface { background: var(--surface-2); border-radius: 22px; padding: 1.6rem; }
.s-neu { background: var(--surface-2); border-radius: 16px; padding: 1.2rem; box-shadow: 6px 6px 13px rgba(15, 23, 42, 0.13), -6px -6px 13px rgba(255, 255, 255, 0.75); }
.s-neu-inset { background: var(--surface-2); border-radius: 16px; padding: 1.2rem; box-shadow: inset 5px 5px 10px rgba(15, 23, 42, 0.13), inset -5px -5px 10px rgba(255, 255, 255, 0.75); }
.s-neu-btn { border: none; background: var(--surface-2); color: var(--text); font-family: var(--body); font-weight: 650; font-size: 0.9rem; border-radius: 12px; padding: 0.6rem 1.1rem; cursor: pointer; box-shadow: 4px 4px 9px rgba(15, 23, 42, 0.13), -4px -4px 9px rgba(255, 255, 255, 0.75); transition: box-shadow 0.12s ease; }
.s-neu-btn:active { box-shadow: inset 4px 4px 9px rgba(15, 23, 42, 0.15), inset -4px -4px 9px rgba(255, 255, 255, 0.7); }
:root[data-theme="dark"] .s-neu, :root[data-theme="dark"] .s-neu-btn { box-shadow: 6px 6px 13px rgba(0, 0, 0, 0.5), -6px -6px 13px rgba(255, 255, 255, 0.045); }
:root[data-theme="dark"] .s-neu-inset { box-shadow: inset 5px 5px 10px rgba(0, 0, 0, 0.5), inset -5px -5px 10px rgba(255, 255, 255, 0.045); }
:root[data-theme="dark"] .s-neu-btn:active { box-shadow: inset 4px 4px 9px rgba(0, 0, 0, 0.55), inset -4px -4px 9px rgba(255, 255, 255, 0.04); }

/* ---- Claymorphism --------------------------------------------------- */
.s-clay { border-radius: 26px; background: var(--surface); padding: 1.4rem 1.5rem; box-shadow: 0 14px 28px rgba(15, 23, 42, 0.13), inset 0 -6px 10px rgba(15, 23, 42, 0.06), inset 0 7px 10px rgba(255, 255, 255, 0.75); }
:root[data-theme="dark"] .s-clay { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), inset 0 -6px 10px rgba(0, 0, 0, 0.35), inset 0 7px 10px rgba(255, 255, 255, 0.05); }
.s-clay-btn { border: none; border-radius: 18px; padding: 0.7rem 1.3rem; background: var(--accent); color: #06211d; font-family: var(--body); font-weight: 750; font-size: 0.92rem; cursor: pointer; box-shadow: 0 8px 16px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 -4px 7px rgba(15, 23, 42, 0.18), inset 0 4px 7px rgba(255, 255, 255, 0.4); transition: transform 0.1s ease; }
.s-clay-btn:active { transform: translateY(2px); }

/* ---- Brutalism ------------------------------------------------------ */
.s-brutal { border: 3px solid var(--text); border-radius: 0; background: var(--surface); box-shadow: 8px 8px 0 var(--text); padding: 1.25rem 1.4rem; }
.s-brutal-accent { background: var(--accent); color: #06211d; }
.s-brutal-btn { border: 3px solid var(--text); border-radius: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.85rem; padding: 0.6rem 1.1rem; cursor: pointer; box-shadow: 5px 5px 0 var(--text); transition: transform 0.05s ease, box-shadow 0.05s ease; }
.s-brutal-btn:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--text); }
.s-brutal-tag { display: inline-block; border: 2px solid var(--text); background: var(--accent); color: #06211d; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; padding: 0.15rem 0.5rem; }

/* ---- Aurora background (solid blurred shapes, no gradient) -----------
   An aurora is a committed dark, glowing panel. It keeps ONE fixed dark
   surface and guaranteed-light text in both themes, so it never inherits the
   page's flipping --ink / --text colors (which made it dark-on-dark in light
   mode and light-on-light in dark mode). */
.s-aurora { position: relative; overflow: hidden; border-radius: 16px; padding: 2rem 1.6rem; background: #0b1220; color: #f1f5f9; isolation: isolate; }
/* Beat the global `.prose p` / heading / link colors so content stays legible
   on the glow regardless of theme. */
.s-aurora :where(h1, h2, h3, h4, h5, h6, p, li, strong, a) { color: #f1f5f9; }
.s-aurora :where(p, li) { text-shadow: 0 1px 2px rgba(2, 6, 23, 0.45); }
.s-aurora :where(h1, h2, h3, h4, h5, h6) { color: #ffffff; text-shadow: 0 1px 3px rgba(2, 6, 23, 0.5); }
.s-aurora::before, .s-aurora::after { content: ""; position: absolute; width: 60%; height: 130%; border-radius: 50%; filter: blur(55px); opacity: 0.55; z-index: -1; animation: s-aurora-move 9s ease-in-out infinite alternate; }
.s-aurora::before { background: #0d9488; top: -45%; left: -8%; }
.s-aurora::after { background: #f59e0b; bottom: -45%; right: -8%; animation-delay: -4.5s; }
@keyframes s-aurora-move { from { transform: translate(0, 0) scale(1); } to { transform: translate(25%, 18%) scale(1.15); } }

/* ---- Glow / spotlight card (solid blurred blob follows cursor) ------- */
.s-glow-card { position: relative; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); padding: 1.5rem; overflow: hidden; }
.s-glow-card::before { content: ""; position: absolute; top: 0; left: 0; width: 300px; height: 300px; margin: -150px 0 0 -150px; border-radius: 50%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s ease;
  background: color-mix(in srgb, var(--accent) 24%, transparent); filter: blur(55px); transform: translate(var(--mx, 0), var(--my, 0)); }
.s-glow-card:hover::before { opacity: 1; }
.s-glow-card > * { position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .s-logo-pulse .peak, .s-logo-pulse .sun, .s-logo-draw .peak-outline, .s-logo-draw .sun,
  .s-logo-orbit::after, .s-dots span, .s-bar::after,
  .s-skel-text, .s-skel-title, .s-skel-avatar, .s-skel-block,
  .s-load-dual, .s-load-dash, .s-load-arc, .s-load-bars span, .s-load-pulse, .s-load-ripple span,
  .s-load-orbit, .s-load-grid span, .s-load-wave span, .s-load-flip, .s-load-bounce span, .s-load-typing span,
  .s-aurora::before, .s-aurora::after { animation: none; }
}
