/* 확률.com — Probability Laboratory
   Aesthetic: dashboard analytics dark, blackboard lecture system
*/

:root {
  --chalk-board: #1A1A20;
  --deep-board: #12121A;
  --chalk-white: #E8E4DC;
  --grid-blue: #2A3A5A;
  --label-blue: #5A7A9A;
  --distribution-red: #E05555;
  --confidence-green: #55B87A;
  --random-gold: #D4A830;
  --walk-purple: #8A6AB8;

  --gap: 8px;
  --serif: "Spectral", "Times New Roman", serif;
  --sans: "Space Grotesk", "Inter", system-ui, sans-serif;
  --mono: "Azeret Mono", "Menlo", "Consolas", monospace;
  --math: "STIX Two Math", "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--deep-board);
  color: var(--chalk-white);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

main {
  padding-bottom: 24px;
}

/* ==================== HEADER ==================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  background: rgba(18, 18, 26, 0.78);
  border-bottom: 1px solid var(--grid-blue);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-glyph {
  font-family: var(--math);
  font-size: 24px;
  color: var(--distribution-red);
  line-height: 1;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--chalk-white);
}

.experiment-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 24px;
}

.nav-dot {
  appearance: none;
  background: transparent;
  border: 1px solid var(--grid-blue);
  color: var(--label-blue);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}

.nav-dot span {
  display: inline-block;
}

.nav-dot:hover {
  border-color: var(--label-blue);
  color: var(--chalk-white);
}

.nav-dot.is-active {
  border-color: var(--distribution-red);
  color: var(--chalk-white);
  background: rgba(224, 85, 85, 0.06);
}

.status-row {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.status-key {
  color: var(--label-blue);
  text-transform: uppercase;
}

.status-val {
  color: var(--chalk-white);
  padding: 2px 8px;
  border: 1px solid var(--grid-blue);
  background: var(--chalk-board);
  min-width: 48px;
  text-align: center;
}

/* ==================== EXPERIMENT SECTIONS ==================== */

.experiment {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  padding: 64px 0 28px;
  background: var(--deep-board);
}

.experiment-banner {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 0 20px 8px;
  border-bottom: 1px solid var(--grid-blue);
  margin: 0 8px 8px;
}

.banner-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  color: var(--distribution-red);
}

.banner-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  color: var(--chalk-white);
  letter-spacing: 0.01em;
}

.banner-formula {
  margin-left: auto;
  font-family: var(--math);
  font-size: 16px;
  color: var(--label-blue);
}

.banner-formula sup,
.banner-formula sub {
  font-size: 0.7em;
}

/* ==================== LAB GRID ==================== */

.lab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: var(--gap);
  height: calc(100vh - 64px - 28px - 60px);
  min-height: 480px;
  padding: 0 var(--gap);
  background: var(--deep-board);
}

.panel {
  position: relative;
  background: var(--chalk-board);
  border: 1px solid var(--grid-blue);
  overflow: hidden;
  transition: opacity 400ms ease, border-color 400ms ease;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(42, 58, 90, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(42, 58, 90, 0.18) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  opacity: 0.5;
}

.panel-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--label-blue);
  z-index: 2;
  text-transform: uppercase;
}

.panel-formula {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--math);
  font-size: 13px;
  color: var(--chalk-white);
  z-index: 2;
  opacity: 0.85;
}

.panel-formula sub,
.panel-formula sup {
  font-size: 0.7em;
}

.panel-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.panel-meta {
  position: absolute;
  bottom: 8px;
  right: 12px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  z-index: 2;
}

.meta-key {
  color: var(--label-blue);
  text-transform: uppercase;
}

.meta-val {
  color: var(--chalk-white);
  background: rgba(26, 26, 32, 0.6);
  padding: 1px 6px;
  border: 1px solid rgba(42, 58, 90, 0.6);
}

/* canvas crossfade transitions */
.experiment.is-fading .panel-canvas {
  opacity: 0;
  transition: opacity 380ms ease;
}

.experiment .panel-canvas {
  opacity: 1;
  transition: opacity 380ms ease;
}

/* highlight active panel border subtly when experiment is in view */
.experiment.is-active .panel {
  border-color: rgba(42, 58, 90, 0.95);
}

/* ==================== TITLE OVERLAY ==================== */

.title-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  background: rgba(18, 18, 26, 0.92);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 800ms ease, visibility 0s linear 800ms;
}

.title-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 400ms ease, visibility 0s linear 0s;
}

.overlay-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 28px;
  color: var(--distribution-red);
  letter-spacing: 0.04em;
}

.overlay-text {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 56px;
  color: var(--chalk-white);
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.overlay-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--label-blue);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 14px;
}

/* ==================== FOOTER ==================== */

.site-footer {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 14px 20px;
  border-top: 1px solid var(--grid-blue);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  background: var(--deep-board);
}

.foot-key { color: var(--chalk-white); text-transform: uppercase; }
.foot-line { color: var(--label-blue); margin-right: auto; }
.site-footer .foot-key:last-child { color: var(--label-blue); }

/* ==================== ANIMATIONS ==================== */

@keyframes pulse-border {
  0%, 100% { border-color: var(--grid-blue); }
  50% { border-color: rgba(224, 85, 85, 0.6); }
}

.experiment.is-active.is-just-entered .panel {
  animation: pulse-border 1200ms ease 1;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1100px) {
  .panel-formula { display: none; }
}

@media (max-width: 900px) {
  .lab-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }
  .banner-formula { display: none; }
  .status-row .status-key:nth-of-type(2),
  .status-row .status-val:nth-of-type(2) { display: none; }
  .overlay-text { font-size: 42px; }
}

@media (max-width: 560px) {
  .lab-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, 1fr);
    height: auto;
  }
  .experiment {
    height: auto;
    min-height: 100vh;
  }
  .panel {
    height: 200px;
  }
  .overlay-text { font-size: 32px; }
  .overlay-num { font-size: 20px; }
  .experiment-nav { margin-right: 12px; }
  .status-row { display: none; }
}
