/* ============================================================
   ESRAEL NATE — photographs
   Editorial-minimal: warm paper, big grotesque type, mono accents.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;900&family=Space+Mono:wght@400;700&display=swap');

:root {
  --paper: #f4f2ed;
  --ink: #141414;
  --hair: rgba(20, 20, 20, 0.18);
  --sans: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'Space Mono', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-anchor: none; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.5s ease, color 0.5s ease;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* ---------- shared bits ---------- */

.stamp {
  display: inline-block;
  margin-top: 40px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 10px 22px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--ink);
  background: var(--paper);
}

.down-arrows {
  margin-top: 12vh;
  font-size: 20px;
  letter-spacing: 0.5em;
}

/* ---------- intro: fullscreen -> framed ---------- */

.intro {
  position: relative;
  /* Large-viewport height: the hero must cover the screen even after the
     mobile URL bar collapses, or the first panel peeks in below it. */
  height: 100vh;
  height: 100lvh;
  background: var(--paper);
  overflow: hidden;
}
.intro-link {
  position: absolute;
  inset: 0;
  display: block;
}
.intro-frame {
  position: absolute;
  inset: 0;
  animation: frame-in 1.1s cubic-bezier(0.76, 0, 0.24, 1) 0.9s forwards;
}
.intro-frame picture,
.intro-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@keyframes frame-in {
  to { inset: 20px; }
}

.intro-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: 5vh 20px 6vh;
  color: #f4f2ed;
  opacity: 0;
  animation: overlay-in 0.9s ease 1.6s forwards;
  pointer-events: none;
}
@keyframes overlay-in {
  to { opacity: 1; }
}
.intro-name {
  font-weight: 900;
  font-size: clamp(38px, 7vw, 96px);
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.4);
}
.intro-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.intro-meta {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}
.intro-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
/* On phones the intro title matches the album panels exactly. */
@media (max-width: 700px) {
  .intro-overlay { padding-top: 10vh; }
  .intro-name { font-size: clamp(34px, 6vw, 84px); }
}
.intro .down-arrows {
  margin-top: 0;
  font-size: 18px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .intro-frame { animation: none; inset: 20px; }
  .intro-overlay { animation: none; opacity: 1; }
}

/* ---------- album index: cinematic panels ---------- */

/* Soft alignment: when a scroll settles near a panel's centered position,
   ease it perfectly into frame; anywhere else, scrolling stays free.
   Native proximity snap on desktop only — iOS applies it as a hard jump
   after momentum, so phones get a JS settle-assist instead (index script). */
@media (min-width: 701px) {
  html.home {
    scroll-snap-type: y proximity;
  }
  /* JS wheel-paging (index script) owns desktop travel when active;
     native snap would double-adjust against its tween. */
  html.home.js-snap {
    scroll-snap-type: none;
  }
  html.home .intro {
    scroll-snap-align: start;
  }
  html.home .album-panel {
    scroll-snap-align: center;
  }
}

.albums {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.album-panel {
  position: relative;
  display: block;
  height: calc(100vh - 40px);
  height: calc(100svh - 40px);
  overflow: hidden;
  background: #e4e1da;
}
.album-panel picture { display: contents; }
.album-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  transition: transform 1.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.album-panel:hover img {
  transform: scale(1.012);
}
.panel-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  text-align: center;
  color: #f4f2ed;
  padding: 10vh 20px 20px;
}
.panel-title {
  font-weight: 900;
  font-size: clamp(34px, 6vw, 84px);
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.4);
}
.panel-meta {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

/* ---------- album page ---------- */

.album-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.album-top a:hover { text-decoration: underline; }

.album-head {
  text-align: center;
  padding: 14vh 20px 8vh;
}
.album-head h1 {
  font-weight: 900;
  font-size: clamp(52px, 12vw, 150px);
  letter-spacing: -0.04em;
  line-height: 0.92;
  text-transform: uppercase;
}
/* Photo-filled headline: every letter is clipped out of one of the album's
   own photographs (background-clip: text). Letters hold plain ink until
   their photo has loaded, then fade over in a quick cascade — browsers
   without text clipping simply never leave ink. Clicking redeals. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .album-head h1 .hw { white-space: nowrap; }
  .album-head h1 .hc {
    position: relative;
    display: inline-block;
    background-size: cover;
    -webkit-background-clip: text;
    background-clip: text;
    transition: color 0.7s ease;
  }
  .album-head h1 .hc.on { color: transparent; }
  /* Redeal crossfade: a twin of the glyph (same character via attr) sits
     on top carrying the incoming photo, fades in over the old one, then
     the swap commits underneath it invisibly (album script). */
  .album-head h1 .hc::before {
    content: attr(data-ch);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-image: var(--bg2, none);
    background-position: var(--bg2-pos, center);
    background-size: cover;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease var(--sd, 0s);
  }
  .album-head h1 .hc.swap::before { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .album-head h1 .hc,
  .album-head h1 .hc::before { transition: none; }
}

.album-head .album-meta {
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.album-head .album-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 32px;
}
.album-head .album-actions a,
.album-head .album-actions button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.album-head .chapter-jumps {
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 28px;
}
.album-head .chapter-jumps a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- chapters ---------- */

.chapter-head {
  max-width: 1400px;
  margin: 0 auto;
  padding: 70px 20px 26px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--hair);
}
.chapter-head h2 {
  font-weight: 900;
  font-size: clamp(26px, 4vw, 48px);
  letter-spacing: -0.03em;
  line-height: 1;
  text-transform: uppercase;
}
.chapter-head span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  columns: 2;
  column-gap: 20px;
}
.grid a {
  display: block;
  margin-bottom: 20px;
  break-inside: avoid;
  overflow: hidden;
}
/* In the two-column grid the gap lives as a transparent border, not a
   margin: WebKit wraps a margin that lands exactly on a column break to
   the top of the next column, leaving a stray space above its first
   photo (the balance point in some albums hits the break exactly).
   Borders are part of the box, so they can never wrap. background-clip
   keeps the average-color placeholder off the border strip. */
