﻿:root {
  --paper: #eff0ec;
  --paper-2: #e4e5df;
  --ink: #151917;
  --muted: #6b736d;
  --line: #d7d9d3;
  --moss: #4b5d45;
  --dark: #0c0f0e;
  --sel: #ccd5c6;

  --radius: 14px;
  --pad: clamp(16px, 4vw, 40px);
  --font: "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-display: "Comfortaa", "Nunito", system-ui, sans-serif;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #121513;
  --paper-2: #1c201d;
  --ink: #e7e9e4;
  --muted: #8b938c;
  --line: #2a2e2a;
  --moss: #a2ba93;
  --sel: #2f3b2c;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121513;
    --paper-2: #1c201d;
    --ink: #e7e9e4;
    --muted: #8b938c;
    --line: #2a2e2a;
    --moss: #a2ba93;
    --sel: #2f3b2c;
    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* на телефоне браузер подсвечивает нажатый элемент голубым —
   при открытии просмотрщика это выглядит как вспышка поверх фото */
html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }
img { max-width: 100%; }

::selection { background: var(--sel); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  width: 83%;
  max-width: 2400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .wrap { width: auto; padding: 0 var(--pad); }
}

/* ── шапка ───────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.masthead.is-hidden { transform: translateY(-100%); }

.masthead__bar { border-bottom: 1px solid var(--line); }

.masthead__bar .wrap {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 20px;
  padding-top: 13px;
  padding-bottom: 13px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
}

.bar-right {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  margin-left: auto;
}

.nav {
  display: flex;
  gap: clamp(12px, 2vw, 26px);
  font-size: 13.5px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 3px 0;
  white-space: nowrap;
  transition: color 0.18s ease;
}

.nav a:hover { color: var(--ink); }

.nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.nav-tags {
  display: flex;
  gap: clamp(10px, 1.4vw, 18px);
}

.nav-tag { color: var(--muted); font-size: 13px; }

.nav-all {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line);
  text-underline-offset: 5px;
}

.nav-all:hover { text-decoration-color: var(--ink); }

@media (max-width: 1520px) { .nav-tags a:nth-child(n+7) { display: none; } }
@media (max-width: 1320px) { .nav-tags a:nth-child(n+5) { display: none; } }
@media (max-width: 1120px) { .nav-tags a:nth-child(n+3) { display: none; } }
@media (max-width: 900px) { .nav-tags { display: none; } }

.nav-util {
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 0 3px 14px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
  transition: color 0.18s ease;
}

.nav-util:hover { color: var(--ink); }

.nav-util[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.theme {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.theme:hover { color: var(--ink); background: var(--paper-2); }

.i-moon { display: none; }

:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

.masthead__sub .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.months {
  display: flex;
  gap: clamp(12px, 1.8vw, 20px);
  font-size: 12.5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.months::-webkit-scrollbar { display: none; }

.months a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 2px 0;
  transition: color 0.18s ease;
}

.months a:hover { color: var(--ink); }

.months a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.masthead__count {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}

@media (max-width: 760px) {
  .masthead__count { display: none; }
}

/* ── заголовок раздела ───────────────────────────────── */

.page-head {
  display: block;
  padding-top: clamp(24px, 4vw, 46px);
}

.page-head h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.7vw, 32px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.page-head__count {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.page-head__desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 54ch;
}

.page-head__parent {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.page-head__parent a { color: var(--muted); text-underline-offset: 3px; }
.page-head__parent a:hover { color: var(--ink); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.chip:hover { color: var(--ink); border-color: var(--ink); }

.chip .n {
  font-size: 11px;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

/* ── лента ───────────────────────────────────────────── */

.day { margin-top: clamp(26px, 3.4vw, 44px); }
.day:first-of-type { margin-top: clamp(16px, 2.4vw, 26px); }

.day + .day {
  border-top: 1px solid var(--line);
  padding-top: clamp(18px, 2.4vw, 30px);
}

.empty {
  margin: 0;
  padding: 40px 0 10px;
  font-size: 15px;
  color: var(--muted);
}

.day__label {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0 0 11px;
  padding: 7px 0 8px;
  background: var(--paper);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.012em;
  font-variant-numeric: tabular-nums;
}

.rows { --per: 2; --gap: 24px; }

.row {
  display: flex;
  gap: var(--gap);
  margin-bottom: clamp(22px, 2.6vw, 30px);
}

.row:last-child { margin-bottom: 0; }

.row .item {
  flex: var(--ar, 1) 1 0;
  min-width: 0;
}

.row--end .item {
  flex: 0 0 calc((100% - (var(--per) - 1) * var(--gap)) / var(--per));
}

.item { margin: 0; }

/* мягкое появление кадров при прокрутке (класс .reveal ставится из app.js) */
.reveal .item {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reveal .item.is-in {
  opacity: 1;
  transform: none;
}

.shot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--ar, 1.33333);
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--paper-2);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  text-decoration: none;
}

.shot picture {
  display: block;
  width: 100%;
  height: 100%;
}

.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.24, 1);
}

