/* ============================================================
   BRAND SUITE TRENDS — Аддитивные слои поверх brand.css
   Не меняет существующие стили, не меняет цвета
   ============================================================ */

/* ═══ ШАГ 3: ОРГАНИЧЕСКИЕ ФОРМЫ (волны, blob, clip-path) ═══ */

/* SVG волны между секциями */
.section-wave {
  width: 100%;
  overflow: hidden;
  line-height: 0;
  margin-bottom: -1px;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

/* Blob-декор — добавляется JS */
.blob-decor {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  border-radius: 60% 40% 70% 30% / 50% 60% 40% 70%;
  animation: blobMorph 10s ease-in-out infinite;
}
.blob-decor--1 {
  width: 380px; height: 380px;
  background: var(--accent-cyan);
  opacity: 0.05;
  top: -60px; right: -80px;
  animation-delay: 0s;
}
.blob-decor--2 {
  width: 240px; height: 240px;
  background: var(--violet-core);
  opacity: 0.04;
  bottom: -40px; left: -60px;
  animation-delay: -4s;
}
@keyframes blobMorph {
  0%,100% { border-radius: 60% 40% 70% 30% / 50% 60% 40% 70%; }
  33%    { border-radius: 40% 60% 30% 70% / 60% 40% 70% 30%; }
  66%    { border-radius: 70% 30% 60% 40% / 30% 70% 50% 60%; }
}

/* Hero clip-path — диагональный срез */
.hero-clip {
  position: relative;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
  padding-bottom: 80px;
}
@media (max-width: 768px) {
  .hero-clip {
    clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%);
    padding-bottom: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob-decor { animation: none; }
}

@media (max-width: 768px) {
  .blob-decor { display: none; }
}

/* ═══ ШАГ 5: АРХИВНО-ИНДЕКСНЫЙ СТИЛЬ ═══ */

.archive-grid {
  counter-reset: archive-index;
}
.archive-grid > * {
  counter-increment: archive-index;
  position: relative;
}
.archive-grid > *::before {
  content: counter(archive-index, decimal-leading-zero);
  position: absolute;
  top: 14px; left: 16px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  opacity: 0.45;
  pointer-events: none;
  z-index: 1;
}
.archive-grid > * {
  transition: background 0.15s ease, padding-left 0.2s ease;
}
.archive-grid > *:hover {
  background: rgba(0, 245, 212, 0.04);
  padding-left: 8px;
}

/* Заголовок архива — добавляется JS */
.archive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-cyan);
  margin-bottom: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  opacity: 0.8;
}

/* Archive-style tags */
.tag, .category, .label,
[class*="tag"], [class*="category"] {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
}

/* ═══ ШАГ 11: HUMAN-MADE OVERLAYS ═══ */

/* Hand-drawn arrow рядом с главной CTA */
.hand-arrow {
  position: absolute;
  width: 80px; height: 60px;
  right: -90px; bottom: -8px;
  transform: rotate(-12deg);
  color: var(--accent-cyan);
  pointer-events: none;
}
.hand-arrow .arrow-line {
  animation: drawLine 1.2s ease forwards 1s;
}
.hand-arrow .arrow-head {
  animation: showHead 0.3s ease forwards 2s;
}
@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}
@keyframes showHead {
  to { opacity: 1; }
}

/* Scribble underline под последним словом H1 */
.scribble-word {
  position: relative;
  display: inline-block;
  color: inherit;
}
.scribble-word::after {
  content: '';
  position: absolute;
  left: -3px; bottom: -8px;
  width: calc(100% + 6px); height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M3,8 C40,2 80,10 120,5 C160,1 190,8 197,6' stroke='%2300F5D4' stroke-width='3' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  opacity: 0;
  animation: scribbleIn 0.8s ease forwards 1.5s;
}
@keyframes scribbleIn {
  from { opacity: 0; transform: scaleX(0); transform-origin: left; }
  to   { opacity: 0.7; transform: scaleX(1); }
}

/* Лёгкая бумажная текстура */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="light"] body::before {
  mix-blend-mode: screen;
  opacity: 0.03;
}

@media (max-width: 768px) {
  .hand-arrow { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .arrow-line, .arrow-head, .scribble-word::after {
    animation: none !important;
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ═══ ШАГ 12: AI-ЧАТ-АГЕНТ ═══ */

.ai-chat {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9000;
  font-family: var(--font-display);
}
.chat-toggle {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-cyan);
  color: var(--text-on-accent);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22), 0 0 16px rgba(0,245,212,0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(0,0,0,0.30), 0 0 24px rgba(0,245,212,0.3);
}
.chat-toggle svg { width: 22px; height: 22px; }
.chat-toggle .icon-close { display: none; }
.ai-chat.is-open .chat-toggle .icon-chat  { display: none; }
.ai-chat.is-open .chat-toggle .icon-close { display: block; }

.chat-panel {
  position: absolute;
  bottom: 74px; right: 0;
  width: 340px;
  max-height: 480px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  display: flex; flex-direction: column;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: scale(0.95) translateY(8px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), opacity 0.3s ease;
  pointer-events: none;
}
.chat-panel:not([hidden]) {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}
.chat-header {
  padding: 14px 18px;
  background: rgba(0, 245, 212, 0.1);
  border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between;
  align-items: center;
}
.chat-title  { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.chat-status { font-size: 0.7rem; color: var(--accent-cyan); }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 180px;
  max-height: 260px;
}
.message { max-width: 85%; }
.message p {
  margin: 0; padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.85rem; line-height: 1.5;
}
.message--bot p {
  background: rgba(0, 245, 212, 0.06);
  color: var(--text-secondary);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 245, 212, 0.08);
}
.message--user { align-self: flex-end; }
.message--user p {
  background: rgba(0, 245, 212, 0.15);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.chat-suggestions {
  padding: 4px 14px 8px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.suggestion-chip {
  padding: 5px 12px;
  border: 1px solid rgba(0, 245, 212, 0.25);
  color: var(--accent-cyan);
  background: transparent;
  border-radius: 20px;
  font-size: 0.74rem; cursor: pointer;
  font-family: var(--font-display);
  transition: all 0.15s ease;
}
.suggestion-chip:hover {
  background: rgba(0, 245, 212, 0.12);
  border-color: var(--accent-cyan);
}

.chat-input-form {
  display: flex; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
}
.chat-input {
  flex: 1; padding: 9px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}
.chat-input:focus { border-color: var(--accent-cyan); }
.chat-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-cyan);
  color: var(--text-on-accent); border: none;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease;
}
.chat-send:hover { transform: scale(1.08); }
.chat-send svg { width: 16px; height: 16px; }

.chat-badge {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px;
  background: #ff4444;
  color: #fff; font-size: 0.7rem; font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  animation: badgePop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

@media (max-width: 480px) {
  .chat-panel { width: calc(100vw - 48px); right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-toggle, .suggestion-chip { transition: none; }
}
