/*
 * styles.css — Laser Refraction Simulator
 * Breezeway Labs — https://breezewaylabs.com
 *
 * Copyright (c) 2015–2026 Keith Warren
 * MIT License — https://opensource.org/licenses/MIT
 */

/* ══════════════════════════════════════════
   Design tokens (CSS custom properties)
   ══════════════════════════════════════════
   --bg          Warm off-white page background
   --panel       Semi-transparent frosted-glass card surface
   --ink         Primary text color (near-black warm)
   --muted       Secondary / label text
   --accent      Red laser accent for interactive highlights
   --accent-soft Translucent version of accent for fills
   --water       Water fill tint inside the tank
   --water-edge  Stronger water-surface stroke color
   --line        Subtle divider / border color
   --shadow      Box-shadow for floating card panels
*/
:root {
  --bg: #f3efe3;
  --panel: rgba(255, 251, 240, 0.88);
  --ink: #1d1c1a;
  --muted: #615c4d;
  --accent: #cc1f4a;
  --accent-soft: rgba(204, 31, 74, 0.16);
  --water: rgba(79, 163, 214, 0.28);
  --water-edge: rgba(61, 112, 160, 0.55);
  --line: rgba(29, 28, 26, 0.12);
  --shadow: 0 24px 80px rgba(82, 64, 34, 0.18);
}

/* ══════════════════════════════════════════
   Global reset
   ══════════════════════════════════════════ */
* {
  box-sizing: border-box;
}

/* ══════════════════════════════════════════
   Base typography + background
   Multi-stop linear gradient gives a warm
   parchment feel matching the canvas backdrop.
   ══════════════════════════════════════════ */
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Century Gothic", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.8), transparent 30%),
    linear-gradient(180deg, #efe7d2 0%, #f6f1e7 48%, #e5dcc8 100%);
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: start;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.94;
}

.lede {
  max-width: 44rem;
  font-size: 1.04rem;
  line-height: 1.65;
  color: var(--muted);
}

.controls,
.sim-panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.controls {
  padding: 22px;
}

.toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 62px;
  height: 36px;
  border-radius: 999px;
  background: #d6cbb3;
  transition: background 160ms ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fffdf7;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 160ms ease;
}

.toggle input:checked + .toggle-track {
  background: #4aa5d3;
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(26px);
}

.toggle-copy {
  display: grid;
  gap: 2px;
}

.toggle-copy strong,
.readout strong {
  font-weight: 700;
}

.toggle-copy small,
.readout span {
  color: var(--muted);
}

.slider-group {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.slider-group span {
  font-weight: 500;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.readout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.readout {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.5);
  min-height: 5rem;          /* prevent height change when result text changes */
}

.readout strong {
  display: block;
  margin-top: 4px;
  font-size: 1.0rem;
  white-space: nowrap;       /* never wrap — prevents layout reflow */
  overflow: hidden;
  text-overflow: ellipsis;
}

.sim-panel {
  margin-top: 24px;
  padding: 22px;
}

canvas {
  display: block;
  width: min(100%, 900px);
  margin: 0 auto;
  touch-action: none;
}

.hint {
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
}

/* ══════════════════════════════════════════
   Breadcrumb nav (sim.html only)
   Appears above the app-shell on the simulation page.
   Shows:  ← Physics Lab / Laser Refraction / Simulation
   ══════════════════════════════════════════ */
.breadcrumb {
  padding: 0.7rem 1.5rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid rgba(29, 28, 26, 0.1);
  background: rgba(255, 251, 240, 0.7);
  backdrop-filter: blur(12px);
}

.breadcrumb a {
  color: #6a4a7c;
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  color: rgba(29, 28, 26, 0.3);
}

.breadcrumb .current {
  color: var(--muted);
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 20px;
    padding-bottom: 24px;
  }

  .controls,
  .sim-panel {
    border-radius: 22px;
  }
}
