/* Markus, Melike & Co. — photo journal */

/* ------------------------------------------------------------------ tokens */

:root {
  --paper: #f6f3ee;
  --surface: #fffdf9;
  --ink: #1c1a17;
  --ink-2: #57524a;
  --muted: #958f85;
  --line: rgb(28 26 23 / .1);
  --line-strong: rgb(28 26 23 / .18);
  --glass: rgb(255 253 249 / .72);
  --placeholder: #e5dfd5;
  --danger: #b4432f;
  --shadow-sm: 0 1px 2px rgb(30 20 10 / .06), 0 2px 8px -2px rgb(30 20 10 / .08);
  --shadow-photo: 0 1px 1px rgb(30 20 10 / .05), 0 18px 40px -22px rgb(30 20 10 / .45);
  --shadow-lift: 0 2px 4px rgb(30 20 10 / .08), 0 30px 60px -24px rgb(30 20 10 / .5);

  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --wide: 1440px;
  --bar-h: 64px;
  --ease: cubic-bezier(.2, .75, .2, 1);
  --r-photo: 2px;
  color-scheme: light;
}

/* Dark mode: follows the device unless the theme button set data-theme
   (light/dark) on <html>. The dark tokens are listed twice – once for each case. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #121110;
    --surface: #1b1a18;
    --ink: #efebe4;
    --ink-2: #b9b2a7;
    --muted: #7f796f;
    --line: rgb(255 250 240 / .09);
    --line-strong: rgb(255 250 240 / .18);
    --glass: rgb(24 23 21 / .7);
    --placeholder: #26241f;
    --danger: #e0715b;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-photo: 0 18px 40px -22px rgb(0 0 0 / .8);
    --shadow-lift: 0 30px 60px -24px rgb(0 0 0 / .9);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #121110;
  --surface: #1b1a18;
  --ink: #efebe4;
  --ink-2: #b9b2a7;
  --muted: #7f796f;
  --line: rgb(255 250 240 / .09);
  --line-strong: rgb(255 250 240 / .18);
  --glass: rgb(24 23 21 / .7);
  --placeholder: #26241f;
  --danger: #e0715b;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-photo: 0 18px 40px -22px rgb(0 0 0 / .8);
  --shadow-lift: 0 30px 60px -24px rgb(0 0 0 / .9);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--bar-h);
  /* Keep the scrollbar's space when scrolling is locked (lightbox, dialogs):
     otherwise the page widens and every gallery re-layouts (see lockScroll) */
  scrollbar-gutter: stable;
}
html.no-scroll { overflow: hidden; }
/* The kept scrollbar strip (desktop) matches what covers the page */
html.no-scroll[data-lock='dark'] { background: #0b0a09; }
html.no-scroll[data-lock='dim'] { background: color-mix(in srgb, var(--paper) 58%, rgb(20 18 15)); }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.6 var(--sans);
  letter-spacing: -.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--ink) 85%, transparent); color: var(--paper); }

:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ink) 70%, transparent);
  outline-offset: 3px;
  border-radius: 4px;
}

.icon { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.icon svg, .btn svg {
  width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  --btn-bg: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--btn-bg);
  font-size: 13px; font-weight: 500; letter-spacing: .02em;
  text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: background .25s var(--ease), border-color .25s, color .25s, transform .2s var(--ease), box-shadow .25s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn svg { width: 15px; height: 15px; stroke-width: 2; }
.btn-solid { --btn-bg: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
.btn-solid:hover:not(:disabled) { --btn-bg: color-mix(in srgb, var(--ink) 86%, var(--paper)); }
.btn-ghost { border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-quiet { color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); --btn-bg: var(--line); }
.btn-danger { --btn-bg: var(--danger); color: #fff; }
.btn-danger:hover { --btn-bg: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-wide { width: 100%; height: 44px; margin-top: 8px; }

.round-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink);
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s, color .2s, opacity .2s, border-color .2s;
}
.round-btn:hover:not(:disabled) { transform: scale(1.06); border-color: var(--line-strong); }
.round-btn:disabled { opacity: .3; cursor: default; }
.round-btn.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: var(--shadow-sm);
}
.round-btn.danger:hover { color: var(--danger); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px 0 10px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px; cursor: pointer;
  transition: border-color .2s, transform .2s var(--ease);
}
.chip:hover { border-color: var(--ink); transform: translateY(-1px); }
.chip .icon { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ top bar */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--bar-h);
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  transition: background .35s var(--ease), box-shadow .35s;
}
.topbar.scrolled {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: 0 1px 0 var(--line);
}
.brand {
  min-width: 0; /* lets the title shorten with … instead of pushing the buttons off-screen */
  font: 500 23px/1 var(--serif);
  letter-spacing: .005em;
  text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
body.masthead-visible .brand { opacity: 0; transform: translateY(6px); pointer-events: none; }
.actions { display: flex; align-items: center; gap: 8px; flex: none; }

.btn-compact .compact-only { display: none; }

/* Light / dark switch */
.theme-toggle { background: transparent; color: var(--ink-2); }
.theme-toggle:hover:not(:disabled) { color: var(--ink); }
.theme-toggle .icon { width: 17px; height: 17px; transition: transform .5s var(--ease); }
.theme-toggle:active .icon { transform: rotate(-30deg) scale(.9); }
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  /* colours change at once, not each with its own transition */
  transition: none !important;
}