@media (min-width: 701px) {
  html:not(.focus) .grid a {
    margin-bottom: 0;
    border-bottom: 20px solid transparent;
    /* !important: the inline background shorthand on each photo anchor
       resets background-clip to border-box, which would paint the
       placeholder color under the transparent border. */
    background-clip: content-box !important;
  }
}
.grid img {
  width: 100%;
  opacity: 0;
  transition: transform 1.6s cubic-bezier(0.2, 0.6, 0.2, 1), opacity 0.5s ease;
}
.grid img.ld { opacity: 1; }
.grid a:hover img { transform: scale(1.012); }

@media (max-width: 700px) {
  .grid { columns: 1; }
}

/* ---------- more albums (bottom of each album page) ---------- */

.more-albums {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 80px;
}
.more-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-top: 1px solid var(--hair);
  padding-top: 16px;
  margin-bottom: 20px;
}
.more-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.more-tile {
  position: relative;
  display: block;
  overflow: hidden;
}
.more-tile img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 1.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.more-tile:hover img {
  transform: scale(1.012);
}
.more-title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  color: #f4f2ed;
  font-weight: 900;
  font-size: clamp(20px, 2.6vw, 34px);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.45);
}
@media (max-width: 700px) {
  .more-grid { grid-template-columns: 1fr; }
}

/* ---------- phone focus mode: bg to black, gaps breathe open ----------
   The grid layout itself never changes — only colors flip, and the
   zero-height meta bars between photos ease open to fit the text. */

.focus-meta {
  position: relative;
  display: flex;
  height: 0;
  opacity: 0;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  /* Height only animates on bars near the viewport (.animate, set by JS);
     off-screen bars jump instantly with the scroll compensated, so the
     whole page never visibly shifts during the transition. */
  transition: opacity 0.35s ease;
}
.focus-meta.animate {
  transition: height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}
.focus-meta a {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.focus-meta .fm-share {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 0;
}

html.focus {
  --paper: #0a0a0a;
  --ink: #f4f2ed;
  --hair: rgba(244, 242, 237, 0.18);
}
/* In focus mode every bar opens (constant spacing), but only the bar
   belonging to the most-in-frame photo shows its text. */
html.focus .focus-meta {
  height: 72px;
}
html.focus .focus-meta.on {
  opacity: 1;
}

/* Desktop focus mode (preview variant): fullscreen viewer, pure cuts. */
@media (min-width: 701px) {
  body { transition: none; }
  html.focus .grid { columns: 1; max-width: none; padding: 0; }
  html.focus .grid a {
    display: block;
    height: 100vh;
    margin: 0 0 20px;
    background: none !important;
  }
  html.focus .grid img {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    transition: none;
  }
  html.focus .grid a:hover img { transform: none; }
  html.focus .focus-meta {
    position: fixed;
    inset: auto 0 0 0;
    height: 0;
    overflow: visible;
    background: none;
    z-index: 40;
    transition: none;
    /* Every bar is fixed to the same corner controls here, so only the
       active photo's bar may exist — invisible ones still catch clicks,
       and the last bar in DOM order used to win: Download and Share
       always acted on the album's final photo. */
    display: none;
  }
  html.focus .focus-meta.on { display: flex; }
  html.focus .focus-meta span,
  html.focus .focus-meta a,
  html.focus .focus-meta .fm-share {
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.75);
    font-size: 12px;
    line-height: 1;
  }
  html.focus .focus-meta span {
    position: fixed;
    inset: auto 0 20px 0;
    text-align: center;
    pointer-events: none;
  }
  html.focus .focus-meta .fm-share {
    position: fixed;
    inset: auto auto 20px 24px;
    height: auto;
    transform: none;
  }
  html.focus .focus-meta a {
    position: fixed;
    inset: auto 24px 20px auto;
    height: auto;
    margin: 0;
    transform: none;
  }
  html.focus .fx-nav { display: flex; }
}

/* Prev/next chevrons, right edge, desktop focus only. */
.fx-nav {
  display: none;
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  gap: 22px;
  z-index: 45;
}
.fx-nav button {
  background: none;
  border: none;
  cursor: pointer;
  color: #f4f2ed;
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1;
  padding: 6px;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.75);
}
.fx-nav button:hover { opacity: 0.7; }
}

/* ---------- back to top ---------- */

.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  background: var(--paper);
  color: var(--ink);
  border: none;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, background-color 0.5s ease, color 0.5s ease;
}
.to-top.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--hair);
  padding: 24px 20px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
