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

/* ══════════════════════════════════════════════════════════════════
   CSS custom properties (design tokens)
   These variables drive the entire colour palette and shadow system.
══════════════════════════════════════════════════════════════════ */
:root {
  --bg-top: #f3efe4;
  --bg-bottom: #ddd3c3;
  --panel: rgba(255, 251, 245, 0.86);
  --panel-strong: rgba(255, 248, 239, 0.95);
  --ink: #1f1c18;
  --muted: #665b4c;
  --accent: #c14f2a;
  --accent-soft: rgba(193, 79, 42, 0.16);
  --sea: #3777a4;
  --sea-soft: rgba(55, 119, 164, 0.18);
  --line: rgba(31, 28, 24, 0.12);
  --shadow: 0 26px 80px rgba(87, 61, 24, 0.16);
}

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

/* ══════════════════════════════════════════════════════════════════
   Base body — gradient background, typography, and colour
══════════════════════════════════════════════════════════════════ */
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Century Gothic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 26%),
    radial-gradient(circle at right, rgba(193, 79, 42, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

/* ══════════════════════════════════════════════════════════════════
   Breadcrumb navigation (sim.html only)
   Sticky bar at the top of the simulation page linking back to the
   Physics Lab index and Wave Basics landing page.
══════════════════════════════════════════════════════════════════ */
.sim-breadcrumb {
  padding: 0.6rem 1.5rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(243, 239, 228, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 28, 24, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.sim-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

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

.sim-breadcrumb .sep {
  color: rgba(31, 28, 24, 0.3);
}

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

/* ══════════════════════════════════════════════════════════════════
   Application shell — centred max-width wrapper with vertical padding
══════════════════════════════════════════════════════════════════ */
.app-shell {
  width: min(1380px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

/* ══════════════════════════════════════════════════════════════════
   Frosted-glass panel base style
   Applied to the hero card, left controls sidebar, and canvas card.
   Uses backdrop-filter blur for the glassmorphism effect.
══════════════════════════════════════════════════════════════════ */
.hero-card,
.controls,
.canvas-card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

/* ══════════════════════════════════════════════════════════════════
   Hero card — horizontal flex row: copy on left, action buttons right
══════════════════════════════════════════════════════════════════ */
.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  padding: 28px;
}

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

/* ══════════════════════════════════════════════════════════════════
   Typography — headings and paragraph baseline reset
══════════════════════════════════════════════════════════════════ */
h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 4vw, 4.4rem);
  line-height: 0.95;
}

.lede,
.section-note,
.concept-card p {
  line-height: 1.58;
  color: var(--muted);
}

.hero-copy {
  max-width: 50rem;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════════
   Button base — shared pill shape, warm-orange gradient primary style
══════════════════════════════════════════════════════════════════ */
button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  color: #fffaf4;
  background: linear-gradient(135deg, #d26a3d, #b8412f);
  box-shadow: 0 10px 24px rgba(184, 65, 47, 0.24);
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

button:hover,
.pause-toggle:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
}

/* ══════════════════════════════════════════════════════════════════
   Pause toggle — styled <label> that wraps a hidden checkbox input
   so the entire pill is the click target for pause/play
══════════════════════════════════════════════════════════════════ */
.pause-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  color: #fffaf4;
  background: linear-gradient(135deg, #d26a3d, #b8412f);
  box-shadow: 0 10px 24px rgba(184, 65, 47, 0.24);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  transition: transform 160ms ease, filter 160ms ease;
}

.pause-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.pause-toggle span {
  pointer-events: none;
}

/* Ghost / segment variant — transparent white background, no shadow */
button.ghost,
.segment {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  border: 1px solid rgba(31, 28, 24, 0.08);
}

/* ══════════════════════════════════════════════════════════════════
   Main two-column layout: 340 px controls sidebar + fluid canvas stage
══════════════════════════════════════════════════════════════════ */
.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.controls {
  padding: 20px;
}

.section-block + .section-block,
.section-block + .concept-card {
  margin-top: 20px;
}

.section-block h2,
.canvas-card h2 {
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.segment {
  padding: 12px 14px;
}

.segment.active {
  background: var(--ink);
  color: #fffaf4;
}

/* ══════════════════════════════════════════════════════════════════
   Slider group — two-column grid: label + value display on top row,
   range input spanning full width on bottom row
══════════════════════════════════════════════════════════════════ */
.slider-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 14px;
}

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

.slider-group strong {
  color: var(--muted);
  font-size: 0.95rem;
}

.slider-group input[type="range"] {
  grid-column: 1 / -1;
}

/* ══════════════════════════════════════════════════════════════════
   Equation readout box — shows current v = fλ relationship inline
══════════════════════════════════════════════════════════════════ */
.equation-readout {
  margin: 4px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(31, 28, 24, 0.08);
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

.equation-detail {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

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

.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--ink);
}

.button-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.utility-button {
  width: 100%;
  justify-content: center;
}

/* ══════════════════════════════════════════════════════════════════
   Concept card — soft blue teaching-focus callout at bottom of sidebar
══════════════════════════════════════════════════════════════════ */
.concept-card {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(55, 119, 164, 0.12), rgba(255, 255, 255, 0.5));
  border: 1px solid rgba(55, 119, 164, 0.18);
}

.concept-card h3 {
  margin-bottom: 8px;
}

.concept-tip {
  margin-bottom: 0;
  font-size: 0.93rem;
}

.stage-column {
  display: grid;
  gap: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.live-readout {
  min-width: 220px;
  text-align: right;
}

.live-readout span {
  color: var(--muted);
}

.live-readout strong {
  display: block;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════════
   Canvas element — fills the card width; height clamped via #waveCanvas
══════════════════════════════════════════════════════════════════ */
canvas {
  display: block;
  width: 100%;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(232, 223, 210, 0.7));
}

#waveCanvas {
  height: min(62vh, 560px);
}

.canvas-card {
  padding: 18px;
}

/* ══════════════════════════════════════════════════════════════════
   Responsive overrides
══════════════════════════════════════════════════════════════════ */

/* Tablet: collapse two-column layout to single column */
@media (max-width: 1040px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* Mobile: tighten padding, stack hero vertically, reduce canvas height */
@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 16px, 1380px);
    padding-top: 12px;
  }

  .hero-card {
    flex-direction: column;
    align-items: start;
  }

  .hero-card,
  .controls,
  .canvas-card {
    border-radius: 22px;
  }

  #waveCanvas {
    height: min(56vh, 460px);
  }
}
