/* =========================================================
   Custom Flipbook Covers — White-Label Gallery
   Aesthetic: refined editorial, warm off-white, image-forward
   ========================================================= */

:root {
  --paper: #f5f1ea;
  --paper-soft: #ebe5da;
  --ink: #1a1815;
  --ink-soft: #4a463f;
  --ink-mute: #8a847a;
  --rule: #d8d2c5;
  --accent: #a8633b;
  --accent-soft: #c08960;
  --serif: 'Fraunces', 'Times New Roman', serif;
  --body: 'Newsreader', Georgia, serif;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
  --max: 1320px;
  --gutter: clamp(1.5rem, 3vw, 3rem);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at top, rgba(168, 99, 59, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(26, 24, 21, 0.02) 0%, transparent 50%);
}

/* =========================================================
   Masthead
   ========================================================= */
.masthead {
  padding: clamp(3rem, 8vw, 7rem) var(--gutter) clamp(2rem, 5vw, 4rem);
  border-bottom: 1px solid var(--rule);
}

.masthead-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.8s 0.1s ease-out forwards;
}

.title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
  font-variation-settings: "opsz" 144;
  font-style: italic;
  font-weight: 500;
  opacity: 0;
  animation: fadeUp 0.9s 0.2s ease-out forwards;
}

.lede {
  font-family: var(--body);
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 56ch;
  margin-bottom: clamp(2rem, 4vw, 3rem);
  opacity: 0;
  animation: fadeUp 0.9s 0.35s ease-out forwards;
}

.rule {
  width: 64px;
  height: 1px;
  background: var(--accent);
  margin-bottom: 1.5rem;
  transform-origin: left;
  transform: scaleX(0);
  animation: drawLine 0.6s 0.55s ease-out forwards;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 3vw, 3rem);
  opacity: 0;
  animation: fadeUp 0.9s 0.65s ease-out forwards;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meta-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-mute);
}

.meta-value {
  font-family: var(--body);
  font-size: 0.95rem;
  color: var(--ink);
}

/* =========================================================
   Gallery
   ========================================================= */
.gallery-wrap {
  padding: clamp(3rem, 6vw, 5rem) var(--gutter);
}

.gallery {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(1.5rem, 2.5vw, 2.5rem);
}

.cover-card {
  position: relative;
  background: var(--paper-soft);
  cursor: zoom-in;
  overflow: hidden;
  aspect-ratio: 7.53 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0;
  animation: fadeUp 0.8s ease-out forwards;
}

/* Stagger animation for first batch */
.cover-card:nth-child(1) { animation-delay: 0.1s; }
.cover-card:nth-child(2) { animation-delay: 0.15s; }
.cover-card:nth-child(3) { animation-delay: 0.2s; }
.cover-card:nth-child(4) { animation-delay: 0.25s; }
.cover-card:nth-child(5) { animation-delay: 0.3s; }
.cover-card:nth-child(6) { animation-delay: 0.35s; }
.cover-card:nth-child(7) { animation-delay: 0.4s; }
.cover-card:nth-child(8) { animation-delay: 0.45s; }
.cover-card:nth-child(n+9) { animation-delay: 0.5s; }

.cover-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -8px rgba(26, 24, 21, 0.18),
              0 4px 12px -4px rgba(26, 24, 21, 0.1);
}

.cover-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.cover-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(26, 24, 21, 0.06);
  pointer-events: none;
}

/* Some cards span wider on larger screens for visual rhythm */
@media (min-width: 768px) {
  .cover-card.feature {
    grid-column: span 2;
  }
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
}

/* =========================================================
   Show more button
   ========================================================= */
.show-more-wrap {
  max-width: var(--max);
  margin: clamp(2.5rem, 5vw, 4rem) auto 0;
  display: flex;
  justify-content: center;
}

.show-more-wrap[hidden],
.show-more[hidden] {
  display: none;
}

.show-more {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 1rem 2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.show-more:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(168, 99, 59, 0.04);
}

.show-more:focus-visible {
  outline: none;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 99, 59, 0.18);
}

.show-more-icon {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.3s ease;
}

.show-more:hover .show-more-icon {
  transform: translateY(2px);
}

.error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  font-family: var(--body);
  color: var(--ink-soft);
  font-style: italic;
}

/* =========================================================
   Colophon
   ========================================================= */
.colophon {
  padding: clamp(2.5rem, 5vw, 4rem) var(--gutter);
  border-top: 1px solid var(--rule);
  margin-top: clamp(3rem, 6vw, 5rem);
}

.colophon-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.colophon-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr;
  gap: clamp(1rem, 2vw, 2rem);
  align-items: baseline;
}

.colophon-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
}

.colophon-value {
  font-family: var(--body);
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* =========================================================
   Lightbox
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 15, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  padding: clamp(2rem, 5vw, 4rem);
  cursor: zoom-out;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-figure {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  cursor: default;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 10rem);
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  background: var(--paper);
  transform: scale(0.96);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lightbox.active .lightbox-image {
  transform: scale(1);
}

.lightbox-caption {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(245, 241, 234, 0.55);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: transparent;
  border: 1px solid rgba(245, 241, 234, 0.22);
  color: var(--paper);
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 400;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.lightbox-close {
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  line-height: 1;
  border-radius: 50%;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  font-size: 2rem;
  line-height: 1;
  border-radius: 50%;
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

.lightbox-close:hover,
.lightbox-nav:hover {
  border-color: var(--accent-soft);
}

.lightbox-nav:hover { transform: translateY(-50%) scale(1.05); }

@media (max-width: 640px) {
  .lightbox-nav { width: 44px; height: 44px; font-size: 1.6rem; }
  .lightbox-prev { left: 0.75rem; }
  .lightbox-next { right: 0.75rem; }
  .lightbox-close { top: 0.75rem; right: 0.75rem; }
}

/* =========================================================
   Animations
   ========================================================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes drawLine {
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
