/* ===================================================================
   LumaBook.ai — Landing Page Stylesheet
   Pure Minimalist Parchment Aesthetic — Exactly Matching Book Reader
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700;900&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500;1,600&family=Inter:wght@400;500;600&family=MedievalSharp&family=Pirata+One&family=UnifrakturMaguntia&display=swap');

@font-face {
  font-family: 'Bookerly';
  src: local('Bookerly'),
    url('../fonts/Bookerly-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-primary: #F7F1E7;
  --bg-surface: rgba(247, 241, 231, 0.95);
  --border-color: rgba(0, 0, 0, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --btn-bg: #f0eae1;
  --btn-hover: #e8dfd3;
  --header-height: 136px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-reading: 'Bookerly', 'EB Garamond', Georgia, serif;
  --ink-color: #241e19;
  /* Illustrations use deep warm ink #1a1612 baked into the canvas LUT; no softening filter */
  --ink-filter: none;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  user-select: none !important;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  touch-action: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Soft spotlight behind the carousel + warm vignette at the edges */
body {
  background:
    radial-gradient(ellipse 46% 50% at 50% 52%, rgba(255, 252, 246, 0.95) 0%, rgba(255, 252, 246, 0) 72%),
    radial-gradient(ellipse 120% 105% at 50% 48%, rgba(70, 48, 26, 0) 58%, rgba(70, 48, 26, 0.13) 100%),
    var(--bg-primary);
}

/* Paper grain (static SVG noise, multiplied onto the parchment) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* ===== APP HEADER (IDENTICAL TO BOOK READER) ===== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  /* Transparent so the spotlight / grain read as one continuous sheet of paper
     (the page never scrolls, so nothing passes underneath the header). */
  background: transparent;
  border-bottom: none;
}

.header-left {
  flex: 1;
  display: flex;
  align-items: center;
}

.header-logo-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  margin-top: 8px; /* sit slightly below the header's vertical centre */
  animation: lb-fade-up 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.05s backwards;
}

.header-logo-img {
  height: 76px; /* large centred brand mark (logo is ~3:1, so ~228px wide) */
  width: auto;
  object-fit: contain;
  display: block;
}

.header-center {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.header-tagline {
  margin-top: 6px;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: normal;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: #000;
  white-space: nowrap;
  animation: lb-fade-up 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.25s backwards;
}

.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  :root {
    --header-height: 108px;
  }
  .header-logo-img {
    height: 56px;
  }
  .header-tagline {
    margin-top: 4px;
    font-size: 15px;
  }
}

