/* Lumos Autism Newsletter - Design System */
/* Premium publication design - clean, minimal, Substack-quality */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* ========== CSS Variables ========== */
:root {
  --bg-primary: #ffffff;
  --text-primary: #232323;
  --text-secondary: #666666;
  --accent-primary: #273f5d;
  --accent-secondary: #3b82f6;
  --darkest-blue: #0c192c;
  --karaoke-highlight: #3b82f6;
  --card-border: #eaeaea;
  --card-radius: 8px;
  --card-padding: 32px;
  --max-width: 720px;
  --section-gap: 56px;
  --font-family: 'Montserrat', sans-serif;
}

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

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

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  font-weight: 400;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-secondary);
}

img {
  max-width: 100%;
  height: auto;
}

/* ========== Layout Container ========== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== Header ========== */
.header {
  padding: 48px 0 32px;
  text-align: center;
  border-bottom: 1px solid var(--card-border);
}

.header__logo {
  max-width: 90px;
  margin: 0 auto 16px;
  display: block;
}

.header__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.header__subtitle {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.header__edition {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.header__edition a {
  font-weight: 500;
}

/* ========== Section Base ========== */
.section {
  padding: var(--section-gap) 0;
}

.section__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

/* ========== Edition Abstract ========== */
.edition-abstract {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  text-align: center;
  border-bottom: 1px solid var(--card-border);
}

/* ========== Share Buttons ========== */
.share-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0;
}
.share-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px;
  max-width: 30px;
  border-radius: 50%;
  background: #f0f0f0;
  color: #888;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  overflow: hidden;
}
.share-btn:hover {
  background: var(--accent-primary);
  color: white;
  transform: scale(1.08);
}
.share-btn svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  fill: currentColor;
  flex-shrink: 0;
}
.share-btn--whatsapp:hover { background: #25D366; }
.share-btn--facebook:hover { background: #1877F2; }
.share-btn--twitter:hover { background: #000; }
.share-btn--linkedin:hover { background: #0A66C2; }
.share-btn--copy:hover { background: var(--accent-primary); }

/* Share Buttons - Language Visibility */
.share-label.lang-pt { display: inline; }
.share-label.lang-en { display: none; }
html[lang="en"] .share-label.lang-en { display: inline; }
html[lang="en"] .share-label.lang-pt { display: none; }

/* ========== Podcast Section ========== */
.podcast-section {
  padding: var(--section-gap) 0;
  border-bottom: 1px solid var(--card-border);
}

.podcast-section__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.podcast-section__description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.7;
}

/* Audio Player */
.audio-player {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  background: linear-gradient(135deg, #273f5d 0%, #1a2d45 100%);
  border: none;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(39, 63, 93, 0.2);
}

.audio-player audio {
  width: 100%;
  height: 48px;
  border-radius: 8px;
  outline: none;
  filter: invert(1) hue-rotate(180deg) brightness(1.1) contrast(0.9);
}

.audio-player__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.audio-player--placeholder audio {
  opacity: 0.4;
  pointer-events: none;
}

.audio-player--placeholder .audio-player__badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Webkit audio styling */
.audio-player audio::-webkit-media-controls-panel {
  background: transparent;
  border-radius: 8px;
}

.audio-player audio::-webkit-media-controls-play-button {
  background-color: #3b82f6;
  border-radius: 50%;
}

.audio-player audio::-webkit-media-controls-current-time-display,
.audio-player audio::-webkit-media-controls-time-remaining-display {
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 0.75rem;
}

/* Podcast Summary (Table of Contents) */
.podcast-summary {
  background: #ffffff;
  border: none;
  border-radius: var(--card-radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.podcast-summary__title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.podcast-summary__text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.podcast-summary__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.podcast-summary__list li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: 18px;
  position: relative;
  margin-bottom: 6px;
}

.podcast-summary__list li::before {
  content: "\2022";
  color: var(--accent-secondary);
  font-weight: 700;
  position: absolute;
  left: 2px;
}

/* Transcript Controls */
.transcript-controls {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.transcript-controls__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.transcript-controls__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.transcript-controls__toggle input[type="checkbox"] {
  accent-color: var(--accent-primary);
}

/* Transcript Language Tabs - Pill Style */
.transcript-lang-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
}

.transcript-lang-tab {
  padding: 8px 20px;
  border: 1px solid var(--card-border);
  border-bottom: none;
  background: #fafafa;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
  transition: background 0.2s, color 0.2s;
}

.transcript-lang-tab.active {
  background: #ffffff;
  color: var(--accent-primary);
  border-color: var(--card-border);
  border-bottom: 1px solid #fff;
  margin-bottom: -1px;
  z-index: 1;
  position: relative;
}

.transcript-lang-tab:hover:not(.active) {
  background: #f0f0f0;
}

/* Transcript Area - Book-page feel */
.transcript-area {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 0 var(--card-radius) var(--card-radius) var(--card-radius);
  padding: 28px 32px;
  max-height: 800px;
  overflow-y: auto;
  scroll-behavior: smooth;
  line-height: 2.0;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.transcript-area::-webkit-scrollbar {
  width: 5px;
}

.transcript-area::-webkit-scrollbar-track {
  background: transparent;
}

.transcript-area::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.transcript-area::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* Transcript Words & Karaoke */
.transcript-word {
  display: inline;
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.transcript-word:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.transcript-word.active {
  background: var(--karaoke-highlight);
  color: #ffffff;
  border-radius: 3px;
  padding: 1px 3px;
  transform: scale(1.02);
}

/* Speaker Labels */
.transcript-speaker {
  display: block;
  font-weight: 700;
  color: var(--accent-primary);
  margin-top: 16px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.transcript-speaker:first-child {
  margin-top: 0;
}

.transcript-paragraph {
  margin-bottom: 14px;
}

/* ========== Newsletter Section ========== */
.newsletter-section {
  padding: var(--section-gap) 0;
}

.newsletter-section__intro {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.8;
}

/* ========== Article Card ========== */
.article-card {
  background: var(--bg-primary);
  border-radius: var(--card-radius);
  border: 1px solid var(--card-border);
  padding: var(--card-padding);
  margin-bottom: 28px;
  transition: box-shadow 0.25s ease;
  box-shadow: none;
}

.article-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.article-card__position {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: #f0f0f0;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.article-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  line-height: 1.4;
}

.article-card__title a {
  color: inherit;
}

.article-card__title a:hover {
  color: var(--accent-secondary);
}

.article-card__summary {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 18px;
  line-height: 1.8;
}

.article-card__summary p {
  margin-bottom: 12px;
}

.article-card__summary p:last-child {
  margin-bottom: 0;
}

.article-card__why {
  background: #fafafa;
  border-left: 3px solid var(--accent-secondary);
  padding: 16px 20px;
  margin-bottom: 18px;
  border-radius: 0 var(--card-radius) var(--card-radius) 0;
}

.article-card__why-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.article-card__why-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.75;
}

.article-card__source {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.article-card__source a {
  font-weight: 500;
  color: var(--accent-secondary);
}

/* Article Card References */
.article-card__references {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eee;
}

.article-card__references-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.article-card__references-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-card__references-list li {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 3px;
  line-height: 1.5;
}

.article-card__references-list li a {
  color: #999;
  word-break: break-all;
}

.article-card__references-list li a:hover {
  color: var(--accent-secondary);
}

/* ========== References Section (global fallback) ========== */
.references-section {
  padding: var(--section-gap) 0;
  border-top: 1px solid var(--card-border);
}

.references-section__list {
  list-style: decimal;
  padding-left: 24px;
}

.references-section__list li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.references-section__list li a {
  color: #999;
  word-break: break-all;
}

/* ========== Editions List ========== */
.editions-list {
  padding: var(--section-gap) 0;
  border-top: 1px solid var(--card-border);
}

.editions-list__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 16px;
}

.editions-list__items {
  list-style: none;
  padding: 0;
}

.editions-list__item {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.editions-list__item:last-child {
  border-bottom: none;
}

.editions-list__link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
}

.editions-list__date {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.editions-list__current {
  font-size: 0.7rem;
  color: var(--accent-secondary);
  font-weight: 600;
  text-transform: uppercase;
}

/* ========== Footer ========== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.footer__brand {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.footer__text {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 2px;
  line-height: 1.5;
}

.footer__links {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.footer__links a {
  font-size: 0.75rem;
  font-weight: 500;
  color: #999;
}

.footer__links a:hover {
  color: var(--accent-secondary);
}

/* ========== Mobile Responsive ========== */
@media (max-width: 768px) {
  :root {
    --section-gap: 40px;
    --card-padding: 24px;
  }

  html {
    font-size: 16px;
  }

  .container {
    padding: 0 16px;
  }

  .header {
    padding: 36px 0 24px;
  }

  .header__title {
    font-size: 1.5rem;
  }

  .header__logo {
    max-width: 72px;
  }

  .section__title,
  .podcast-section__title {
    font-size: 1.2rem;
  }

  .article-card__title {
    font-size: 1.1rem;
  }

  .transcript-area {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
    max-height: 300px;
    padding: 20px;
    font-size: 0.88rem;
  }

  .audio-player {
    padding: 14px 16px;
  }

  .edition-abstract {
    padding: 24px 16px;
  }
}

@media (max-width: 480px) {
  :root {
    --section-gap: 32px;
    --card-padding: 20px;
  }

  html {
    font-size: 15px;
  }

  .header__title {
    font-size: 1.35rem;
  }

  .header__logo {
    max-width: 64px;
  }

  .editions-list__link {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .footer__links {
    flex-direction: column;
    gap: 8px;
  }

  .transcript-area {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
    max-height: 250px;
    padding: 16px;
  }

  .article-card {
    margin-bottom: 20px;
  }

  .share-buttons {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ========== Print Styles ========== */
@media print {
  .audio-player,
  .transcript-area,
  .transcript-controls,
  .transcript-lang-tabs,
  .share-buttons {
    display: none;
  }

  .article-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  body {
    font-size: 12pt;
  }
}

/* Auto-scroll Switch Toggle */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch__slider {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  background: #ccc;
  border-radius: 22px;
  transition: background 0.3s;
  flex-shrink: 0;
}
.switch__slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .switch__slider {
  background: #3b82f6;
}
.switch input:checked + .switch__slider::after {
  transform: translateX(18px);
}
