/* © 2026 SnakeIndex — SNAKE-ARCH-001
   Shared Snake family header, drawer, scale background and footer.
   Inline-able. No external dependencies. Theme via data-theme / data-theme-pref
   and localStorage key snakeindex-theme (system follows prefers-color-scheme). */

:root {
  --sf-scale: rgba(31, 163, 79, .11);
  --sf-sweep: rgba(255, 255, 255, .42);
  --sf-header-logo: 36px;
  --sf-header-title: 20px;
  --sf-header-gap: 10px;
  --sf-ink: #1b5e20;
  --sf-fg: #202124;
  --sf-muted: #70757a;
  --sf-panel: #ffffff;
  --sf-panel2: #f8f9fa;
  --sf-line: #e5e7eb;
  --sf-overlay: rgba(15, 20, 18, .45);
}
html.light, html[data-theme="light"] {
  --sf-scale: rgba(31, 163, 79, .11);
  --sf-sweep: rgba(255, 255, 255, .5);
  --sf-ink: #1b5e20;
  --sf-fg: #202124;
  --sf-muted: #70757a;
  --sf-panel: #ffffff;
  --sf-panel2: #f8f9fa;
  --sf-line: #d5e3da;
  --sf-overlay: rgba(15, 20, 18, .4);
}
html.dark, html[data-theme="dark"] {
  --sf-scale: rgba(95, 224, 138, .10);
  --sf-sweep: rgba(95, 224, 138, .16);
  --sf-ink: #5fe08a;
  --sf-fg: #e8eaed;
  --sf-muted: #9aa69f;
  --sf-panel: #1c231f;
  --sf-panel2: #1a201c;
  --sf-line: #2d3a32;
  --sf-overlay: rgba(6, 12, 8, .55);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]):not(.light):not(.dark) {
    --sf-scale: rgba(95, 224, 138, .10);
    --sf-sweep: rgba(95, 224, 138, .16);
    --sf-ink: #5fe08a;
    --sf-fg: #e8eaed;
    --sf-muted: #9aa69f;
    --sf-panel: #1c231f;
    --sf-panel2: #1a201c;
    --sf-line: #2d3a32;
    --sf-overlay: rgba(6, 12, 8, .55);
  }
}

