/* ============================================================
   Kadriko — дизайн-токены и базовые компоненты
   Светлая, тёплая, дружелюбная тема для творческой студии.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800;900&family=Onest:wght@400;500;600;700&display=swap');

:root {
  /* поверхность */
  --bg: #faf6ef;
  --bg-soft: #f4ede2;
  --bg-warm: #fdf9f2;
  --panel: #ffffff;
  --panel-2: #fff8ef;
  --panel-3: #f6efe4;
  --surface: #ffffff;

  /* текст */
  --ink: #241f19;
  --text: #2f2a23;
  --text-dim: #5d554a;
  --muted: #877a6b;
  --muted-2: #ab9f90;

  /* линии и тени */
  --line: #ece3d6;
  --line-strong: #dcd1c1;
  --shadow: 0 20px 50px rgba(84, 60, 32, 0.1);
  --shadow-sm: 0 6px 18px rgba(84, 60, 32, 0.07);
  --shadow-hover: 0 24px 60px rgba(84, 60, 32, 0.14);

  /* акценты */
  --coral: #f26b4e;
  --coral-dark: #d9533a;
  --coral-soft: #fde7df;
  --violet: #a184d6;
  --violet-soft: #f0e9fb;
  --cyan: #6aaecb;
  --cyan-soft: #e5f2f7;
  --pink: #e06b8c;
  --pink-soft: #fbe7ed;
  --green: #5da87a;
  --green-soft: #e3f2e9;
  --gold: #e6a93f;
  --gold-soft: #fcf0d8;
  --red: #d4574f;
  --red-soft: #fbe6e2;

  /* сохраняем имена старых переменных для совместимости */
  --text-dim: #5d554a;
  --grad: linear-gradient(135deg, #ff9a6c 0%, #f26b4e 100%);
  --grad-soft: linear-gradient(135deg, rgba(242, 107, 78, 0.14), rgba(230, 169, 63, 0.12));
  --grad-pink: linear-gradient(135deg, #f29bb3, #a184d6);

  /* радиусы */
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 26px;
  --radius-xl: 34px;

  /* шрифты */
  --font: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Nunito', 'Onest', 'Segoe UI', system-ui, sans-serif;

  --container: 1200px;
  --header-h: 78px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d9cdbd;
  border-radius: 999px;
  border: 3px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: #c8b9a5;
}

.container {
  width: min(100% - 48px, var(--container));
  margin-inline: auto;
}

@media (max-width: 720px) {
  .container {
    width: min(100% - 32px, var(--container));
  }
}

.gradient-text {
  color: var(--coral);
  background: none;
  -webkit-text-fill-color: currentColor;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral-dark);
}

.eyebrow::before {
  content: '';
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--coral);
}

/* ---------- кнопки ---------- */
.btn {
  --btn-h: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--btn-h);
  padding: 0 24px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-family: var(--font);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease,
    border-color 0.16s ease, color 0.16s ease;
  user-select: none;
}

.btn:active {
  transform: translateY(1px) scale(0.995);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 24px rgba(242, 107, 78, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(242, 107, 78, 0.38);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(84, 60, 32, 0.03);
}

.btn-ghost:hover {
  border-color: #c9bba8;
  background: #fffdf9;
}

.btn-outline {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--coral);
  color: var(--coral-dark);
  background: rgba(242, 107, 78, 0.06);
}

.btn-soft {
  background: var(--coral-soft);
  color: var(--coral-dark);
  border-color: rgba(242, 107, 78, 0.22);
}

.btn-soft:hover {
  background: #fbdccf;
}

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(212, 87, 79, 0.28);
  color: #a83a34;
}

.btn-danger:hover {
  background: #f8d9d4;
}

.btn-sm {
  --btn-h: 38px;
  padding: 0 16px;
  font-size: 13.5px;
}

.btn-lg {
  --btn-h: 56px;
  padding: 0 30px;
  font-size: 16.5px;
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.btn-block {
  width: 100%;
}

/* ---------- бейджи и чипы ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 27px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  white-space: nowrap;
}

.badge-violet {
  background: var(--violet-soft);
  border-color: rgba(161, 132, 214, 0.25);
  color: #6f55a8;
}

.badge-cyan {
  background: var(--cyan-soft);
  border-color: rgba(106, 174, 203, 0.25);
  color: #3d7f9d;
}

.badge-green {
  background: var(--green-soft);
  border-color: rgba(93, 168, 122, 0.25);
  color: #3c7d58;
}

.badge-gold {
  background: var(--gold-soft);
  border-color: rgba(230, 169, 63, 0.3);
  color: #9c7324;
}

.badge-red {
  background: var(--red-soft);
  border-color: rgba(212, 87, 79, 0.25);
  color: #a83a34;
}

/* ---------- формы ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > label,
.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.input,
.select,
.textarea {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.textarea {
  height: auto;
  min-height: 100px;
  padding: 14px 16px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-2);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(242, 107, 78, 0.14);
}

.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='%23877a6b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
  cursor: pointer;
}

.select option {
  background: #fff;
  color: var(--text);
}

.hint {
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.5;
}

.error-text {
  color: #b0473f;
  font-size: 13px;
}

/* ---------- поверхности ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.glass {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
}

/* ---------- тосты ---------- */
.toast-stack {
  position: fixed;
  z-index: 1200;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 270px;
  max-width: 390px;
  padding: 14px 17px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 40px rgba(84, 60, 32, 0.16);
  font-size: 14px;
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-in 0.22s ease both;
}

.toast.leaving {
  animation: toast-out 0.2s ease forwards;
}

.toast-success {
  border-color: #cfe8d9;
}

.toast-error {
  border-color: #f2cfca;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.toast-success .toast-icon {
  color: var(--green);
}

.toast-error .toast-icon {
  color: var(--red);
}

.toast-info .toast-icon {
  color: var(--coral);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* ---------- модальные окна ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(60, 46, 30, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.18s ease;
}

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 40px 110px rgba(64, 46, 26, 0.28);
  animation: modal-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.modal-wide {
  width: min(900px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 0;
}

.modal-head h3 {
  font-size: 21px;
}

.modal-body {
  padding: 18px 26px 26px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--bg-warm);
}

.modal-close:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--bg-soft);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

/* ---------- загрузка ---------- */
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(242, 107, 78, 0.25);
  border-top-color: var(--coral);
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 34px;
  height: 34px;
  border-width: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

/* ---------- утилиты ---------- */
.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 22px 0;
}

.stack {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
}

.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

.grow { flex: 1; }
.wrap { flex-wrap: wrap; }
.center { align-items: center; }
.between { justify-content: space-between; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

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