/* ===========================================================================
   Yalper — landing & app shell
   Plain CSS, no framework. Heavy use of CSS animations + custom properties.
   =========================================================================== */

:root {
  --bg-0: #07060e;
  --bg-1: #0f0d1f;
  --bg-2: #181434;
  --surface: rgba(28, 22, 60, 0.65);
  --surface-strong: rgba(40, 32, 80, 0.85);
  --border: rgba(163, 133, 255, 0.18);
  --border-strong: rgba(163, 133, 255, 0.42);
  --primary: #a385ff;
  --primary-deep: #6c4dff;
  --accent: #ff79c6;
  --accent-cyan: #5ddfff;
  --text: #f1ecff;
  --text-dim: #b8b1d8;
  --text-mute: #8a85a8;
  --danger: #ff5d6c;
  --ok: #45e0a3;

  --shadow-card: 0 24px 80px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 60px rgba(163, 133, 255, 0.35);

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;

  --gap: clamp(16px, 2vw, 28px);
  --content-w: 1100px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(108, 77, 255, 0.35), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(255, 121, 198, 0.18), transparent 60%),
    radial-gradient(800px 800px at 50% 110%, rgba(93, 223, 255, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 30%, var(--bg-2));
  min-height: 100vh;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  backdrop-filter: blur(14px);
  background: rgba(7, 6, 14, 0.55);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 20px;
}

.logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 30%, #fff7, transparent 50%),
    linear-gradient(135deg, var(--accent), var(--primary) 50%, var(--accent-cyan));
  box-shadow: var(--shadow-glow);
  animation: logoPulse 4s ease-in-out infinite;
  position: relative;
}
.logo-mark::after {
  content: "";
  position: absolute;
  inset: 7px 8px 7px 10px;
  background: white;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  opacity: 0.95;
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 0px var(--primary)); }
  50% { filter: drop-shadow(0 0 14px var(--primary)); }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 22px);
}
.site-nav a {
  font-weight: 500;
  color: var(--text-dim);
  position: relative;
  padding: 6px 4px;
  transition: color 0.2s ease;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: -3px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 2px;
  transition: left 0.25s ease, right 0.25s ease;
}
.site-nav a:hover { color: var(--text); }
.site-nav a:hover::after { left: 0; right: 0; }

.btn-pill {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: white !important;
  padding: 8px 16px !important;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(108, 77, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn-pill:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(108, 77, 255, 0.55); }
.btn-pill::after { display: none; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.ghost-btn:hover { background: rgba(163, 133, 255, 0.12); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  padding: 12px 22px;
  border-radius: var(--radius-m);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--primary) 60%, var(--accent-cyan));
  color: #0c0a1e;
  box-shadow: 0 14px 40px rgba(108, 77, 255, 0.45);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 50px rgba(108, 77, 255, 0.6); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover { background: var(--surface-strong); }
.btn-danger { background: linear-gradient(135deg, #ff5d6c, #c93d77); color: white; }

/* ---------- Layout ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 40px);
}

.page {
  animation: pageIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes pageIn {
  0% { opacity: 0; transform: translateY(14px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 4vw, 50px);
  align-items: center;
  padding: clamp(30px, 5vw, 80px) 0 60px;
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
}

.hero h1 {
  font-size: clamp(36px, 5.5vw, 64px);
  line-height: 1.05;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, var(--primary) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--text-dim);
  max-width: 540px;
  line-height: 1.55;
  margin: 0 0 28px;
}
.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* Animated visualizer mock */
.hero-visual {
  position: relative;
  aspect-ratio: 1.15 / 1;
  border-radius: var(--radius-l);
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(255, 121, 198, 0.35), transparent 50%),
    radial-gradient(120% 120% at 100% 100%, rgba(93, 223, 255, 0.35), transparent 50%),
    linear-gradient(135deg, rgba(40, 32, 80, 0.85), rgba(20, 14, 40, 0.9));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.hero-visual::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, var(--accent), var(--primary), var(--accent-cyan), var(--accent));
  filter: blur(60px);
  opacity: 0.35;
  animation: spin 18s linear infinite;
  z-index: -1;
}
@keyframes spin { to { transform: rotate(360deg); } }

.eq-bars {
  display: flex;
  gap: 8px;
  align-items: end;
  height: 60%;
  padding: 0 14%;
  width: 100%;
}
.eq-bars span {
  flex: 1;
  background: linear-gradient(180deg, var(--accent), var(--primary), var(--accent-cyan));
  border-radius: 6px;
  min-height: 8px;
  animation: eqBar 1.4s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(163, 133, 255, 0.45);
}
.eq-bars span:nth-child(1)  { animation-delay: -0.0s; }
.eq-bars span:nth-child(2)  { animation-delay: -0.1s; }
.eq-bars span:nth-child(3)  { animation-delay: -0.2s; }
.eq-bars span:nth-child(4)  { animation-delay: -0.3s; }
.eq-bars span:nth-child(5)  { animation-delay: -0.4s; }
.eq-bars span:nth-child(6)  { animation-delay: -0.5s; }
.eq-bars span:nth-child(7)  { animation-delay: -0.6s; }
.eq-bars span:nth-child(8)  { animation-delay: -0.7s; }
.eq-bars span:nth-child(9)  { animation-delay: -0.8s; }
.eq-bars span:nth-child(10) { animation-delay: -0.9s; }
.eq-bars span:nth-child(11) { animation-delay: -1.0s; }
.eq-bars span:nth-child(12) { animation-delay: -1.1s; }

@keyframes eqBar {
  0%, 100% { transform: scaleY(0.25); }
  50% { transform: scaleY(1); }
}

.hero-version-pill {
  position: absolute;
  top: 18px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(7, 6, 14, 0.6);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.hero-version-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

/* ---------- Sections ---------- */
.section {
  padding: 60px 0;
}
.section h2 {
  font-size: clamp(28px, 3.6vw, 40px);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.section .subtitle {
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 0 36px;
  font-size: 17px;
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
}

.card {
  position: relative;
  padding: 24px;
  border-radius: var(--radius-l);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.card .icon {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 121, 198, 0.18), rgba(163, 133, 255, 0.18));
  color: var(--primary);
  margin-bottom: 14px;
  font-size: 22px;
}
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--text-dim); line-height: 1.55; font-size: 15px; }

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- Forms / panels ---------- */
.panel {
  max-width: 480px;
  margin: 60px auto;
  padding: 36px;
  border-radius: var(--radius-l);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
}
.panel.wide { max-width: 760px; }

