/* ==========================================================================
   Ysnip — Design System
   Professional black & white theme. Vanilla CSS, no frameworks.
   ========================================================================== */

:root {
  /* Core palette */
  --black: #0a0a0a;
  --ink: #111214;
  --ink-2: #1c1e22;
  --gray-900: #202226;
  --gray-800: #2c2f36;
  --gray-700: #3a3e46;
  --gray-500: #6b7280;
  --gray-400: #9aa0aa;
  --gray-300: #c7ccd3;
  --gray-200: #e5e7eb;
  --gray-100: #f2f3f5;
  --gray-50: #f8f9fb;
  --white: #ffffff;

  /* Accents (kept subtle/minimal) */
  --accent: #111214;
  --accent-contrast: #ffffff;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #2563eb;

  /* Brand (yellow / orange) */
  --brand: #f59e0b;          /* amber-500 — primary brand */
  --brand-strong: #ea580c;   /* orange-600 — hover / emphasis */
  --brand-dark: #c2410c;     /* orange-700 — dark surfaces (white text) */
  --brand-soft: #fff7ed;     /* orange-50 — tint backgrounds */
  --brand-contrast: #111214; /* dark text on bright brand */

  /* Semantic */
  --bg: var(--white);
  --bg-soft: var(--gray-50);
  --surface: var(--white);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --text: var(--ink);
  --text-soft: var(--gray-500);
  --text-inverse: var(--white);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.06), 0 1px 3px rgba(10, 10, 10, 0.08);
  --shadow-md: 0 6px 18px rgba(10, 10, 10, 0.08), 0 2px 6px rgba(10, 10, 10, 0.06);
  --shadow-lg: 0 24px 60px rgba(10, 10, 10, 0.14), 0 8px 24px rgba(10, 10, 10, 0.10);

  /* Type */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Consolas, monospace;

  --container: 1140px;
  --nav-h: 68px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0 0 0.4em; line-height: 1.12; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); }
h3 { font-size: 1.35rem; }
p  { margin: 0 0 1em; }
a  { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-strong);
}

.muted { color: var(--text-soft); }
.center { text-align: center; }
.lead { font-size: 1.18rem; color: var(--gray-500); max-width: 620px; }

/* ---------- Buttons ---------- */
.btn {
  --pad-y: 12px; --pad-x: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  padding: var(--pad-y) var(--pad-x);
  border-radius: var(--r-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-strong); color: #fff; box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--ink); background: var(--gray-50); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-white { background: var(--white); color: var(--ink); }
.btn-white:hover { box-shadow: var(--shadow-md); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-lg { --pad-y: 15px; --pad-x: 28px; font-size: 1rem; }
.btn-sm { --pad-y: 8px; --pad-x: 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card-soft { background: var(--bg-soft); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--gray-100); color: var(--gray-700);
  border: 1px solid var(--border);
}
.badge-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.badge-success { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.badge-warning { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.badge-danger  { background: #fef3f2; color: #b42318; border-color: #fecdca; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 0.78rem; color: var(--text-soft); margin-top: 5px; }

.input, .textarea, .select {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 11px 13px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }

.checkbox, .radio { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 0.9rem; }
.checkbox input, .radio input { width: 17px; height: 17px; accent-color: var(--brand); }

/* Range / slider */
.range { width: 100%; accent-color: var(--brand); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 25px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--gray-300); border-radius: var(--r-full); transition: 0.2s; }
.switch .track::before { content: ""; position: absolute; height: 19px; width: 19px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::before { transform: translateX(19px); }

/* ---------- Utilities ---------- */
.row { display: flex; gap: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.grid { display: grid; gap: 24px; }
.mt-8{margin-top:8px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}.mt-32{margin-top:32px}
.mb-8{margin-bottom:8px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.hidden { display: none !important; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); border: 0; margin: 24px 0; }
.text-sm { font-size: 0.86rem; }
.text-xs { font-size: 0.76rem; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; z-index: 9999; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r-full); box-shadow: var(--shadow-lg); font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: toastIn 0.25s ease; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Spinner ---------- */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner.dark { border-color: rgba(0,0,0,0.15); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading overlay */
.overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.75); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 9998; }

/* Focus visible */
:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }

::selection { background: var(--brand); color: var(--brand-contrast); }

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; border: 2px solid var(--white); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
