/*
  Design sandbox for a "1990s photobook" look — a lightly coloured aged
  paper page with photos in square white mounts and a physical drop
  shadow, instead of the live site's rounded/borderless gallery tiles.
  Self-contained: nothing here is shared with site.css.
*/

:root {
  --paper: #f3ebd8;
  --ink: #362d20;
  --ink-soft: #5a4c38;
  --mat: #fffcf4;
}

* {
  box-sizing: border-box;
}

figure {
  /* Browsers default <figure> to `margin: 1em 40px`, which was shrinking
     .photo-mount inside .chapter-card down from its .stack-layer siblings
     (which fill the card via inset: 0) — made the "stack" visible at rest
     instead of only revealing it on hover. */
  margin: 0;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  background-color: var(--paper);
  background-image:
    url('/img/paper-grain.svg'),
    radial-gradient(ellipse 60% 40% at 12% 8%, rgba(139, 111, 74, 0.1), transparent 60%),
    radial-gradient(ellipse 50% 35% at 88% 92%, rgba(120, 95, 60, 0.09), transparent 65%),
    radial-gradient(ellipse 70% 50% at 70% 15%, rgba(160, 130, 90, 0.05), transparent 70%);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-size: 300px 300px, auto, auto, auto;
  background-blend-mode: multiply, normal, normal, normal;
  box-shadow: inset 0 0 140px rgba(60, 45, 25, 0.16);
  color: var(--ink);
  font-family: 'Caveat', 'Patrick Hand', 'Segoe Print', cursive;
  font-weight: 600;
  min-height: 100vh;
  padding: 56px 20px 96px;
}

.page {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  text-align: center;
  margin-bottom: 48px;
}

.page-head h1 {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: 0.02em;
  overflow-wrap: break-word;
}

.page-head .welcome {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-weight: 600;
  max-width: 560px;
  margin: 0 auto 18px;
  font-size: 1.5rem;
  line-height: 1.4;
  color: var(--ink);
}

.page-head .note {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  opacity: 0.85;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 1.35rem;
  text-decoration: none;
  border-bottom: 1px dashed rgba(54, 45, 32, 0.4);
}

.back-link:hover {
  color: var(--ink);
}

/* --- quick links: sticky row of jump-to-section tabs --- */

.quicklinks {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 28px;
  padding: 10px 16px;
  margin-bottom: 40px;
  background: rgba(243, 235, 216, 0.94);
  border-bottom: 1px solid rgba(54, 45, 32, 0.18);
}

.quicklinks a {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.quicklinks a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink-soft);
}

/* --- back to top --- */

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--mat);
  color: var(--ink);
  font-size: 1.5rem;
  text-decoration: none;
  box-shadow:
    0 12px 22px -10px rgba(35, 25, 15, 0.5),
    0 3px 6px rgba(35, 25, 15, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 40;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-3px);
}

.spread {
  margin-bottom: 56px;
}

.selection-spread {
  padding-top: 12px;
}

.spread h2 {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  border-bottom: 1px solid rgba(54, 45, 32, 0.25);
  padding-bottom: 6px;
  margin-bottom: 24px;
}

.spread h3 {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 40px 32px;
  padding: 4px 0 16px;
  margin-bottom: 28px;
  min-width: 0;
  /* Without this, grid items default to align-items: stretch, so a card
     with a longer (wrapped) caption stretches every other card in its row
     to match — and for .chapter-card, whose .stack-layer children fill the
     stretched box via inset:0 while .photo-mount doesn't, that mismatch
     made the "stack" visible even at rest instead of only on hover. */
  align-items: start;
}

.more-wrap {
  text-align: center;
  margin-top: -6px;
}

.more-btn {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-size: 1.35rem;
  font-weight: 600;
  background: var(--mat);
  color: var(--ink);
  border: 1px solid rgba(54, 45, 32, 0.3);
  padding: 8px 30px;
  cursor: pointer;
  box-shadow: 0 6px 14px -8px rgba(35, 25, 15, 0.4);
  transition: transform 0.15s ease;
}

.more-btn:hover {
  transform: translateY(-2px);
}

.hidden {
  display: none;
}

/* --- the physical print: square white mount + drop shadow --- */

