/* ============================================================
   The K Street Health Brief — Capitol Editorial
   Premium policy publication aesthetic
   ============================================================ */

:root {
  --navy:       #1a365d;
  --navy-deep:  #0f2440;
  --navy-light: #2a4a7f;
  --gold:       #c27d38;
  --gold-muted: #d4a06a;
  --gold-pale:  #f5e6d0;
  --slate:      #64748b;
  --slate-light:#94a3b8;
  --slate-wash: #f1f5f9;
  --ink:        #1e293b;
  --body-text:  #334155;
  --cream:      #faf8f5;
  --white:      #ffffff;
  --rule-color: #cbd5e1;
  --font-serif: 'Lora', 'Charter', 'Georgia', serif;
  --font-sans:  'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  color: var(--body-text);
  background: var(--cream);
  line-height: 1.7;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--article {
  max-width: 680px;
}

/* --- Loading screen --- */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  z-index: 100;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-inner { text-align: center; }

.loading-rule {
  width: 48px;
  height: 3px;
  background: var(--gold);
  margin: 0 auto 16px;
  animation: loading-pulse 1.2s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.3; width: 48px; }
  50% { opacity: 1; width: 80px; }
}

.loading-text {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--slate);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- Masthead --- */
.masthead {
  background: var(--navy);
  color: var(--white);
  padding: 0;
  text-align: center;
}

.masthead-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 28px;
}

.masthead-rule {
  height: 2px;
  margin: 0 auto;
}

.masthead-rule--top {
  background: var(--gold);
  width: 64px;
  margin-bottom: 28px;
}

.masthead-rule--bottom {
  background: var(--gold);
  width: 200px;
  margin-top: 16px;
  opacity: 0.4;
}

.masthead-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.masthead-icon {
  font-size: 0.5rem;
  color: var(--gold);
  opacity: 0.7;
}

.masthead-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--white);
}

.masthead-subtitle {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--slate-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 10px;
}

.masthead-date {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gold-muted);
  letter-spacing: 0.04em;
  margin-top: 16px;
}

/* --- Reveal animations --- */
.app {
  animation: app-reveal 0.6s ease-out;
}

@keyframes app-reveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Episode header --- */
.episode-header {
  padding: 40px 0 8px;
}

.episode-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 10px;
}

.episode-description {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--slate);
  line-height: 1.5;
}

/* --- Audio player --- */
.player-section {
  padding: 24px 0 12px;
}

.player {
  background: var(--white);
  border: 1px solid var(--rule-color);
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(26, 54, 93, 0.06);
}

.player-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-label-icon {
  color: var(--gold);
  font-size: 0.85rem;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--navy);
  background: var(--navy);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.play-btn:hover {
  background: var(--navy-light);
  border-color: var(--navy-light);
  transform: scale(1.05);
}

.play-btn:active {
  transform: scale(0.97);
}

.play-btn svg {
  margin-left: 2px; /* optical centering for play triangle */
}

.play-btn svg:last-child {
  margin-left: 0;
}

.skip-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}

.skip-btn:hover {
  background: var(--slate-wash);
}

.skip-btn:active {
  transform: scale(0.92);
}

.skip-label {
  position: absolute;
  font-family: var(--font-sans);
  font-size: 0.48rem;
  font-weight: 700;
  color: var(--navy);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin-top: 1px;
  pointer-events: none;
}

.player-track {
  flex: 1;
  min-width: 0;
}

.player-progress-wrap {
  position: relative;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.player-progress-bg {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--slate-wash);
  border-radius: 2px;
}

.player-progress-fill {
  position: absolute;
  left: 0;
  height: 4px;
  width: 0%;
  background: var(--navy);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.player-progress-knob {
  position: absolute;
  left: 0%;
  width: 14px;
  height: 14px;
  background: var(--navy);
  border: 2px solid var(--white);
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  opacity: 0;
  transition: opacity 0.2s;
}

.player-progress-wrap:hover .player-progress-knob,
.player.is-playing .player-progress-knob {
  opacity: 1;
}

.player-times {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--slate-light);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* --- Show notes --- */
.show-notes-section {
  padding: 8px 0 0;
}

.show-notes-details {
  background: var(--white);
  border: 1px solid var(--rule-color);
  border-radius: 10px;
  overflow: hidden;
}

.show-notes-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.show-notes-toggle::-webkit-details-marker { display: none; }

.show-notes-label {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.show-notes-chevron {
  font-size: 0.7rem;
  color: var(--slate-light);
  transition: transform 0.2s;
}

.show-notes-details[open] .show-notes-chevron {
  transform: rotate(180deg);
}

.show-notes-body {
  padding: 0 20px 20px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--body-text);
  line-height: 1.65;
  white-space: pre-line;
}

.show-notes-body a {
  color: var(--navy-light);
  text-decoration: underline;
  text-decoration-color: var(--gold-muted);
  text-underline-offset: 2px;
}

.show-notes-body a:hover {
  color: var(--gold);
}

/* --- Article body --- */
.briefing {
  padding: 20px 0 48px;
}

.briefing-rule {
  height: 1px;
  background: var(--rule-color);
  margin-bottom: 36px;
}

/* Table of contents */
.article-toc {
  background: var(--white);
  border: 1px solid var(--rule-color);
  border-radius: 8px;
  padding: 18px 24px;
  margin-bottom: 32px;
}

.toc-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.article-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}