/* ===== MAIN LANDING STAGE (3D COVER FLOW PERSPECTIVE) ===== */
.landing-stage {
  position: relative;
  z-index: 1; /* above the grain layer */
  padding-top: calc(var(--header-height) + clamp(8px, 2vh, 28px));
  padding-bottom: clamp(16px, 3vh, 40px);
  max-width: 1440px;
  margin: 0 auto;
  padding-left: clamp(20px, 4vw, 64px);
  padding-right: clamp(20px, 4vw, 64px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
}

/* ===== 3D COVER FLOW STAGE TRACK ===== */
.titles-row {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: 544px;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 40em;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  margin: clamp(4px, 1.5vh, 20px) auto 0;
  padding: 0;
  touch-action: none;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

/* ===== READING LAMP BEHIND THE FOCUSED BOOK =====
   The lamp precedes the carousel in the DOM, so it paints behind the books
   and their titles, and it stays fixed at the centre: books slide into the
   light as they come into focus. It only brightens the page behind them; the
   rest of the page keeps its parchment colour. */
.lamp-stage {
  position: relative;
  width: 100%;
  max-width: 1100px;
}

.lamp {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Cone of light from above plus a pool of light around the centre book, in a
   brighter tint of the parchment (same hue). The blur sits on the parent so
   the clipped trapezoid gets soft edges. */
.lamp-beam {
  position: absolute;
  top: -110px;
  left: 50%;
  width: 460px;
  height: 700px;
  transform: translateX(-50%);
  filter: blur(18px);
  animation: lamp-on 1.2s ease-out 0.6s backwards;
}

.lamp-beam::before {
  content: '';
  position: absolute;
  inset: 0 0 34% 0;
  clip-path: polygon(39% 0, 61% 0, 100% 100%, 0 100%);
  background: linear-gradient(to bottom,
    rgba(255, 249, 240, 0) 0%,
    rgba(255, 249, 240, 0.95) 32%,
    rgba(255, 249, 240, 0.8) 75%,
    rgba(255, 249, 240, 0) 100%);
}

.lamp-beam::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 50% 42% at 50% 54%,
    rgba(255, 249, 240, 0.9) 0%,
    rgba(255, 249, 240, 0.55) 55%,
    rgba(255, 249, 240, 0) 100%);
}

@keyframes lamp-on {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Grab / Grabbing swipe state */
.landing-stage.is-swiping,
.titles-row.is-swiping {
  cursor: grabbing !important;
}

.landing-stage.is-swiping .title-column,
.titles-row.is-swiping .title-column {
  cursor: grabbing !important;
}

.landing-stage.is-moving .title-column:hover .video-container,
.titles-row.is-moving .title-column:hover .video-container,
.landing-stage.is-swiping .title-column:hover .video-container,
.titles-row.is-swiping .title-column:hover .video-container {
  transform: none !important;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.08),
    0 10px 24px -4px rgba(15, 23, 42, 0.12),
    0 3px 8px -1px rgba(15, 23, 42, 0.06) !important;
}

.landing-stage.is-moving .video-container,
.titles-row.is-moving .video-container,
.landing-stage.is-swiping .video-container,
.titles-row.is-swiping .video-container {
  transition: none !important;
}

.landing-stage.is-moving .title-info-block,
.titles-row.is-moving .title-info-block,
.landing-stage.is-swiping .title-info-block,
.titles-row.is-swiping .title-info-block {
  transform: none !important;
  transition: none !important;
}

/* ===== COVER FLOW ITEM (BOOK CARD) ===== */
.title-column {
  position: absolute;
  top: 10px;
  left: calc(50% - 90px); /* Center 180px card exactly */
  width: 180px;
  height: 426px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  outline: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform-origin: center center;
  transform-style: preserve-3d;
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  touch-action: none;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  -webkit-user-drag: none;
  /* Entrance: fade in, staggered by distance from the centre card (--d set in JS) */
  animation: cf-card-in 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(0.2s + var(--d, 0) * 0.11s);
}

/* Deep "hero" shadow under the centre card; opacity is driven from JS */
.cf-hero-shadow {
  position: absolute;
  top: 0;
  left: 0;
  width: 180px;
  height: 320px;
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
  box-shadow:
    0 30px 50px -18px rgba(36, 30, 25, 0.42),
    0 14px 22px -10px rgba(36, 30, 25, 0.22);
}

/* Video Container — 180x320 VIDEO DIMENSIONS (1:1 with the title preview .bin) */
.video-container {
  width: 180px;
  height: 320px;
  flex-shrink: 0; /* never let the taller title block squeeze the 1:1 preview */
  max-width: 100%;
  aspect-ratio: 9 / 16;
  position: relative;
  background-color: var(--bg-primary, #F7F1E7) !important;
  border: none !important;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.08),
    0 10px 24px -4px rgba(15, 23, 42, 0.12),
    0 3px 8px -1px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  will-change: transform, filter, box-shadow;
  /* Floor reflection. --refl (0..~0.25) is set per card from JS: 0 for the
     centre card (its title block sits there), rising for the side stacks.
     Chrome / Safari only; other browsers simply show no reflection. */
  -webkit-box-reflect: below 6px linear-gradient(to bottom, transparent 0%, transparent 74%, rgba(0, 0, 0, var(--refl, 0)) 100%);
  touch-action: none;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  -webkit-user-drag: none;
  transform: none;
  transition: box-shadow 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  animation: cf-rise-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(0.2s + var(--d, 0) * 0.11s);
}

.title-scene-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;
  border: none !important;
  outline: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  image-rendering: pixelated;
  /* Optional ink-tone filter hook (currently none; ink colour #1a1612 is set in the JS LUT) */
  filter: var(--ink-filter);
}

/* Dynamic Text: Book title and author directly below video */
.title-info-block,
.title-header-block {
  text-align: center;
  margin-top: 26px;
  /* Wider than the 180px column; align-items:center on the column makes it
     overhang evenly on both sides. */
  width: 280px;
  max-width: none;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: opacity;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.title-heading {
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0;
  white-space: normal;
  text-align: center;
  transition: color 0.2s ease;
}

/* Author in spaced small caps */
.title-author {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  font-style: normal;
  font-variant-caps: all-small-caps;
  color: #4a4038;
  margin-top: 6px;
  letter-spacing: 0.16em;
  white-space: normal;
  text-align: center;
}

/* Thin ornamental rule with a centred diamond */
.title-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--ink-color);
  opacity: 0.55;
}

.title-rule::before,
.title-rule::after {
  content: '';
  width: 34px;
  height: 1px;
  background: currentColor;
}

.title-rule span {
  font-size: 7px;
  line-height: 1;
}

.title-hook {
  margin-top: 8px;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 15px;
  font-style: normal;
  line-height: 1.35;
  max-width: 250px;
  text-wrap: balance;
  color: #5b5048;
  letter-spacing: 0.02em;
}

/* Primary call to action (a span inside the card's <a>) */
.cta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 9px 22px 10px;
  border-radius: 999px;
  background: var(--ink-color);
  color: #F7F1E7;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  box-shadow: 0 6px 16px -6px rgba(36, 30, 25, 0.5);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.cta-arrow {
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.title-column.cf-active:hover .cta-pill {
  background: #000;
  box-shadow: 0 10px 22px -8px rgba(36, 30, 25, 0.6);
  transform: translateY(-1px);
}

