/* ============================================
   Luna Lullaby Bird — site styles
   Deep purple-navy night sky · warm gold accents
   ============================================ */

:root {
  /* Color */
  --bg-deep: #0a0820;
  --bg-mid: #161043;
  --bg-soft: #221858;
  --night: #120b35;

  --text: #f5ecd6;
  --text-soft: rgba(245, 236, 214, 0.78);
  --text-faint: rgba(245, 236, 214, 0.55);

  --gold: #ffd982;
  --gold-bright: #ffe6a0;
  --gold-deep: #f0a830;
  --rose: #f6b7c0;

  --line: rgba(255, 217, 130, 0.18);

  /* Type */
  --font-display: "DM Serif Display", Georgia, serif;
  --font-body: "Quicksand", system-ui, sans-serif;
  --font-friendly: "Fredoka", "Quicksand", system-ui, sans-serif;

  /* Layout */
  --container: 1200px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 28px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(ellipse at 50% 0%, var(--bg-mid) 0%, var(--bg-deep) 60%, #050314 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a { color: inherit; text-decoration: none; }

/* ============================================
   Starfield background
   ============================================ */
.starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.stars {
  position: absolute;
  inset: -10%;
  background-repeat: repeat;
}

.stars--small {
  background-image:
    radial-gradient(1px 1px at 12% 8%, rgba(255,255,255,0.7), transparent 50%),
    radial-gradient(1px 1px at 23% 17%, rgba(255,236,200,0.5), transparent 50%),
    radial-gradient(1px 1px at 67% 42%, rgba(255,255,255,0.6), transparent 50%),
    radial-gradient(1px 1px at 88% 73%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(1px 1px at 33% 88%, rgba(255,236,200,0.5), transparent 50%),
    radial-gradient(1px 1px at 55% 25%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1px 1px at 78% 92%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(1px 1px at 5% 55%, rgba(255,255,255,0.5), transparent 50%);
  background-size: 100% 100%;
  animation: twinkle-slow 7s ease-in-out infinite alternate;
}

.stars--medium {
  background-image:
    radial-gradient(1.5px 1.5px at 18% 35%, rgba(255,217,130,0.8), transparent 60%),
    radial-gradient(1.5px 1.5px at 71% 18%, rgba(255,255,255,0.8), transparent 60%),
    radial-gradient(1.5px 1.5px at 42% 62%, rgba(255,217,130,0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 92% 50%, rgba(255,255,255,0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 9% 78%, rgba(255,217,130,0.6), transparent 60%);
  background-size: 100% 100%;
  animation: twinkle-slow 9s ease-in-out infinite alternate-reverse;
}

.stars--large {
  background-image:
    radial-gradient(2.5px 2.5px at 28% 22%, var(--gold-bright), transparent 60%),
    radial-gradient(2.5px 2.5px at 61% 78%, rgba(255,255,255,0.9), transparent 60%),
    radial-gradient(2.5px 2.5px at 84% 33%, var(--gold-bright), transparent 60%);
  background-size: 100% 100%;
  animation: twinkle-slow 5s ease-in-out infinite alternate;
}

.moon-glow {
  position: absolute;
  top: -10%;
  right: -8%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,217,130,0.18) 0%, rgba(255,217,130,0.06) 35%, transparent 65%);
  filter: blur(40px);
  border-radius: 50%;
}

@keyframes twinkle-slow {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

/* ============================================
   Site header
   ============================================ */
.site-header {
  position: relative;
  z-index: 5;
  padding: 28px clamp(20px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--gold-bright);
  letter-spacing: 0.01em;
}

/* ============================================
   Hero
   ============================================ */
.home {
  position: relative;
  z-index: 2;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 56px) 80px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  padding: clamp(24px, 6vw, 60px) 0;
}

.hero__cover {
  position: relative;
  perspective: 1200px;
}

.cover-button {
  position: relative;
  display: block;
  padding: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 217, 130, 0.18),
    0 0 80px -20px rgba(255, 217, 130, 0.35);
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.5s ease;
  width: 100%;
}

.cover-button:hover,
.cover-button:focus-visible {
  transform: translateY(-6px) rotateX(2deg);
  box-shadow:
    0 40px 80px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 217, 130, 0.35),
    0 0 100px -20px rgba(255, 217, 130, 0.55);
  outline: none;
}

.cover-button img {
  width: 100%;
  height: auto;
  display: block;
}

.cover-button__hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(10, 8, 32, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 217, 130, 0.4);
  border-radius: 999px;
  font-family: var(--font-friendly);
  font-size: 14px;
  font-weight: 500;
  color: var(--gold-bright);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cover-button:hover .cover-button__hint,
.cover-button:focus-visible .cover-button__hint {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* On touch devices, hide the floating hint — it overlaps the printed byline on the cover.
   The tap affordance is obvious from the prominent cover and the visible CTA buttons below. */
@media (hover: none) {
  .cover-button__hint { opacity: 0; }
}

.hero__text {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--rose);
  font-size: clamp(16px, 1.6vw, 20px);
  margin: 0;
  letter-spacing: 0.01em;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(40px, 6.5vw, 80px);
  line-height: 1;
  margin: 0;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
}

.hero__byline {
  font-family: var(--font-friendly);
  font-weight: 500;
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--text-soft);
  margin: 0;
}

.hero__desc {
  font-size: clamp(16px, 1.4vw, 17px);
  color: var(--text);
  margin: 14px 0 8px;
  max-width: 58ch;
  line-height: 1.65;
}

.hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  font-family: var(--font-friendly);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.005em;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  cursor: pointer;
  text-align: center;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.btn--primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  color: #2a1a04;
  box-shadow: 0 8px 24px -8px rgba(255, 217, 130, 0.55);
  font-weight: 600;
}
.btn--primary:hover {
  box-shadow: 0 14px 32px -8px rgba(255, 217, 130, 0.7);
}

