/* Anny 2022–2026 — галерея и слайд-шоу. Палитра и шрифты — как на основном сайте. */

:root {
  --ink: #1d2433;
  --paper: #ece8dd;
  --sea: #16222e;
  --sea-2: #1e2f3f;
  --sea-3: #0d151d;
  --foam: #c8d4dc;
  --brass: #d9b36c;          /* латунь рынды */
  --redlead: #e2572b;        /* сурик на шпорах мачт */
  --serif: "Old Standard TT", "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--sans); color: var(--foam); background: var(--sea); line-height: 1.6; font-size: 17px; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, select { font: inherit; color: inherit; }
body:not([data-lang="en"]) [lang-en], body:not([data-lang="sv"]) [lang-sv] { display: none !important; }
body.showing { overflow: hidden; }

/* ── шапка ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: linear-gradient(#0d151de6, #0d151d00); pointer-events: none;
}
.topbar.solid { background: #16222ef2; backdrop-filter: blur(6px); box-shadow: 0 1px 0 #ffffff14; }
.topbar > * { pointer-events: auto; }
.wordmark { font-family: var(--serif); font-size: 20px; letter-spacing: .06em; text-decoration: none; display: flex; align-items: baseline; gap: 10px; }
.wordmark .ex { font-family: var(--mono); font-size: 12px; opacity: .55; letter-spacing: .12em; }
.langswitch { display: flex; border: 1px solid #ffffff3a; border-radius: 3px; overflow: hidden; }
.langswitch button { background: none; border: 0; padding: 5px 11px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; cursor: pointer; opacity: .6; }
.langswitch button[aria-pressed="true"] { background: var(--foam); color: var(--sea); opacity: 1; }

/* ── обложка ── */
.hero { position: relative; min-height: 92vh; display: flex; align-items: flex-end; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #0d151d55 0%, #0d151d00 30%, #0d151dcc 72%, var(--sea) 100%); }
.hero-copy { position: relative; z-index: 1; max-width: 760px; padding: 0 28px 56px; margin: 0 auto 0 max(0px, calc((100vw - 1320px) / 2)); }
.over { font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); margin-bottom: 14px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(46px, 8vw, 104px); line-height: .98; color: #fff; letter-spacing: -.01em; }
h1 em { color: var(--brass); }
.lede { margin-top: 22px; font-size: 18px; max-width: 58ch; color: #dfe7ec; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn { border: 1px solid #ffffff55; background: none; padding: 13px 22px; font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; border-radius: 2px; transition: background .2s, color .2s, border-color .2s; }
.btn-light { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-light:hover { background: #fff; }
.btn-ghost:hover { background: #ffffff1c; border-color: #fff; }
.stats { margin-top: 22px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; opacity: .7; }

/* ── категории ── */
.chips { position: sticky; top: 0; z-index: 40; display: flex; gap: 8px; overflow-x: auto; padding: 62px 28px 14px; margin-top: -48px; background: linear-gradient(#16222e00, var(--sea) 46px); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid #ffffff2e; border-radius: 99px; padding: 6px 14px; font-size: 14px; text-decoration: none; white-space: nowrap; background: #16222ed0; transition: border-color .2s, background .2s; }
.chip:hover { border-color: var(--brass); }
.chip b { font-family: var(--mono); font-weight: 400; font-size: 11px; opacity: .55; margin-left: 6px; }

.sec { max-width: 1320px; margin: 0 auto; padding: 56px 28px 8px; scroll-margin-top: 60px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; border-top: 1px solid #ffffff1f; padding-top: 18px; }
.sec-num { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; color: var(--brass); }
.sec h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 4vw, 48px); line-height: 1.05; color: #fff; }
.sec-sub { font-size: 16px; opacity: .72; margin-top: 4px; }
.sec-play { border: 1px solid #ffffff3a; background: none; border-radius: 2px; padding: 8px 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }
.sec-play:hover { border-color: var(--brass); color: var(--brass); }

.grid { display: flex; flex-wrap: wrap; gap: 6px; }
.grid::after { content: ""; flex-grow: 1e4; }
.tile { position: relative; height: 230px; flex-grow: var(--g); flex-basis: calc(var(--r) * 230px); min-width: 0; overflow: hidden; border: 0; padding: 0; background: var(--sea-2); cursor: zoom-in; border-radius: 2px; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .3s; }
.tile:hover img, .tile:focus-visible img { transform: scale(1.04); }
.tile:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.tile .t-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 10px 8px; text-align: left; font-size: 12.5px; line-height: 1.3; color: #fff; background: linear-gradient(#0000, #000c); opacity: 0; transition: opacity .25s; }
.tile:hover .t-meta, .tile:focus-visible .t-meta { opacity: 1; }
.tile .t-meta small { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; opacity: .75; margin-top: 2px; }
.tile .t-vid { position: absolute; top: 8px; right: 8px; background: #000a; color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 99px; font-family: var(--mono); }
@media (max-width: 640px) { .tile { height: 150px; flex-basis: calc(var(--r) * 150px); } .hero-copy, .sec, .chips, .topbar { padding-left: 16px; padding-right: 16px; } }

footer { max-width: 1320px; margin: 70px auto 0; padding: 26px 28px 60px; border-top: 1px solid #ffffff1f; font-size: 14px; opacity: .8; }
footer .hint { margin-top: 10px; font-family: var(--mono); font-size: 12px; opacity: .7; }

/* ═══ показ ═══ */
.show { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; overflow: hidden; }
.show[hidden] { display: none; }
.show.idle { cursor: none; }
.stage, .layer { position: absolute; inset: 0; }
.layer { opacity: 0; transition: opacity 1.6s ease; }
.layer.on { opacity: 1; }
.layer.bg { background-size: cover; background-position: center; filter: blur(34px) brightness(.42) saturate(1.1); transform: scale(1.15); }
.layer.fg { display: flex; align-items: center; justify-content: center; }
.layer.fg img, .layer.fg video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; will-change: transform; }
.layer.fg.cover img { width: 100%; height: 100%; object-fit: cover; }
.layer.fg img.kb { animation: kb var(--dur, 10s) linear both; transform-origin: var(--ox, 50%) var(--oy, 50%); }
@keyframes kb { from { transform: scale(var(--s0, 1)); } to { transform: scale(var(--s1, 1.07)); } }
.show.paused .layer.fg img.kb { animation-play-state: paused; }

.caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 14vh 4.2vw 4.4vh; background: linear-gradient(#0000, #000000b8 62%, #000000d8); pointer-events: none; transition: opacity .8s; }
.show.nocap .caption { opacity: 0; }
.show.metaonly .cap-cat, .show.metaonly .cap-text { display: none; }
.show.metaonly .caption { padding-top: 8vh; background: linear-gradient(#0000, #00000099); }
.show.metaonly .cap-meta { margin-top: 0; opacity: 1; text-shadow: 0 1px 10px #000; }
.caption.swap > * { opacity: 0; transform: translateY(8px); }
.caption > * { transition: opacity .7s ease, transform .7s ease; }
.cap-cat { font-family: var(--mono); font-size: clamp(11px, 1.05vw, 20px); letter-spacing: .2em; text-transform: uppercase; color: var(--brass); }
.cap-text { font-family: var(--serif); font-size: clamp(22px, 2.9vw, 60px); line-height: 1.12; max-width: 30em; margin-top: .25em; text-wrap: balance; text-shadow: 0 2px 18px #000a; }
.cap-meta { font-family: var(--mono); font-size: clamp(12px, 1.25vw, 24px); letter-spacing: .08em; margin-top: .7em; opacity: .85; }
.cap-meta .dot { margin: 0 .7em; opacity: .5; }
.counter { position: absolute; right: 4.2vw; bottom: 4.6vh; font-family: var(--mono); font-size: clamp(11px, 1vw, 18px); letter-spacing: .1em; opacity: .5; pointer-events: none; }
.show.nocap .counter { opacity: 0; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #ffffff14; }
.progress i { display: block; height: 100%; width: 0; background: var(--brass); }

/* титульные карточки глав */
.card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6vw; background: radial-gradient(ellipse at 50% 40%, #1e2f3f 0%, #0d151d 70%); opacity: 0; pointer-events: none; transition: opacity 1.4s ease; }
.card.on { opacity: 1; }
.card .k { font-family: var(--mono); font-size: clamp(12px, 1.3vw, 24px); letter-spacing: .3em; text-transform: uppercase; color: var(--brass); }
.card .t { font-family: var(--serif); font-size: clamp(44px, 8.4vw, 170px); line-height: 1; margin: .22em 0 .2em; }
.card .s { font-size: clamp(16px, 1.9vw, 38px); opacity: .8; max-width: 26em; text-wrap: balance; }
.card .rule { width: 12vw; height: 1px; background: var(--brass); margin: 2.4vh auto; opacity: .7; }
.card.xmas { background: radial-gradient(ellipse at 50% 35%, #25405a 0%, #0b131b 72%); }
.card.xmas .t { font-style: italic; font-size: clamp(40px, 7vw, 140px); }
.card.xmas .greet { font-family: var(--serif); font-size: clamp(18px, 2.5vw, 48px); line-height: 1.5; opacity: .9; }
.card.xmas .star { font-size: clamp(30px, 4vw, 80px); color: var(--brass); line-height: 1; }

.snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 1.2s; }
.show.snowing .snow { opacity: 1; }

.mhint { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); padding: 8px 16px; background: #0d151dd9; border: 1px solid #ffffff26; border-radius: 99px; font-family: var(--mono); font-size: clamp(12px, 1vw, 18px); letter-spacing: .06em; opacity: 0; pointer-events: none; transition: opacity .6s; white-space: nowrap; }
.mhint.on { opacity: .92; }

.controls { position: absolute; top: 18px; right: 18px; display: flex; align-items: center; gap: 4px; padding: 6px; background: #0d151dcc; backdrop-filter: blur(8px); border: 1px solid #ffffff1f; border-radius: 6px; transition: opacity .4s; }
.show.idle .controls { opacity: 0; pointer-events: none; }
.controls button { width: 40px; height: 38px; background: none; border: 0; border-radius: 4px; font-size: 18px; cursor: pointer; }
.controls button:hover, .controls button.on { background: #ffffff1f; }
.controls button.on { color: var(--brass); }
.controls select { height: 38px; background: #0d151d; border: 1px solid #ffffff26; border-radius: 4px; padding: 0 8px; font-size: 13px; cursor: pointer; }
.controls .sep { width: 1px; height: 22px; background: #ffffff26; margin: 0 4px; }
.controls :focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
@media (max-width: 640px) { .controls { left: 8px; right: 8px; top: 8px; justify-content: space-between; } .controls select { max-width: 92px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .layer.fg img.kb { animation: none; }
  .tile img { transition: none; }
}

/* ═══ режим Admin: правка подписей ═══ */
footer .credits { margin-top: 10px; font-size: 13px; opacity: .8; }
.admin-only { display: none !important; }
body.admin .admin-only { display: inline-block !important; }
body.admin .tile.edited::after { content: "✎"; position: absolute; left: 8px; top: 8px; background: var(--brass); color: var(--ink); font-size: 12px; padding: 1px 6px; border-radius: 99px; }
.adminbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 20px; background: #0d151df2; border-top: 1px solid var(--brass); font-size: 14px; }
.adminbar[hidden] { display: none; }
.adminbar b { font-family: var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--brass); font-weight: 500; }
.adminbar .grow { flex: 1; }
.adminbar button, .editor button { border: 1px solid #ffffff3a; background: none; border-radius: 3px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.adminbar button:hover, .editor button:hover { border-color: var(--brass); color: var(--brass); }
.editor { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, 92vw); z-index: 5; display: flex; flex-direction: column; gap: 14px; padding: 24px; background: #0d151df5; border: 1px solid #ffffff2e; border-radius: 8px; box-shadow: 0 30px 80px #000c; }
.editor[hidden] { display: none; }
.editor h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; }
.editor h3 small { font-family: var(--mono); font-size: 12px; opacity: .6; margin-left: 8px; }
.editor label { display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .95; flex: 1; }
.editor textarea, .editor input { font: 17px/1.4 var(--sans); letter-spacing: 0; text-transform: none; color: #fff; background: #16222e; border: 1px solid #ffffff33; border-radius: 4px; padding: 9px 11px; resize: vertical; }
.editor textarea:focus, .editor input:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: transparent; }
.editor .row { display: flex; gap: 12px; flex-wrap: wrap; }
.editor .btns { margin-top: 4px; }
.editor button.primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.editor button.primary:hover { background: #fff; color: var(--ink); }
