/* chirp.css: styling for the gravitational wave chirp demo.
 * Fedora Core 1 window chrome with dual canvas: space grey 3D orbit viewport
 * and sunken slate metric strain oscilloscope. */

:root {
  --lead: #5BCEFA;   /* sky blue (leader) */
  --twin1: #F5A9B8;  /* soft pink (twin b) */
  --twin2: #FFFFFF;  /* crisp white (twin c) */
  --horizon: #111827;
  --isco-ring: #ef4444;
  --space-grey: #0d121d;
  --oscilloscope-bg: #2e3440;
  --grid-line: #3b4252;
  --grid-text: #88c0d0;
  --font-mono: 'CaskaydiaCove Nerd Font Mono', 'CaskaydiaCove NF', monospace;
  --font-sans: 'Lexend Deca', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body.demo-page {
  background-color: #ffffff;
  color: #000000;
  font-family: var(--font-sans);
}

body.demo-page main {
  max-width: none;
}

.crumbs {
  font-size: 13px;
  margin: 0 0 16px 0;
  color: #555;
}

.crumbs a {
  color: #0000ee;
  text-decoration: underline;
}

.hero2 {
  display: flex;
  flex-direction: row;
  gap: 24px;
  align-items: flex-start;
  margin: 12px 0 24px 0;
}

.hero-text {
  flex: 1 1 55%;
  min-width: 0;
}

.hero-text h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 10px 0;
  letter-spacing: -0.02em;
}

.hero-text .lede {
  font-size: 15px;
  line-height: 1.5;
  color: #222;
  margin: 0 0 16px 0;
}

.hero-code {
  flex: 1 1 45%;
  min-width: 320px;
}

.hero-code pre.code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.release-box {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pair-buttons {
  display: flex;
  gap: 8px;
}

.pair-buttons a.button {
  white-space: nowrap;
}

/* FC1 Window Frame */
.ws-window {
  display: flex;
  flex-direction: column;
  height: clamp(560px, 80vh, 820px);
  min-height: 520px;
  border: 1px solid #7a7a7a;
  background: #d4d0c8;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.25);
  margin-bottom: 30px;
  overflow: hidden;
}

.ws-window.ws-max {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  border-radius: 0;
  border: none;
  max-width: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.ws-maxed {
  overflow: hidden;
}

.ws-titlebar {
  flex: 0 0 26px;
  background: linear-gradient(#fafafa, #d2d2d2);
  border-bottom: 1px solid #7a7a7a;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #000;
  user-select: none;
}

.ws-titlebar button {
  background: #ece9d8;
  border: 1px solid #7a7a7a;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #a0a0a0;
  width: 18px;
  height: 18px;
  padding: 0;
  line-height: 14px;
  font-size: 12px;
  cursor: pointer;
}

.demo-container {
  display: flex;
  flex-direction: row;
  border-top: 1px solid #fff;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.viewport-panel {
  flex: 1 1 65%;
  display: flex;
  flex-direction: column;
  background: #e0ded8;
  border-right: 1px solid #7a7a7a;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.canvas-wrapper {
  position: relative;
  flex: 1 1 0;
  min-height: 180px;
  height: 100%;
  width: 100%;
  background: radial-gradient(circle at 50% 40%, #1e2638 0%, #0d121d 85%);
  border-bottom: 1px solid #7a7a7a;
  box-shadow: inset 1px 1px 0 #000;
  overflow: hidden;
}

#orbitCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#orbitCanvas:active {
  cursor: grabbing;
}

.oscilloscope-panel {
  position: relative;
  flex: 0 0 clamp(120px, 20vh, 180px);
  min-height: 100px;
  width: 100%;
  background: var(--oscilloscope-bg);
  box-shadow: inset 1px 1px 0 #1e2638;
  border-bottom: 1px solid #7a7a7a;
  overflow: hidden;
}

#scopeCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.scope-title-badge {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--grid-text);
  background: rgba(13, 18, 29, 0.75);
  padding: 2px 6px;
  border: 1px solid #4c566a;
  pointer-events: none;
  z-index: 5;
}

/* Overlay Legends & Pills */
.overlay-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(13, 18, 29, 0.85);
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 6px 10px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  backdrop-filter: blur(2px);
  z-index: 5;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.camera-controls-floating {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}

.btn-icon {
  width: 26px;
  height: 26px;
  background: rgba(13, 18, 29, 0.85);
  border: 1px solid #334155;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.btn-icon:hover {
  background: #1e293b;
  color: #ffffff;
}

.btn-icon.btn-active {
  background: #1e293b;
  border-color: #5BCEFA;
  color: #5BCEFA;
}

.audio-pill {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(13, 18, 29, 0.85);
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 4px 8px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  z-index: 5;
}

.audio-pill.active {
  border-color: #5BCEFA;
  color: #5BCEFA;
}

/* Timeline Playback Dock */
.timeline-dock {
  background: #ece9d8;
  padding: 8px 12px;
  border-top: 1px solid #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.playback-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.btn {
  background: #ece9d8;
  border: 1px solid #7a7a7a;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #a0a0a0;
  padding: 3px 8px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.2;
}

.btn:active, .btn-active {
  box-shadow: inset 1px 1px 0 #a0a0a0, inset -1px -1px 0 #fff;
  background: #d8d4c8;
}

.btn-primary {
  font-weight: 700;
}

#playPauseBtn {
  width: 64px;
  min-width: 64px;
  padding: 3px 6px;
  white-space: nowrap;
}

#playIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  font-size: 12px;
  line-height: 1;
}

