/* Gallery frontend — vanilla CSS, no framework.
   Layout never measures images: every tile carries --ar (width/height) from
   the manifests, so the justified grid is computed by flexbox with zero
   layout shift, responsive, and works with JS disabled. */

/* --- self-hosted type (no external requests) ----------------------------- */
/* Fraunces — display serif (masthead, headings, album titles).
   Inter   — humanist sans (UI, metadata, body).
   Variable woff2, latin + latin-ext (latin-ext carries the Lithuanian
   diacritics: ą č ę ė į š ų ū ž). Subset split by unicode-range so a browser
   only fetches the glyphs a page actually uses. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- design tokens ------------------------------------------------------- */
:root {
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Editorial light — ink on warm paper. */
  --paper: #faf8f5;          /* page background */
  --surface: #ffffff;        /* raised surfaces */
  --ink: #17150f;            /* primary text */
  --muted: #75706a;          /* secondary text */
  --line: rgba(23, 21, 15, 0.12);
  --accent: #9a5a32;         /* sienna — hairline + hover; restrained */
  --accent-ink: #8a4f2b;     /* accent tuned for ≥4.5:1 text on paper */

  --gap: 4px;                /* justified-grid gutter (album pages) */
  --measure: 1640px;         /* page max width */
}

/* Cinematic dark — light type glowing on near-black. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c0c0d;
    --surface: #161617;
    --ink: #f0ede7;
    --muted: #908b83;
    --line: rgba(255, 255, 255, 0.14);
    --accent: #d99a6c;
    --accent-ink: #e0a87c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  font-feature-settings: "cv05" 1, "cv08" 1; /* Inter: friendlier l, tail-y */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-ink); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 0.5rem 1rem;
  z-index: 20;
}
.skip:focus { left: 0; }

/* --- site header (masthead) ---------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header a.brand {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.site-header .brand-mark { opacity: 0.55; font-weight: 400; }
.site-header .header-link {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.site-header .header-link:hover { color: var(--accent-ink); }

/* --- page shell ---------------------------------------------------------- */
main {
  padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem;
  max-width: var(--measure);
  margin: 0 auto;
}

/* --- index hero ---------------------------------------------------------- */
.hero {
  padding: clamp(3rem, 9vw, 7rem) 0 clamp(2rem, 5vw, 3.5rem);
  max-width: 22ch;
}
.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 430;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
}
.hero .lede {
  margin: 1.25rem 0 0;
  max-width: 46ch;
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6;
  color: var(--muted);
}
.hero .rule {
  width: 3.5rem;
  height: 2px;
  margin-top: 1.75rem;
  border: 0;
  background: var(--accent);
}

/* album-page heading (kept simple; album pages aren't re-skinned here) */
.album-head h1 {
  font-family: var(--serif);
  font-weight: 460;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: clamp(1.5rem, 4vw, 2.5rem) 0 0.4rem;
}
.lede, .album-meta { color: var(--muted); margin: 0.25rem 0 1rem; }
.album-meta time { margin-right: 0.5rem; }
.breadcrumb { margin-top: 1.25rem; font-size: 0.85rem; letter-spacing: 0.02em; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-ink); }
.grid-more { color: var(--muted); }

/* --- justified photo grid (Flickr-style, pure CSS) ----------------------- */
/* --row-h is defined here (not inline) so media queries can scale it;
   the build sets --row-h-base per page from theme.grid_target_row_height. */
.grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  --row-h: var(--row-h-base, 240px);
}
@media (max-width: 600px) {
  .grid { --row-h: calc(var(--row-h-base, 240px) * 0.58); }
}
.grid::after { content: ""; flex-grow: 1000000; } /* keep last row left-aligned */
.tile {
  flex-grow: calc(var(--ar) * 100);
  flex-basis: calc(var(--ar) * var(--row-h));
  aspect-ratio: var(--ar);
  max-width: 100%;
  display: block;
  position: relative;
  background-size: cover;       /* LQIP data-URI sits behind the image */
  background-position: center;
  border-radius: 2px;
  overflow: hidden;
}
.tile img,
.tile picture {
  display: block;
  width: 100%;
  height: 100%;
}
.tile img { object-fit: cover; }

/* --- album wall (index) --------------------------------------------------- */
/* Editorial "plate + caption": the cover photo carries the weight, the title
   sits below in serif, metadata is quiet. No card chrome — the images are the
   design. */
.albums {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(1.5rem, 3vw, 2.75rem) clamp(1.25rem, 2.5vw, 2rem);
}
.card a {
  display: block;
  color: var(--ink);
  text-decoration: none;
}
.card-img {
  display: block;
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.card-img img, .card-img picture { display: block; width: 100%; height: 100%; }
/* letterbox, never crop: these are a photographer's composed frames — show the
   whole picture and pad off-aspect covers against the plate (see lessons.md). */
.card-img img { object-fit: contain; }
/* subtle vignette so light photos still read against the page edge */
.card-img::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 3px;
  pointer-events: none;
}
.card-meta {
  display: block;
  padding: 0.85rem 0.1rem 0;
}
.card-title {
  display: block;
  font-family: var(--serif);
  font-weight: 460;
  font-size: 1.18rem;
  line-height: 1.2;
  letter-spacing: -0.005em;
}
.card-sub {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.card-sub time { font-variant-numeric: tabular-nums; }
.card a:hover .card-title { color: var(--accent-ink); }

@media (prefers-reduced-motion: no-preference) {
  .card a { transition: transform 0.18s ease; }
  .card a:hover { transform: translateY(-3px); }  /* lift, not zoom — no crop */
}

/* Lightbox caption: optional photo caption + the original filename (so the
   owner can match a displayed photo to the RAW archive). Drawn over the
   PhotoSwipe dark backdrop, so it is always light-on-dark. */
.pswp__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: none;
}
.pswp__caption:empty { display: none; }
.pswp__caption .cap-text { display: block; }
.pswp__caption .cap-file {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  opacity: 0.75;
}
.pswp__caption .cap-credit {
  display: block;
  font-size: 0.8rem;
  opacity: 0.75;
}
/* the caption ignores pointer events, but the contact link stays clickable */
.pswp__caption .cap-credit a { pointer-events: auto; color: inherit; }

/* --- site footer (gallery.contact_email) --------------------------------- */
.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 4vw, 2.5rem) 3.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--accent-ink); }