.sf-scale { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sf-scale-parallax { position: absolute; inset: -24px; will-change: transform; transform: translate3d(0,0,0); }
.sf-scale svg.scale-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sf-scale svg.scale-bg path { fill: none; stroke: var(--sf-scale); stroke-width: 1.1; }
.sf-scale-sweep {
  position: absolute; inset: -30%;
  background: radial-gradient(ellipse 42% 32% at 50% 50%, var(--sf-sweep) 0%, transparent 70%);
  animation: sf-sweep 10s ease-in-out infinite;
  will-change: transform, opacity;
  pointer-events: none;
  mix-blend-mode: soft-light;
}
html.dark .sf-scale-sweep, html[data-theme="dark"] .sf-scale-sweep { mix-blend-mode: screen; }
@keyframes sf-sweep {
  0% { transform: translate3d(-28%, -18%, 0); }
  50% { transform: translate3d(28%, 14%, 0); }
  100% { transform: translate3d(-28%, -18%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .sf-scale-parallax { transform: none !important; will-change: auto; }
  .sf-scale-sweep { animation: none !important; opacity: 0 !important; }
}

.sf-header {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 20px 22px;
  box-sizing: border-box;
  min-height: 64px;
  background: transparent;
}
.sf-burger {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--sf-line, var(--line2, #dfe1e5));
  background: var(--sf-panel, var(--bg, #fff));
  color: var(--sf-fg, var(--fg, #202124));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sf-burger:hover { border-color: var(--sf-ink, var(--g, #1b7a34)); color: var(--sf-ink, var(--g, #1b7a34)); }
.sf-burger:focus-visible { outline: 2px solid var(--sf-ink, var(--g, #1b7a34)); outline-offset: 2px; }
.sf-burger svg { width: 22px; height: 22px; display: block; }
.sf-brand {
  display: flex;
  align-items: center;
  gap: var(--sf-header-gap);
  text-decoration: none;
  min-width: 0;
  color: inherit;
}
.sf-brand:hover { text-decoration: none; }
.sf-brand img {
  width: var(--sf-header-logo);
  height: var(--sf-header-logo);
  display: block;
  flex: 0 0 var(--sf-header-logo);
  object-fit: contain;
}
.sf-title {
  font-size: var(--sf-header-title);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--sf-ink, var(--g-deep, #1b5e20));
  white-space: nowrap;
}
.sf-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.sf-backdrop {
  position: fixed; inset: 0;
  background: var(--sf-overlay);
  z-index: 80;
  border: 0; padding: 0; margin: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity .32s ease;
}
.sf-backdrop[hidden] { display: none; }
.sf-backdrop.is-open { opacity: 1; }
.sf-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(340px, 88vw);
  background: var(--sf-panel, var(--panel, #fff));
  color: var(--sf-fg, var(--fg, #202124));
  z-index: 90;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  transform: translate3d(-105%, 0, 0);
  transition: transform .4s cubic-bezier(.22, 1, .36, 1);
  display: flex;
  flex-direction: column;
  padding: 8px 0 28px;
  overflow: auto;
  will-change: transform;
}
.sf-drawer.is-open { transform: translate3d(0, 0, 0); }
.sf-drawer[hidden] { display: none; }
.sf-drawer-head { display: flex; align-items: center; justify-content: flex-end; padding: 8px 12px 6px; }
.sf-drawer-close {
  width: 40px; height: 40px; border-radius: 10px; border: 0;
  background: transparent; color: var(--sf-fg, var(--fg));
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.sf-drawer-close:hover { color: var(--sf-ink, var(--g)); background: var(--sf-panel2, var(--panel2)); }
.sf-drawer-close:focus-visible { outline: 2px solid var(--sf-ink, var(--g)); outline-offset: 2px; }
.sf-drawer-close svg { width: 22px; height: 22px; display: block; }
.sf-section { margin: 8px 0 4px; padding: 0; list-style: none; }
.sf-section + .sf-section { border-top: 1px solid var(--sf-line, var(--line)); margin-top: 10px; padding-top: 10px; }
.sf-section-label {
  display: block; padding: 6px 22px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--sf-muted, var(--muted));
}
.sf-drawer a.sf-link {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 22px; color: var(--sf-fg, var(--fg));
  text-decoration: none; font-size: 15px; font-weight: 600; border-radius: 0;
}
.sf-drawer a.sf-link svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--sf-ink, var(--g)); }
.sf-drawer a.sf-link:hover { background: var(--sf-panel2, var(--panel2)); color: var(--sf-ink, var(--g)); text-decoration: none; }
.sf-drawer a.sf-link:active { background: color-mix(in srgb, var(--sf-ink, #1b7a34) 12%, transparent); }
.sf-drawer a.sf-link:focus-visible { outline: 2px solid var(--sf-ink, var(--g)); outline-offset: -2px; }
.sf-drawer a.sf-link[aria-current="page"] { color: var(--sf-ink, var(--g)); }
@media (prefers-reduced-motion: reduce) {
  .sf-drawer, .sf-backdrop { transition: none; }
}

.sf-footer {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: 16px 28px 18px;
  border-top: 1px solid var(--sf-line, var(--line, #e5e7eb));
  background: var(--footer, var(--sf-panel2, #f2f2f2));
  color: var(--sf-muted, var(--muted, #70757a));
  font-size: 12px;
  line-height: 1.5;
}
.sf-footer-inner { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.sf-footer-legal { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.sf-footer-legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.sf-footer-legal a:hover { color: var(--sf-ink, var(--g)); }
.sf-footer .patrol-snake {
  position: absolute; top: 0; left: 0;
  width: 36px; height: 14px; margin: 0;
  pointer-events: none; z-index: 1;
  offset-rotate: auto; offset-anchor: center;
  animation: sf-patrol 42s linear infinite;
  opacity: 0; will-change: offset-distance;
}
.sf-footer .patrol-snake.is-set { opacity: 1; }
.sf-footer .patrol-snake svg { display: block; width: 36px; height: 14px; overflow: visible; }
@keyframes sf-patrol { to { offset-distance: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .sf-footer .patrol-snake { animation: none !important; will-change: auto; }
  .sf-footer .patrol-snake.is-set { opacity: 1; }
}

@media (max-width: 768px) {
  .sf-burger, .sf-drawer-close { width: 44px; height: 44px; }
  .sf-header { padding: 6px 12px 20px; }
  .sf-footer { padding: 14px 16px 16px; }
}
