/* =========================================================
   ПЕРЕМЕННЫЕ — меняешь тут, а не по всему файлу
   ========================================================= */
:root {
  --bg: #121212;
  --bg-panel: #1a1a1a;
  --bg-panel-raised: #202020;
  --border: #3a3a3a;
  --border-strong: #565656;
  --text: #d8d5cc;
  --text-dim: #8a877e;
  --text-faint: #5c594f;
  --accent: #3f6fb3;      /* акцент — синяя "нить" на доске расследования */
  --accent-dim: #2c4d7a;

  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-serif: Georgia, 'Times New Roman', serif;

  --gap: 24px;
  --radius: 2px;
}

* { box-sizing: border-box; }

html {
  /* Always show the vertical scrollbar so its width never changes
     between short and long pages — this is what removes the jitter
     when navigating. We tried scrollbar-gutter: stable here first,
     but it has a known unresolved browser bug where full-width
     elements (like .site-header's border) don't reach the edge
     the reserved gutter creates — see the note below if this
     needs revisiting. overflow-y: scroll is the simpler, predictable
     fix: no reserved-but-unused gutter, just a scrollbar that's
     always there. */
  overflow-y: scroll;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.6;
}

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

img { max-width: 100%; display: block; }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  display: flex;
  align-items: stretch;
  justify-content: center;
  border-bottom: thin solid var(--border-strong);
  font-family: var(--font-mono);
}

.main-nav {
  display: flex;
}

.main-nav a {
  display: flex;
  align-items: center;
  padding: 0 var(--gap);
  border-right: thin solid var(--border);
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.04em;
  min-height: 48px;
}

.main-nav a:first-child {
  border-left: thin solid var(--border);
}

.main-nav a:hover {
  background: var(--bg-panel-raised);
  text-decoration: none;
}

.main-nav a.current {
  color: var(--accent);
  background: var(--bg-panel-raised);
}

/* =========================================================
   ЛЭЙАУТ: левая пустая колонка + центр + правый сайдбар
   Центральная колонка — единственная, где живёт контент,
   поэтому и манифест, и My Posts используют один и тот же
   .main-col и оказываются строго друг под другом по центру.
   ========================================================= */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr 260px; }
  .sidebar-left { display: none; }
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.sidebar-left {
  /* без своей границы — граница задаётся только .main-col, симметрично правой стороне */
}

.main-col {
  border-right: thin solid var(--border-strong);
  border-left: thin solid var(--border-strong);
  padding: 40px var(--gap);
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 800px) {
  .main-col { border-right: none; border-left: none; }
}

.sidebar {
  padding: var(--gap);
  font-family: var(--font-mono);
  font-size: 13px;
}

.sidebar-photo {
  border: thin solid var(--border-strong);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  overflow: hidden;
  margin-bottom: 12px;
}

.sidebar-photo img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-info {
  color: var(--text-dim);
  line-height: 1.7;
}

.sidebar-info h4 {
  color: var(--text-faint);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
  margin: 20px 0 6px;
}

/* =========================================================
   МАНИФЕСТ (статичный блок)
   ========================================================= */
.manifest {
  max-width: 68ch;
}

.manifest .kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.manifest h1 {
  font-size: 2.4rem;
  margin: 0 0 24px;
  font-weight: 400;
  border-bottom: thin solid var(--border);
  padding-bottom: 20px;
}

.manifest p {
  color: var(--text);
  margin: 0 0 1.2em;
}

/* =========================================================
   FEATURED / ТЕКУЩЕЕ ДЕЛО
   ========================================================= */
.dossier {
  margin-top: 56px;
  padding-top: 32px;
  border-top: thin dashed var(--border-strong);
}

.dossier-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.dossier-label .date {
  color: var(--accent);
  border: thin solid var(--accent-dim);
  padding: 2px 8px;
}

.dossier h2 {
  font-size: 1.7rem;
  font-weight: 400;
  margin: 0 0 16px;
}

.dossier .body p { margin: 0 0 1em; }
.dossier .body ul,
.dossier .body ol { margin: 0 0 1em; padding-left: 1.4em; color: var(--text); }
.dossier .body h2,
.dossier .body h3 { font-weight: 400; margin: 1.4em 0 0.6em; color: var(--text); }
.dossier .body a { color: var(--accent); }
.dossier .body strong { color: var(--text); }
.dossier .body img,
.post-item .full-text img,
.manifest img {
  width: 100%;
  border: thin solid var(--border);
  margin: 8px 0 4px;
  filter: saturate(0.85) contrast(1.05);
}
.dossier .body iframe,
.post-item .full-text iframe,
.manifest iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: thin solid var(--border-strong);
  margin: 16px 0;
}

