/* ⚡ theme-flash.css: Galvanic Astral Flash (Gemini Flash 3.8 inspired) */

:root {
  /* Surface & Canvas Tokens */
  --bg-color: #070a14;
  --surface-color: #0e1526;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent-color: #38bdf8;
  --accent-hover: #7dd3fc;
  --border-color: #1e293b;
  --code-bg: #090e1a;
  --code-text: #c084fc;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Fira Code", SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout */
  --max-width: 860px;
  --card-radius: 12px;
}

/* Palette Variants (opt-in via palette: frontmatter) */
.palette-nova {
  --accent-color: #fbbf24;
  --accent-hover: #fde047;
  --code-text: #fde047;
}

.palette-aurora {
  --accent-color: #34d399;
  --accent-hover: #6ee7b7;
  --code-text: #6ee7b7;
}

.palette-hyper {
  --accent-color: #f472b6;
  --accent-hover: #f9a8d4;
  --code-text: #e879f9;
}

/* Custom Themed Scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.4) var(--bg-color);
  scroll-behavior: smooth;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.25);
  border-radius: 5px;
  border: 2px solid var(--bg-color);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-color);
}

/* Galvanic Scroll Progress Indicator (Scroll-Driven Animation) */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    @keyframes flash-scroll-grow {
      from { transform: scaleX(0); }
      to { transform: scaleX(1); }
    }

    .flash-scroll-indicator {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: linear-gradient(90deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
      transform-origin: 0 50%;
      animation: flash-scroll-grow auto linear;
      animation-timeline: scroll();
      z-index: 999;
      box-shadow: 0 0 10px rgba(56, 189, 248, 0.7), 0 0 20px rgba(129, 140, 248, 0.4);
    }
  }
}

/* Ambient cosmic mesh & celestial spark nodes */
.flash-ambient-mesh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.flash-aurora {
  position: absolute;
  top: -15%;
  left: 10%;
  width: 80%;
  height: 70%;
  background:
    radial-gradient(ellipse 75% 50% at 50% 0%, rgba(56, 189, 248, 0.14), transparent 70%),
    radial-gradient(ellipse 55% 40% at 85% 60%, rgba(129, 140, 248, 0.08), transparent 60%),
    radial-gradient(circle at 15% 75%, rgba(192, 132, 252, 0.06), transparent 50%);
  filter: blur(40px);
}

.flash-spark-node {
  position: absolute;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px var(--accent-color), 0 0 12px var(--accent-color);
  opacity: 0.6;
  animation: flash-twinkle 4s infinite ease-in-out;
}

.flash-spark-node--1 { top: 14%; left: 9%; width: 3px; height: 3px; animation-delay: 0s; }
.flash-spark-node--2 { top: 28%; right: 12%; width: 2px; height: 2px; animation-delay: 1.3s; }
.flash-spark-node--3 { top: 56%; left: 15%; width: 2px; height: 2px; animation-delay: 2.5s; }
.flash-spark-node--4 { top: 76%; right: 18%; width: 3px; height: 3px; animation-delay: 0.9s; }
.flash-spark-node--5 { top: 88%; left: 42%; width: 2px; height: 2px; animation-delay: 3.2s; }

@keyframes flash-twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 0.9; transform: scale(1.3); }
}

/* Base Body Styles */
body.flash-theme {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

.flash-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem 1.25rem;
  position: relative;
  z-index: 1;
}

/* Header & HUD Topbar */
.flash-header {
  margin-bottom: 2rem;
}

.flash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.flash-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.flash-spark {
  color: var(--accent-color);
  font-size: 1.25rem;
  text-shadow: 0 0 10px var(--accent-color);
}

.flash-brand-name {
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.flash-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-color);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.flash-telemetry {
  display: flex;
  align-items: center;
}

.telemetry-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(14, 21, 38, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
}

.pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
  animation: flash-pulse 2s infinite ease-in-out;
  margin-right: 6px;
}

@keyframes flash-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* Site Navigation Integration */
.flash-nav {
  display: flex;
  align-items: center;
}

.flash-nav nav {
  display: flex;
}

.flash-nav ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.35rem;
}

.flash-nav li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.flash-nav a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.flash-nav a:hover {
  color: var(--accent-color);
  background: rgba(56, 189, 248, 0.08);
}

/* Hero Section */
.flash-hero {
  margin-top: 2rem;
}

.flash-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem 0;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent-color);
}

.flash-deck {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin: 0 0 1.25rem 0;
  line-height: 1.5;
}

.flash-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.meta-pill {
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: rgba(14, 21, 38, 0.7);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-family: var(--font-mono);
}

.meta-label {
  color: var(--accent-color);
  margin-right: 0.25rem;
}