#playIcon.is-pause {
  font-size: 0;
  gap: 2px;
}

#playIcon.is-pause::before,
#playIcon.is-pause::after {
  content: "";
  display: block;
  width: 2.5px;
  height: 8.5px;
  background: currentColor;
}

.timeline-slider-wrap {
  width: 100%;
}

.timeline-slider {
  width: 100%;
  margin: 0;
  cursor: pointer;
}

.timeline-scrubber-info {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #333;
}

/* Sidebar Panel */
.sidebar-panel {
  flex: 0 0 350px;
  max-width: 420px;
  min-width: 290px;
  height: 100%;
  background: #ece9d8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-nav {
  flex: 0 0 auto;
  display: flex;
  background: #d4d0c8;
  border-bottom: 1px solid #7a7a7a;
  padding: 4px 6px 0 6px;
  gap: 2px;
}

.tab-btn {
  border: 1px solid #7a7a7a;
  border-bottom: none;
  background: linear-gradient(#f6f6f6, #dedede);
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  text-transform: lowercase;
}

.tab-btn.active {
  background: #ece9d8;
  font-weight: 700;
  position: relative;
  top: 1px;
}

.tab-content {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  padding: 10px;
  overflow-y: auto;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.card-section {
  background: #f4f2e9;
  border: 1px solid #7a7a7a;
  box-shadow: inset 1px 1px 0 #fff;
  padding: 10px;
  margin-bottom: 10px;
}

.card-title,
.ws-window h1,
.ws-window h2,
.ws-window h3,
.ws-window h4,
.home2 .ws-window h1,
.home2 .ws-window h2,
.home2 .ws-window h3,
.home2 .ws-window h4,
.home2 .ws-window .card-title {
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  margin: 0 0 6px 0 !important;
  padding: 0 !important;
  border: 0 !important;
  text-transform: lowercase !important;
  letter-spacing: normal !important;
  color: #000000 !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ws-window h1::after,
.ws-window h2::after,
.ws-window h3::after,
.ws-window h4::after,
.ws-window .card-title::after,
.home2 .ws-window h1::after,
.home2 .ws-window h2::after,
.home2 .ws-window h3::after,
.home2 .ws-window h4::after,
.home2 .ws-window .card-title::after {
  display: none !important;
  content: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Consensus Tether Controls */
.consensus-card {
  border-left: 3px solid #5BCEFA;
}

.tether-control-box {
  margin: 6px 0;
}

.tether-extremes-row, .tether-sub-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #555;
}

.consensus-slider {
  width: 100%;
  margin: 4px 0;
}

.tether-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  background: #fff;
  border: 1px solid #7a7a7a;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.telemetry-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 4px;
}

.telemetry-label {
  color: #444;
}

.telemetry-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #000;
}

/* Monospace Terminal Code Box */
.terminal-box {
  background: var(--oscilloscope-bg);
  color: #d8dee9;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  padding: 8px;
  border: 1px solid #4c566a;
  box-shadow: inset 1px 1px 2px #000;
  overflow-x: auto;
  white-space: pre;
}

.receipt-verified-badge {
  display: inline-block;
  background: #2e7d32;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  margin-bottom: 6px;
}

/* Responsive Rules */
@media (max-width: 860px) {
  .desktop-only {
    display: none !important;
  }
  .hero2 {
    flex-direction: column;
  }
  .hero-text,
  .hero-code {
    width: 100%;
    min-width: 0;
    flex: none;
  }
  .ws-window:not(.ws-max) {
    display: block;
    flex: none;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }
  .ws-window:not(.ws-max) .demo-container {
    display: block;
    flex: none;
    height: auto;
    overflow: visible;
  }
  .ws-window:not(.ws-max) .viewport-panel {
    display: block;
    flex: none;
    border-right: none;
    border-bottom: 1px solid #7a7a7a;
    width: 100%;
    min-width: 0;
    height: auto;
    overflow: visible;
  }
  .ws-window:not(.ws-max) .canvas-wrapper {
    display: block;
    flex: none;
    width: 100%;
    height: 300px;
    min-height: 260px;
  }
  .ws-window:not(.ws-max) .oscilloscope-panel {
    display: block;
    flex: none;
    width: 100%;
    height: 120px;
    min-height: 100px;
  }
  .ws-window:not(.ws-max) .timeline-dock {
    flex: none;
    width: 100%;
    height: auto;
  }
  .ws-window:not(.ws-max) .sidebar-panel {
    display: block;
    flex: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    overflow: visible;
  }
  .ws-window:not(.ws-max) .tab-content {
    display: block;
    flex: none;
    height: auto;
    max-height: none;
    overflow-y: visible;
  }
  .overlay-legend {
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 4px 8px;
    font-size: 10px;
  }
  .legend-item {
    margin: 0;
  }
  .legend-item span:last-child {
    display: none;
  }
  .legend-item[data-short]::after {
    content: attr(data-short);
    font-weight: 700;
  }
  .scope-title-badge {
    font-size: 9.5px;
    max-width: calc(100% - 16px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .playback-controls #stepPrevBtn,
  .playback-controls #stepNextBtn {
    display: none;
  }
  .playback-controls {
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 4px;
  }
  .playback-controls .btn {
    flex: 1 1 auto;
    padding: 4px 6px;
    font-size: 11px;
    white-space: nowrap;
  }
  .ws-window.ws-max {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .ws-window.ws-max .demo-container {
    flex-direction: column;
    height: 100%;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }
  .ws-window.ws-max .viewport-panel {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #7a7a7a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .ws-window.ws-max .canvas-wrapper {
    flex: 1 1 auto;
    min-height: 140px;
    height: auto;
    width: 100%;
  }
  .ws-window.ws-max .oscilloscope-panel {
    flex: 0 0 84px;
    min-height: 70px;
    height: 84px;
    width: 100%;
  }
  .ws-window.ws-max .timeline-dock {
    flex: 0 0 auto;
    width: 100%;
    padding: 6px 10px;
    gap: 4px;
  }
  .ws-window.ws-max .sidebar-panel {
    flex: 0 0 35dvh;
    height: 35dvh;
    max-height: 35dvh;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .ws-window.ws-max .tab-content {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
  }
  .hero-code pre.code {
    white-space: pre-wrap;
    word-break: break-all;
  }
}

