/* SYM-OMEGA4-V18 — Styles ROBE-MES Cathédrale Henry pour les 3 modules interactifs Ω-4
   (Instrument Web Audio 432 Hz, Carte Vivante 14 Sites, Lecteur Juxtalinéaire)
   0 dépendance externe · Responsive Desktop / Z Fold7 / Mobile · ovX = 0 */

.o4-shell {
  margin: 1.5rem 0 2rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(35, 25, 15, 0.06);
  max-width: 100%;
  box-sizing: border-box;
}

.o4-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.o4-head h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
}

.o4-sub {
  margin: 0.25rem 0 0;
  color: var(--ink-muted);
  font-size: 0.98rem;
}

.o4-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.o4-chip {
  font-family: var(--font-display);
  font-size: 0.9rem;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease;
}

.o4-chip:hover,
.o4-chip:focus-visible {
  border-color: var(--gold);
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.o4-chip[aria-pressed="true"],
.o4-chip.is-active {
  background: #26305E;
  color: #FBF7EF;
  border-color: #C9A227;
}

/* === MODULE 1 : INSTRUMENT WEB AUDIO 432 Hz × 2^40 ⇄ nm === */
.o4-audio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.o4-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.o4-metric {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.o4-metric-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.o4-metric-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--ink);
}

.o4-swatch-wrap {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  margin-bottom: 1rem;
}

.o4-swatch {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 18px rgba(201, 162, 39, 0.35);
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.o4-canvas {
  display: block;
  width: 100%;
  height: 150px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #121A36;
  margin-bottom: 0.85rem;
}

.o4-keyboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 0.45rem;
  margin: 0.85rem 0 1rem;
}

.o4-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.62rem 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-bottom: 4px solid var(--key-color, #C9A227);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  transition: transform 100ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.o4-key:hover,
.o4-key:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(35, 25, 15, 0.12);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.o4-key.is-playing {
  background: #26305E;
  color: #FBF7EF;
  border-color: #C9A227;
}

.o4-key-note {
  font-size: 1rem;
  font-weight: 700;
}

.o4-key-hz {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.85;
}

.o4-key-nm {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  opacity: 0.8;
}

.o4-slider-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.85rem;
  margin: 0.75rem 0;
}

.o4-slider-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.o4-slider-label input[type="range"] {
  width: 100%;
  accent-color: #26305E;
}

/* === MODULE 2 : CARTE VIVANTE CONSTELLATION (14 SITES) === */
.o4-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.o4-svg-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 50%, var(--surface) 0%, var(--bg-soft) 100%);
  padding: 0.5rem;
  box-sizing: border-box;
}

.o4-svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.o4-edge {
  stroke: rgba(38, 48, 94, 0.24);
  stroke-width: 1.4;
  fill: none;
  transition: stroke 160ms ease, stroke-width 160ms ease, opacity 160ms ease;
}

.o4-edge.is-lit {
  stroke: #C9A227;
  stroke-width: 3;
  opacity: 1;
}

.o4-edge.is-dim {
  opacity: 0.14;
}

.o4-node {
  cursor: pointer;
  transition: opacity 160ms ease;
}

.o4-node.is-dim {
  opacity: 0.28;
}

.o4-node circle {
  transition: r 150ms ease, stroke-width 150ms ease;
}

.o4-node:hover circle,
.o4-node:focus-visible circle,
.o4-node.is-selected circle {
  stroke: #C9A227;
  stroke-width: 3.5;
}

.o4-node-label {
  font-family: "HenryDidot", "CormorantEditorial", Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  fill: #23190F;
  pointer-events: none;
}

:root[data-theme="nuit"] .o4-node-label,
[data-theme="dark"] .o4-node-label {
  fill: #FBF7EF;
}

.o4-inspector {
  padding: 1.1rem 1.2rem;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
}

.o4-inspector h3 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.o4-links-list {
  list-style: none;
  padding: 0;
  margin: 0.65rem 0 0;
  display: grid;
  gap: 0.45rem;
}

.o4-links-list li {
  font-size: 0.9rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* === MODULE 3 : LECTEUR JUXTALINÉAIRE BILINGUE & COMMENTÉ === */
.o4-juxta-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.o4-juxta-search {
  flex: 1 1 200px;
  min-width: 0;
  padding: 0.48rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.96rem;
}

.o4-juxta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.95fr);
  gap: 0.9rem;
  align-items: start;
}

.o4-juxta-col {
  padding: 0.9rem;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.o4-juxta-col h3 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  color: var(--royal);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.o4-seg {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.58rem 0.7rem;
  margin: 0 0 0.45rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--juxta-size, 1.04rem);
  line-height: 1.55;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.o4-seg:hover,
.o4-seg:focus-visible {
  border-color: var(--gold);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.o4-seg.is-selected {
  background: #FFF6DC;
  border-color: #C9A227;
  box-shadow: inset 3px 0 0 #26305E;
}

:root[data-theme="nuit"] .o4-seg.is-selected,
[data-theme="dark"] .o4-seg.is-selected {
  background: #223163;
  border-color: #E8C958;
  box-shadow: inset 3px 0 0 #E8C958;
}

.o4-seg-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--gold-deep);
  margin-right: 0.4rem;
}

.o4-juxta-grid.is-interlinear {
  grid-template-columns: minmax(0, 1fr);
}

.o4-apparat-card {
  padding: 0.9rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--gold);
}

.o4-apparat-card h4 {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  color: var(--royal);
}

.o4-lemma-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.o4-lemma {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

/* === RESPONSIVE STRICT (Z Fold7 374px & Mobile 390px -> ovX = 0) === */
@media (max-width: 920px) {
  .o4-audio-grid,
  .o4-map-layout,
  .o4-juxta-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .o4-shell {
    padding: 1rem;
  }
}

@media (max-width: 460px) {
  .o4-keyboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .o4-shell {
    padding: 0.85rem;
  }
}
