/* ============================================
   CERN CMS Open Data — VSPD Visualization
   Scientific static site — fully responsive
   ============================================ */

:root {
  --bg-dark: #0d1117;
  --bg-card: #161b22;
  --bg-elevated: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.15);
  --success: #3fb950;
  --warning: #d29922;
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Monaco', monospace;
  --radius: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ----- Layout ----- */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.site-header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.site-header .brand:hover {
  color: var(--accent);
}

.site-header .nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ----- Typography ----- */
h1, h2, h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.65rem); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h3 { font-size: 1.2rem; }

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ----- Cards & sections ----- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2 { border-bottom: none; padding-bottom: 0; }

/* ----- Experiment canvas area ----- */
.experiment-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.experiment-canvas-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  aspect-ratio: 16/10;
  min-height: 320px;
  background: var(--bg-dark);
  border-radius: 4px;
}

.experiment-canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.toggle-group {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.toggle-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.toggle-group input[type="radio"] {
  accent-color: var(--accent);
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.timeline-controls input[type="range"] {
  width: 180px;
  min-width: 120px;
  accent-color: var(--accent);
}

.timeline-controls .event-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 6ch;
}

/* ----- Lists ----- */
ul, ol {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

li { margin-bottom: 0.35rem; }

/* ----- Code / math ----- */
code, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--accent);
}

pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0 0 1rem 0;
}

pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

/* ----- Footer ----- */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .site-header nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-header .brand { margin-right: 0; }

  main { padding: 1rem; }

  .experiment-canvas-container {
    min-height: 240px;
  }

  .controls-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ----- Utility ----- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
