/* soccer3d — Audio CSS (ACS) UI sound effects. Source of truth.
 *
 * Served at /soccer3d.acs and linked via <link rel="audiostyle"> in
 * index.html. The acs-audio runtime (imported in main.tsx) auto-loads its
 * 49 built-in presets (defaults.acs) plus this sheet, then attaches one
 * document-level listener per event type and resolves the cascade.
 *
 * Mantine v8 emits stable `mantine-{Component}-{section}` classes that we
 * target here. Semantic intent the DOM doesn't encode (primary vs
 * destructive action) is tagged with a `data-sfx="..."` attribute on the
 * component (Mantine forwards unknown props to the root node).
 *
 * In-scene game audio (ball kick, stadium ambience) uses real recorded samples (Ogg Vorbis, src/assets/sfx/)
 * via the separate Web Audio module lib/gameAudio.ts — not this sheet.
 */

:root {
  master-volume: 0.6;
  room: small-room;
}

/* === Buttons ===
 * Baseline: every Mantine Button / ActionIcon gets a tactile tap.
 * The cta/danger overrides below have the SAME specificity (0,1,0) as
 * this base rule, so they win purely by source order — they must stay
 * declared AFTER this block. Do NOT reorder. (Disabled rules below use
 * 0,2,0 and override regardless of order.) */
.mantine-Button-root,
.mantine-ActionIcon-root {
  sound-on-click: tap-tactile;
}

/* Disabled controls reject the click (higher specificity, 0,2,0).
 * Note: a natively-disabled <button disabled> dispatches no click event,
 * so this only fires for Mantine's data-disabled / aria-disabled buttons;
 * our `disabled`-prop buttons stay silent (intended). */
.mantine-Button-root:disabled,
.mantine-Button-root[data-disabled],
.mantine-ActionIcon-root:disabled,
.mantine-ActionIcon-root[data-disabled] {
  sound-on-click: denied;
  volume: 0.3;
}

/* Primary / commit actions — Host, Join, Create, Start, Save, Confirm. */
[data-sfx='cta'] {
  sound-on-click: pop;
}

/* Destructive / exit actions — Leave Room, End Match. */
[data-sfx='danger'] {
  sound-on-click: thunk;
}

/* === Modals === */
.mantine-Modal-content {
  sound-on-appear: modal-open;
  sound-on-leave: modal-close;
}

/* === Number steppers (capacity, match duration / goal target) === */
.mantine-NumberInput-control {
  sound-on-click: tick;
}

/* === Segmented control (match mode: Süre / Gol Sayısı) === */
.mantine-SegmentedControl-label {
  sound-on-click: tick;
}

/* === Text entry — soft keystroke while typing === */
input:on-input,
textarea:on-input {
  sound: keystroke;
  volume: 0.4;
}

/* Silence per-keystroke typing on touch devices (soft keyboards). */
@media (hover: none) and (pointer: coarse) {
  input:on-input,
  textarea:on-input {
    volume: 0 !important;
  }
}

/* === Accessibility ===
 * `prefers-reduced-sound` is a CSS proposal not yet shipped by browsers;
 * the acs-audio runtime evaluates it gracefully (treated as false until
 * adopted), so this is a forward-looking no-op today. */
@media (prefers-reduced-sound: reduce) {
  :root {
    master-volume: 0;
  }
}
