:root {
  color-scheme: dark;
  --bg: #08070a;
  --panel: rgba(17, 15, 23, 0.95);
  --text: #f8f6f7;
  --muted: #b1a8b0;
  --accent: #ff7b6d;
  --button: #ff7b6d;
  --button-hover: #ff906f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 123, 109, 0.18), transparent 30%),
    radial-gradient(
      circle at bottom right,
      rgba(132, 79, 255, 0.12),
      transparent 22%
    ),
    var(--bg);
  color: var(--text);
}

.page-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.hero {
  width: min(100%, 980px);
  padding: 1.5rem;
}

.hero-card {
  display: grid;
  gap: 1.75rem;
  align-items: center;
  grid-template-columns: 1fr;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.28);
}

.cover-image {
  width: 100%;
  display: block;
  object-fit: contain;
  aspect-ratio: 3 / 4;
}

.hero-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.read-chapter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #e1b24a, #5ea79f);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 18px 40px rgba(94, 167, 159, 0.24);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
  border: none;
  cursor: pointer;
  margin-top: 0.75rem;
}

.hero-headline {
  text-align: center;
  padding: 0 1rem;
}

.hero-headline h1,
.hero-headline .subhead {
  margin-left: auto;
  margin-right: auto;
  background: linear-gradient(135deg, #f7e2a9, #d6efe4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  padding: 0 20px;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 700;
  font-size: 0.8rem;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 4vw, 4rem);
  line-height: 0.98;
}

.description {
  margin: 0 0 2rem;
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.75;
}

.description-with-image {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.description-image {
  max-width: 140px;
  width: 100%;
  height: auto;
  border-radius: 20px;
  object-fit: cover;
}

@media (max-width: 720px) {
  .description-with-image {
    flex-direction: column;
    align-items: flex-start;
  }

  .description-image {
    max-width: 100%;
  }
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.email-input {
  padding: 1rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.chapter-container .email-input {
  background: #f5f5f5;
  color: #111;
  border-color: rgba(51, 51, 51, 0.15);
}

.chapter-container .email-input::placeholder {
  color: #666;
}

.email-input:focus {
  outline: none;
  border-color: var(--accent);
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #e1b24a, #5ea79f);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 18px 40px rgba(94, 167, 159, 0.24);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
  border: none;
  cursor: pointer;
}

.download-button:hover:not(:disabled),
.download-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 24px 50px rgba(94, 167, 159, 0.32);
  background: linear-gradient(135deg, #f2d16b, #7ec9bc);
}

.download-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  text-align: center;
}

.message.success {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.info-link {
  color: var(--button);
  text-decoration: underline;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}

body.modal-open {
  overflow: hidden;
}

.modal-panel {
  width: min(100%, 680px);
  max-width: 680px;
  background: #fff;
  color: #111;
  border-radius: 24px;
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.32);
  padding: 2rem;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 999px;
  background: rgba(17, 15, 23, 0.05);
  color: #111;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  margin: 1rem 0 2rem;
  line-height: 1.75;
}

.modal-body ul {
  margin: 1rem 0;
  padding-left: 1.25rem;
}

.modal-body li {
  margin-bottom: 0.8rem;
}

.modal-action-button {
  width: 100%;
}

@media (max-width: 720px) {
  .modal-panel {
    padding: 1.5rem;
  }
}

@media (min-width: 768px) {
  .hero-card {
    grid-template-columns: 1fr 1fr;
  }

  .cover-image {
    min-height: 100%;
  }
}

@media (max-width: 520px) {
  .hero-copy {
    padding: 1.5rem;
  }
}

/* Chapter Preview Styles */
.chapter-preview {
  padding: 4rem 2rem;
  background: linear-gradient(90deg, #e1b24a, #5ea79f);
  border-radius: 24px;
}

.chapter-container {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.8);
  padding: 2rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.08);
}

.chapter-preview h2 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  color: #4d2b17;
}

.read-chapter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #e1b24a, #5ea79f);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 18px 40px rgba(94, 167, 159, 0.24);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
  border: none;
  cursor: pointer;
  margin-bottom: 1rem;
}

.read-chapter-button:hover,
.read-chapter-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 24px 50px rgba(94, 167, 159, 0.32);
  background: linear-gradient(135deg, #f2d16b, #7ec9bc);
}

.chapter-head {
  text-align: center;
  margin-bottom: 3rem;
  color: #4d2b17;
}

.chapter-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: #4a2f1c;
  margin-bottom: 4rem;
}

.chapter-content p {
  margin-bottom: 1.5rem;
}

.chapter-content .section-break {
  text-align: center;
  font-weight: bold;
  font-size: 1.25rem;
  margin: 2rem 0;
}

.chapter-cta {
  text-align: center;
  padding: 3rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chapter-cta .email-form {
  max-width: 400px;
  margin: 0 auto;
}

.cta-text {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  color: var(--muted);
}

@media (max-width: 768px) {
  .page-shell {
    padding: 0;
  }

  .hero {
    padding: 0;
  }

  .hero-headline {
    padding: 1rem 1.5rem;
  }

  .chapter-preview {
    padding: 0;
  }

  .chapter-container {
    margin: 0;
  }

  .chapter-preview h2 {
    font-size: 2rem;
  }

  .chapter-content {
    font-size: 1rem;
  }
}

/* Mobile hero: cover image floats left, copy wraps around and below it */
@media (max-width: 767px) {
  .hero-card {
    display: block;
  }

  .hero-media {
    float: left;
    width: 44%;
    padding: 1.25rem 0.75rem 0.75rem 1.25rem;
  }

  .cover-image {
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    min-height: unset;
    aspect-ratio: 3 / 4;
  }

  .read-chapter-button {
    width: 100%;
    margin-top: 0.65rem;
    margin-bottom: 0;
    padding: 0.55rem 0.5rem;
    font-size: 0.78rem;
    line-height: 1.3;
    box-shadow: none;
  }

  .hero-copy {
    padding: 1.25rem 1.25rem 1.75rem 0.75rem;
  }

  .hero-copy h3 {
    font-size: 1rem;
    line-height: 1.4;
    margin-top: 0;
    margin-bottom: 0.6rem;
  }

  .hero-copy > p {
    font-size: 0.875rem;
    line-height: 1.65;
    margin-bottom: 0.75rem;
  }

  .description {
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 0;
  }

  .description-with-image {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .description-image {
    max-width: 60px;
    border-radius: 12px;
    flex-shrink: 0;
  }
}