/* ------------------------------------------------------------------ masthead */

main {
  flex: 1;
  width: 100%;
  padding: 0 var(--gutter);
  /* Full-bleed bands (100vw) must never widen the page. `hidden` instead of
     `clip`: clip needs iOS 16+, and main holds nothing sticky. */
  overflow-x: hidden;
}

.masthead {
  text-align: center;
  padding: clamp(48px, 10vw, 128px) 0 clamp(72px, 11vw, 150px);
  animation: rise 1.2s var(--ease) both;
}
.masthead-title {
  margin: 0;
  font: 400 clamp(46px, 9.5vw, 132px)/.95 var(--serif);
  letter-spacing: -.02em;
  text-wrap: balance;
}
.masthead-tagline {
  display: flex; align-items: center; justify-content: center;
  margin: clamp(18px, 2.4vw, 30px) 0 0;
  font-size: 11.5px; font-weight: 500;
  letter-spacing: .32em; text-transform: uppercase;
  color: var(--muted);
}
.masthead-tagline:empty { display: none; }
.masthead-tagline::before, .masthead-tagline::after {
  content: ''; flex: none;
  width: clamp(16px, 4vw, 34px); height: 1px; margin: 0 clamp(10px, 2vw, 16px);
  background: var(--line-strong);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

#view { transition: opacity .3s var(--ease); }
#view.loading { opacity: .35; }

.page-label, .back-link {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: clamp(32px, 6vw, 72px) auto;
  font-size: 11.5px; font-weight: 500; letter-spacing: .26em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
}
.back-link { width: fit-content; transition: color .2s; }
.back-link:hover { color: var(--ink); }
.back-link .icon { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ post */

.post {
  position: relative;
  max-width: var(--wide);
  margin: 0 auto;
}
.post + .post { margin-top: clamp(120px, 15vw, 220px); }
/* Section break between posts (and after the last one): three small dots,
   as in a printed magazine */
.post + .post::before, .post:last-of-type::after {
  content: '';
  position: absolute; left: 50%; top: calc(clamp(120px, 15vw, 220px) / -2);
  width: 4px; height: 4px; margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: -18px 0 0 var(--muted), 18px 0 0 var(--muted);
  opacity: .55;
}
.post:last-of-type::after { top: auto; bottom: calc(clamp(120px, 15vw, 220px) / -2); }
/* Room for those dots inside <main> (which clips its overflow) */
.post:last-of-type { margin-bottom: calc(clamp(120px, 15vw, 220px) / 2 + 24px); }

.post-head {
  max-width: 760px;
  margin: 0 auto clamp(36px, 5.5vw, 72px);
  text-align: center;
}
.post-meta {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 0 0 18px;
  font-size: 11px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase;
  color: var(--muted);
}
.post-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .7; }
.post-title {
  margin: 0;
  font: 400 clamp(36px, 5.6vw, 72px)/1.02 var(--serif);
  letter-spacing: -.015em;
  text-wrap: balance;
}
.post-title a { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .5s var(--ease); }
.post-title a:hover { background-size: 100% 1px; }
.post-desc {
  max-width: 560px;
  margin: 18px auto 0;
  font: italic 400 clamp(19px, 2vw, 23px)/1.45 var(--serif);
  color: var(--ink-2);
  text-wrap: pretty;
}
.post-rule {
  display: block;
  width: 44px; height: 2px; margin: 26px auto 0;
  border-radius: 2px;
  background: var(--accent);
  opacity: .85;
}

.post-tools {
  position: absolute; top: 0; right: 0; z-index: 5;
  display: flex; gap: 8px;
}
.post-tools .icon { width: 16px; height: 16px; }


/* ------------------------------------------------------------------ photo tile */

.ph {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--r-photo);
  background: var(--ph-color, var(--placeholder));
  cursor: zoom-in;
  isolation: isolate;
  /* Safari does not always clip blurred/transformed children with overflow alone */
  clip-path: inset(0 round var(--r-photo));
  -webkit-tap-highlight-color: transparent;
}
.ph-blur {
  position: absolute; inset: -12%;
  background-size: cover; background-position: center;
  filter: blur(18px) saturate(1.15);
  transform: scale(1.05);
}
.ph img {
  position: relative;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 30%;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity .9s var(--ease), transform 1.4s var(--ease), filter .6s;
}
.ph img.loaded { opacity: 1; transform: none; }
.ph img.failed { opacity: 0; }

