/*
Theme Name: AI Encyclopedia
Description: Тема для ИИ-энциклопедии вопросов и ответов
Version: 1.0
*/

:root {
  --bg: #f4efe6;
  --surface: #fbf8f2;
  --text: #3a3328;
  --muted: #8c8273;
  --border: #e8e0d2;
  --accent: #a87a4a;
  --accent-soft: #f0e6d6;
  --orange: #f5821f;
  --shadow: 0 1px 2px rgba(76, 60, 40, .04), 0 4px 16px rgba(76, 60, 40, .07);
  --shadow-hover: 0 4px 8px rgba(76, 60, 40, .07), 0 12px 28px rgba(168, 122, 74, .18);
  --radius: 16px;
  --maxw: 1120px;
  --readw: 760px;
}

/* ===== RESET ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.read {
  max-width: var(--readw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== HEADER ===== */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(244, 239, 230, .8);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.01em;
  text-decoration: none;
  color: inherit;
}

.logo .mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #c79a63);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover {
  color: var(--text);
}

.nav .ask-btn {
  border: none;
  cursor: pointer;
  background: var(--orange);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 10px;
  transition: background .15s;
  text-decoration: none;
  display: inline-block;
}

.nav .ask-btn:hover {
  background: #dd6f0e;
}

/* ===== HERO (главная) ===== */
.hero {
  padding: 80px 0 56px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero p {
  font-size: 18px;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 36px;
}

/* ===== SEARCH / ASK BOX ===== */
.ask {
  max-width: 680px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  transition: box-shadow .2s, border-color .2s;
}

.ask:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px #fbe3cb;
}

.ask input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 12px 14px;
  color: var(--text);
}

.ask input::placeholder {
  color: #b3a892;
}

.ask button {
  border: none;
  cursor: pointer;
  background: var(--orange);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 11px;
  transition: background .15s, transform .05s;
  white-space: nowrap;
}

.ask button:hover {
  background: #dd6f0e;
}

.ask button:active {
  transform: translateY(1px);
}

/* Hero specific ask */
.hero .ask {
  max-width: 680px;
  margin: 0 auto;
}

/* Pagehead specific ask */
.pagehead .ask {
  margin: 24px 0 0;
  max-width: 680px;
}

/* Ask card (на странице вопроса) */
.askcard .ask {
  max-width: 560px;
  background: var(--bg);
}

/* ===== SECTIONS ===== */
.section {
  padding: 8px 0 96px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-head h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.section-head span {
  color: var(--muted);
  font-size: 14px;
}

/* ===== GRID (категории и вопросы) ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* Сетка для страницы категории — карточки пошире */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #e0cba8;
}

.card .ico {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 22px;
}

.card .title {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -.01em;
  line-height: 1.3;
}

.card .arrow {
  margin-top: auto;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .18s, transform .18s;
}

.card:hover .arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Question card (страница категории) */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 160px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.question-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #e0cba8;
}

.question-card .q {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.01em;
  line-height: 1.35;
}

.question-card .meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.question-card .date {
  font-size: 13px;
  color: var(--muted);
}

.question-card .arrow {
  color: var(--orange);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .18s, transform .18s;
}

.question-card:hover .arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ===== PAGE HEAD (категория) ===== */
.pagehead {
  padding: 48px 0 32px;
}

/* ===== BREADCRUMBS ===== */
.crumbs {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--text);
}

.pagehead h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
}

.pagehead .lead {
  color: var(--muted);
  font-size: 16px;
  margin-top: 12px;
  max-width: 620px;
}

.count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
}

/* ===== ARTICLE (страница вопроса) ===== */
article {
  padding: 48px 0 24px;
}

article .crumbs {
  margin-bottom: 18px;
}

article h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
}

.chip.date {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  padding-left: 0;
}

/* ===== PROSE (текст ответа) ===== */
.prose {
  font-size: 17.5px;
  line-height: 1.75;
  color: #463f33;
}

.prose p {
  margin-bottom: 20px;
}

.prose p:first-child {
  font-size: 19px;
  color: var(--text);
}

.prose strong {
  color: var(--text);
}

/* ===== DIVIDER ===== */
.divider {
  max-width: var(--readw);
  margin: 40px auto;
  border: none;
  border-top: 1px solid var(--border);
}

/* ===== RELATED QUESTIONS ===== */
.related {
  padding: 8px 0 8px;
}

.related h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 20px;
}

.rel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.rel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}

.rel-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #e0cba8;
}

.rel-card .q {
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.4;
}

.rel-card .dot {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 15px;
}

/* ===== ASK WRAP (страница вопроса) ===== */
.askwrap {
  padding: 48px 0 96px;
}

.askcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  text-align: center;
  box-shadow: var(--shadow);
}

.askcard h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 8px;
}

.askcard p {
  color: var(--muted);
  margin-bottom: 24px;
}

/* ===== FOOTER ===== */
footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
  color: var(--muted);
  font-size: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.foot a {
  color: var(--muted);
  text-decoration: none;
}

.foot a:hover {
  color: var(--text);
}

/* ===== CHAT WINDOW (для будущего функционала) ===== */
.ai-chat-box {
  margin: 0 auto;
  max-width: 680px;
}

.chat-window {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 100px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 560px) {
  .hero {
    padding: 56px 0 40px;
  }

  .ask {
    flex-direction: column;
    align-items: stretch;
  }

  .ask button {
    width: 100%;
  }

  .askcard {
    padding: 24px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .post-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}