.title-column.cf-active:hover .cta-arrow {
  transform: translateX(4px);
}

/* Title block children rise in one after another on first load */
.title-info-block > * {
  animation: lb-fade-up 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
.title-info-block > :nth-child(1) { animation-delay: 0.45s; }
.title-info-block > :nth-child(2) { animation-delay: 0.53s; }
.title-info-block > :nth-child(3) { animation-delay: 0.61s; }
.title-info-block > :nth-child(4) { animation-delay: 0.69s; }
.title-info-block > :nth-child(5) { animation-delay: 0.77s; }

/* State-based styling for active center vs background stacks */
.title-column.cf-active {
  pointer-events: auto;
}

.title-column.cf-active .video-container {
  filter: brightness(1);
}

.title-column.cf-left .video-container,
.title-column.cf-right .video-container {
  filter: brightness(0.85);
}

.title-column.cf-active .title-info-block {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.title-column.cf-left .title-info-block,
.title-column.cf-right .title-info-block {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ===== INTERACTIVE HOVER FEEDBACK ===== */
.landing-stage:not(.is-moving):not(.is-swiping) .title-column.cf-active:hover .video-container {
  transform: none;
  box-shadow:
    0 2px 6px rgba(15, 23, 42, 0.08),
    0 14px 28px -4px rgba(15, 23, 42, 0.16),
    0 4px 10px -2px rgba(15, 23, 42, 0.08) !important;
}

.title-column.cf-left:hover .video-container,
.title-column.cf-right:hover .video-container {
  filter: brightness(0.92);
}

.landing-stage:not(.is-moving):not(.is-swiping) .title-column.cf-active:hover .title-info-block {
  transform: none;
}

.title-column:hover .title-heading {
  color: #000;
}

.font-sherlock {
  font-family: 'Pirata One', 'UnifrakturMaguntia', Georgia, serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.font-alice {
  font-family: 'MedievalSharp', cursive;
  font-size: 18px;
  font-weight: 400;
}

.font-odyssey {
  font-family: 'Cinzel Decorative', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.font-usher {
  font-family: 'IM Fell English SC', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ===== PREV / NEXT ARROWS ===== */
.cf-arrow {
  position: absolute;
  top: 170px; /* vertical centre of the 320px video (column top 10px) */
  transform: translateY(-50%);
  z-index: 300;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(36, 30, 25, 0.32);
  background: rgba(247, 241, 231, 0.6);
  color: var(--ink-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.25s ease;
  animation: lb-fade-in 0.8s ease 0.9s backwards;
}

.cf-arrow-prev { left: max(8px, calc(50% - 470px)); }
.cf-arrow-next { right: max(8px, calc(50% - 470px)); }

.cf-arrow:hover {
  background: var(--ink-color);
  border-color: var(--ink-color);
  color: #F7F1E7;
}

.cf-arrow:focus-visible,
.cf-dot:focus-visible {
  outline: 2px solid var(--ink-color);
  outline-offset: 3px;
}

.cf-arrow:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

/* ===== DOT INDICATORS ===== */
.cf-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  animation: lb-fade-in 0.8s ease 1s backwards;
}

.cf-dot {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cf-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(36, 30, 25, 0.28);
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.25s ease;
}

.cf-dot:hover::before {
  background: rgba(36, 30, 25, 0.55);
}

.cf-dot.is-active::before {
  width: 18px;
  background: var(--ink-color);
}

/* ===== ENTRANCE KEYFRAMES ===== */
@keyframes lb-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes lb-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cf-card-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cf-rise-in {
  from { transform: translateY(24px); }
  to { transform: none; }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .landing-stage {
    padding-top: calc(var(--header-height) + 20px);
    padding-bottom: 24px;
  }
  .titles-row {
    perspective: 40em;
    height: 544px;
  }
  .title-column {
    top: 10px;
  }
}

@media (max-width: 640px) {
  .landing-stage {
    padding-top: calc(var(--header-height) + 8px);
    padding-bottom: 16px;
  }
  .titles-row {
    perspective: 40em;
    height: 524px;
    margin: 8px auto 0;
  }
  .title-column {
    top: 5px;
  }
  .title-info-block {
    margin-top: 20px;
  }
  /* Cards fill the width on phones; swipe + dots replace the arrows */
  .cf-arrow {
    display: none;
  }
  /* Neighbours sit closer on phones, so the pool of light is narrower */
  .lamp-beam {
    width: 340px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-logo-link,
  .header-tagline,
  .title-column,
  .video-container,
  .title-info-block > *,
  .cf-arrow,
  .cf-dots,
  .lamp-beam {
    animation: none !important;
  }
  .cta-arrow,
  .cf-dot::before {
    transition: none;
  }
}