/* Glossy light sweep on hover */
.ph::after {
  content: '';
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(110deg, transparent 35%, rgb(255 255 255 / .22) 50%, transparent 65%);
  transform: translateX(-110%);
  pointer-events: none;
}
@media (hover: hover) {
  .ph:hover img.loaded { transform: scale(1.035); }
  .ph:hover::after { transform: translateX(110%); transition: transform 1.1s var(--ease); }
}
.ph:focus-visible { outline-offset: 4px; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1.1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ layout: Flow (justified rows) */

.g-row { display: flex; justify-content: center; }
.g-row:last-child { margin-bottom: 0 !important; }
.g-justified .ph { flex: none; }

/* ------------------------------------------------------------------ layout: Mosaic */

.g-mosaic { position: relative; }
.g-mosaic .ph { position: absolute; }

/* ------------------------------------------------------------------ layout: Masonry */

.g-masonry { display: flex; gap: clamp(10px, 1.4vw, 20px); align-items: flex-start; }
.g-masonry.is-single { max-width: 720px; margin: 0 auto; }
.g-masonry-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: clamp(10px, 1.4vw, 20px); }
.g-masonry .ph { aspect-ratio: var(--ar); box-shadow: var(--shadow-photo); }
/* ------------------------------------------------------------------ layout: Editorial */

.g-editorial {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(12px, 2vw, 32px);
  row-gap: clamp(48px, 7vw, 120px);
  align-items: start;
}
.g-editorial .ph { aspect-ratio: var(--ar); overflow: visible; background: none; clip-path: none; }
.g-editorial .ph img, .g-editorial .ph-blur { border-radius: var(--r-photo); }
.g-editorial .ph::after { display: none; }
.g-editorial .ph-blur { inset: 0; overflow: hidden; clip-path: inset(0 round var(--r-photo)); transform: none; filter: blur(14px); }
.g-editorial .ph img { box-shadow: var(--shadow-photo); }
.ed-0 { grid-column: 1 / span 6; }
.ed-1 { grid-column: 8 / span 4; align-self: end; }
.ed-2 { grid-column: 2 / span 4; }
.ed-3 { grid-column: 7 / span 5; margin-top: clamp(40px, 9vw, 140px); }
.ed-4 { grid-column: 4 / span 6; }
.ed-solo { grid-column: 3 / span 8; }
.ed-num {
  position: absolute; left: 0; top: calc(100% + 12px);
  font: italic 400 15px/1 var(--serif);
  color: var(--muted);
  letter-spacing: .04em;
}
.ed-1 .ed-num, .ed-3 .ed-num { left: auto; right: 0; }

/* ------------------------------------------------------------------ layout: Cinematic */

.bleed { width: 100vw; margin-left: calc(50% - 50vw); }