.photo-mount {
  background: var(--mat);
  padding: 12px 12px 32px;
  border-radius: 0;
  box-shadow:
    0 16px 28px -12px rgba(35, 25, 15, 0.5),
    0 4px 8px rgba(35, 25, 15, 0.22);
  transform: rotate(var(--tilt, 0deg));
  min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* A standalone photo (Selection, or inside a Chapter/Album page) opens the
   lightbox on click — lift it slightly on hover so that's obvious. Scoped to
   .grid's direct children only, so it doesn't apply inside .chapter-card
   (those get the stack-peek hover instead, not a moving mount). */
.grid > .photo-mount:hover {
  transform: rotate(var(--tilt, 0deg)) translateY(-6px);
  box-shadow:
    0 22px 34px -12px rgba(35, 25, 15, 0.55),
    0 8px 14px rgba(35, 25, 15, 0.28);
}

.photo-frame {
  line-height: 0;
}

.photo-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

figcaption {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-weight: 600;
  text-align: center;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 1.35rem;
}

/* --- about: photo, then text underneath, centered as one narrow column --- */

.about-spread {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.about-photo {
  display: inline-block;
  margin: 0 auto 24px;
}

.about-photo .photo-frame img {
  aspect-ratio: auto;
  cursor: default;
}

.about-text {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-weight: 600;
  text-align: left;
  font-size: 1.5rem;
  line-height: 1.5;
}

.about-text p {
  margin: 0 0 16px;
}

.about-text a {
  color: var(--ink);
}

.page-foot {
  text-align: center;
  margin-top: 40px;
  font-family: 'Caveat', 'Patrick Hand', cursive;
  font-size: 0.9rem;
  color: var(--ink-soft);
  opacity: 0.7;
}

/* --- chapter/album cover cards: a permanently-visible stack of prints,
   the whole group lifting together on hover --- */

.chapter-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease;
}

.chapter-card:hover,
.chapter-card:focus-visible {
  transform: translateY(-6px);
}

.chapter-card .photo-mount {
  position: relative;
  z-index: 1;
}

.chapter-card .stack-layer {
  position: absolute;
  inset: 0;
  background: var(--mat);
  box-shadow: 0 10px 18px -10px rgba(35, 25, 15, 0.4);
}

.chapter-card .layer-1 {
  transform: rotate(calc(var(--tilt, 0deg) - 3deg)) translate(3px, 4px);
}

.chapter-card .layer-2 {
  transform: rotate(calc(var(--tilt, 0deg) - 5deg)) translate(6px, 8px);
}

/* --- lightbox: click a photo to see it at its own dimensions --- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.lightbox.open {
  display: block;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 15, 10, 0.9);
  cursor: zoom-out;
}

.lightbox-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.15);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lightbox.playing .lightbox-progress {
  opacity: 1;
}

.lightbox-progress-bar {
  height: 100%;
  width: 0;
  background: #ffffff;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 96px;
  pointer-events: none;
}

.lightbox-content img {
  pointer-events: auto;
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  background: #fff;
  padding: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

#lightbox-caption {
  color: #ffffff;
  font-size: 1.35rem;
  text-align: center;
  max-width: 80vw;
  transition: opacity 0.2s ease;
}

.lightbox-controls {
  position: absolute;
  top: 18px;
  right: 24px;
  z-index: 2;
  display: flex;
  gap: 10px;
  transition: opacity 0.2s ease;
}

.lightbox-close,
.lightbox-fullscreen,
.lightbox-play {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 0;
  background-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-fullscreen:hover,
.lightbox-play:hover {
  background-color: rgba(255, 255, 255, 0.22);
}

.lightbox-fullscreen,
.lightbox-play {
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
}

.lightbox-fullscreen {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cpolyline points='9 21 3 21 3 15'/%3E%3Cline x1='21' y1='3' x2='14' y2='10'/%3E%3Cline x1='3' y1='21' x2='10' y2='14'/%3E%3C/svg%3E");
}

.lightbox.fullscreen .lightbox-fullscreen {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 14 10 14 10 20'/%3E%3Cpolyline points='20 10 14 10 14 4'/%3E%3Cline x1='14' y1='10' x2='21' y2='3'/%3E%3Cline x1='3' y1='21' x2='10' y2='14'/%3E%3C/svg%3E");
}

.lightbox-play {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='6,4 20,12 6,20' fill='white'/%3E%3C/svg%3E");
}

.lightbox.playing .lightbox-play {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='4' width='5' height='16' fill='white'/%3E%3Crect x='14' y='4' width='5' height='16' fill='white'/%3E%3C/svg%3E");
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  translate: 0 -50%;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

/* Tapping/clicking the photo while full screen hides the chrome — the
   controls stay in the layout (so nothing reflows) but become invisible
   and non-interactive. */
.lightbox.controls-hidden .lightbox-controls,
.lightbox.controls-hidden .lightbox-nav,
.lightbox.controls-hidden #lightbox-caption {
  opacity: 0;
  pointer-events: none;
}

/* --- adapt spacing/type down for narrow screens --- */

@media (max-width: 600px) {
  body {
    padding: 36px 14px 64px;
  }

  .page-head {
    margin-bottom: 36px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 26px 18px;
  }

  .photo-mount {
    padding: 10px 10px 28px;
  }

  .lightbox-content {
    padding: 24px 60px;
  }

  .lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  .lightbox-prev {
    left: 8px;
  }

  .lightbox-next {
    right: 8px;
  }

  .quicklinks {
    gap: 6px 18px;
    margin-bottom: 28px;
  }

  .quicklinks a {
    font-size: 1.15rem;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
  }
}