.shot:hover img { transform: scale(1.03); }
.shot:focus-visible { outline-offset: -3px; }

.item figcaption { margin-top: 9px; }

.item .cap {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 5px;
}

.item-tags .tag {
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s ease;
}

.item-tags .tag:hover { color: var(--ink); }

/* ── страницы ────────────────────────────────────────── */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(30px, 4vw, 48px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.pager__link {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.18s ease;
}

.pager__link:hover { border-color: var(--ink); }

.pager__link.is-off {
  color: var(--muted);
  opacity: 0.4;
  border-bottom-color: transparent;
}

.pager__pos {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* ── теги ────────────────────────────────────────────── */

.tags-index {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 22px;
  margin-top: clamp(46px, 6vw, 76px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tags-index h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.tags-index a {
  font-size: 13.5px;
  text-decoration: none;
  transition: color 0.18s ease;
}

.tags-index a:hover { color: var(--moss); }

.tags-index .n {
  margin-left: 5px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tag-group { margin-top: 36px; }

.tag-group h2 {
  margin: 0 0 14px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.tag-list {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: grid;
  gap: 20px;
  max-width: 640px;
}

.tag-row {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}

.tag-row img,
.tag-thumb {
  flex: 0 0 auto;
  width: 104px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--paper-2);
  display: block;
}

.tag-row__name {
  font-size: 17px;
  transition: color 0.18s ease;
}

.tag-row:hover .tag-row__name { color: var(--moss); }

.tag-list .n {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tag-list p {
  margin: 6px 0 0 120px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* ── подвал ──────────────────────────────────────────── */

.foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-top: clamp(60px, 8vw, 110px);
  padding-top: 16px;
  padding-bottom: 36px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

.foot a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.foot a:hover { color: var(--ink); border-color: var(--ink); }

.foot__links { display: flex; gap: 16px; }

/* ── архив ───────────────────────────────────────────── */

.year-block { margin-top: clamp(26px, 3vw, 40px); }

.year-block h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.year-block h2 .n {
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.month-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0 24px;
}

.month-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color 0.18s ease;
}

.month-list a:hover { color: var(--moss); }

.month-list .n {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── просмотрщик ─────────────────────────────────────── */

.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  color: #eceee9;
  visibility: hidden;
}

/* затемнение — отдельный слой под содержимым: страница плавно уходит
   в темноту, пока кадр летит на место, и так же плавно возвращается */
.lb__dim {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--dark);
  opacity: 0;
  pointer-events: none;
}

/* содержимое просмотрщика — над слоем затемнения */
.lb__bar,
.lb__stage,
.lb__cap { position: relative; z-index: 1; }

.lb.is-open { visibility: visible; }


.lb__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px clamp(10px, 2.4vw, 22px);
  font-size: 12.5px;
  color: #8c958f;
  font-variant-numeric: tabular-nums;
}

.lb__close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #eceee9;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.lb__close:hover { background: rgba(255, 255, 255, 0.07); }

.lb__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 0;
  padding: 0 clamp(2px, 1.3vw, 22px);
  overflow: hidden;
  touch-action: none;
}

.lb.is-zoomed .lb__img { cursor: grab; }
.lb.is-zoomed .lb__img:active { cursor: grabbing; }

.lb__img {
  display: block;
  flex: 0 1 auto;
  width: auto;
  height: auto;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.lb__img.is-ready { opacity: 1; }

.lb__nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(12, 15, 14, 0.35);
  color: #eceee9;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.lb__nav:hover { background: rgba(255, 255, 255, 0.1); }
.lb__nav--prev { left: clamp(4px, 1.6vw, 18px); }
.lb__nav--next { right: clamp(4px, 1.6vw, 18px); }

.lb__cap {
  flex: 0 0 auto;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 28px) 16px;
  max-width: 72ch;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.45;
  color: #dde1db;
}

.lb__cap .lb__meta {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  color: #828b85;
}

/* ── узкие экраны ────────────────────────────────────── */

@media (max-width: 900px) {
  .wordmark { font-size: 18px; }
  .nav { font-size: 12px; gap: 11px; }
  .nav-util { display: none; }
  .bar-right { gap: 9px; }
  .theme { width: 26px; height: 26px; margin-right: -4px; }
  .masthead__bar .wrap { padding-top: 11px; padding-bottom: 11px; }
  .masthead__sub .wrap { padding-top: 8px; padding-bottom: 8px; }
  .months { font-size: 12px; }

  .page-head { padding-top: 22px; }
  .page-head__desc { font-size: 14px; }

  /* на телефоне ряд превращается в столбик: отступ должен быть
     у каждого кадра, иначе между парами он вдвое больше */
  .row { display: block; margin-bottom: 0; }
  .row .item,
  .row--end .item { width: 100%; flex: none; margin-bottom: 26px; }

  .lb__nav { display: none; }  .lb__stage { gap: 10px; }
  .lb__cap { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .shot:hover img { transform: none; }
}

/* ── узкие экраны: шапка в две строки ─────────────────── */

@media (max-width: 700px) {
  .masthead__bar .wrap {
    flex-wrap: wrap;
    row-gap: 6px;
    column-gap: 12px;
  }
  .wordmark { font-size: 19px; white-space: normal; }
  .bar-right {
    flex-basis: 100%;
    margin-left: 0;
    justify-content: flex-start;
    gap: 14px;
  }
  .theme { margin-left: auto; margin-right: 0; }
}

@media (max-width: 420px) {
  .wordmark { font-size: 17px; }
  .nav { gap: 12px; }
}

/* ── визуальные улучшения ─────────────────────────────── */

:root {
}

:root[data-theme="dark"] {
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wash-top: rgba(255, 255, 255, 0.035);
    --wash-bottom: rgba(0, 0, 0, 0.35);
  }
}

/* фон: едва заметный градиент плюс микрошум */
body {
  background-color: var(--paper);
  transition: background-color 0.28s ease, color 0.28s ease;
}

/* плавная смена темы */
.masthead,
.masthead__bar,
.masthead__sub,
footer,
.foot,
.day__label,
.pager__link,
.month-list a,
.tag-list a,
.chip {
  transition: background-color 0.28s ease,
              color 0.28s ease,
              border-color 0.28s ease;
}

/* фото приподнимается при наведении, зум мягче */
@media (hover: hover) and (pointer: fine) {
  .shot {
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
                box-shadow 0.3s ease;
  }
  .shot:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(15, 20, 15, 0.14);
  }
  .shot:hover img { transform: scale(1.012); }
}

/* линия между днями затухает к краям */
.day + .day { border-top: 0; position: relative; }

.day + .day::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--line) 14%,
    var(--line) 86%,
    transparent 100%);
}

/* дата дня как метка с тонким хвостом */
.day__label {
  display: flex;
  align-items: center;
  gap: 14px;
}

.day__label time { flex: 0 0 auto; }

.day__label::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent 92%);
}

/* подпись не растягивается на всю плитку */
.item .cap { max-width: 54ch; }

/* шапка и дата: полупрозрачный фон с размытием, чтобы не было полосы
   на градиентном фоне (сплошной цвет — запасной вариант) */
.masthead,
.day__label { background-color: var(--paper); }




/* ── плавные переходы между страницами ─────────────────── */

@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.34s;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}


/* акцентная линия под шапкой */
.masthead__bar { border-bottom: 0; }

.masthead::after {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--line) 18%,
    var(--line) 82%,
    transparent 100%);
}


/* кадр «вынимается» из ленты: пока он летит, миниатюра на месте не видна */
.shot.is-lifted {
  opacity: 0;
  transition: opacity 0.12s ease;
}
