/* ==========================================================================
   Fun Simulations - Warm, Minimalist & Ultra-Fast Mobile Theme
   Shared styles for Landing Page & Interactive Simulations
   ========================================================================== */

:root {
  --bg-page: #faf7f2;
  --bg-card: #ffffff;
  --border-card: #ede8df;
  --border-focus: #f59e0b;

  --text-main: #292524;
  --text-muted: #78716c;
  --text-dim: #a8a29e;

  /* Warm color palette */
  --coral-main: #ff6b6b;
  --coral-hover: #fa5252;
  --coral-light: #fff0f0;

  --honey-main: #f59e0b;
  --honey-hover: #d97706;
  --honey-light: #fef3c7;

  --indigo-main: #6366f1;
  --indigo-light: #eef2ff;

  --mint-main: #10b981;
  --mint-light: #ecfdf5;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --shadow-soft: 0 4px 18px rgba(78, 62, 45, 0.05);
  --shadow-hover: 0 10px 30px rgba(78, 62, 45, 0.12);
  --shadow-active: 0 2px 8px rgba(78, 62, 45, 0.06);

  --transition-fast: 150ms ease;
  --transition-bounce: 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */
.app-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-card);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--coral-main) 0%, var(--honey-main) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
  flex-shrink: 0;
}

.brand-atom-svg {
  width: 24px;
  height: 24px;
  display: block;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-page);
  border: 1px solid var(--border-card);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.btn-back-home:hover {
  background: #f1ede4;
  transform: translateX(-2px);
}

.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--border-card);
}

.sim-brand-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
}

.nav-home-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-page);
  border: 1px solid var(--border-card);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.nav-home-pill:hover {
  color: var(--text-main);
  background: #f1ede4;
}

/* ==========================================================================
   LANDING PAGE: MINIMALIST ICON BUTTON LAUNCHER
   ========================================================================== */
.landing-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px 50px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
}

@media (max-width: 600px) {
  .landing-container {
    padding: 24px 16px 36px 16px;
    gap: 30px;
  }
}

.hero-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 850;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.2;
}

@media (max-width: 600px) {
  .hero-title {
    font-size: 1.75rem;
  }
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .hero-subtitle {
    font-size: 0.92rem;
  }
}

/* Simulation Buttons Gallery Grid */
.sim-launcher-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px 28px;
  width: 100%;
  max-width: 860px;
}

@media (max-width: 600px) {
  .sim-launcher-grid {
    gap: 22px 18px;
  }
}

/* Individual Simulation Tile Item */
.sim-tile-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 150px;
}

@media (max-width: 600px) {
  .sim-tile-item {
    width: 130px;
    gap: 8px;
  }
}

/* The Interactive Icon Button (Square with large icon covering most of it) */
.sim-icon-button {
  width: 140px;
  height: 140px;
  background: var(--bg-card);
  border: 2.5px solid var(--border-card);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  padding: 12px;
  transition: transform var(--transition-bounce), box-shadow var(--transition-fast), border-color var(--transition-fast);
  user-select: none;
}

@media (max-width: 600px) {
  .sim-icon-button {
    width: 124px;
    height: 124px;
    border-radius: 24px;
    padding: 10px;
  }
}

/* Big SVG illustration covering most of button */
.sim-tile-icon-svg {
  width: 90%;
  height: 90%;
  display: block;
  transition: transform var(--transition-bounce);
}

/* Active Simulation Button Styling */
.sim-icon-button.active {
  border-color: #ffd0d0;
  background: linear-gradient(145deg, #ffffff 0%, #fff7f7 100%);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.15);
}

.sim-icon-button.active:hover {
  transform: translateY(-5px) scale(1.04);
  box-shadow: 0 12px 30px rgba(255, 107, 107, 0.28);
  border-color: var(--coral-main);
}

.sim-icon-button.active:hover .sim-tile-icon-svg {
  transform: scale(1.06);
}

.sim-icon-button.active:active {
  transform: translateY(-1px) scale(0.98);
}

/* Inactive / Coming Soon Simulation Button */
.sim-icon-button.disabled {
  background: #fbf9f5;
  border-color: #eee9e0;
  opacity: 0.72;
  cursor: default;
  filter: grayscale(18%);
}

.sim-icon-button.disabled:hover {
  transform: none;
}

.soon-pill-badge {
  position: absolute;
  bottom: 8px;
  background: rgba(237, 232, 223, 0.95);
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* The Name Below the Button (One Single Line) */
.sim-tile-label {
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--text-main);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 600px) {
  .sim-tile-label {
    font-size: 0.82rem;
  }
}

.sim-tile-item.disabled .sim-tile-label {
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================================
   SIMULATION PAGE LAYOUT & CARDS (For spring.html)
   ========================================================================== */
.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  flex: 1;
  width: 100%;
}

@media (max-width: 900px) {
  .main-wrapper {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 14px;
  }
}

.sim-col, .controls-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fun-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-top {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-card);
  background: rgba(250, 247, 242, 0.4);
}

.card-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.regime-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition-fast);
}

.regime-pill.underdamped { background: var(--indigo-light); color: var(--indigo-main); }
.regime-pill.critical { background: var(--mint-light); color: var(--mint-main); }
.regime-pill.overdamped { background: var(--honey-light); color: var(--honey-hover); }
.regime-pill.undamped { background: var(--coral-light); color: var(--coral-main); }