.cine-hero {
  position: relative;
  display: grid; place-items: center;
  padding: clamp(28px, 6vw, 96px) var(--gutter);
  overflow: hidden;
  background: #1a1815;
}
.cine-ambient {
  position: absolute; inset: -80px;
  background-size: cover; background-position: center;
  filter: blur(60px) saturate(1.5) brightness(.72);
  transform: scale(1.15);
}
.cine-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgb(0 0 0 / .35));
  pointer-events: none;
}
.cine-main {
  z-index: 1;
  width: min(100%, calc(80vh * var(--ar)));
  aspect-ratio: var(--ar);
  box-shadow: 0 40px 90px -30px rgb(0 0 0 / .75), 0 0 0 1px rgb(255 255 255 / .06);
}
.cine-grid {
  --g: clamp(8px, 1.2vw, 16px);
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--g);
  max-width: calc(var(--cols) * 460px);
  margin: clamp(14px, 2vw, 24px) auto 0;
}
/* Incomplete last rows are centred instead of leaving a hole. */
.cine-grid .ph { width: calc((100% - (var(--cols) - 1) * var(--g)) / var(--cols)); aspect-ratio: 4 / 5; }

/* ------------------------------------------------------------------ layout: Filmstrip */

.fs-track {
  display: flex; gap: clamp(8px, 1.2vw, 16px);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding: 0 var(--gutter);
  padding: 8px var(--gutter) 28px;
  scrollbar-width: none;
  cursor: grab;
}
.fs-track::-webkit-scrollbar { display: none; }
.fs-track.dragging { cursor: grabbing; scroll-snap-type: none; }
.fs-track.dragging .ph { pointer-events: none; }
.fs-track .ph {
  flex: none;
  height: clamp(300px, 68vh, 720px);
  aspect-ratio: var(--ar);
  scroll-snap-align: start;
  box-shadow: var(--shadow-photo);
}
.fs-end { flex: none; width: 1px; }
.fs-controls {
  display: flex; align-items: center; gap: 10px;
  max-width: var(--wide); margin: 4px auto 0;
}
.fs-progress { flex: 1; height: 1px; background: var(--line-strong); overflow: hidden; margin-right: 12px; }
.fs-progress span {
  display: block; height: 100%;
  background: var(--ink);
  transform-origin: left; transform: scaleX(.04);
  transition: transform .25s linear;
}
.fs-controls .round-btn .icon { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ layout: Scrapbook */

.g-scrapbook {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: clamp(12px, 2.4vw, 36px) clamp(8px, 1.6vw, 24px);
  padding: clamp(8px, 2vw, 32px) 0;
}
.print {
  --pad: clamp(7px, .9vw, 13px);
  position: relative;
  padding: var(--pad) var(--pad) calc(var(--pad) * 3.6);
  background: #fbf9f4;
  border-radius: 1px;
  box-shadow: 0 1px 1px rgb(0 0 0 / .06), 0 14px 30px -14px rgb(40 25 10 / .45);
  transform: translateY(var(--dy)) rotate(var(--rot));
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.print-p { width: clamp(150px, 21vw, 290px); }
.print-l { width: clamp(220px, 31vw, 420px); }
.print .ph { aspect-ratio: var(--ar); border-radius: 0; }
.print .ph::before {
  /* subtle gloss on the print surface */
  content: '';
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(135deg, rgb(255 255 255 / .2), transparent 40%);
  pointer-events: none;
}
@media (hover: hover) {
  .print:hover {
    z-index: 3;
    transform: translateY(calc(var(--dy) - 8px)) rotate(0deg) scale(1.05);
    box-shadow: 0 2px 4px rgb(0 0 0 / .08), 0 40px 70px -26px rgb(40 25 10 / .55);
  }
  .print .ph:hover img.loaded { transform: none; }
}

/* ------------------------------------------------------------------ layout: Gallery Noir */

.post.layout-noir {
  --ink: #f2eee8;
  --ink-2: #b8b1a6;
  --muted: #8a847a;
  --line: rgb(255 255 255 / .1);
  --line-strong: rgb(255 255 255 / .2);
  --glass: rgb(30 29 27 / .7);
  --surface: #1e1d1b;
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  padding: clamp(64px, 10vw, 150px) var(--gutter);
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgb(255 245 230 / .07), transparent 70%),
    #0d0d0c;
  color: var(--ink);
}
.post.layout-noir .post-tools { top: 24px; right: var(--gutter); }
.post.layout-noir .post-rule { background: var(--ink); opacity: .5; }

.g-noir { display: flex; flex-direction: column; align-items: center; gap: clamp(48px, 8vw, 120px); max-width: 1240px; margin: 0 auto; }
.noir-row { display: flex; justify-content: center; gap: clamp(16px, 3vw, 48px); width: 100%; }
.noir-single .ph { width: min(100%, calc(78vh * var(--ar))); aspect-ratio: var(--ar); }
.noir-pair .ph { flex: var(--ar) 1 0; aspect-ratio: var(--ar); min-width: 0; }
.g-noir .ph { box-shadow: 0 40px 80px -30px rgb(0 0 0 / .9), 0 0 0 1px rgb(255 255 255 / .05); }

/* ------------------------------------------------------------------ pager / empty */

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: var(--wide);
  margin: clamp(32px, 5vw, 64px) auto 0; /* the last post already leaves room for its dots */
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
}
.pager-numbers { display: flex; gap: 4px; }
.pager-link, .pager-gap {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: 999px; text-decoration: none;
  color: var(--ink-2);
  transition: background .2s, color .2s;
}
.pager-link:hover { background: var(--line); color: var(--ink); }
.pager-link[aria-current] { background: var(--ink); color: var(--paper); }
.pager-step { padding: 0 14px; }
.pager-step.disabled { color: var(--muted); opacity: .45; }

