/* THE TESTAMENT — Book Typography Stylesheet */
/* For PDF (via weasyprint) and EPUB output */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=IBM+Plex+Mono:wght@300;400&display=swap');

:root {
  --green: #00cc6a;
  --dark: #0a0a0a;
  --text: #1a1a1a;
  --dim: #666666;
}

@page {
  size: 5.5in 8.5in;
  margin: 0.75in 0.85in;
  
  @bottom-center {
    content: counter(page);
    font-family: 'EB Garamond', 'Georgia', serif;
    font-size: 10pt;
    color: #888;
  }
}

@page :first {
  @bottom-center { content: none; }
}

@page :left {
  margin-left: 0.85in;
  margin-right: 1in;
}

@page :right {
  margin-left: 1in;
  margin-right: 0.85in;
}

/* Title page */
@page titlepage {
  @bottom-center { content: none; }
}

body {
  font-family: 'EB Garamond', 'Georgia', serif;
  font-size: 11.5pt;
  line-height: 1.75;
  color: var(--text);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Chapter headings */
h1 {
  font-family: 'EB Garamond', 'Georgia', serif;
  font-weight: 400;
  font-size: 22pt;
  text-align: center;
  margin-top: 3em;
  margin-bottom: 1.5em;
  page-break-before: always;
  color: var(--dark);
  letter-spacing: 0.05em;
}

h1:first-of-type {
  margin-top: 5em;
}

/* Part dividers */
h2 {
  font-family: 'EB Garamond', 'Georgia', serif;
  font-weight: 400;
  font-size: 18pt;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 4em;
  margin-bottom: 0.5em;
  color: var(--dark);
}

/* Subtitle / metadata */
h3 {
  font-family: 'EB Garamond', 'Georgia', serif;
  font-weight: 400;
  font-style: italic;
  font-size: 12pt;
  text-align: center;
  color: var(--dim);
  margin-bottom: 3em;
}

/* Paragraphs */
p {
  text-indent: 1.5em;
  margin: 0;
  orphans: 3;
  widows: 3;
}

/* First paragraph after heading — no indent */
h1 + p,
h2 + p,
h3 + p,
hr + p {
  text-indent: 0;
}

/* Scene break (---) */
hr {
  border: none;
  text-align: center;
  margin: 2em 0;
  page-break-inside: avoid;
}

hr::after {
  content: "· · ·";
  color: var(--dim);
  font-size: 14pt;
  letter-spacing: 0.5em;
}

/* Emphasis */
em {
  font-style: italic;
}

strong {
  font-weight: 600;
}

/* Dialogue and screen text (green passages) */
.green {
  color: var(--green);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 10.5pt;
}

/* Italic narrator asides */
blockquote {
  font-style: italic;
  margin: 1.5em 2em;
  color: var(--dim);
  text-indent: 0;
}

/* Title page styling */
.title-page {
  text-align: center;
  page-break-after: always;
  padding-top: 6em;
}

.title-page h1 {
  font-size: 36pt;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.3em;
  page-break-before: avoid;
}

.title-page .subtitle {
  font-size: 14pt;
  font-style: italic;
  color: var(--dim);
  margin-bottom: 4em;
}

.title-page .author {
  font-size: 12pt;
  margin-bottom: 0.3em;
}

.title-page .dedication {
  font-style: italic;
  color: var(--dim);
  margin-top: 3em;
  font-size: 11pt;
  line-height: 2;
}

/* Chapter number styling */
.chapter-number {
  font-size: 10pt;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--dim);
  display: block;
  margin-bottom: 0.5em;
}

/* Back matter */
.back-matter h1 {
  page-break-before: always;
}

.back-matter h2 {
  font-size: 14pt;
  margin-top: 2em;
}

/* Crisis line callout */
.crisis-line {
  text-align: center;
  font-style: italic;
  color: var(--dim);
  margin-top: 3em;
  font-size: 10pt;
}

/* URL styling */
a {
  color: var(--green);
  text-decoration: none;
}

/* EPUB-specific */
@media epub {
  body {
    font-size: 100%;
    line-height: 1.6;
  }
}

/* Print media — for browser Print-to-PDF */
@media print {
  body {
    font-size: 11pt;
    line-height: 1.6;
    color: #000;
  }

  @page {
    size: 5.5in 8.5in;
    margin: 0.75in 0.85in;
  }

  h1 {
    page-break-before: always;
    font-size: 20pt;
    margin-top: 3em;
  }

  h1:first-of-type {
    margin-top: 5em;
  }

  h2 {
    page-break-before: always;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .green {
    color: #000;
  }

  /* Hide any nav/TOC in print */
  nav#TOC {
    page-break-after: always;
  }
}