/* Canvas Viewport */
.canvas-holder {
  position: relative;
  width: 100%;
  height: 420px;
  background: #fdfcf9;
  cursor: default;
}

@media (max-width: 900px) {
  .canvas-holder {
    height: 360px;
  }
}

@media (max-width: 600px) {
  .canvas-holder {
    height: 310px;
  }
}

#oscillatorCanvas,
#pendulumCanvas,
#waveCanvas,
#orbitCanvas,
#projectileCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.drag-hint-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-card);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--coral-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  pointer-events: none;
  user-select: none;
}

/* Hooke's Law Interactive Card */
.hooke-card {
  border-color: #ffd0d0;
}

.hooke-formula-badge {
  background: var(--coral-light);
  color: var(--coral-main);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
}

.hooke-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hooke-equation-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
}

.hooke-term {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.term-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.term-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.term-val.coral {
  color: var(--coral-main);
}

.term-val.mint {
  color: var(--mint-main);
}

.term-val.indigo {
  color: var(--indigo-main);
}

.eq-symbol {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dim);
}

.force-meter-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meter-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.force-meter-track {
  width: 100%;
  height: 10px;
  background: #ede8df;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.force-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ff6b6b);
  border-radius: var(--radius-pill);
  transition: width 60ms linear;
}

.hooke-insight-text {
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.45;
  background: #fff8f5;
  border-left: 3px solid var(--coral-main);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Card Header Action buttons (Pause/Play & Reset) */
.card-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-card-action,
.btn-card-reset {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.btn-card-action:hover,
.btn-card-reset:hover {
  background: #f1ede4;
  color: var(--text-main);
  transform: translateY(-1px);
}

.btn-card-action:active,
.btn-card-reset:active {
  transform: translateY(1px);
}

.btn-card-action.paused {
  background: var(--mint-main);
  color: #ffffff;
  border-color: var(--mint-main);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.preset-info h4 {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.preset-info p {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Sliders */
.sliders-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slider-unit {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.slider-val-tag {
  background: var(--bg-page);
  border: 1px solid var(--border-card);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--coral-main);
  font-variant-numeric: tabular-nums;
}

/* Custom warm range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #ede8df;
  border-radius: var(--radius-pill);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--coral-main);
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  cursor: grab;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--coral-hover);
}

input[type="range"]::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.05);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--coral-main);
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  cursor: grab;
}

/* Collapsible Details */
.details-toggle {
  background: transparent;
  border: none;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  width: 100%;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Collapsible Cards (Spring Control, Hooke's Law, Motion Graph) */
.collapsible-section-card,
.collapsible-graph-card {
  overflow: hidden;
}

.collapse-heading-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.collapse-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(250, 247, 242, 0.4);
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.collapse-trigger:hover {
  background: rgba(241, 237, 228, 0.6);
}

.collapse-state-pill {
  background: var(--bg-page);
  border: 1px solid var(--border-card);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.collapse-trigger:hover .collapse-state-pill {
  color: var(--text-main);
  background: #ffffff;
}

.collapse-content {
  border-top: 1px solid var(--border-card);
}

.collapsible-graph-card .collapse-content {
  padding: 12px 14px 14px 14px;
}

.graph-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.graph-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
}

.graph-metric-label {
  color: var(--text-main);
}

.graph-axis-hint {
  color: var(--text-dim);
}

.graph-canvas-container {
  width: 100%;
  height: 110px;
  background: #faf7f2;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

#graphCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Segmented Control (Pill buttons for discrete choices) */
.segmented-control {
  display: flex;
  background: #ede8df;
  padding: 3px;
  border-radius: var(--radius-pill);
  gap: 3px;
}

.segmented-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
  user-select: none;
}

.segmented-btn:hover {
  color: var(--text-main);
}

.segmented-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Wave Simulation Accents */
.wave-physics-card {
  border-color: #c7f2e1;
}

.wave-formula-badge {
  background: var(--mint-light);
  color: var(--mint-main);
}

.wave-meter-fill {
  background: linear-gradient(90deg, #10b981, #6366f1);
}

.wave-insight-text {
  border-left-color: var(--mint-main);
  background: #f0fdf4;
}

/* Orbit Simulation Accents */
.orbit-physics-card {
  border-color: #fde68a;
}

.orbit-formula-badge {
  background: var(--honey-light);
  color: var(--honey-hover);
}

.orbit-meter-fill {
  background: linear-gradient(90deg, #f59e0b, #38bdf8);
}

.orbit-insight-text {
  border-left-color: var(--honey-main);
  background: #fffdf5;
}

/* Projectile Simulation Accents */
.projectile-physics-card {
  border-color: #fecdd3;
}

.projectile-formula-badge {
  background: #ffe4e6;
  color: #e11d48;
}

.projectile-meter-fill {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}

.projectile-insight-text {
  border-left-color: #f43f5e;
  background: #fff1f2;
}

.btn-card-action.fire {
  background: #f43f5e;
  color: #ffffff;
  border-color: #e11d48;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.35);
}

.btn-card-action.fire:hover {
  background: #e11d48;
  color: #ffffff;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 18px;
  font-size: 0.76rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-card);
  margin-top: auto;
}
