:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-strong: #eef3f8;
  --text: #122033;
  --muted: #5f6d7e;
  --line: #dbe4ee;
  --blue: #123e7c;
  --blue-strong: #0a2d62;
  --orange: #f59e3d;
  --orange-strong: #dd7d18;
  --success: #167a52;
  --danger: #b83f46;
  --shadow: 0 18px 50px rgba(18, 62, 124, 0.12);
  --radius: 8px;
  --sans: "Inter", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1320;
  --surface: #101b2b;
  --surface-strong: #17263a;
  --text: #edf4ff;
  --muted: #a9b7c7;
  --line: #26384e;
  --blue: #79aef8;
  --blue-strong: #b6d2ff;
  --orange: #ffb35f;
  --orange-strong: #ffc27a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--orange);
  color: #1c1409;
  padding: 8px 14px;
}

.skip-link:focus { left: 12px; top: 12px; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--orange) 80%, transparent);
  outline-offset: 2px;
}

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

.wrap {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}

.site-header .wrap {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.brand .mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-strong), var(--blue));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .16);
  font-size: 13px;
  font-weight: 800;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.main-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: color .2s ease, background .2s ease;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: var(--surface-strong);
  color: var(--blue-strong);
}

.header-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.tool-btn,
.lang-toggle {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 11px;
  font: 700 13px/1 var(--sans);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.tool-btn:hover,
.lang-toggle:hover {
  border-color: var(--orange);
  transform: translateY(-1px);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(64px, 9vw, 110px) 0 48px;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--blue) 12%, transparent), transparent 48%),
    radial-gradient(circle at 84% 18%, color-mix(in srgb, var(--orange) 18%, transparent), transparent 26%);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  gap: 42px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--orange-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 12ch;
  margin: 0 0 18px;
  font-size: clamp(2.7rem, 7vw, 5.6rem);
  line-height: .96;
  letter-spacing: 0;
}

.hero .lede {
  max-width: 62ch;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.18rem);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font: 800 14px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-strong); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-strong); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.hero-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.hero-preview-body {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.preview-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  padding: 16px 18px;
}

.preview-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-strong);
  color: var(--blue-strong);
  font-weight: 900;
}

.preview-row strong { display: block; line-height: 1.25; }
.preview-row span { color: var(--muted); font-size: 13px; }
.price { color: var(--orange-strong); font-weight: 850; white-space: nowrap; }

section { padding: 62px 0; }
section.tight { padding: 42px 0; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  letter-spacing: 0;
}

.section-head p {
  max-width: 62ch;
  margin: 8px 0 0;
  color: var(--muted);
}

.count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.feature-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature-card,
.index-card,
.panel,
.empty-state,
.admin-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(18, 62, 124, 0.07);
}

.feature-card,
.index-card {
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.feature-card:hover,
.index-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
  box-shadow: var(--shadow);
}

.thumb {
  min-height: 150px;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 82%, #111), color-mix(in srgb, var(--orange) 58%, #fff)),
    var(--surface-strong);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  color: #fff;
}

.thumb[data-kind="Dataset"] { background: linear-gradient(135deg, #164b7d, #1d7b68); }
.thumb[data-kind="Image"] { background: linear-gradient(135deg, #5b4ba3, #ef884d); }
.thumb[data-kind="Video"] { background: linear-gradient(135deg, #112c55, #d96e43); }
.thumb[data-kind="Creative"] { background: linear-gradient(135deg, #2f5f7f, #f0a93e); }

.badge {
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(8px);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 850;
}

.card-body {
  display: flex;
  min-height: 205px;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

.index-card h3,
.feature-card h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.desc {
  margin: 0;
  color: var(--muted);
  font-size: .94rem;
  flex: 1;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.author {
  color: var(--text);
  font-weight: 750;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
}

.view-link {
  color: var(--blue-strong);
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
}

.view-link:hover { color: var(--orange-strong); }

.tag-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.tag-filter button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 8px 14px;
  font: 750 13px/1 var(--sans);
  cursor: pointer;
  transition: all .18s ease;
}

.tag-filter button:hover,
.tag-filter button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.info-band {
  background: var(--surface-strong);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
}

.simple-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.simple-list li {
  border-left: 3px solid var(--orange);
  padding: 4px 0 4px 14px;
  color: var(--muted);
}

.panel {
  max-width: 560px;
  padding: 24px;
}

.panel.wide { max-width: 100%; }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input[type="text"],
.field input[type="password"],
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 12px 13px;
  font: 15px/1.4 var(--sans);
}

.field input[type="file"] {
  width: 100%;
  color: var(--muted);
  font-size: 14px;
}

.field textarea { min-height: 100px; resize: vertical; }

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--orange);
  outline: none;
}

.form-msg {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--success); }

.empty-state {
  padding: 42px 22px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.progress-bar {
  height: 5px;
  display: none;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--line);
}

.progress-bar.active { display: block; }

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--orange);
  transition: width .2s ease;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  margin-bottom: 12px;
}

.admin-row .info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-row .info strong { font-size: 1rem; }
.admin-row .info span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 42px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}

.chat-launcher:hover { transform: translateY(-2px); background: var(--blue-strong); }
.chat-launcher .avatar { font-size: 25px; }

.chat-widget {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 50;
  width: min(360px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s ease, opacity .22s ease;
}

.chat-widget.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--blue);
  color: #fff;
}

.chat-head .avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .16);
  font-size: 20px;
}

.chat-title { flex: 1; min-width: 0; }
.chat-title strong { display: block; line-height: 1.2; }
.chat-title span { display: block; opacity: .82; font-size: 12px; }
.chat-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.chat-log {
  height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.chat-msg {
  max-width: 88%;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 14px;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--orange);
  color: #231506;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.chat-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 11px 12px;
  font: 14px/1.3 var(--sans);
}

.chat-form button {
  min-width: 76px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

@media (max-width: 900px) {
  .site-header .wrap {
    grid-template-columns: 1fr auto;
    padding: 14px 0;
  }

  .main-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .hero .wrap,
  .split {
    grid-template-columns: 1fr;
  }

  .hero h1 { max-width: 13ch; }
  .feature-grid,
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .wrap { width: min(100% - 28px, 1160px); }
  .site-header .wrap { gap: 12px; }
  .brand { white-space: normal; }
  .brand .mark { flex: 0 0 36px; }
  .header-tools { align-self: start; }
  .main-nav a { padding: 8px 9px; font-size: 13px; }
  .hero { padding-top: 48px; }
  .feature-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }
  .section-head {
    align-items: start;
    flex-direction: column;
  }
  .admin-row {
    align-items: stretch;
    flex-direction: column;
  }
  .chat-launcher { right: 14px; bottom: 14px; }
  .chat-widget { right: 14px; bottom: 82px; }
}