.btn--secondary {
  background: rgba(255, 217, 130, 0.06);
  color: var(--gold-bright);
  border: 1px solid rgba(255, 217, 130, 0.35);
}
.btn--secondary:hover {
  background: rgba(255, 217, 130, 0.12);
  border-color: rgba(255, 217, 130, 0.6);
}

.btn--ghost {
  color: var(--text-soft);
  padding: 13px 18px;
  font-size: 14px;
}
.btn--ghost:hover { color: var(--gold-bright); }

/* ============================================
   Footer
   ============================================ */
.site-footer {
  text-align: center;
  padding: 48px 0 8px;
  font-size: 13px;
  color: var(--text-faint);
}

.site-footer p { margin: 0; }

/* ============================================
   Reader (full-screen overlay)
   ============================================ */
.reader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at 50% 30%, #1a1248 0%, #0a0820 60%, #050314 100%);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.reader[hidden] {
  display: none !important;
}

.reader.is-visible {
  opacity: 1;
}

.reader__topbar {
  display: grid;
  grid-template-columns: 60px 1fr 100px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 8, 32, 0.6);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.reader__close {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-soft);
  transition: background 0.2s ease, color 0.2s ease;
}
.reader__close:hover {
  background: rgba(255, 217, 130, 0.12);
  color: var(--gold-bright);
}

.reader__title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--gold-bright);
}

.reader__page-indicator {
  text-align: right;
  font-family: var(--font-friendly);
  font-size: 14px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.reader__stage {
  flex: 1;
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  align-items: center;
  gap: 12px;
  padding: 24px clamp(12px, 2vw, 32px);
  min-height: 0;
}

.reader__nav {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 217, 130, 0.08);
  border: 1px solid rgba(255, 217, 130, 0.25);
  color: var(--gold-bright);
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.reader__nav:hover:not(:disabled) {
  background: rgba(255, 217, 130, 0.18);
  border-color: rgba(255, 217, 130, 0.55);
  transform: scale(1.05);
}

.reader__nav:active:not(:disabled) {
  transform: scale(0.97);
}

.reader__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.reader__viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.spread-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.spread-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.spread-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow:
    0 25px 60px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 217, 130, 0.12);
  /* Allow user pinch-zoom on touch and rotate via device orientation */
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-drag: none;
}

.reader__hint {
  text-align: center;
  font-size: 12px;
  font-family: var(--font-friendly);
  color: var(--text-faint);
  padding: 12px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.reader__hint .desktop-only { display: inline; }
.reader__hint .mobile-only { display: none; }

/* ============================================
   End screen
   ============================================ */
.end-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(ellipse at 50% 30%, #1a1248 0%, #0a0820 60%, #050314 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.end-screen[hidden] {
  display: none !important;
}

.end-screen.is-visible {
  opacity: 1;
}

.end-screen__inner {
  max-width: 560px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.end-screen__icon {
  filter: drop-shadow(0 0 30px rgba(255, 217, 130, 0.4));
  margin-bottom: 4px;
}

.end-screen__eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--rose);
  font-size: 18px;
  margin: 0;
  letter-spacing: 0.05em;
  text-transform: lowercase;
}

.end-screen__title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  margin: 0;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.end-screen__desc {
  font-size: 17px;
  color: var(--text);
  margin: 8px 0 12px;
  line-height: 1.6;
  max-width: 44ch;
}

.end-screen__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 8px;
  }
  .hero__cover {
    max-width: 420px;
    margin: 0 auto;
  }
  .hero__text {
    text-align: center;
    align-items: center;
  }
  .hero__buttons {
    justify-content: center;
  }
  .hero__desc {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .reader__topbar {
    grid-template-columns: 42px 1fr 80px;
    padding: 10px 12px;
  }
  .reader__title {
    font-size: 15px;
  }
  .reader__stage {
    grid-template-columns: 44px 1fr 44px;
    gap: 6px;
    padding: 12px 8px;
  }
  .reader__nav {
    width: 42px;
    height: 42px;
  }
  .reader__hint {
    font-size: 11px;
    padding: 8px;
  }
  .reader__hint .desktop-only { display: none; }
  .reader__hint .mobile-only { display: inline; }
}

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