/* ---------- Универсальная кнопка-тоггл + скрываемый блок ----------
   Можно ставить сколько угодно раз где угодно между абзацами:
   <button class="toggle-btn">...</button>
   <div class="toggle-block" hidden>...что угодно внутри...</div>
   ------------------------------------------------------------- */
.toggle-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-panel);
  border: thin solid var(--border);
  padding: 8px 14px;
  cursor: pointer;
  margin: 20px 0;
  display: inline-block;
}

.toggle-btn:hover { border-color: var(--border-strong); color: var(--text); }

.toggle-block[hidden] { display: none; }

/* .gallery — специфичная grid-раскладка ДЛЯ ФОТО, используется
   вместе с .toggle-block: class="gallery toggle-block" */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin: 0 0 24px;
}

.gallery figure {
  margin: 0;
  border: thin solid var(--border);
  background: var(--bg-panel);
}

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.05);
}

.gallery figcaption {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 8px 10px;
  border-top: thin solid var(--border);
}

/* =========================================================
   ВИДЕО-СЛОТ (заготовка на будущее)
   ========================================================= */
.video-slot {
  border: thin dashed var(--border-strong);
  background: var(--bg-panel);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  padding: 20px;
  margin: 24px 0;
}

.video-slot.has-video {
  border-style: solid;
  padding: 0;
}

.video-slot iframe,
.video-slot video {
  width: 100%;
  height: 100%;
  border: 0;
}

/* =========================================================
   MY POSTS — лента + фильтр по дате
   ========================================================= */
.posts-section {
  border-top: thin solid var(--border-strong);
  border-left: none;
  border-right: none;
}

.posts-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.posts-header h2 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 400;
  margin: 0;
}

.date-filter {
  font-family: var(--font-mono);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.date-filter input[type="date"] {
  background: var(--bg-panel);
  border: thin solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  font-family: var(--font-mono);
}

.date-filter button {
  background: none;
  border: thin solid var(--border);
  color: var(--text-dim);
  padding: 5px 10px;
  cursor: pointer;
  font-family: var(--font-mono);
}

.date-filter button:hover { color: var(--text); border-color: var(--border-strong); }

.post-list { display: flex; flex-direction: column; gap: 0; }

.post-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--gap);
  padding: 18px 0;
  border-bottom: thin solid var(--border);
}

.post-item .p-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  padding-top: 3px;
}

.post-item h3 {
  margin: 0 0 6px;
  font-weight: 400;
  font-size: 1.15rem;
}

.post-item h3.clickable {
  cursor: pointer;
}

.post-item h3.clickable:hover {
  color: var(--accent);
}

.post-item p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.post-item .full-text {
  color: var(--text);
  font-size: 0.95rem;
}

.post-item .full-text p { margin: 0 0 1em; color: var(--text); }
.post-item .full-text ul,
.post-item .full-text ol { margin: 0 0 1em; padding-left: 1.4em; }
.post-item .full-text a { color: var(--accent); }

.post-item.hidden { display: none; }

.empty-state {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  padding: 20px 0;
}

/* =========================================================
   ФУТЕР
   ========================================================= */
.site-footer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  padding: 30px;
  border-top: thin solid var(--border);
}

/* =========================================================
   LIGHTBOX — click any image on the site to view it full-size.
   Semi-transparent dark backdrop, image at its natural size
   (capped to the viewport so it never overflows), caption below,
   arrows on desktop, swipe on touch.
   ========================================================= */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 8, 8, 0.88); /* semi-transparent, not solid — the page stays faintly visible behind it */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}

.lightbox-overlay[hidden] { display: none; }

.lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border: thin solid var(--border-strong);
  cursor: default;
}

.lightbox-caption {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 16px;
  text-align: center;
  max-width: 70ch;
}

.lightbox-caption[hidden] { display: none; }

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  background: none;
  border: thin solid var(--border-strong);
  color: var(--text);
  font-family: var(--font-mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close {
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  font-size: 22px;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 26px;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-prev[hidden],
.lightbox-next[hidden] { display: none; }

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--bg-panel-raised);
  border-color: var(--accent);
}

@media (max-width: 700px) {
  /* On narrow screens the side arrows crowd a small image — swipe
     is the primary way to navigate here, so shrink the arrows and
     move them out of the way rather than removing them (someone
     without touch, e.g. a mouse on a small window, still needs them). */
  .lightbox-prev,
  .lightbox-next {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }
  .lightbox-img { max-height: 68vh; }
}

