/* rybocop.com — общий стиль (из макета TASK-001). Мобильная вёрстка основная, десктоп — расширение. */
:root {
  --bg: #faf8f4;
  --paper: #ffffff;
  --ink: #1f1d1a;
  --muted: #6f6a62;
  --line: #e6e1d8;
  --soft: #efebe4;
  --accent: #b5532a;
  --serif: 'Literata', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); overflow-wrap: break-word; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.meta { color: var(--muted); font-size: 13px; letter-spacing: .01em; }
.meta a:hover { color: var(--accent); }

/* шапка */
header.site { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
/* При прокрутке вниз шапка уезжает, при прокрутке вверх возвращается (site.js) */
header.site { transition: transform .25s ease; will-change: transform; }
header.site.away { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) { header.site { transition: none; } }
header.site .wrap { display: flex; align-items: center; gap: 20px; height: 56px; }
.logo { font: 600 20px var(--serif); flex: none; }
.logo span { color: var(--accent); }
header nav { display: flex; gap: 18px; font-size: 14px; color: var(--muted); overflow-x: auto; scrollbar-width: none; white-space: nowrap; min-width: 0; }
header nav::-webkit-scrollbar { display: none; }
header nav a:hover, header nav a[aria-current] { color: var(--ink); }
header nav a[aria-current] { font-weight: 600; }
.search { margin-left: auto; color: var(--muted); flex: none; padding: 6px; }
.search:hover { color: var(--ink); }
footer.site { margin-top: 64px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* заголовок списка и переключатель режимов (D-007) */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; margin: 28px 0 24px; flex-wrap: wrap; }
.toolbar h1 { font: 600 30px/1.2 var(--serif); margin: 0; }
.switch { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.switch a, .switch button { border: 0; background: none; font: 500 14px var(--sans); color: var(--muted); padding: 7px 16px; border-radius: 999px; cursor: pointer; }
.switch a[aria-current], .switch button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.switch.small button { padding: 5px 12px; font-size: 13px; }

/* подписи над фото (D-010) — общий вид текста блоков */
figure { margin: 0; }
figcaption a, .brick figcaption a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 4px; scrollbar-width: thin; }
.slides > img, .slides > a, .slides > .ph { flex: 0 0 100%; scroll-snap-align: center; }
.slides img { width: 100%; height: 100%; object-fit: contain; background: #f1eee8; }
.slides-n { text-align: center; color: var(--muted); font-size: 13px; padding-top: 6px; }

/* Журнал */
.journal { max-width: 860px; margin: 0 auto; }
.j-card { padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--line); }
.j-card h2 { font: 600 26px/1.25 var(--serif); margin: 4px 0 14px; }
.j-lead h2 { font-size: 34px; }
@media (min-width: 860px) { .j-lead h2 { font-size: 42px; } }
.j-card h2 a:hover { color: var(--accent); }
.j-brick { margin-bottom: 18px; }
.j-brick figcaption { font: 17px/1.65 var(--serif); color: #3b3833; margin-bottom: 12px; }
.j-brick img { width: 100%; height: auto; border-radius: 4px; }
.j-foot { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; margin: 6px 0 10px; }
.more { color: var(--accent); font-weight: 500; font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--accent); }
.tags a:hover { text-decoration: underline; }

/* Альбом: одинаковая геометрия карточек, чтобы соседи выстраивались ровно */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 24px; }
.a-card { background: var(--paper); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; }
.a-head { padding: 14px 16px 12px; min-height: 92px; }
.a-head h2 { font: 600 20px/1.3 var(--serif); margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.a-head h2 a:hover { color: var(--accent); }
.a-head .year { color: var(--accent); font-weight: 400; }
.a-mosaic { display: grid; gap: 2px; aspect-ratio: 4 / 3; overflow: hidden; grid-template-rows: 100%; background: var(--soft); }
.a-mosaic img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; }
.a-mosaic.n2 { grid-template-columns: 1fr 1fr; }
.a-mosaic.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.a-mosaic.n3 img:first-child { grid-row: 1 / 3; }
.a-mosaic.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.a-list { margin: 0; padding: 4px 16px 14px; list-style: none; font-size: 14px; }
.a-list li { padding: 5px 0; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-list li:first-child { border-top: 0; }
.a-list li a:hover { color: var(--accent); }
.a-list li.rest a { color: var(--accent); font-weight: 500; }

/* Дневник */
.diary { display: grid; gap: 32px; }
@media (min-width: 860px) { .diary { grid-template-columns: minmax(0, 1fr) 280px; } }
.d-month { font: 600 14px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 24px 0 6px; }
.d-month:first-child { margin-top: 0; }
.d-row { display: grid; grid-template-columns: 72px 36px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.d-row img, .d-noimg { width: 72px; height: 54px; object-fit: cover; border-radius: 3px; background: var(--soft); }
.d-day { font: 600 22px var(--serif); color: var(--muted); text-align: center; }
.d-main { display: flex; flex-direction: column; min-width: 0; }
.d-title { font: 600 17px/1.3 var(--serif); }
.d-row:hover .d-title { color: var(--accent); }
.d-side .box { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-bottom: 16px; }
.box-h { font-weight: 600; margin-bottom: 8px; }
.box-h a:hover { color: var(--accent); }
.mini-cal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 12px; text-align: center; }
.mini-cal span, .mini-cal a { padding: 6px 0; border-radius: 3px; color: var(--muted); background: #f3f0ea; }
.mini-cal a.on { background: var(--accent); color: #fff; }
.years { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.years a { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
.years a[aria-current], .years a:hover { border-color: var(--accent); color: var(--accent); }
.mini-map { display: grid; place-items: center; height: 120px; border-radius: 4px; font-size: 13px; color: var(--muted);
  background: repeating-linear-gradient(45deg, #eef1ec, #eef1ec 8px, #e6ebe4 8px, #e6ebe4 16px); }
.mini-map:hover { color: var(--accent); }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; font-size: 14px; color: var(--muted); }
.pager a { color: var(--accent); font-weight: 500; padding: 8px 0; }

/* пост */
.post-head { padding-top: 32px; }
.post-head h3 { font: 600 32px/1.2 var(--serif); margin: 6px 0 16px; }
@media (min-width: 860px) { .post-head h3 { font-size: 44px; } }
.post-date { display: block; font: 400 15px var(--sans); color: var(--muted); margin-top: 10px; }
.post-tools { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.trip-link { color: var(--accent); }
.bricks { max-width: 1100px; margin: 28px auto 0; }
.brick { margin: 0 0 36px; }
.brick > img { width: auto; height: auto; max-width: 100%; max-height: 90vh; margin: 0 auto; }
/* Фото с геометкой: булавка справа вверху, по клику — карта поверх фото (как templates/mapPin.tpl старого сайта) */
.ph { position: relative; display: block; }
.brick > .ph { width: fit-content; max-width: 100%; margin: 0 auto; }
.brick > .ph > img { width: auto; height: auto; max-width: 100%; max-height: 90vh; }
.slides .ph > a { display: block; height: 100%; }
.pin { position: absolute; top: 8px; right: 8px; z-index: 2; width: 32px; height: 32px; padding: 0; border: 0; background: none;
  cursor: pointer; display: grid; place-items: center; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .7)); }
.pin-map { position: absolute; top: 25px; right: 25px; z-index: 3; width: 88%; height: 88%; min-height: 220px;
  border-radius: 8px; overflow: hidden; background: #e8e4dc; box-shadow: 0 4px 18px rgba(0, 0, 0, .3); }
.brick figcaption { max-width: 760px; margin: 0 auto 12px; padding: 0 16px; font: 18px/1.65 var(--serif); }
.brick .slides img { max-height: 85vh; }
body.look .brick figcaption, body.look .slides-n { display: none; }
body.look .brick { margin-bottom: 6px; }
.post-foot { margin-top: 40px; }
.prevnext { display: flex; justify-content: space-between; gap: 16px; margin: 28px 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.prevnext a { display: flex; flex-direction: column; max-width: 48%; font: 600 16px/1.3 var(--serif); }
.prevnext a:hover { color: var(--accent); }
.prevnext a.next { text-align: right; margin-left: auto; }
.prevnext small { font: 400 13px var(--sans); color: var(--muted); margin-bottom: 4px; }
.comments h2 { font: 600 22px var(--serif); }
.cmnt { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cmnt p { margin: 4px 0 0; }
.comments form { display: grid; gap: 8px; margin-top: 16px; }
.comments input, .comments textarea { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); width: 100%; }
.comments textarea { min-height: 90px; }
.comments .hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.comments button { justify-self: start; font: 500 14px var(--sans); background: var(--ink); color: #fff; border: 0; border-radius: 4px; padding: 10px 18px; cursor: pointer; }

.notfound { padding-top: 48px; }
.notfound h1 { font: 600 32px var(--serif); }
.notfound a { color: var(--accent); }

/* шапка на телефоне: меню — второй строкой с прокруткой */
@media (max-width: 760px) {
  header.site .wrap { flex-wrap: wrap; height: auto; gap: 0 12px; padding-top: 10px; }
  header.site .logo { order: 1; }
  header.site .search { order: 2; }
  header nav { order: 3; flex: 0 0 100%; padding: 8px 0 10px; gap: 20px; font-size: 15px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
.link { color: var(--accent); }
.link:hover { text-decoration: underline; }
.year { color: var(--accent); font-weight: 400; }

/* теги и места */
.cloud { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; line-height: 1.3; }
.cloud a { font-family: var(--serif); }
.cloud a:hover { color: var(--accent); }
.cloud sup { font: 11px var(--sans); color: var(--muted); margin-left: 2px; }
.places { columns: 3 280px; column-gap: 32px; }
.place { break-inside: avoid; padding: 0 0 18px; }
.place h2 { font: 600 20px var(--serif); margin: 0 0 4px; }
.place h2 a:hover, .place p a:hover { color: var(--accent); }
.place p { margin: 0; font-size: 14px; color: #3b3833; }

/* календарь */
.years { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 24px; }
.cal-month h2 { font: 600 17px var(--serif); margin: 0 0 8px; }
.cal-month h2 a { color: var(--accent); }
.cal-month.empty { opacity: .45; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; font-size: 13px; text-align: center; }
.cal-grid span, .cal-grid a { padding: 5px 0; border-radius: 3px; }
.cal-grid .wd { color: var(--muted); font-size: 11px; }
.cal-grid a.on { background: var(--accent); color: #fff; font-weight: 600; }
.cal-grid a.on:hover { background: var(--ink); }

/* карты */
.map { height: 70vh; min-height: 360px; border-radius: 6px; overflow: hidden; background: #eef1ec; border: 1px solid var(--line); margin-bottom: 12px; }
.map-small { height: 380px; min-height: 0; }
.balloon-list { margin: 6px 0; padding-left: 20px; max-height: 220px; overflow: auto; }
.balloon-list a, .map a { color: var(--accent); }
.trips-list { margin-top: 24px; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.t-card { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.t-card img, .t-noimg { margin-top: auto; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--soft); }
.t-body { display: flex; flex-direction: column; padding: 10px 12px; font: 600 16px/1.3 var(--serif); }
.t-card:hover b { color: var(--accent); }
.t-card[data-noroute] .t-body .meta { color: #9a948a; }
.d-day small { display: block; font: 12px var(--sans); }
.trip-posts { margin-top: 16px; }
.toolbar .year { font-size: .8em; }

/* статистика */
.stat h1 { font: 600 32px var(--serif); margin: 32px 0 12px; }
.stat h2 { font: 600 22px var(--serif); margin: 40px 0 12px; }
.stat .lead { font: 18px/1.65 var(--serif); }
.progress-row { margin: 14px 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.progress { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.progress div { height: 100%; background: var(--accent); border-radius: 999px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 180px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar-v { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar:hover .bar-v { background: var(--ink); }
.bar-n { font-size: 12px; color: var(--muted); }
.bar-y { font-size: 11px; color: var(--muted); padding-top: 4px; }
@media (max-width: 520px) { .bar-y { writing-mode: vertical-rl; transform: rotate(180deg); } }
.top li { padding: 4px 0; }
.top a:hover { color: var(--accent); }
.extremes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.extreme { display: flex; flex-direction: column; gap: 6px; }
.extreme img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
.extreme:hover .d-title { color: var(--accent); }

/* поиск */
.searchbox { display: flex; gap: 8px; margin: 32px 0 16px; }
.searchbox input { flex: 1; min-width: 0; font: inherit; font-size: 18px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.searchbox button { font: 500 15px var(--sans); background: var(--ink); color: #fff; border: 0; border-radius: 6px; padding: 0 18px; cursor: pointer; }
.empty { padding: 16px 0; }
.s-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.s-row img, .s-row .d-noimg { width: 96px; height: 72px; object-fit: cover; border-radius: 3px; }
.s-row:hover .d-title { color: var(--accent); }
.snippet { font-size: 14px; color: #3b3833; margin-top: 4px; }
.snippet mark { background: #f6dfc9; color: inherit; padding: 0 1px; }

/* Режимы ленты (D-007): все три в странице, показывается выбранный — html[data-mode], по умолчанию Журнал. */
.m-album, .m-diary { display: none; }
html[data-mode="album"] .m-album, html[data-mode="diary"] .m-diary { display: block; }
html[data-mode="album"] .m-journal, html[data-mode="diary"] .m-journal { display: none; }
.switch button[aria-current="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
