/* ========================================
   JOURNAL ARTICLE - Editorial Page Styles
   Extracted from public/journal/article.html so the server-rendered article
   route (api/journal/render.js, PRD 0002) and the legacy client shell share
   one source of truth. Keep visually identical to the prior inline block.
   ======================================== */

::selection {
  background: var(--primary, #1E6F6B);
  color: var(--stone-50);
}

/* ========================================
   HERO - Full-bleed image + title overlay
   ======================================== */

.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--primary-950);
}

.hero-image {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.6;
  transition: opacity 0.6s ease;
}

.hero-image.loaded { opacity: 0.7; }

.hero-gradient {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 70%;
  background: linear-gradient(to top, var(--bg-dark) 0%, rgba(11,31,31,0.8) 40%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 900px;
  padding: 0 3rem 5rem;
  margin: 0 auto;
  width: 100%;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone-400);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.3s ease;
}

.back-link:hover { color: var(--primary-300); }

.hero-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-400);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 200;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--stone-50);
}

/* ========================================
   LISTEN BAR - Audio narration player
   ======================================== */

.listen-bar {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 3rem 0;
}

.listen-bar-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
}

.listen-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--stone-500);
  flex-shrink: 0;
}

.listen-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--primary-300);
  background: transparent;
  color: var(--primary-300);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.listen-play:hover:not(:disabled) {
  background: var(--primary, #1E6F6B);
  border-color: var(--primary, #1E6F6B);
  color: var(--stone-50);
}

.listen-play:disabled { opacity: 0.4; cursor: wait; }

.listen-play svg { width: 14px; height: 14px; margin-left: 2px; }

/* Equalizer: five bars, volume-reactive via Web Audio when available,
   CSS keyframe fallback otherwise (.is-animating) */
.listen-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.35;
  transition: opacity 0.4s ease;
}

.listen-eq.is-active { opacity: 1; }

.listen-eq span {
  width: 3px;
  height: 18%;
  border-radius: 1.5px;
  background: var(--primary-300);
  transition: height 0.08s linear;
}

.listen-eq.is-active span { background: var(--accent, #C4734C); }

.listen-eq.is-animating span {
  animation: eq-bounce 1.1s ease-in-out infinite;
}

.listen-eq.is-animating span:nth-child(1) { animation-delay: 0s; }
.listen-eq.is-animating span:nth-child(2) { animation-delay: 0.18s; }
.listen-eq.is-animating span:nth-child(3) { animation-delay: 0.36s; }
.listen-eq.is-animating span:nth-child(4) { animation-delay: 0.09s; }
.listen-eq.is-animating span:nth-child(5) { animation-delay: 0.27s; }

@keyframes eq-bounce {
  0%, 100% { height: 18%; }
  50% { height: 95%; }
}

@media (prefers-reduced-motion: reduce) {
  .listen-eq.is-animating span { animation: none; }
  .listen-eq span { transition: none; }
}

.listen-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--stone-500);
}

.listen-audio {
  flex: 1;
  min-width: 200px;
  height: 40px;
}

@media (max-width: 1024px) {
  .listen-bar { padding: 2rem 2rem 0; }
}

@media (max-width: 640px) {
  .listen-bar { padding: 1.5rem 1.5rem 0; }
  .listen-bar-inner { gap: 0.75rem; padding: 0.75rem 1rem; }
}

/* ========================================
   ARTICLE BODY - Editorial typography
   ======================================== */

.article-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 3rem 6rem;
}

.article-body h1 {
  display: none; /* Title is in the hero */
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--stone-50);
  margin: 3rem 0 1.25rem;
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--stone-100);
  margin: 2.5rem 0 1rem;
}

.article-body p {
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--stone-300);
  margin-bottom: 1.5rem;
}

.article-body p:first-of-type {
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--stone-200);
}

.article-body a {
  color: var(--primary-300);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.3s ease;
}

.article-body a:hover { color: var(--accent-400); }

.article-body strong {
  font-weight: 500;
  color: var(--stone-100);
}

.article-body em {
  font-style: italic;
  color: var(--stone-200);
}

