/* Sergey Khakhlev — dark, cinematic. Mobile-first. */
:root {
  --bg: #0a0a0b;
  --bg2: #141416;
  --line: #26262a;
  --text: #ececea;
  --muted: #8f8d88;
  --accent: #e9c98a;      /* warm champagne */
  --heart: #ff5a6a;
  --maxw: 1400px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font-family: "Helvetica Neue", Arial, sans-serif; font-weight: 300; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* nav */
.nav { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: rgba(10,10,11,0.7); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { font-size: 14px; letter-spacing: 0.32em; text-transform: uppercase; font-weight: 400; }
.brand b { font-weight: 600; }
.nav .navlink { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }

/* hero (landing) */
.hero { min-height: 82vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 22px; }
.hero h1 { font-size: 34px; letter-spacing: 0.34em; text-transform: uppercase; font-weight: 300; margin: 0; }
.hero .role { margin-top: 18px; color: var(--muted); font-size: 12px; letter-spacing: 0.4em; text-transform: uppercase; }
.hero .accent { color: var(--accent); }

/* section heading */
.sect { max-width: var(--maxw); margin: 0 auto; padding: 30px 20px 70px; }
.sect h2 { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); font-weight: 400; margin: 0 0 22px; }

/* gallery cards grid (landing list of galleries) */
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.card { position: relative; overflow: hidden; border-radius: 4px; background: var(--bg2); aspect-ratio: 3/2; }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1), opacity .4s; opacity: .92; }
.card:hover img { transform: scale(1.04); opacity: 1; }
.card .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 18px 16px;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent); }
.card .meta .t { font-size: 16px; letter-spacing: .04em; }
.card .meta .s { font-size: 12px; color: var(--muted); margin-top: 3px; letter-spacing: .1em; text-transform: uppercase; }

/* gallery hero cover */
.hero { position: relative; width: 100%; height: 42vh; min-height: 220px; max-height: 560px; overflow: hidden; background: var(--bg2); }
.hero img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(10,10,11,.25), rgba(10,10,11,.95)); }
.hero + .ghead { padding-top: 22px; margin-top: -70px; position: relative; z-index: 2; }

/* gallery header */
.ghead { max-width: var(--maxw); margin: 0 auto; padding: 46px 20px 24px; text-align: center; }
.ghead h1 { font-size: 26px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 300; margin: 0; }
.ghead .sub { color: var(--muted); font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; margin-top: 12px; }
.ghead .intro { color: var(--muted); max-width: 620px; margin: 18px auto 0; font-size: 15px; }
/* minimal controls: quiet text links, no pills */
.gtools { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.btn { font: inherit; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
  background: none; border: none; padding: 4px 0; cursor: pointer; transition: color .2s, border-color .2s;
  border-bottom: 1px solid transparent; }
.btn:hover { color: var(--text); border-bottom-color: var(--line); }
.btn.on { color: var(--accent); border-bottom-color: var(--accent); }

/* folders (sub-albums as clickable cards) */
.folders { max-width: var(--maxw); margin: 0 auto; padding: 6px 12px 80px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.folder .meta .s { text-transform: none; letter-spacing: .04em; }
.folderbar { max-width: var(--maxw); margin: 0 auto; padding: 4px 16px 12px; display: flex; align-items: baseline;
  justify-content: center; gap: 10px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; }
.folderbar .back { color: var(--muted); cursor: pointer; border-bottom: 1px solid transparent; }
.folderbar .back:hover { color: var(--text); border-bottom-color: var(--line); }
.folderbar .sep { color: var(--line); }
.folderbar .fname { color: var(--accent); }
@media (min-width: 700px) { .folders { grid-template-columns: 1fr 1fr 1fr; gap: 16px; padding: 10px 24px 100px; } }

/* photo grid — justified ROWS (left-to-right reading order, sizes set by justify() in JS) */
/* full-bleed: photos use the whole viewport width (headings stay centred at --maxw) */
.masonry { max-width: none; margin: 0; padding: 10px 10px 40px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
#gridwrap { padding-bottom: 60px; }
.pitem { position: relative; border-radius: 3px; overflow: hidden; background: var(--bg2); flex: 0 0 auto; }
.pitem img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .6s; cursor: zoom-in; }
.pitem img.loaded { opacity: 1; }
.pitem .heart { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.4); backdrop-filter: blur(4px);
  font-size: 17px; cursor: pointer; opacity: 0; transition: .2s; border: none; color: #fff; }
.pitem:hover .heart, .pitem .heart.fav { opacity: 1; }
.pitem .heart.fav { color: var(--heart); }
.protect img { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; pointer-events: auto; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 90; background: rgba(6,6,7,.97); display: none; align-items: center; justify-content: center; }
.lb.open { display: flex; }
.lb img { max-width: 94vw; max-height: 86vh; object-fit: contain; box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.lb .cap { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 13px; letter-spacing: .06em; padding: 0 20px; }
.lb .x { position: absolute; top: 16px; right: 20px; font-size: 26px; color: var(--muted); cursor: pointer; line-height: 1; }
.lb .arrow { position: absolute; top: 50%; transform: translateY(-50%); font-size: 34px; color: var(--muted); cursor: pointer; padding: 20px; user-select: none; }
.lb .arrow:hover, .lb .x:hover { color: var(--text); }
.lb .prev { left: 4px; } .lb .next { right: 4px; }
/* Telegram-style paging: full-height tap zones on the left/right thirds */
.lb .tapzone { position: absolute; top: 0; bottom: 0; width: 33%; z-index: 3; -webkit-tap-highlight-color: transparent; }
.lb .tzl { left: 0; } .lb .tzr { right: 0; }
.lb .x, .lb .arrow, .lb .lbtools { z-index: 5; }
.lb img { position: relative; z-index: 2; }
/* freeze the page behind an open lightbox so swiping never scrolls the grid */
body.lb-open { overflow: hidden; touch-action: none; }
.lb .lbtools { position: absolute; top: 14px; left: 20px; display: flex; gap: 14px; align-items: center; }
.lb .lbtools .h { font-size: 22px; cursor: pointer; color: #fff; }
.lb .lbtools .h.fav { color: var(--heart); }
.lb .lbtools a { color: var(--muted); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }

/* pin gate */
.pin { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.pin input { background: var(--bg2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 20px;
  letter-spacing: .3em; text-align: center; padding: 14px 18px; border-radius: 6px; margin: 20px 0 14px; width: 220px; }
.pin input:focus { outline: none; border-color: var(--accent); }

/* back-to-top */
.totop { position: fixed; right: 18px; bottom: 18px; z-index: 70; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(20,20,22,.82); backdrop-filter: blur(8px); color: var(--muted);
  font-size: 17px; cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .25s, transform .25s, color .2s, border-color .2s; }
.totop.on { opacity: 1; pointer-events: auto; transform: none; }
.totop:hover { color: var(--accent); border-color: var(--accent); }
@media (min-width: 700px) { .totop { right: 26px; bottom: 26px; } }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 40px 20px; text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.foot a { color: var(--muted); } .foot a:hover { color: var(--accent); }

.center-note { text-align: center; color: var(--muted); padding: 80px 20px; letter-spacing: .1em; }

@media (min-width: 700px) {
  .hero h1 { font-size: 52px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 18px; }
  .masonry { padding: 14px 14px 90px; }
  .ghead h1 { font-size: 34px; }
}
@media (min-width: 1080px) {
  .cards { grid-template-columns: 1fr 1fr 1fr; }
  .hero h1 { font-size: 64px; }
}