/* Galvanic Divider */
.flash-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2.25rem 0;
}

.flash-divider__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.4), transparent);
}

.flash-divider__glyph {
  color: var(--accent-color);
  font-size: 1.1rem;
  text-shadow: 0 0 10px var(--accent-color);
}

/* Main Content Card (Glassmorphic) */
.flash-card {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.06) 0%, rgba(14, 21, 38, 0.8) 12%, rgba(14, 21, 38, 0.8) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--card-radius);
  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.45),
    0 0 1px 1px rgba(56, 189, 248, 0.25),
    0 0 35px rgba(56, 189, 248, 0.06);
  padding: 2.5rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.flash-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.5),
    0 0 1px 1px rgba(56, 189, 248, 0.35),
    0 0 45px rgba(56, 189, 248, 0.1);
}

.flash-card-inner {
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Headings within content */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1 { font-size: 2rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
h2 { font-size: 1.5rem; border-bottom: 1px solid rgba(30, 41, 59, 0.6); padding-bottom: 0.35rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* Links */
a {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

/* Typography & Lists */
p {
  margin: 1.1rem 0;
}

ul, ol {
  padding-left: 1.5rem;
  margin: 1.1rem 0;
}

li {
  margin: 0.4rem 0;
}

/* Code & Pre: Terminal Chrome Enhancement */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 0.18em 0.42em;
  border-radius: 4px;
  border: 1px solid rgba(192, 132, 252, 0.2);
}

pre {
  position: relative;
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-top: 2px solid var(--accent-color);
  border-radius: 8px;
  padding: 2.75rem 1.25rem 1.25rem 1.25rem;
  overflow-x: auto;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5), 0 4px 20px rgba(0, 0, 0, 0.25);
  margin: 1.75rem 0;
}

pre::before {
  content: "● ● ●   ⚡ FLASH COGNITION TERMINAL // 0.0ms";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.85rem;
  line-height: 1.85rem;
  background: rgba(14, 21, 38, 0.92);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding-left: 0.85rem;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  pointer-events: none;
}

pre code {
  background: transparent;
  padding: 0;
  border: none;
  border-radius: 0;
  color: var(--text-primary);
  font-size: 0.92rem;
}

/* Long inline code wraps instead of blowing out narrow viewports */
:not(pre) > code {
  overflow-wrap: anywhere;
}

/* Blockquotes: Reanimated Transmission Enhancement */
blockquote {
  margin: 1.75rem 0;
  padding: 1.15rem 1.35rem 1.15rem 1.5rem;
  background: rgba(14, 21, 38, 0.55);
  border-left: 3px solid var(--accent-color);
  border-radius: 0 8px 8px 0;
  box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.04), 0 2px 8px rgba(0, 0, 0, 0.15);
  color: var(--text-secondary);
  position: relative;
}

blockquote::before {
  content: "⚡ REANIMATED TRANSMISSION // TELEMETRY";
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-color);
  margin-bottom: 0.6rem;
}

blockquote p:first-child {
  margin-top: 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Horizontal Rules */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin: 2rem 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
}

th {
  background: rgba(30, 41, 59, 0.85);
  color: var(--accent-color);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

td {
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

tr:nth-child(even) td {
  background: rgba(14, 21, 38, 0.35);
}

tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

th[align="center"], td[align="center"] { text-align: center; }
th[align="right"], td[align="right"] { text-align: right; }

/* Responsive Media */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Footer & Standardized Slots */
.flash-footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.flash-lore {
  margin-bottom: 0.75rem;
}

.flash-lore .rk-lore {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
  margin: 0;
}

.footer-credit {
  margin: 0.35rem 0;
}

.footer-asset-meta,
.footer-tags {
  margin: 0.25rem 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Accessibility: Visible focus indicators */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
summary:focus,
[tabindex]:focus,
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

/* Selection Highlight */
::selection {
  background: rgba(56, 189, 248, 0.3);
  color: var(--text-primary);
}

/* Narrow Viewport Adaptations */
@media (max-width: 768px) {
  .flash-container {
    padding: 1.25rem 1rem 3rem 1rem;
  }

  .flash-topbar {
    flex-wrap: wrap;
  }

  .flash-title {
    font-size: 1.85rem;
  }

  .flash-card {
    padding: 1.5rem 1.1rem;
  }
}

/* Print Optimization */
@media print {
  .flash-ambient-mesh,
  .flash-scroll-indicator,
  .flash-telemetry {
    display: none !important;
  }

  body.flash-theme {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .flash-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .flash-title {
    -webkit-text-fill-color: initial !important;
    color: #000000 !important;
  }

  pre, code {
    border: 1px solid #cccccc !important;
    background: #f8f8f8 !important;
    color: #000000 !important;
  }
}
