:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --text: #1c1d21;
  --muted: #6b6f7a;
  --border: #e3e5ea;
  --accent: #2a7ae2;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --surface: #1f2229;
    --text: #e8e9ed;
    --muted: #9a9fab;
    --border: #2e323b;
    --accent: #5aa0ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
img, video { max-width: 100%; height: auto; display: block; }
h1 { font-size: 1.9rem; line-height: 1.25; margin: .4em 0 .3em; }
h2 { font-size: 1.3rem; margin: 2em 0 .8em; }
small, .muted { color: var(--muted); font-weight: normal; }

.container { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.site-header { border-bottom: 1px solid var(--border); padding: 14px 0; }
.logo { font-weight: 700; color: var(--text); text-decoration: none; }
.site-footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 24px 0; color: var(--muted); font-size: .9rem; }

.crumbs { font-size: .9rem; color: var(--muted); margin-top: 24px; }
.crumbs a { color: var(--muted); }
.post-meta { color: var(--muted); font-size: .95rem; margin-bottom: 20px; }
.post-meta a { color: inherit; }

.post-body { overflow-wrap: anywhere; }
.post-body blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; }
.post-body pre { background: var(--surface); padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: .9rem; }
.post-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.post-body :not(pre) > code { background: var(--surface); padding: .1em .35em; border-radius: 4px; }
.spoiler { background: var(--text); color: transparent; border-radius: 4px; cursor: pointer; transition: .2s; }
.spoiler:hover, .spoiler:focus { background: transparent; color: inherit; }
.hashtag { color: var(--accent); }

/* Media + carousel (scroll-snap works without JS; JS only adds buttons and the counter). */
.media { position: relative; margin: 0 0 20px; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.media-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.media-track::-webkit-scrollbar { display: none; }
.media-item { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.media-item img, .media-item video { width: 100%; max-height: 80vh; object-fit: contain; }
.media-audio, .media-document { padding: 16px; align-items: stretch; }
.media-audio audio { width: 100%; }
.document { font-weight: 600; text-decoration: none; }
.video-external { position: relative; display: block; width: 100%; color: #fff; text-decoration: none; }
.video-external span { position: absolute; inset: auto 0 0 0; padding: 12px 16px; background: linear-gradient(transparent, rgba(0,0,0,.75)); font-weight: 600; }

.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.45); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-btn:disabled { opacity: 0; pointer-events: none; }
.carousel-counter { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.45); color: #fff; font-size: .8rem; padding: 2px 8px; border-radius: 10px; }

.button { display: inline-block; padding: 10px 18px; border-radius: 10px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; margin: 4px 8px 4px 0; }
.button-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.post-actions { margin: 28px 0; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.post-nav a { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-size: .95rem; }
.post-nav span { display: block; color: var(--muted); font-size: .8rem; }
.post-nav .next { text-align: right; grid-column: 2; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cards-list { grid-template-columns: 1fr; }
.card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); background: var(--bg); }
.card:hover { border-color: var(--accent); }
.card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card-body { padding: 12px 14px; }
.card-title { font-weight: 650; line-height: 1.35; }
.card-excerpt { color: var(--muted); font-size: .92rem; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { color: var(--muted); font-size: .8rem; margin-top: 8px; }
.cards-list .card { flex-direction: row; }
.cards-list .card img { width: 180px; flex: 0 0 180px; aspect-ratio: auto; }
@media (max-width: 560px) {
  .cards-list .card { flex-direction: column; }
  .cards-list .card img { width: 100%; flex-basis: auto; aspect-ratio: 16 / 9; }
  h1 { font-size: 1.5rem; }
}

.channel-description { color: var(--muted); }
.channel-list { padding: 0; list-style: none; }
.channel-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; }
