/* ============================================================================
   High Dimension Music Group — core theme
   Dark rasta: deep black-green field, red/gold/green triad, neon edge light.
   ========================================================================== */

:root {
  /* field */
  --void: #040906;
  --deep: #07100b;
  --panel: #0c1810;
  --panel-2: #112217;
  --line: #1c3524;
  --line-hot: #2a5236;

  /* rasta triad */
  --red: #e63946;
  --red-soft: #ff5a67;
  --gold: #f4c542;
  --gold-soft: #ffd96b;
  --green: #2fbf71;
  --green-soft: #4ee094;

  /* ink */
  --ink: #eaf5ec;
  --ink-2: #a9c4b0;
  --ink-3: #6b8874;
  --ink-4: #455c4d;

  --rasta: linear-gradient(90deg, var(--red) 0%, var(--gold) 50%, var(--green) 100%);
  --rasta-135: linear-gradient(135deg, var(--red) 0%, var(--gold) 50%, var(--green) 100%);
  --glow-green: 0 0 0 1px rgba(47, 191, 113, 0.3), 0 0 32px -4px rgba(47, 191, 113, 0.45);
  --glow-gold: 0 0 0 1px rgba(244, 197, 66, 0.3), 0 0 32px -4px rgba(244, 197, 66, 0.4);

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --r-full: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--deep);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient field: three coloured pools + a fine grain, fixed behind everything. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60vw 60vh at 12% -10%, rgba(230, 57, 70, 0.14), transparent 60%),
    radial-gradient(55vw 55vh at 92% 8%, rgba(244, 197, 66, 0.11), transparent 60%),
    radial-gradient(70vw 70vh at 50% 108%, rgba(47, 191, 113, 0.16), transparent 62%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.6) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: overlay;
}

/* ------------------------------------------------------------------ type */

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 650;
}

h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; color: var(--ink-2); }
a { color: var(--green-soft); text-decoration: none; }
a:hover { color: var(--gold-soft); }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin: 0 0 12px;
}

.gradient-text {
  background: var(--rasta);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; }
.muted { color: var(--ink-3); }
.tiny { font-size: 12px; }

/* --------------------------------------------------------------- surfaces */

.panel {
  background: linear-gradient(180deg, rgba(17, 34, 23, 0.85), rgba(12, 24, 16, 0.85));
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(14px);
}

.rasta-bar {
  height: 3px;
  background: var(--rasta);
  border-radius: var(--r-full);
}

/* --------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid var(--line-hot);
  border-radius: var(--r-full);
  background: rgba(17, 34, 23, 0.7);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.18s var(--ease), border-color 0.18s, background 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--green);
  box-shadow: var(--glow-green);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--rasta-135);
  color: #06120a;
  border-color: transparent;
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--glow-gold); }

.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-icon { padding: 9px; border-radius: var(--r-full); }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(4, 9, 6, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 191, 113, 0.15);
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%236b8874' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 11px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.field { margin-bottom: 16px; }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.check input { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; flex: none; }

/* ------------------------------------------------------------------ chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: rgba(12, 24, 16, 0.7);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
}
.chip:hover { border-color: var(--line-hot); color: var(--ink); }
.chip.active {
  background: var(--rasta-135);
  color: #06120a;
  border-color: transparent;
}
.chip .n {
  font-size: 11px;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.tag-green { background: rgba(47, 191, 113, 0.16); color: var(--green-soft); }
.tag-gold  { background: rgba(244, 197, 66, 0.16); color: var(--gold-soft); }
.tag-red   { background: rgba(230, 57, 70, 0.16); color: var(--red-soft); }
.tag-dim   { background: rgba(107, 136, 116, 0.14); color: var(--ink-3); }

/* ---------------------------------------------------------------- overlays */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4, 9, 6, 0.82);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease);
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-hot);
  border-radius: var(--r-lg);
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.28s var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-backdrop.open .modal { transform: none; }
.modal-body { padding: 28px; }
.modal-lg { max-width: 620px; }

.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(400px, calc(100vw - 32px));
}
.toast {
  padding: 13px 18px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  border: 1px solid var(--line-hot);
  border-left: 3px solid var(--green);
  font-size: 13.5px;
  color: var(--ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.32s var(--ease);
}
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--gold); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- helpers */

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: var(--r-full); border: 2px solid var(--deep); }
::-webkit-scrollbar-thumb:hover { background: var(--line-hot); }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
