/* ═══════════════════════════════════════════
   «Княжа доба» — Modern 2025
   oklch() · light-dark() · fluid type
   ═══════════════════════════════════════════ */

:root {
  color-scheme: dark;

  --accent-red:    oklch(62% 0.22 20);
  --accent-green:  oklch(65% 0.18 155);
  --accent-orange: oklch(68% 0.16 55);
  --accent-blue:   oklch(55% 0.20 270);
  --accent-gold:   oklch(72% 0.14 85);

  --bg:        oklch(12% 0.01 260);
  --surface:   oklch(16% 0.01 260);
  --surface2:  oklch(19% 0.02 260);
  --border:    oklch(27% 0.02 260);
  --border-hover: oklch(40% 0.04 260);
  --text:      oklch(92% 0 0);
  --text-muted: oklch(65% 0.02 250);
  --text-dim:  oklch(45% 0.01 250);

  --radius: 0.5rem;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace;
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Focus ── */
:focus-visible { outline: 2px solid var(--accent-red); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Fluid headings ── */
h1, h2, h3, .hero p { text-wrap: balance; }

/* ═══════════════ Navigation ═══════════════ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: oklch(12% 0.01 260 / 92%);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
}

.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem; font-weight: 500;
  padding: 0.8rem 0.9rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  letter-spacing: 0.01em;
}
.nav a:hover,
.nav a.active { color: #fff; border-bottom-color: var(--accent-red); }
.nav a.home {
  font-weight: 700; color: var(--accent-red);
  font-size: 0.9rem; letter-spacing: 0.02em;
}

/* ═══════════════ Hero ═══════════════ */
.hero {
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem clamp(2rem, 4vw, 3rem);
  text-align: center;
  background:
    radial-gradient(ellipse 70% 50% at 20% 50%, oklch(42% 0.18 20 / 65%), transparent),
    radial-gradient(ellipse 50% 60% at 80% 30%, oklch(40% 0.15 80 / 58%), transparent),
    var(--bg);
}
.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 800; letter-spacing: -0.02em;
  color: var(--accent-red);
  margin-bottom: 0.5rem;
}
.hero p {
  color: var(--text-muted);
  max-width: 650px; margin: 0 auto;
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  line-height: 1.6;
}

/* ═══════════════ Section ═══════════════ */
.section {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(1.5rem, 3vw, 2.5rem) 1.25rem;
}

.section-title {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 700; letter-spacing: -0.01em;
  padding: 0 0 0.75rem;
  border-bottom: 2px solid;
  margin-bottom: 1.75rem;
}

/* ── Accent variants ── */
.accent-red    { border-bottom-color: var(--accent-red)    !important; color: var(--accent-red); }
.accent-green  { border-bottom-color: var(--accent-green)  !important; color: var(--accent-green); }
.accent-orange { border-bottom-color: var(--accent-orange) !important; color: var(--accent-orange); }
.accent-blue   { border-bottom-color: var(--accent-blue)   !important; color: var(--accent-blue); }
.accent-gold   { border-bottom-color: var(--accent-gold)   !important; color: var(--accent-gold); }

/* ═══════════════ Grid ═══════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 1.25rem;
}

/* ═══════════════ Cards ═══════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}
.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.card:has(img:hover) {
  overflow: visible;
}

.card-header {
  padding: 0.9rem 1.1rem;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); gap: 0.5rem;
}
.card-header .badge {
  padding: 0.15rem 0.6rem; border-radius: 1rem;
  font-size: 0.65rem; font-weight: 700; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.card-header .name { font-size: 0.8rem; font-weight: 600; }

.badge-red    { background: var(--accent-red);    color: #fff; }
.badge-green  { background: var(--accent-green);  color: #111; }
.badge-orange { background: var(--accent-orange); color: #111; }
.badge-blue   { background: var(--accent-blue);   color: #fff; }
.badge-gold   { background: var(--accent-gold);   color: #111; }

.card-body { padding: 1rem 1.1rem; }

.prompt {
  background: rgb(255 255 255 / 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-size: 0.65rem; line-height: 1.5;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  position: relative;
  color: var(--text-muted);
}

.copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: var(--accent-blue); color: #fff;
  border: none; border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.6rem; cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}
.copy-btn:hover { background: oklch(50% 0.18 270); }
.copy-btn.copied { background: var(--accent-green); }
.copy-btn.failed { background: oklch(45% 0.20 20); }

/* ═══════════════ Rule block ═══════════════ */
.rule-block {
  background: rgb(255 255 255 / 0.03);
  border: 1px solid rgb(233 69 96 / 0.25);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
  font-size: 0.75rem; line-height: 1.6;
}
.rule-block pre {
  background: rgb(0 0 0 / 0.3);
  border: 1px solid var(--border);
  padding: 0.5rem; margin: 0.4rem 0;
  font-size: 0.6rem; border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: pre-wrap;
}

/* ═══════════════ Landing category cards ═══════════════ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.25rem;
}

.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  text-decoration: none; color: var(--text);
  display: block;
  transition: border-color 0.2s, transform 0.15s;
}
.cat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.cat-card .accent-line {
  width: 2rem; height: 3px;
  border-radius: 3px;
  margin-bottom: 1rem;
}
.cat-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.35rem; letter-spacing: -0.01em; }
.cat-card p  { color: var(--text-muted); font-size: 0.8rem; line-height: 1.5; }
.cat-card .count { font-size: 0.7rem; color: var(--text-dim); margin-top: 0.5rem; }

/* ═══════════════ Footer ═══════════════ */
.footer {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--text-dim);
  font-size: 0.7rem; line-height: 1.6;
  border-top: 1px solid var(--border);
}
.footer a { color: var(--text-dim); }
.footer a:hover { color: var(--text-muted); }

/* ═══════════════ Responsive ═══════════════ */
@media (width <= 500px) {
  .grid, .cat-grid { grid-template-columns: 1fr; }
  .nav a { font-size: 0.7rem; padding: 0.7rem 0.5rem; }
}
