/* ===== Magazine Layout ===== */
/* Barlow Condensed (headlines) + iA Writer Quattro S (body, semi-mono) + Space Mono (highlights) */
/* Standalone design, independent of the site theme system */

/* === Reset & Base === */
html {
  scroll-behavior: smooth;
}

.magazine {
  margin: 0;
  padding: 0;
  background: #f5f0eb;
  color: #121212;
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.magazine *,
.magazine *::before,
.magazine *::after {
  box-sizing: border-box;
}

/* === Background Color Fade === */
.magazine-hero {
  background: linear-gradient(to bottom, #fe4400 0%, #fe4400 60%, #f5f0eb 100%);
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-bottom: 0;
  overflow: visible;
}

.magazine-body-wrap {
  background: #f5f0eb;
}

/* === Article Container === */
.magazine-article {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* === Header === */
.magazine-header {
  padding: 2.5rem 0 1.5rem;
  margin-bottom: 0;
}

/* Top bar: reading time */
.magazine-topbar {
  display: flex;
  justify-content: center;
  align-items: baseline;
  padding-bottom: 0;
  margin-bottom: 2rem;
}

.magazine-label {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #121212;
  text-transform: none;
  display: block;
}

.magazine-wordmark {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #121212;
}

.magazine-reading-time {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-style: italic;
  font-weight: 400;
  color: rgba(18, 18, 18, 0.6);
}

/* Title: massive, condensed grotesque, ALL CAPS */
.magazine-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 7rem;
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #121212;
  margin: 0 0 1.5rem;
  text-wrap: balance;
  text-align: center;
}

.magazine-title span {
  display: block;
}

/* Subtitle */
.magazine-subtitle {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  color: rgba(18, 18, 18, 0.7);
  text-align: center;
  margin: 0 0 1rem;
}

/* Author + date */
.magazine-meta {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  font-weight: 400;
  color: rgba(18, 18, 18, 0.5);
  text-align: center;
}

.magazine-meta span + span::before {
  content: " — ";
}

/* === Table of Contents === */
.magazine-toc {
  padding: 1.5rem 0;
  margin-bottom: 0;
  text-align: center;
}

.magazine-toc-title {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(18, 18, 18, 0.4);
  margin-bottom: 0.75rem;
  font-weight: 400;
}

.magazine-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: inline-block;
  text-align: left;
  columns: 2;
  column-gap: 2rem;
}

.magazine-toc-list li {
  break-inside: avoid;
  margin-bottom: 0.3rem;
}

.magazine-toc-list a {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #121212;
  text-decoration: none;
  transition: color 0.15s ease;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.magazine-toc-list a:hover {
  color: rgba(18, 18, 18, 0.5);
}

.magazine-toc-number {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: rgba(18, 18, 18, 0.35);
  flex-shrink: 0;
  min-width: 2rem;
  text-align: right;
}

/* === Body: Single Column === */
.magazine-body {
  max-width: 680px;
}

/* === Paragraphs === */
.magazine-body p {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

/* === Opening Quote (epigraph before first chapter text) === */
.magazine-body .epigraph {
  font-style: italic;
  color: #555;
  margin: 0 0 1.5rem;
  padding-left: 1rem;
  border-left: 2px solid #ccc;
  font-size: 0.84rem;
  line-height: 1.6;
}

.magazine-body .epigraph a {
  color: #888;
  text-decoration: none;
  font-style: normal;
  font-size: 0.75rem;
}

.magazine-body .epigraph a:hover {
  color: #fe4400;
}

/* === Chapter Headings === */
.chapter-heading {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #121212;
  margin: 4rem 0 0.75rem;
  padding-top: 0;
  text-align: center;
}

.chapter-heading .chapter-number {
  display: block;
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #AAA;
  margin-bottom: 0.4rem;
}

/* First chapter heading */
.magazine-body .chapter-heading:first-of-type {
  margin-top: 4rem;
}

/* === Introduction (before first chapter) === */
.magazine-intro {
  margin-bottom: 2.5rem;
}

.magazine-intro p {
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 1.15rem;
}

/* === Blockquotes / Pull Quotes === */
.magazine-body blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 1.5rem;
  font-style: italic;
  color: #333;
}

.magazine-body blockquote p {
  margin-bottom: 0.5rem;
}

/* Full-width pull quotes */
.pull-quote {
  text-align: center;
  padding: 2rem 0;
  margin: 2.5rem 0;
}

.pull-quote p {
  font-family: 'Space Mono', monospace;
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.35;
  color: #121212;
  margin: 0 0 0.5rem;
  text-align: center;
}

.pull-quote cite {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: #999;
}

/* === Illustration Placeholders === */
.illustration-placeholder {
  margin: 3rem 0;
  padding: 3rem 2rem;
  border: 1px solid #E0E0E0;
  text-align: center;
  background: #FAFAFA;
}

.illustration-placeholder p {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 400;
  font-style: italic;
  color: #999;
  margin: 0;
  text-align: center;
}

/* === Links === */
.magazine-body a {
  color: #121212;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.magazine-body a:hover {
  color: #888;
}

/* === Horizontal Rules === */
.magazine-body hr {
  border: none;
  margin: 3rem 0;
}

/* === Highlighted passages (Space Mono) === */
.magazine-body .highlight {
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  line-height: 1.45;
  display: block;
  margin: 1rem 0;
}

/* === Emphasis === */
.magazine-body em {
  font-style: italic;
}

.magazine-body strong {
  font-weight: 600;
}

/* === Inline chapter-end underline === */
.chapter-end-text {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* === Footer === */
.magazine-footer {
  padding: 2rem 0 3rem;
  margin-top: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.magazine-back-link {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  color: #999;
  text-decoration: none;
  transition: color 0.15s ease;
}

.magazine-back-link:hover {
  color: #121212;
}

.magazine-copyright {
  font-family: 'iA Writer Quattro S', 'iA Writer Quattro', 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 400;
  color: #BBB;
}

/* === Pill Overlay === */
.pill-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.4s ease;
}

.pill-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem 3.5rem;
  border-radius: 999rem;
  background: rgba(254, 68, 0, 0.7);
  border: 0.3rem solid #fe4400;
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  cursor: pointer;
  box-shadow:
    0 0 40px rgba(254, 68, 0, 0.4),
    0 0 80px rgba(254, 68, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  gap: 0;
}

.pill-button:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 60px rgba(254, 68, 0, 0.5),
    0 0 120px rgba(254, 68, 0, 0.3);
}

.pill-input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  width: 140px;
  padding: 0;
  text-align: center;
}

.pill-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.pill-divider {
  width: 2px;
  height: 1.4em;
  background: rgba(255, 255, 255, 0.35);
}

.pill-submit {
  background: transparent;
  border: none;
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s ease;
}

.pill-submit:hover {
  opacity: 0.7;
}

.pill-submit:hover {
  opacity: 1;
}

/* === Responsive === */

@media (max-width: 600px) {
  .magazine-article {
    padding: 0 1.25rem;
  }

  .magazine-header {
    padding: 1.5rem 0 1rem;
  }

  .magazine-topbar {
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-start;
  }

  .magazine-title {
    font-size: 3.5rem;
  }

  .magazine-subtitle {
    font-size: 1rem;
  }

  .magazine-toc-list {
    columns: 1;
  }

  .chapter-heading {
    font-size: 1.8rem;
  }

  .magazine-body .chapter-heading:first-of-type {
    margin-top: 4rem;
  }

  .pull-quote p {
    font-size: 1.1rem;
  }

  .magazine-body .highlight {
    font-size: 0.9rem;
  }

  .chapter-play-btn {
    width: 28px;
    height: 28px;
  }

  .pill-button {
    font-size: 1.2rem;
    padding: 1rem 2.5rem;
  }

  .pill-input {
    font-size: 1.2rem;
    width: 100px;
  }

  .pill-submit {
    font-size: 1.2rem;
  }
}

/* === Chapter Play Button (TTS) === */
.chapter-play-btn {
  display: none;
}

.chapter-play-btn:hover {
  border-color: rgba(18, 18, 18, 0.5);
  color: rgba(18, 18, 18, 0.6);
}

.chapter-play-btn.loading {
  animation: tts-pulse 1s ease-in-out infinite;
  border-color: rgba(18, 18, 18, 0.4);
  color: rgba(18, 18, 18, 0.4);
}

.chapter-play-btn.playing {
  border-color: #fe4400;
  color: #fe4400;
}

.chapter-play-btn.playing:hover {
  opacity: 0.7;
}

.chapter-play-btn svg {
  display: block;
  flex-shrink: 0;
}

@keyframes tts-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* === Print === */
@media print {
  .magazine {
    font-size: 11pt;
    background: #fff;
  }

  .magazine-article {
    max-width: none;
    padding: 0;
  }

  .magazine-footer {
    display: none;
  }

  .chapter-heading {
    page-break-before: always;
  }

  .illustration-placeholder {
    border-style: solid;
  }

  .pill-overlay {
    display: none;
  }

  .chapter-play-btn {
    display: none;
  }

  .magazine-body-wrap {
    background: #fff;
  }
}
