/* ==========================================================================
   Fără să numeri / Without Counting — Design System & Stylesheet
   Laboratory Tachistoscope Perceptual Instrument
   ========================================================================== */

:root {
  /* Dark Mode (Default) */
  --bg-primary: #0a0e17;
  --bg-surface: #131b29;
  --bg-surface-elevated: #1a2538;
  --bg-chamber: #07090f;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --border-subtle: #223048;
  --border-strong: #334460;
  
  --accent-brass: #d4a373;
  --accent-brass-hover: #e6b887;
  --accent-brass-glow: rgba(212, 163, 115, 0.25);
  --accent-brass-dark: #8c6239;
  
  --dot-fill: #fdfbf7;
  --dot-stroke: #d8cebc;
  --dot-number: #0a0e17;
  
  --shutter-blade: #1e293b;
  --shutter-blade-edge: #475569;
  --shutter-blade-sheen: #334155;
  
  --correct: #2dd4bf;
  --correct-bg: rgba(45, 212, 191, 0.12);
  --correct-border: #14b8a6;
  
  --miss: #fb7185;
  --miss-bg: rgba(251, 113, 133, 0.12);
  --miss-border: #f43f5e;
  
  --focus-ring: #e6b887;
  
  --font-serif: "Newsreader", "Playfair Display", "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --max-width: 780px;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-chamber: #111827;
  
  --text-primary: #090d16;
  --text-secondary: #1e293b;
  --text-muted: #475569;
  
  --border-subtle: #cbd5e1;
  --border-strong: #94a3b8;
  
  --accent-brass: #9a652a;
  --accent-brass-hover: #7c4f1c;
  --accent-brass-glow: rgba(154, 101, 42, 0.2);
  --accent-brass-dark: #5a3810;
  
  --dot-fill: #fdfbf7;
  --dot-stroke: #cbd5e1;
  --dot-number: #090d16;
  
  --shutter-blade: #1e293b;
  --shutter-blade-edge: #475569;
  --shutter-blade-sheen: #334155;
  
  --correct: #0f766e;
  --correct-bg: rgba(15, 118, 110, 0.08);
  --correct-border: #0d9488;
  
  --miss: #be123c;
  --miss-bg: rgba(190, 18, 60, 0.08);
  --miss-border: #e11d48;
  
  --focus-ring: #9a652a;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  line-height: 1.65;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Accessibility: visually hidden live announcer */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-link {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-link:hover {
  color: var(--accent-brass);
}

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

.btn-ctrl {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.btn-ctrl:hover {
  border-color: var(--accent-brass);
  color: var(--text-primary);
}

/* ==========================================================================
   Main Container & Hero
   ========================================================================== */

.page-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
}

.hero-section {
  text-align: center;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.hero-deck {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  color: var(--text-secondary);
  max-width: 38rem;
  margin: 0 auto 0.75rem;
  line-height: 1.5;
}

.hero-meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent-brass);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.meta-dot {
  opacity: 0.4;
}

/* ==========================================================================
   Tachistoscope Instrument Chamber
   ========================================================================== */

.instrument-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  position: relative;
}

.instrument-plate {
  position: relative;
  width: clamp(250px, 60vw, 320px);
  height: clamp(250px, 60vw, 320px);
  margin: 0.5rem 0 1.25rem;
  border-radius: 50%;
  padding: 12px;
  background: radial-gradient(circle, var(--accent-brass-hover) 0%, var(--accent-brass) 50%, var(--accent-brass-dark) 100%);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.35),
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 6px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.instrument-rim-notches {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

.chamber-aperture {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-chamber);
  overflow: hidden;
  box-shadow: inset 0 6px 16px rgba(0, 0, 0, 0.8);
}

