/* ------------------------------------------------------------------
   Archivo (Omnibus-Type, SIL OFL 1.1) — self-hosted variable subsets.
   latin-ext carries the Czech caron/ring glyphs (Ě Č Ř Š Ž Ď Ů);
   latin carries the acutes (Í Á Ó Ý). Both are required by the title.
   ------------------------------------------------------------------ */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/archivo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/archivo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0a0a0a;
  --tile-bg: #141414;
  --fg: #f4f1ee;
  --muted: rgba(244, 241, 238, 0.34);
  --accent: #e9a53f;

  --pad: clamp(1rem, 3.2vw, 2.75rem);

  --ease: cubic-bezier(0.16, 0.84, 0.44, 1);
  --ease-flip: cubic-bezier(0.32, 0.72, 0, 1);
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Scroll lock: body is pinned, so the document scrollbar collapses —
   --sbw pads the width back so nothing shifts under the lightbox. */
body.is-locked {
  position: fixed;
  left: 0;
  width: 100%;
  padding-right: var(--sbw, 0px);
}

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

.masthead {
  position: relative;
  padding: clamp(4.5rem, 13vh, 10rem) var(--pad) clamp(3.75rem, 10vh, 8.5rem);
  text-align: center;
}

/* A barely-there warm lift so the near-black has depth behind the title.
   Scrolls away with the header rather than tracking the viewport. */
.masthead::before {
  content: '';
  position: absolute;
  /* No horizontal bleed: a negative inline inset would push the document's
     scrollWidth past the viewport and only overflow-x:hidden would hide it. */
  inset: -30% 0 -10%;
  background: radial-gradient(56% 62% at 50% 42%, rgba(255, 231, 201, 0.075), transparent 72%);
  pointer-events: none;
}

.masthead__title {
  position: relative;
  margin: 0;
  font-size: clamp(1.4rem, 4.35vw, 3.6rem);
  font-weight: 200;
  line-height: 1.3;
  letter-spacing: 0.13em;
  /* Optical centring: trailing letter-space pulls caps visually left. */
  padding-left: 0.13em;
  color: var(--fg);
  text-wrap: balance;
}

/* ------------------------------------------------------------------ grid */

.gridwrap {
  max-width: 2200px;
  margin: 0 auto;
  padding: 0 var(--pad) clamp(4rem, 12vh, 9rem);
}

.grid {
  position: relative;
  width: 100%;
}

.tile {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--tile-bg);
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.tile.is-in {
  opacity: 1;
  transform: none;
}

.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.tile__lqip {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.14);
  filter: blur(14px);
  transition: opacity 0.6s ease;
}

.tile.is-loaded .tile__lqip { opacity: 0; }

.tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease,
              transform 0.4s var(--ease),
              filter 0.4s var(--ease);
}

.tile.is-loaded .tile__img { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile__img {
    transform: scale(1.03);
    filter: brightness(1.08);
  }
}

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.lightbox[hidden] { display: none; }

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 7, 7, 0.93);
  -webkit-backdrop-filter: blur(24px) saturate(0.85);
  backdrop-filter: blur(24px) saturate(0.85);
  opacity: 0;
  transition: opacity 0.42s var(--ease-flip);
}

.lightbox.is-open .lightbox__backdrop { opacity: 1; }

.lightbox__stage {
  position: absolute;
  inset: 0;
  touch-action: none;
}

.lightbox__figure {
  position: absolute;
  margin: 0;
  transform-origin: 0 0;
  will-change: transform, opacity;
  /* LQIP sits underneath so the figure is never an empty box on the
     first frame of the zoom, however cold the cache is. */
  background-size: cover;
  background-position: center;
}

.lightbox__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox__img--full {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.lightbox__img--full.is-ready { opacity: 1; }

/* chrome fades in a beat after the zoom lands */
.lightbox__chrome {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease 0.16s;
}

.lightbox.is-open .lightbox__chrome { opacity: 1; }

.lbtn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0.55;
  transition: opacity 0.25s var(--ease), background-color 0.25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.lbtn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) and (pointer: fine) {
  .lbtn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.11);
  }
}

.lbtn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.lbtn--close { top: clamp(0.75rem, 2.2vw, 1.75rem); right: clamp(0.75rem, 2.2vw, 1.75rem); }
.lbtn--prev  { left: clamp(0.5rem, 1.8vw, 1.75rem); top: 50%; margin-top: -24px; }
.lbtn--next  { right: clamp(0.5rem, 1.8vw, 1.75rem); top: 50%; margin-top: -24px; }

.lightbox__counter {
  position: absolute;
  left: clamp(1rem, 2.4vw, 2rem);
  bottom: clamp(0.9rem, 2.2vw, 1.6rem);
  margin: 0;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* ------------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  .tile {
    transform: none;
    transition: opacity 0.3s linear;
  }
  .tile__img { transition: opacity 0.3s linear; }
  .tile:hover .tile__img { transform: none; filter: none; }
  .lightbox__figure { transition: opacity 0.2s linear !important; }
  .lightbox__backdrop { transition: opacity 0.25s linear; }
}
