/* ===========================================================================
 * Wave simulation — styling for the canvas, controls, and the two-column
 * hero variant that places the simulation beside the title.
 *
 * Depends on the design tokens defined in style.css.
 * ========================================================================= */

/* ---- Two-column hero ---- */
.hero--with-sim .hero__grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: var(--space-lg);
  align-items: center;
  width: 100%;
}

.hero--with-sim .hero__content {
  max-width: 100%;
}

.hero--with-sim .hero__title {
  font-size: clamp(2rem, 4.2vw, 3.2rem);
}

/* ---- Simulation panel ---- */
.wave-mount {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

.wave-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #14202c;
  border: 1px solid rgba(168, 212, 238, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: crosshair;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.wave-canvas {
  width: 100%;
  height: 100%;
  display: block;
  /* iOS: suppress the long-press callout and any default touch gestures
     so a hold doesn't fire touchcancel mid-tone and kill the continuous
     source. preventDefault() in JS alone doesn't stop the callout. */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.wave-hint {
  position: absolute;
  inset: auto 0 1rem 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 400;
  color: rgba(240, 240, 238, 0.6);
  pointer-events: none;
  letter-spacing: 0.02em;
  transition: opacity 0.6s ease;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.wave-hint.is-faded { opacity: 0; }

/* ---- Render-mode toggle (floats centered on top of the canvas) ----
   Glassmorphic pill with a sliding thumb. data-active="pressure|intensity"
   on the container drives which segment the thumb sits under, so the
   transition runs purely off CSS. */
.wave-mode-toggle {
  position: absolute;
  top: 0.7rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  padding: 3px;
  background: rgba(20, 32, 44, 0.62);
  border: 1px solid rgba(168, 212, 238, 0.18);
  border-radius: 999px;
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  z-index: 3;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.wave-mode-toggle__thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--color-accent);
  border-radius: 999px;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

.wave-mode-toggle[data-active="intensity"] .wave-mode-toggle__thumb {
  transform: translateX(100%);
}

.wave-mode-toggle__btn {
  position: relative;
  z-index: 1;
  flex: 1;
  font-family: var(--font-main);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.4rem 1.1rem;
  background: transparent;
  color: rgba(240, 240, 238, 0.62);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.wave-mode-toggle__btn:hover {
  color: rgba(240, 240, 238, 0.92);
}

.wave-mode-toggle__btn.is-active {
  color: #fff;
}

/* ---- Stationary source markers (overlay layer above the canvas) ---- */
.wave-source-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wave-source-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  background: rgba(168, 212, 238, 0.85);
  border: 1.5px solid rgba(20, 32, 44, 0.6);
  box-shadow: 0 0 8px rgba(168, 212, 238, 0.45);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.wave-source-marker.is-dragging { cursor: grabbing; }

.wave-source-marker__close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(20, 32, 44, 0.78);
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transition: opacity var(--transition), background var(--transition);
}

.wave-source-marker:hover .wave-source-marker__close,
.wave-source-marker__close:hover {
  opacity: 1;
}

.wave-source-marker__close:hover {
  background: rgba(201, 122, 90, 0.95);
}

.wave-frame.is-placing { cursor: copy; }

/* ---- Controls (sit on the dark hero) ---- */
.wave-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Preset row: a single grouped segmented control. The wrapping track gives
   the buttons a unified surface; individual buttons are borderless and the
   active one fills with a faint accent tint instead of a solid colour, so
   it doesn't compete with the floating mode toggle. */
.wave-presets {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: rgba(240, 240, 238, 0.04);
  border: 1px solid rgba(240, 240, 238, 0.08);
  border-radius: 7px;
}

.wave-presets .wave-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 5px;
  padding: 0.45rem 0.5rem;
  font-size: 0.74rem;
  letter-spacing: 0.01em;
}

.wave-presets .wave-btn:hover {
  background: rgba(240, 240, 238, 0.06);
  border-color: transparent;
}

.wave-presets .wave-btn.is-active {
  background: rgba(168, 212, 238, 0.16);
  color: rgb(168, 212, 238);
  border-color: transparent;
}

.wave-btn {
  font-family: var(--font-main);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.42rem 0.75rem;
  background: rgba(240, 240, 238, 0.04);
  color: rgba(240, 240, 238, 0.72);
  border: 1px solid rgba(240, 240, 238, 0.12);
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}

.wave-btn:hover {
  background: rgba(240, 240, 238, 0.08);
  color: var(--color-hero-text);
  border-color: rgba(240, 240, 238, 0.22);
}

.wave-btn.is-active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.wave-btn--ghost {
  background: transparent;
}

.wave-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 30px;
}

.wave-label {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(240, 240, 238, 0.42);
  white-space: nowrap;
  min-width: 84px;
}

.wave-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: rgba(240, 240, 238, 0.14);
  outline: none;
  border-radius: 999px;
  cursor: pointer;
}

.wave-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-hero-text);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 0 rgba(168, 212, 238, 0);
  transition: box-shadow 0.18s ease;
}

.wave-slider:hover::-webkit-slider-thumb,
.wave-slider:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px rgba(168, 212, 238, 0.18);
}

.wave-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-hero-text);
  border: none;
  cursor: pointer;
  transition: box-shadow 0.18s ease;
}

.wave-slider:hover::-moz-range-thumb,
.wave-slider:focus::-moz-range-thumb {
  box-shadow: 0 0 0 5px rgba(168, 212, 238, 0.18);
}

/* ---- Mobile: stack title above sim ---- */
@media (max-width: 900px) {
  .hero--with-sim .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .wave-mount {
    max-width: 420px;
  }
}

@media (max-width: 480px) {
  .wave-btn {
    font-size: 0.72rem;
    padding: 0.35rem 0.55rem;
  }
}