.empty { text-align: center; padding: 48px 0 96px; color: var(--ink-2); }
.empty-title { font: italic 400 30px/1.2 var(--serif); color: var(--ink); margin: 0 0 18px; }
.empty .btn { margin-top: 8px; }

.import-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  max-width: var(--wide);
  margin: 0 auto clamp(48px, 7vw, 96px);
  padding: 18px 22px;
  border: 1px dashed var(--line-strong); border-radius: 14px;
  background: var(--surface);
  animation: rise .8s var(--ease) both;
}
.import-banner strong { display: block; font-weight: 600; }
.import-banner span { color: var(--ink-2); font-size: 14px; }
.import-list { display: flex; flex-wrap: wrap; gap: 8px; }

.footer {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: clamp(40px, 6vw, 80px) var(--gutter) 40px;
  text-align: center;
  font: italic 400 17px/1 var(--serif);
  color: var(--muted);
}
.footer-link {
  font: 500 11px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  transition: color .2s;
}
.footer-link:hover { color: var(--ink); }

/* ------------------------------------------------------------------ statistics (admin) */

.stats { max-width: 1120px; margin: clamp(24px, 5vw, 56px) auto 0; }
.st-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.st-title { margin: 0; font: 400 clamp(36px, 5vw, 56px)/1 var(--serif); letter-spacing: -.01em; }
.st-periods { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.st-period {
  height: 32px; padding: 0 14px; border: 0; border-radius: 999px;
  background: none; color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.st-period[aria-selected='true'] { background: var(--ink); color: var(--paper); }
.st-body { transition: opacity .25s; }
.st-body.loading { opacity: .4; }

.st-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.st-tile, .st-card {
  padding: 20px 22px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface);
}
.st-tile { display: flex; flex-direction: column; gap: 6px; }
.st-tile-label { font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--ink-2); }
.st-tile-value { font: 400 40px/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.st-tile-note { font-size: 12px; color: var(--muted); }

.st-card { margin-bottom: 12px; }
.st-card-title { margin: 0 0 16px; font-size: 13px; font-weight: 600; color: var(--ink); }

.st-plot { display: flex; gap: 10px; height: 220px; }
.st-axis {
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums;
  transform: translateY(-.5em); min-width: 2.5em;
}
.st-axis span:last-child { transform: translateY(.5em); }
.st-area { position: relative; flex: 1; min-width: 0; }
.st-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.st-grid span { border-top: 1px solid var(--line); }
.st-grid span:last-child { border-top-color: var(--line-strong); }
.st-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.st-bar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; outline: none; }
.st-bar-fill {
  display: block; width: 100%; min-height: 0;
  border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--ink) 72%, transparent);
  transition: background .15s;
}
.st-bar:not(.on):has(.st-bar-fill[style*='height: 0%'])::after {
  /* zero days: a hairline on the baseline so the time axis stays readable */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line-strong);
}
.st-bar.on .st-bar-fill, .st-bar:focus-visible .st-bar-fill { background: var(--ink); }
.st-tip {
  position: absolute; top: -8px; transform: translate(-50%, -100%); z-index: 2;
  display: flex; flex-direction: column; gap: 2px; white-space: nowrap;
  padding: 8px 12px; border-radius: 10px;
  background: var(--ink); color: var(--paper);
  font-size: 12px; pointer-events: none;
  box-shadow: 0 8px 24px -8px rgb(0 0 0 / .35);
}
.st-xlabels { display: flex; justify-content: space-between; margin: 8px 0 0 calc(2.5em + 10px); font-size: 11px; color: var(--muted); }

