/* styles/settings.css
   Player-facing settings modal — UI Scale + Mute Audio.
   Gear icon bottom-right opens a centered modal with two controls.
   Mirrors the project's mono-caps + serif-italic register so it
   reads as part of the world, not a generic settings tray. */

/* ---------- GEAR BUTTON ---------- */

#settings-gear {
  position: fixed;
  right: 1.5vw;
  bottom: 1.5vh;
  z-index: var(--z-hud);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 22, 0.78);
  border: 1px solid rgba(184, 224, 255, 0.22);
  border-radius: 50%;
  color: rgba(184, 224, 255, 0.55);
  cursor: pointer;
  transition: all 200ms ease;
  padding: 0;
}
#settings-gear:hover {
  color: rgba(232, 216, 255, 0.95);
  border-color: rgba(232, 216, 255, 0.6);
  box-shadow: 0 0 16px rgba(232, 216, 255, 0.18);
}
#settings-gear:active {
  transform: scale(0.95);
  filter: brightness(1.15);
}

/* Scaffold-level + beat-mode opacity dimming, so the gear breathes
   in concert with the rest of the chrome. */
body[data-scaffold-level="0"] #settings-gear { opacity: 0.55; }
body[data-scaffold-level="1"] #settings-gear { opacity: 0.75; }
body[data-scaffold-level="2"] #settings-gear { opacity: 0.95; }
body[data-scaffold-level="3"] #settings-gear { opacity: 1;    }
body.beat-prose #settings-gear { opacity: 0.4; }

/* ---------- MODAL ---------- */

#settings-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
}
#settings-modal.open { display: flex; }

#settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

#settings-panel {
  position: relative;
  width: min(30rem, 92vw);
  max-height: 84vh;
  background: rgba(10, 14, 22, 0.97);
  border: 1px solid rgba(184, 224, 255, 0.32);
  border-radius: 4px;
  box-shadow:
    0 0 32px rgba(184, 224, 255, 0.12),
    0 16px 48px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: settings-panel-appear 280ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes settings-panel-appear {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ---------- HEADER ---------- */

#settings-header {
  position: relative;
  padding: 22px 24px 16px 24px;
  border-bottom: 1px solid rgba(184, 224, 255, 0.15);
}
#settings-eyebrow {
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.45em;
  color: rgba(184, 224, 255, 0.5);
  text-transform: uppercase;
  margin-bottom: 6px;
}
#settings-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  color: rgba(232, 216, 255, 0.95);
  line-height: 1;
  margin: 0;
}
#settings-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid rgba(232, 216, 255, 0.25);
  border-radius: 2px;
  color: rgba(232, 216, 255, 0.75);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: all 200ms ease;
  padding: 0;
}
#settings-close:hover {
  border-color: rgba(232, 216, 255, 0.9);
  color: rgba(232, 216, 255, 1);
  background: rgba(232, 216, 255, 0.08);
}

/* ---------- BODY ---------- */

#settings-body {
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-row-label .srl-name {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(232, 216, 255, 0.95);
}
.settings-row-label .srl-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.88rem;
  color: rgba(232, 216, 255, 0.6);
  line-height: 1.35;
  margin-top: 4px;
}
.settings-row-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- UI SCALE RADIO BUTTONS ---------- */

#ui-scale-control {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.scale-btn {
  flex: 1 1 0;
  min-width: 56px;
  padding: 10px 8px;
  background: rgba(20, 24, 32, 0.7);
  border: 1px solid rgba(184, 224, 255, 0.25);
  border-radius: 2px;
  color: rgba(184, 224, 255, 0.78);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 180ms ease;
}
.scale-btn:hover {
  border-color: rgba(184, 224, 255, 0.65);
  background: rgba(30, 38, 56, 0.85);
  color: rgba(232, 240, 255, 0.95);
}
.scale-btn.active {
  background: rgba(60, 90, 130, 0.6);
  border-color: rgba(184, 224, 255, 0.95);
  color: rgba(248, 232, 192, 1);
  box-shadow: 0 0 12px rgba(184, 224, 255, 0.28);
  font-weight: bold;
}

/* ---------- MUTE TOGGLE SWITCH ---------- */

#mute-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 6px 4px;
  font-family: var(--mono);
}
.toggle-track {
  position: relative;
  width: 44px;
  height: 22px;
  background: rgba(20, 24, 32, 0.85);
  border: 1px solid rgba(184, 224, 255, 0.4);
  border-radius: 12px;
  transition: all 200ms ease;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: rgba(184, 224, 255, 0.85);
  border-radius: 50%;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
#mute-toggle.on .toggle-track {
  background: rgba(80, 130, 180, 0.6);
  border-color: rgba(184, 224, 255, 0.95);
}
#mute-toggle.on .toggle-thumb {
  left: 24px;
  background: rgba(232, 248, 255, 1);
}
.toggle-label {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(184, 224, 255, 0.85);
  min-width: 32px;
}
#mute-toggle.on .toggle-label {
  color: rgba(232, 248, 255, 1);
}

/* ---------- FOOTER ---------- */

#settings-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px 18px 24px;
  border-top: 1px solid rgba(184, 224, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
}
#settings-reset {
  background: transparent;
  border: 1px solid rgba(232, 216, 255, 0.28);
  border-radius: 2px;
  color: rgba(232, 216, 255, 0.7);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 180ms ease;
}
#settings-reset:hover {
  border-color: rgba(232, 216, 255, 0.85);
  color: rgba(232, 216, 255, 1);
}
#settings-footer-note {
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.32em;
  color: rgba(184, 224, 255, 0.45);
  text-transform: uppercase;
}

/* Discreet author credit below the footer — quieter than the footer
   note itself; the link styling mirrors the celestial-violet of the
   Narrator voice so it reads as part of the game's typographic
   vocabulary, not a generic hyperlink. */
#settings-credit {
  padding: 12px 24px 16px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.7rem;
  text-align: center;
  color: rgba(184, 212, 232, 0.32);
  border-top: 1px solid rgba(184, 212, 232, 0.06);
}
#settings-credit a {
  color: rgba(232, 216, 255, 0.55);
  text-decoration: none;
  border-bottom: 1px dotted rgba(232, 216, 255, 0.3);
  transition: color 300ms ease, border-color 300ms ease;
}
#settings-credit a:hover,
#settings-credit a:focus-visible {
  color: rgba(232, 216, 255, 0.92);
  border-bottom-color: rgba(232, 216, 255, 0.8);
  outline: none;
}

/* ---------- SHORT-VIEWPORT GEAR (P2-8) ----------
   On laptops or short windows (<800px tall), the 36px gear at
   bottom-right approaches the Toll voice's right-bottom margin zone
   (bottom 28%, right 4vw). Shrink to 28px so the chrome footprint
   doesn't compete with the prose. Also nudges off the right edge to
   give the Toll voice a clearer corner. */
@media (max-height: 800px) {
  #settings-gear {
    width: 28px;
    height: 28px;
    right: 1vw;
    bottom: 1vh;
  }
  #settings-gear svg { width: 16px; height: 16px; }
}

/* ---------- REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {
  #settings-gear,
  #settings-close,
  .scale-btn,
  .toggle-track,
  .toggle-thumb,
  #settings-reset { transition-duration: 100ms; }
  #settings-panel { animation-duration: 120ms; }
}