.dots-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.dot-circle {
  fill: var(--dot-fill);
  stroke: var(--dot-stroke);
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.dot-number {
  fill: var(--dot-number);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

/* Leaf Shutter Diaphragm */
.shutter-diaphragm {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--shutter-blade-sheen) 0%, var(--shutter-blade) 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.04s ease-out, transform 0.05s ease-out;
  pointer-events: none;
  border: 1px solid var(--shutter-blade-edge);
}

.shutter-diaphragm::before {
  content: "";
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-brass-hover), var(--accent-brass-dark));
  border: 1px solid var(--accent-brass);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.shutter-closed {
  opacity: 1;
  transform: scale(1);
}

.shutter-open {
  opacity: 0;
  transform: scale(0.01);
}

.shutter-inspect {
  opacity: 0.15;
  transform: scale(1);
}

/* Round Badge & Calibration Note */
.round-indicator {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-brass);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.status-instruction {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  text-align: center;
  min-height: 1.5rem;
  margin-bottom: 1rem;
}

/* Action Primary Button */
.btn-action-primary {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  padding: 0.875rem 2.25rem;
  min-height: 52px;
  background: var(--accent-brass);
  color: #090d16;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-brass-glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.1s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-action-primary:hover:not(:disabled) {
  background: var(--accent-brass-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-brass-glow);
}

.btn-action-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-action-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Call Number Pad (Buttons 3-9) */
.call-pad-container {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.15s ease;
}

.call-pad-prompt {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.call-buttons-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 440px;
}

.btn-digit {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  width: clamp(48px, 12vw, 56px);
  height: 52px;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.btn-digit:hover {
  background: var(--accent-brass);
  color: #090d16;
  border-color: var(--accent-brass);
  transform: translateY(-2px);
}

.btn-digit:active {
  transform: translateY(1px);
}

/* Verdict Card */
.verdict-card {
  display: none;
  width: 100%;
  max-width: 440px;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
  animation: slideUp 0.15s ease;
}

.verdict-exact {
  background: var(--correct-bg);
  border: 1px solid var(--correct-border);
  color: var(--correct);
}

.verdict-miss {
  background: var(--miss-bg);
  border: 1px solid var(--miss-border);
  color: var(--miss);
}

/* Keyboard hint line */
.keyboard-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.kbd-badge {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Final Summary & Tachistogram
   ========================================================================== */

.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.summary-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.summary-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.summary-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.metric-cell {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  text-align: center;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-brass);
}

.metric-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Constellation Strip */
.strip-heading {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-align: center;
}

.constellation-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

@media (max-width: 640px) {
  .constellation-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

.constellation-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.constellation-card.badge-exact {
  border-color: var(--correct-border);
}

.constellation-card.badge-miss {
  border-color: var(--miss-border);
}

.card-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  margin-bottom: 0.25rem;
}

.card-diff {
  font-weight: 700;
}

.badge-exact .card-diff {
  color: var(--correct);
}

.badge-miss .card-diff {
  color: var(--miss);
}

.constellation-svg {
  width: 58px;
  height: 58px;
  margin: 0.25rem 0;
}

.constellation-rim {
  fill: var(--bg-chamber);
  stroke: var(--border-subtle);
  stroke-width: 1;
}

.mini-dot {
  fill: var(--dot-fill);
}

.card-footer {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* Summary Action Buttons */
.summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.btn-secondary {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--accent-brass);
  color: var(--accent-brass);
}

/* ==========================================================================
   Editorial Explainer Narrative
   ========================================================================== */

.narrative-article {
  max-width: 40rem;
  margin: 0 auto;
}

.article-section {
  margin-bottom: 2rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.article-p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.65;
}

.article-p strong {
  color: var(--text-primary);
}

.citation-list {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.citation-item {
  padding-left: 1rem;
  border-left: 2px solid var(--accent-brass);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent-brass);
}

.footer-copy {
  line-height: 1.5;
}

/* ==========================================================================
   Animations & Motion Preferences
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  
  .shutter-open {
    opacity: 0 !important;
    transform: none !important;
  }
}