.st-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.st-cols .st-card { margin-bottom: 0; }
.st-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.st-rank li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13.5px; }
.st-rank-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-rank-name a { color: inherit; text-decoration: none; }
.st-rank-name a:hover { text-decoration: underline; }
.st-rank-value { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.st-rank-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.st-rank-bar span { display: block; height: 100%; border-radius: 4px; background: color-mix(in srgb, var(--ink) 72%, transparent); }
.st-empty { margin: 0; color: var(--muted); font-size: 13.5px; }
.st-note { margin: 20px 0 0; font-size: 12.5px; color: var(--muted); }
.st-note a { color: inherit; }

@media (max-width: 860px) {
  .st-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-cols { grid-template-columns: minmax(0, 1fr); }
  .st-tile-value { font-size: 32px; }
  .st-plot { height: 180px; }
}

.noscript { text-align: center; padding: 40px; }

/* ------------------------------------------------------------------ toasts */

.toasts {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 300;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  max-width: min(92vw, 460px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 12px 30px -10px rgb(0 0 0 / .4);
  opacity: 0; transform: translateY(12px) scale(.98);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--danger); color: #fff; }

/* ------------------------------------------------------------------ modals */

.modal {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0; border-radius: 20px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 40px 100px -30px rgb(0 0 0 / .5), 0 0 0 1px var(--line);
  animation: modal-in .45s var(--ease) both;
}
.modal::backdrop {
  background: rgb(20 18 15 / .42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fade-in .3s ease both;
}
.modal.closing { animation: modal-out .22s ease both; }
.modal.closing::backdrop { animation: fade-in .22s ease reverse both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.99); } }
@keyframes fade-in { from { opacity: 0; } }

.modal-small > * { padding: 32px; }
.modal-title { margin: 0 0 8px; font: 400 34px/1.1 var(--serif); letter-spacing: -.01em; }
.modal-text { margin: 0 0 24px; color: var(--ink-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.eyebrow {
  margin: 0 0 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase;
  color: var(--muted);
}

.field { display: block; margin-bottom: 18px; }
.field-label {
  display: flex; justify-content: space-between;
  margin-bottom: 7px;
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
  color: var(--ink-2);
}
.field-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.field-input {
  width: 100%;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--paper);
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--line); background: var(--surface); }
.field-input.invalid { border-color: var(--danger); }
textarea.field-input { resize: vertical; min-height: 72px; line-height: 1.5; }
/* iOS Safari gives date inputs a fixed minimum width that ignores width: 100% */
input[type='date'].field-input { -webkit-appearance: none; appearance: none; min-height: 46px; text-align: left; }
input[type='date'].field-input::-webkit-date-and-time-value { text-align: left; }
.field-title { font: 400 26px/1.2 var(--serif); padding: 10px 14px; }
.form-error { min-height: 1.4em; margin: -6px 0 6px; color: var(--danger); font-size: 13.5px; }

.shake { animation: shake .45s var(--ease); }
@keyframes shake {
  20% { transform: translateX(-8px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(2px); }
}

/* ------------------------------------------------------------------ editor */

/* Only .editor-body scrolls – the dialog itself never does */
.modal-editor { width: min(960px, calc(100vw - 32px)); height: min(900px, calc(100dvh - 32px)); overflow: hidden; }
.editor { display: flex; flex-direction: column; height: 100%; }
.editor-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 26px 32px 18px;
  border-bottom: 1px solid var(--line);
}
.editor-head .modal-title { margin: 0; }
.editor-body { flex: 1; min-height: 0; overflow: hidden auto; padding: 26px 32px 8px; overscroll-behavior: contain; }
.editor-fields { display: grid; grid-template-columns: minmax(0, 1fr) 180px; column-gap: 16px; }
.editor-fields .field:nth-child(1), .editor-fields .field:nth-child(2) { grid-column: 1 / -1; }
.editor-fields .field:nth-child(2) { grid-column: 1; }
.editor-fields .field-date { grid-column: 2; grid-row: 2; }
.editor-section { margin: 10px 0 28px; }
.section-label {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 12px;
  font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--ink-2);
}
.ed-count { color: var(--muted); font-weight: 400; }

