/* ---------- tokens ---------- */
:root {
  --bg: #f3efe7;
  --bg-2: #e9e3d8;
  --ink: #1f1b16;
  --muted: #6e665a;
  --line: #d8d0c2;
  --accent: #8b5a2b;
  --bar: rgba(243, 239, 231, .86);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gap: 8px;
  --pad: 16px;
  --radius: 4px;
  --bar-h: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151310; --bg-2: #1e1b17; --ink: #ece6dc; --muted: #a39a8c;
    --line: #34302a; --accent: #d4a373; --bar: rgba(21, 19, 16, .86);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151310; --bg-2: #1e1b17; --ink: #ece6dc; --muted: #a39a8c;
  --line: #34302a; --accent: #d4a373; --bar: rgba(21, 19, 16, .86);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 52px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.lb-open { overflow: hidden; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(var(--pad), env(safe-area-inset-left)) 0 max(var(--pad), env(safe-area-inset-left));
  background: var(--bar);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.brand { font: 600 24px/1 var(--serif); letter-spacing: .02em; }
.view-btn {
  width: 44px; height: 44px; margin-right: -10px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%; cursor: pointer;
}
.view-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.view-btn .i-single, .single .view-btn .i-grid { display: none; }
.single .view-btn .i-single { display: block; }

/* ---------- hero ---------- */
.hero { padding: 28px var(--pad) 22px; }
.eyebrow {
  margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent);
}
.hero h1 { margin: 0; font: 500 clamp(56px, 18vw, 120px)/.9 var(--serif); letter-spacing: -.01em; }
.lead { margin: 10px 0 0; font: italic 500 22px/1.25 var(--serif); color: var(--muted); }
.meta { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- cover cards (index of cycles) ---------- */
.covers {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap);
  padding: 0 var(--pad) 28px;
}
.cover {
  position: relative; overflow: hidden; border-radius: var(--radius);
  aspect-ratio: 4 / 5; background: var(--bg-2);
}
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10, 8, 6, .78) 0%, rgba(10, 8, 6, .1) 55%, transparent 75%);
}
.cover-txt {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 10px 12px 12px; color: #fff; display: flex; flex-direction: column;
}
.cover-no { font-size: 11px; letter-spacing: .14em; opacity: .75; }
.cover-title { font: 600 clamp(17px, 5vw, 21px)/1.1 var(--serif); margin-top: 2px; text-wrap: balance; }
.cover-n { font-size: 12px; opacity: .8; margin-top: 4px; }
@media (hover: hover) { .cover:hover img { transform: scale(1.04); } }

/* ---------- sticky chips ---------- */
.chips {
  position: sticky; top: var(--bar-h); z-index: 19;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.chips-in {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 8px var(--pad);
  scroll-snap-type: x proximity;
}
.chips-in::-webkit-scrollbar { display: none; }
.chips a {
  flex: none; scroll-snap-align: start;
  padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line); color: var(--muted);
  transition: background .2s, color .2s, border-color .2s;
}
.chips a.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- cycle sections ---------- */
.cykl { padding: 30px var(--pad) 8px; }
.cykl-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 10px;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.cykl-no { font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--accent); }
.cykl h2 { margin: 0; font: 600 28px/1.05 var(--serif); }
.cykl-n { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* masonry by CSS columns – keeps real proportions of every work */
.grid { columns: 2; column-gap: var(--gap); }
.tile {
  display: block; margin-bottom: var(--gap); break-inside: avoid;
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-2); aspect-ratio: var(--ar);
  cursor: zoom-in; -webkit-tap-highlight-color: transparent;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, opacity .4s; }
.tile:active img { transform: scale(.98); }
@media (hover: hover) { .tile:hover img { transform: scale(1.025); } }

/* single-column "reading" view */
.single .grid { columns: 1; }
.single .tile { margin-bottom: 14px; }

@media (min-width: 700px) {
  :root { --pad: 28px; --gap: 12px; }
  .covers { grid-template-columns: repeat(3, 1fr); }
  .grid { columns: 3; }
  .single .grid { columns: 1; max-width: 720px; margin: 0 auto; }
}
@media (min-width: 1100px) {
  :root { --pad: 48px; }
  main, .foot { max-width: 1400px; margin: 0 auto; }
  .covers { grid-template-columns: repeat(6, 1fr); }
  .cover { aspect-ratio: 3 / 4; }
  .grid { columns: 4; }
}

/* ---------- footer ---------- */
.foot {
  padding: 40px var(--pad) 48px; text-align: center; color: var(--muted); font-size: 13px;
}
.foot p { margin: 14px 0 0; }
.up {
  display: inline-block; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink);
}

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 100; color: #f2ede4; touch-action: none; }
.lb[hidden] { display: none; }
.lb-bg { position: absolute; inset: 0; background: #0b0a09; transition: opacity .25s; }
.lb-stage { position: absolute; inset: 0; overflow: hidden; }
.lb-track { display: flex; height: 100%; transform: translate3d(-100%, 0, 0); will-change: transform; }
.lb-track.anim { transition: transform .32s cubic-bezier(.2, .7, .2, 1); }
.lb-slide {
  flex: 0 0 100%; height: 100%; margin: 0;
  display: grid; place-items: center;
  padding: calc(56px + env(safe-area-inset-top)) 8px calc(40px + env(safe-area-inset-bottom));
}
.lb-slide img {
  max-width: none; flex: none; user-select: none; -webkit-user-drag: none;
  transform-origin: 0 0; will-change: transform;
}
.lb-slide img.anim { transition: transform .28s ease; }

.lb-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(6px + env(safe-area-inset-top)) 6px 6px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
  transition: opacity .25s;
}
.lb-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.lb-title { font: 600 18px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-count { font-size: 12px; opacity: .7; }
.lb-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: rgba(20, 18, 16, .45); border: 0; border-radius: 50%; cursor: pointer; color: inherit;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { background: transparent; }
.lb-nav { position: absolute; top: 50%; margin-top: -22px; display: none; transition: opacity .25s; }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-nav:disabled { opacity: .25; cursor: default; }
@media (hover: hover) and (pointer: fine) { .lb-nav { display: grid; } }

.lb-dots {
  position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 6px; transition: opacity .25s;
}
.lb-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .3; transition: opacity .2s, transform .2s; }
.lb-dots i.on { opacity: 1; transform: scale(1.25); }
.lb-hint {
  position: absolute; left: 16px; right: 16px; bottom: calc(34px + env(safe-area-inset-bottom));
  margin: 0; text-align: center; font-size: 12px; opacity: 0; pointer-events: none;
  transition: opacity .4s;
}
.lb-hint.show { opacity: .75; }
.lb.ui-off .lb-top, .lb.ui-off .lb-dots, .lb.ui-off .lb-nav, .lb.zoomed .lb-dots { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lb-track.anim, .lb-slide img.anim, .tile img, .cover img { transition: none; }
}
