* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f6f8fb;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(148, 163, 184, 0.22);
  --primary: #111827;
  --accent: #2563eb;
  --accent-2: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 14px 45px rgba(15, 23, 42, 0.09);
  --shadow-strong: 0 20px 60px rgba(15, 23, 42, 0.14);
  --radius: 28px;
}

body.dark {
  --bg: #020617;
  --card: rgba(15, 23, 42, 0.72);
  --card-solid: #0f172a;
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --shadow-strong: 0 25px 80px rgba(0, 0, 0, 0.45);
}

html,
body {
  min-height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(circle at top, rgba(34, 211, 238, 0.12), transparent 28%),
    radial-gradient(
      circle at top right,
      rgba(37, 99, 235, 0.1),
      transparent 22%
    ),
    var(--bg);
  color: var(--text);
}

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

img {
  display: block;
  width: 100%;
}

/* Blur-up lazy load: изображение плавно появляется */
.lazy-img {
  filter: blur(6px);
  transform: scale(1.02);
  transition: filter 0.35s ease, transform 0.35s ease;
  will-change: filter, transform;
}

.lazy-img.loaded {
  filter: blur(0);
  transform: scale(1);
}

button,
.btn {
  border: none;
  cursor: pointer;
  transition: 0.2s ease;
  font: inherit;
}

/* ─── Button loading state ───────────────────────────────── */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.82;
  color: transparent !important;
}

.btn-loading > * {
  opacity: 0;
}

.btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(37, 99, 235, 0.3);
  border-top-color: #2563eb;
  animation: loading-spin 0.7s linear infinite;
}

/* On dark/solid buttons use white spinner */
.btn-dark.btn-loading::after,
.btn-danger.btn-loading::after,
[class*="btn-primary"].btn-loading::after {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

/* ─── Top page progress bar ─────────────────────────────── */
.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent, #2563eb), #60a5fa);
  z-index: 9999;
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: width 0.28s ease, opacity 0.35s ease;
  pointer-events: none;
}

.page-progress.progress-running {
  opacity: 1;
}

.page-progress.progress-done {
  width: 100% !important;
  opacity: 0;
  transition: width 0.18s ease, opacity 0.4s ease 0.1s;
}

/* ─── Character counter ─────────────────────────────────── */
.char-counter {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
  transition: color 0.18s;
}

.char-counter.char-warn {
  color: #f59e0b;
}

.char-counter.char-over {
  color: var(--danger, #ef4444);
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  outline: none;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

body.dark input,
body.dark textarea,
body.dark select {
  background: rgba(2, 6, 23, 0.45);
}

body.dark input:focus,
body.dark textarea:focus,
body.dark select:focus {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

/* Page entrance animation */
@keyframes page-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page {
  animation: page-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.lightbox-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.94);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
}

.lightbox-overlay.open .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.14s;
  z-index: 1001;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* product detail image — show pointer so user knows it's clickable */
.product-detail-image {
  cursor: zoom-in;
}

/* Scroll-to-top button */
.scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(16px);
  color: var(--text);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.16s ease;
  z-index: 900;
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