.article-toc li {
  counter-increment: toc-counter;
  margin-bottom: 6px;
  line-height: 1.4;
}

.article-toc li::before {
  content: counter(toc-counter) ".";
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-light);
  margin-right: 8px;
}

.article-toc a {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  transition: color 0.15s;
}

.article-toc a:hover {
  color: var(--gold);
}

.article-body h2 {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 44px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-color);
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin: 36px 0 14px;
  line-height: 1.35;
  padding-left: 14px;
  border-left: 3px solid var(--gold);
  scroll-margin-top: 24px;
}

.article-body h3:first-child {
  margin-top: 0;
}

.article-body p {
  margin-bottom: 16px;
  line-height: 1.75;
}

.article-body strong {
  color: var(--ink);
  font-weight: 600;
}

.article-body a {
  color: var(--navy-light);
  text-decoration: underline;
  text-decoration-color: var(--gold-muted);
  text-underline-offset: 2px;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.article-body a:hover {
  color: var(--gold);
  text-decoration-color: var(--gold);
}

.article-body ul, .article-body ol {
  margin: 0 0 16px 0;
  padding-left: 24px;
}

.article-body li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.article-body li::marker {
  color: var(--gold);
}

.article-body blockquote {
  margin: 24px 0;
  padding: 16px 24px;
  border-left: 3px solid var(--gold);
  background: var(--white);
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: var(--slate);
}

.article-body blockquote p {
  margin-bottom: 0;
}

.article-body hr {
  border: none;
  height: 1px;
  background: var(--rule-color);
  margin: 32px 0;
}

/* Editorial intro styling — first paragraph before any heading.
   When article-toc is present it becomes the first child, so we
   also target the first <p> after the TOC via adjacent-sibling and
   :first-of-type so the editorial paragraph always gets styled.  */
.article-body > p:first-child,
.article-body > .article-toc + h2 + p,
.article-body > p:first-of-type {
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.8;
}

/* --- Sources --- */
.sources-section {
  padding: 0 0 48px;
}

.sources-rule {
  height: 1px;
  background: var(--rule-color);
  margin-bottom: 28px;
}

.sources-heading {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 18px;
}

.sources-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 10px;
}

.source-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--rule-color);
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.source-item:hover {
  border-color: var(--gold-muted);
  box-shadow: 0 1px 4px rgba(194, 125, 56, 0.1);
}

.source-item a {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  line-height: 1.4;
  flex: 1;
}

.source-item a:hover {
  color: var(--gold);
}

.source-badge {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--slate);
  background: var(--slate-wash);
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* --- Footer --- */
.site-footer {
  padding: 0 0 48px;
}

.footer-rule {
  height: 2px;
  background: var(--navy);
  margin-bottom: 24px;
}

.footer-text {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--slate);
  text-align: center;
  letter-spacing: 0.02em;
}

.footer-text strong {
  color: var(--navy);
  font-weight: 600;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  html { font-size: 16px; }

  .masthead-inner { padding: 32px 20px 24px; }
  .masthead-brand { gap: 10px; }
  .masthead-icon { display: none; }
  .masthead-rule--bottom { width: 120px; }

  .episode-header { padding: 32px 0 4px; }

  .player { padding: 16px 18px; }
  .player-controls { gap: 12px; }
  .play-btn { width: 40px; height: 40px; }
  .skip-btn { width: 32px; height: 32px; }

  .container { padding: 0 18px; }

  .article-body h3 {
    font-size: 1.15rem;
    padding-left: 12px;
  }

  .article-body blockquote {
    padding: 12px 16px;
    margin: 20px 0;
  }

  .source-item {
    flex-direction: column;
    gap: 4px;
  }

  .source-badge {
    align-self: flex-start;
  }
}

@media (min-width: 1024px) {
  .sources-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Print (for lobbyists who print their briefings) --- */
@media print {
  .player-section,
  .loading-screen,
  .masthead-rule--top,
  .masthead-rule--bottom { display: none; }

  body { background: white; color: black; }
  .masthead { background: white; color: black; border-bottom: 2px solid black; }
  .masthead-title { color: black; }
  .masthead-subtitle, .masthead-date { color: #555; }
  .article-body a { color: black; }
  .article-body h3 { border-left-color: #888; }
}
