:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #23201c;
  --muted: #7d766c;
  --line: #e3ddd2;
  --accent: #8a5a3b;
  --accent-soft: #f3e7dc;
  --answer: #f7f3ec;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* header */

.site-header {
  background: #fffdf9;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 16px;
  font-size: 15px;
}

.nav a {
  color: var(--muted);
}

.nav a:hover {
  color: var(--accent);
}

.search {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.search input {
  width: 240px;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}

.search input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.search button {
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.search button:hover {
  background: #744a2f;
}

/* layout */

main {
  padding: 28px 0 48px;
}

.page-head {
  margin-bottom: 18px;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
  margin: 0 0 6px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.crumbs {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
}

/* cards */

.qa-list {
  display: grid;
  gap: 18px;
}

.qa {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(60, 45, 30, 0.04);
}

.qa-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.qa-who {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.qa-author {
  font-weight: 600;
  font-size: 15px;
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

.qa-author-topic {
  border-left: 3px solid var(--accent);
}

.qa-date {
  color: var(--muted);
  font-size: 13px;
}

.qa-video {
  max-width: 100%;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.qa-video:hover {
  color: var(--accent);
}

.qa-question {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.qa-question.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qa-more {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
}

.answer {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--answer);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  overflow-wrap: anywhere;
}

.answer-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.answer-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
}

.answer-text {
  font-size: 16px;
}

.qa-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--muted);
}

/* videos */

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.video-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.video-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}

.video-card img,
.video-thumb-empty {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--accent-soft);
}

.video-thumb-empty {
  display: grid;
  place-items: center;
  background: linear-gradient(
    135deg,
    hsl(var(--h, 28) 40% 86%),
    hsl(calc(var(--h, 28) + 45) 35% 74%)
  );
}

.video-thumb-empty::after {
  content: "▶";
  font-size: 26px;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 2px 6px rgba(60, 40, 20, 0.25);
}

.video-body {
  padding: 12px 14px 14px;
}

.video-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  margin-bottom: 4px;
}

/* pager */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
}

.pager-btn {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}

.pager-btn:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.pager-btn.disabled {
  color: #bdb6ab;
  background: transparent;
}

.pager-info {
  font-size: 14px;
  color: var(--muted);
}

/* misc */

.btn {
  display: inline-block;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
}

.btn:hover {
  background: #744a2f;
  text-decoration: none;
}

.empty {
  padding: 36px 20px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.back {
  margin-top: 22px;
  font-size: 14px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
  font-size: 13px;
  color: var(--muted);
}

.site-footer p {
  margin: 4px 0;
}

@media (max-width: 720px) {
  .header-inner {
    gap: 10px;
  }

  .nav {
    order: 3;
    width: 100%;
  }

  .search {
    order: 4;
    width: 100%;
    margin-left: 0;
  }

  .search input {
    flex: 1;
    width: auto;
  }

  h1 {
    font-size: 22px;
  }

  .qa {
    padding: 16px;
  }

  .qa-video {
    text-align: left;
  }
}
