/* Дефолтные стили sitectl (M2). Один файл, без inline-стилей (CSP, D-10).
   Светлая/тёмная тема через prefers-color-scheme, системные шрифты. */

:root { color-scheme: light dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  background: #f7f8fa;
  color: #1f2328;
}

.container {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}

a { color: #2b5cc0; }
a:hover { text-decoration-thickness: 2px; }

.site-header {
  border-bottom: 1px solid #d8dce2;
  padding: 0.9rem 0;
}

/* Баннер предпросмотра черновиков (§8.5); только внешний CSS — CSP. */
.draft-banner {
  background: #8a5a00;
  color: #ffffff;
  text-align: center;
  padding: 0.35rem 1rem;
  font-size: 0.9rem;
}
.site-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: inherit;
  text-decoration: none;
}

main { padding: 1.6rem 0 3rem; }

h1 { font-size: 1.6rem; line-height: 1.3; margin: 0 0 0.4rem; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 0.4rem; }

.meta {
  color: #6a737d;
  font-size: 0.9rem;
  margin: 0.2rem 0 1.2rem;
}

.content picture { display: block; }
.content img, .content video {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.content pre {
  overflow-x: auto;
  padding: 0.8rem;
  background: #eceff3;
  border-radius: 6px;
}
.content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}
.content pre code { background: none; padding: 0; }
.content code { background: #eceff3; padding: 0.1em 0.3em; border-radius: 4px; }
.content blockquote {
  margin: 1rem 0;
  padding: 0.1rem 1rem;
  border-left: 3px solid #b6bfca;
  color: #55606b;
}
.content table { border-collapse: collapse; margin: 1rem 0; }
.content th, .content td {
  border: 1px solid #d8dce2;
  padding: 0.35rem 0.6rem;
  text-align: left;
}

.post-item { margin-bottom: 1.7rem; }
.post-item h2 { margin: 0 0 0.2rem; }
.post-thumb { display: block; margin-bottom: 0.55rem; }
.post-thumb img { display: block; width: 100%; height: auto; border-radius: 6px; }

.notfound { text-align: center; padding: 2rem 0; }
.notfound ul { list-style: none; padding: 0; }
.notfound li { margin: 0.4rem 0; }

.site-footer {
  border-top: 1px solid #d8dce2;
  color: #6a737d;
  font-size: 0.85rem;
  padding: 1rem 0 2rem;
}

/* Фото-страница (M3): полный просмотр шире текстового контейнера. */
.photo-page .photo-view { margin: 0; }
.photo-view picture { display: block; }
.photo-view img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
.photo-view figcaption {
  color: #6a737d;
  font-size: 0.9rem;
  margin-top: 0.45rem;
}

/* Галерея: CSS Grid (REQ-P2) — 3/2/1 колонки по ширине экрана. */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
@media (max-width: 50rem) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 30rem) { .gallery-grid { grid-template-columns: 1fr; } }
.g-item { display: block; text-decoration: none; }
.g-item picture { display: block; }
.g-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Лайтбокс: нативный <dialog> (REQ-P2); стили только внешние — CSP. */
.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  color: #ffffff;
  width: min(92vw, 72rem);
}
.lightbox::backdrop { background: rgba(10, 12, 16, 0.92); }
.lightbox-fig { margin: 0; text-align: center; }
.lightbox-fig img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 4px;
}
.lb-caption {
  padding: 0.6rem 1rem;
  color: #d7dce3;
  font-size: 0.95rem;
}
.lb-btn {
  position: fixed;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(20, 24, 30, 0.75);
  color: #ffffff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(60, 68, 80, 0.9); }
.lb-close { top: 0.9rem; right: 0.9rem; }
.lb-prev { left: 0.9rem; top: 50%; margin-top: -1.25rem; }
.lb-next { right: 0.9rem; top: 50%; margin-top: -1.25rem; }

@media (prefers-color-scheme: dark) {
  body { background: #1b1f26; color: #d7dce3; }
  a { color: #8ab4f8; }
  .site-header, .site-footer { border-color: #333a44; }
  .meta, .site-footer { color: #98a1ab; }
  .content pre, .content code { background: #232932; }
  .content blockquote { border-color: #454e5a; color: #a7b0ba; }
  .content th, .content td { border-color: #333a44; }
  .photo-view figcaption { color: #98a1ab; }
  .g-item img { background: #232932; }
}

/* Видео (M4, REQ-P1) */
.video-embed {
  margin: 1.5rem 0;
}
.video-embed video {
  width: 100%;
  height: auto;
  max-height: 80vh;
  background: #000;
  border-radius: 4px;
}
.video-embed figcaption {
  padding-top: 0.4rem;
  color: inherit;
  font-size: 0.95rem;
}
.video-page .meta,
.video-download {
  color: inherit;
}
.video-download {
  margin: 0.8rem 0 1.2rem;
}

/* Агрегатные страницы M5: ссылка на архив с главной, оглавление лет. */
.post-list .archive-link { margin: 1.6rem 0 0; }
.archive-year { margin: 0.35rem 0; font-size: 1.05rem; }
.archive-count { color: #6a737d; }

/* 404 (§8.5): список тегов под навигацией разделов. */
.tag-links { list-style: none; padding: 0; }
.tag-links li { display: inline-block; margin: 0.25rem 0.4rem 0 0; }