.layout-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
@media (min-width: 900px) { .layout-picker { grid-template-columns: repeat(9, minmax(0, 1fr)); } }
.layout-option {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 6px 10px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper);
  font-size: 12px; color: var(--ink-2);
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s, transform .2s var(--ease);
}
.layout-option:hover { border-color: var(--line-strong); color: var(--ink); transform: translateY(-1px); }
.layout-option[aria-checked='true'] { border-color: var(--ink); background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.layout-option .icon { width: 30px; height: 23px; }
.layout-svg { display: block; width: 44px; height: 32px; }
.layout-svg svg { width: 100%; height: 100%; fill: currentColor; stroke: none; opacity: .75; overflow: hidden; }
.layout-option[aria-checked='true'] .layout-svg svg { opacity: 1; }
.layout-hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 30px 16px;
  border: 1.5px dashed var(--line-strong); border-radius: 14px;
  background: var(--paper);
  text-align: center; color: var(--ink-2);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.dropzone:hover, .dropzone.over { border-color: var(--ink); background: var(--surface); }
.dropzone.over { transform: scale(1.01); }
.dropzone .icon { width: 26px; height: 26px; margin-bottom: 6px; color: var(--muted); }
.dropzone strong { color: var(--ink); font-weight: 500; }
.dropzone span:last-child { font-size: 12.5px; color: var(--muted); }

.ed-photos {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px;
  margin-top: 14px;
}
.ed-photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px; overflow: hidden;
  background: var(--placeholder);
  cursor: grab;
  animation: rise .4s var(--ease) both;
}
.ed-photo img { width: 100%; height: 100%; object-fit: cover; transition: opacity .4s, filter .4s; }
.ed-photo.pending img { opacity: 0; }
.ed-photo.pending::before, .ed-photo.working::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .35) 50%, transparent 70%) 0 0 / 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.ed-photo.working img { filter: saturate(.4) brightness(.9); }
.ed-photo.broken { outline: 2px solid var(--danger); }
.ed-photo.dragging { opacity: .35; }
.ed-photo.is-new::after, .ed-photo.done::after {
  position: absolute; left: 7px; bottom: 7px; z-index: 2;
  padding: 2px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  background: rgb(0 0 0 / .55); color: #fff;
}
.ed-photo.is-new::after { content: 'New'; }
.ed-photo.done::after { content: '✓'; background: rgb(40 120 70 / .85); }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.ed-photo-tools {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  display: flex; gap: 4px;
  opacity: 0; transition: opacity .2s;
}
.ed-photo:hover .ed-photo-tools, .ed-photo:focus-within .ed-photo-tools { opacity: 1; }
@media (hover: none) { .ed-photo-tools { opacity: 1; } }
.mini-btn {
  display: grid; place-items: center;
  width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgb(255 255 255 / .88); color: #1c1a17;
  box-shadow: 0 2px 6px rgb(0 0 0 / .2);
  cursor: pointer;
}
.mini-btn .icon { width: 14px; height: 14px; }
.mini-btn:hover { background: #fff; }
.mini-danger:hover { color: var(--danger); }

.editor-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 20px;
  padding: 16px 32px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.ed-progress { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.progress-track { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress-track span {
  display: block; height: 100%;
  background: var(--ink);
  transform-origin: left; transform: scaleX(.02);
  transition: transform .3s var(--ease);
}
.progress-text { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor.busy .editor-body { pointer-events: none; }
.editor.busy .ed-photo-tools, .editor.busy .dropzone { opacity: .4; }

/* ------------------------------------------------------------------ lightbox */

.lb { position: fixed; inset: 0; z-index: 200; touch-action: none; --fade: 1; }
.lb-backdrop {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 70% at 50% 50%, color-mix(in srgb, var(--glow) 22%, transparent), transparent 75%),
    #0b0a09;
  opacity: 0;
  transition: opacity .45s var(--ease), background .6s;
}
.lb.open .lb-backdrop { opacity: var(--fade); }
.lb.closing .lb-backdrop { opacity: 0; transition-duration: .35s; }
.lb-stage { position: absolute; inset: 0; overflow: hidden; }
.lb-strip { position: absolute; inset: 0; will-change: transform; }
.lb-strip .lb-img { transition: opacity .25s ease; }
.lb-img {
  position: absolute;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / .7);
  user-select: none; -webkit-user-select: none;
  will-change: transform;
}
.lb-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px 24px;
  color: #f2eee8;
}
.lb-title { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.lb-title span:first-child { font: italic 400 20px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-counter { font-size: 12px; letter-spacing: .14em; color: rgb(242 238 232 / .6); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-tools { display: flex; gap: 8px; }
.lb .round-btn.glass {
  /* No live blur here: invisible over the dark viewer, but recalculated
     every frame while photos move – expensive on older Macs */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgb(255 255 255 / .1);
  border-color: rgb(255 255 255 / .12);
  color: #f2eee8;
  box-shadow: none;
}
.lb .round-btn.glass:hover:not(:disabled) { background: rgb(255 255 255 / .2); }
.lb-nav { position: absolute; top: 50%; z-index: 2; width: 48px; height: 48px; margin-top: -24px; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-bar, .lb-nav { opacity: 0; transition: opacity .4s var(--ease); }
.lb.open .lb-bar, .lb.open .lb-nav:not(:disabled) { opacity: 1; }
.lb.open .lb-nav:disabled { opacity: .2; }
.lb.idle .lb-bar, .lb.idle .lb-nav, .lb.closing .lb-bar, .lb.closing .lb-nav { opacity: 0 !important; }
.lb.idle { cursor: none; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 760px) {
  :root { --bar-h: 56px; }
  .brand { font-size: 20px; }
  .btn { height: 34px; padding: 0 14px; }
  .actions .btn-quiet { padding: 0 8px; }
  .actions { gap: 6px; }
  .theme-toggle { width: 34px; height: 34px; }
}

/* Phones: "Log out" and "Create" shrink to round icon buttons, so the site
   name keeps its full length next to them (labels stay for screen readers). */
@media (max-width: 480px) {
  .btn-compact { width: 34px; padding: 0 !important; }
  .btn-compact .btn-label { display: none; }
  .btn-compact .compact-only { display: block; }
  .btn-compact svg { width: 16px; height: 16px; }
}
@media (max-width: 360px) {
  .brand { font-size: 18px; }
}

@media (max-width: 760px) {

  .post-tools { position: static; justify-content: center; margin-top: 20px; }
  .post.layout-noir .post-tools { position: static; }

  .g-editorial { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 56px; }
  .g-editorial .ph { grid-column: 1 / -1; margin-top: 0; align-self: start; }
  .g-editorial .ph:nth-child(3n + 2) { grid-column: 2 / -1; }
  .g-editorial .ph:nth-child(3n) { grid-column: 1 / span 5; }

  .cine-grid { --cols: 2 !important; }
  .fs-track .ph { height: 56vh; }
  .print-p { width: 42vw; }
  .print-l { width: 80vw; }

  .lb-nav { display: none; }

  /* iPhone Safari zooms into inputs below 16px and does not zoom back out */
  .field-input:not(.field-title) { font-size: 16px; }

  .modal-small > * { padding: 26px 22px; }
  /* Full screen: pinned to all four edges instead of 100vw/100dvh, which
     iOS Safari measures differently from the visible area */
  .modal-editor {
    inset: 0; margin: 0;
    width: auto; height: auto; max-width: none; max-height: none;
    border-radius: 0;
  }
  .editor-head { padding-top: max(18px, env(safe-area-inset-top)); }
  .editor-foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .editor-head, .editor-body, .editor-foot { padding-left: 18px; padding-right: 18px; }
  .editor-fields { grid-template-columns: minmax(0, 1fr); }
  .editor-fields .field-date { grid-column: 1; grid-row: auto; }
  .editor-foot { flex-wrap: wrap; }
  .ed-progress { flex-basis: 100%; }
  .pager { font-size: 11px; letter-spacing: .1em; }
  .pager-step { padding: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