.article-body blockquote {
  border-left: 3px solid var(--accent-500);
  padding: 1rem 0 1rem 2rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--stone-200);
  font-size: 1.125rem;
  line-height: 1.7;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.article-body li {
  font-size: 1.0625rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--stone-300);
  margin-bottom: 0.5rem;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--primary-300);
}

.article-body pre {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 2rem 0;
  overflow-x: auto;
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--stone-200);
}

.article-body hr {
  border: none;
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 3rem 0;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 2rem 0;
}

/* Lead / TL;DR - liftable summary at the top of the body */
.article-lead {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 300;
  line-height: 1.6;
  color: var(--stone-100);
  padding: 0 0 1.75rem 1.5rem;
  margin: 0 0 2.5rem;
  border-left: 2px solid var(--accent-500);
}

@media (max-width: 640px) {
  .article-lead { font-size: 1.125rem; padding-left: 1.25rem; margin-bottom: 2rem; }
}

/* ========================================
   RELATED - More from the Journal
   ======================================== */

.related {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 3rem 2rem;
}

.related-heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--stone-500);
  margin-bottom: 1.25rem;
}

.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.related-item a {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
  transition: padding-left 0.3s ease;
}

.related-item a:hover { padding-left: 0.5rem; }

.related-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-400);
}

.related-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--stone-100);
  transition: color 0.3s ease;
}

.related-item a:hover .related-title { color: var(--primary-300); }

@media (max-width: 1024px) {
  .related { padding-left: 2rem; padding-right: 2rem; }
}

@media (max-width: 640px) {
  .related { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* ========================================
   ARTICLE FOOTER - Author + Back
   ======================================== */

.article-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 3rem 6rem;
}

.author-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--primary-300);
  flex-shrink: 0;
}

.author-info h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  color: var(--stone-50);
  margin-bottom: 0.25rem;
}

.author-info p {
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--stone-500);
}

.back-to-journal {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stone-50);
  text-decoration: none;
  margin-top: 3rem;
  transition: color 0.3s ease;
}

.back-to-journal::before { content: '\2190'; }
.back-to-journal:hover { color: var(--primary-300); }

/* ========================================
   LOADING
   ======================================== */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
}

.loading-state p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--stone-500);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--surface);
  border-top-color: var(--primary-300);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 404 state */
.not-found {
  text-align: center;
  padding: 12rem 2rem 6rem;
}

.not-found h1 {
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 100;
  color: var(--stone-700);
  margin-bottom: 1rem;
}

.not-found p {
  font-size: 1.125rem;
  color: var(--stone-500);
  margin-bottom: 2rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
  .hero-content { padding: 0 2rem 4rem; }
  .article-body { padding: 3rem 2rem 5rem; }
  .article-footer { padding-left: 2rem; padding-right: 2rem; }
}

@media (max-width: 768px) {
  .hero { min-height: 55vh; }
  .hero-content { max-width: 100%; }
  .article-body h2 { font-size: 1.5rem; margin-top: 2.5rem; }
  .article-body blockquote { padding-left: 1.5rem; }
}

@media (max-width: 640px) {
  .hero { min-height: 45vh; }
  .hero-content { padding: 0 1.5rem 2.5rem; }
  .hero-title { font-size: clamp(1.75rem, 7vw, 2.5rem); }
  .back-link { margin-bottom: 1.25rem; }
  .article-body { padding: 2.5rem 1.5rem 4rem; }
  .article-body p { font-size: 1rem; line-height: 1.75; }
  .article-body p:first-of-type { font-size: 1.0625rem; }
  .article-body h2 { font-size: 1.375rem; margin-top: 2rem; }
  .article-body h3 { font-size: 1.125rem; }
  .article-body blockquote { padding-left: 1.25rem; font-size: 1rem; }
  .article-body pre { padding: 1rem; margin: 1.5rem 0; }
  .article-body li { font-size: 1rem; }
  .article-footer { padding-left: 1.5rem; padding-right: 1.5rem; padding-bottom: 4rem; }
  .not-found { padding-top: 8rem; }
  .not-found h1 { font-size: 4rem; }
}