.panel h2 {
  margin: 0 0 6px;
  font-size: 26px;
}
.panel .hint {
  margin: 0 0 24px;
  color: var(--text-dim);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field label {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field input, .field textarea, .field select {
  font: inherit;
  color: var(--text);
  background: rgba(7, 6, 14, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(163, 133, 255, 0.18);
}

.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }

.form-error {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  background: rgba(255, 93, 108, 0.16);
  border: 1px solid rgba(255, 93, 108, 0.35);
  color: #ffd8de;
  font-size: 14px;
}
.form-ok {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  background: rgba(69, 224, 163, 0.16);
  border: 1px solid rgba(69, 224, 163, 0.35);
  color: #c6ffe6;
  font-size: 14px;
}

/* ---------- Versions table ---------- */
.versions {
  display: grid;
  gap: 14px;
}
.version-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  border-radius: var(--radius-m);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.version-row:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.version-row .v {
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.version-row .meta {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}
.version-row .meta strong { color: var(--text); }
.version-row .badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0c0a1e;
  background: linear-gradient(135deg, var(--accent-cyan), var(--primary));
  margin-right: 6px;
}
.version-row .actions { display: flex; gap: 8px; }

/* ---------- Toasts ---------- */
#toast-host {
  position: fixed;
  inset: auto 16px 16px auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-m);
  background: rgba(28, 22, 60, 0.95);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  color: var(--text);
  min-width: 220px;
  max-width: 340px;
  pointer-events: auto;
  animation: toastIn 0.25s ease both;
  font-size: 14px;
}
.toast.err { border-color: rgba(255, 93, 108, 0.5); }
.toast.ok  { border-color: rgba(69, 224, 163, 0.5); }
.toast.out { animation: toastOut 0.25s ease both; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(12px); }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 28px clamp(16px, 4vw, 40px);
  margin-top: 60px;
  border-top: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 14px;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--text); }

/* ---------- Misc ---------- */
.muted { color: var(--text-mute); }
.text-dim { color: var(--text-dim); }
.kbd {
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", monospace;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(7, 6, 14, 0.65);
  border: 1px solid var(--border);
}

.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(163, 133, 255, 0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.center { display: grid; place-items: center; padding: 40px 0; }

.upload-progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.upload-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary), var(--accent-cyan));
  transition: width 0.2s ease;
}

[hidden] { display: none !important; }
