/* ================= CSS Variables ================= */
:root {
  --bg: #f4f1ea;
  --fg: #3a3548;
  --muted: #7a7488;
  --muted-strong: #5a5468;
  --accent: #a89bc8;
  --accent2: #8fc9b8;
  --border: rgba(168, 155, 200, 0.35);
  --card-bg: rgba(255, 255, 255, 0.6);
  --container: 1200px;
}

/* ================= Reset ================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--fg); }
button { font: inherit; cursor: pointer; }

/* ================= Container ================= */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ================= Header ================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 241, 234, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.site-logo {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.3px;
  color: var(--fg);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
}

.site-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-strong);
  white-space: nowrap;
}

.site-nav a:hover { color: var(--accent); }

.site-search {
  display: flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  padding: 4px 4px 4px 12px;
  flex-shrink: 0;
}

.site-search input {
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  width: 160px;
}

.site-search input::placeholder { color: #b0aab8; }

.site-search button {
  border: none;
  background: var(--accent);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.site-search button:hover { background: var(--fg); }

/* ================= Main ================= */
.site-main { flex: 1; }

/* ================= Footer ================= */
.site-footer {
  margin-top: 80px;
  padding: 48px 0 32px;
  background: rgba(0, 0, 0, 0.02);
  border-top: 1px solid var(--border);
}

.footer-categories h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 14px;
}

.footer-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 24px;
  margin-bottom: 32px;
}

.footer-cat-grid a {
  font-size: 14px;
  color: var(--muted-strong);
}

.footer-cat-grid a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.footer-bottom a { color: var(--muted-strong); }

/* ================= Buttons ================= */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #b8a9d9, #8fc9b8);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 6px 24px rgba(168, 155, 200, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(168, 155, 200, 0.45);
  color: #fff;
}

/* ================= Reduced motion ================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ================= Mobile ================= */
@media (max-width: 820px) {
  .site-header .container {
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
  }
  .site-nav { order: 3; width: 100%; overflow-x: auto; }
  .site-search { flex: 1; }
  .site-search input { width: 100%; }
}
/* ================= Breadcrumbs ================= */
.breadcrumbs {
  margin: 20px 0 24px;
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumbs li + li::before {
  content: '›';
  color: var(--muted);
  opacity: 0.6;
}

.breadcrumbs a {
  color: var(--muted-strong);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs [aria-current="page"] {
  color: var(--fg);
  font-weight: 500;
}
/* ================= Background cards grid ================= */
.bg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.bg-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  color: var(--fg);
}

.bg-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(168, 155, 200, 0.25);
  border-color: var(--accent);
  text-decoration: none;
  color: var(--fg);
}

.bg-card-preview {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.bg-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bg-card-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.5);
  border-top: 1px solid var(--border);
  gap: 8px;
}

.bg-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.bg-card-size {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
/* ================= 404 page ================= */
.error-page {
  padding: 60px 0 80px;
}

.error-hero {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 72px;
}

.error-hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.error-hero p {
  color: var(--muted-strong);
  font-size: 16px;
  margin-bottom: 32px;
}

.error-categories h2 {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 32px;
  color: var(--fg);
}

.error-categories .category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ================= Text pages (license, privacy) ================= */
.text-page {
  max-width: 720px;
  margin: 0 auto 60px;
}

.text-page h1 {
  font-size: clamp(26px, 3.5vw, 38px);
  margin-bottom: 24px;
}

.text-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
}

.text-content h2 { font-size: 20px; margin: 32px 0 12px; }
.text-content h3 { font-size: 17px; margin: 24px 0 10px; }
.text-content p { margin-bottom: 16px; }
.text-content ul, .text-content ol { margin: 0 0 16px 24px; }
.text-content li { margin-bottom: 6px; }
.text-content a { color: var(--accent); }
.text-content code {
  background: #ede9e0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
/* ================= Category cards (shared) ================= */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.category-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  color: var(--fg);
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(168, 155, 200, 0.25);
  border-color: var(--accent);
  color: var(--fg);
  text-decoration: none;
}

.category-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
}