:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-soft: #eff6ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  padding: 1.2rem 1.25rem;
  background: linear-gradient(120deg, #0f172a, #1d4ed8);
  color: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
}

.topbar p {
  margin: 0.25rem 0 0;
  opacity: 0.9;
}

.layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 1rem;
  padding: 1rem;
}

.sidebar {
  position: sticky;
  top: 0.8rem;
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  max-height: calc(100vh - 1.6rem);
  overflow: auto;
}

.sidebar h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

#menu {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.menu-link {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  line-height: 1.25;
}

.menu-link:hover {
  background: #f3f4f6;
}

.menu-link.active {
  background: var(--brand-soft);
  border-color: #bfdbfe;
  color: #1d4ed8;
  font-weight: 600;
}

.content {
  display: grid;
  gap: 0.9rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  scroll-margin-top: 1rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.section-card.is-skeleton {
  min-height: 360px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #e5e7eb;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.25s infinite;
}

.skeleton-media {
  height: 220px;
  margin-bottom: 0.85rem;
}

.skeleton-preview {
  border: 1px solid var(--line);
}

.skeleton-preview .is-ready-image {
  opacity: 0;
  transition: opacity 180ms ease;
}

.skeleton-preview.image-visible .is-ready-image {
  opacity: 1;
}

.skeleton-overlay {
  position: absolute;
  inset: 0;
}

.skeleton-preview.image-visible .skeleton-overlay {
  display: none;
}

.skeleton-line {
  height: 13px;
  margin-bottom: 0.55rem;
}

.skeleton-line.short {
  width: 62%;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.media {
  display: block;
  margin-bottom: 0.85rem;
}

.cover-link {
  position: relative;
  display: block;
  width: min(100%, 420px);
  aspect-ratio: 1414 / 2000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f3f4f6;
}

.media-skeleton {
  position: absolute;
  inset: 0;
  border-radius: 0;
}

.cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 180ms ease;
  object-fit: cover;
  background: #f3f4f6;
}

.cover-link.is-ready .cover {
  opacity: 1;
}

.cover-link.is-ready .media-skeleton {
  display: none;
}

.section-title {
  margin: 0.95rem 0 0.45rem;
  font-size: 0.95rem;
  color: #0f172a;
}

.summary {
  margin: 0;
  color: #111827;
}

.points {
  margin: 0.3rem 0 0;
  padding-left: 1.15rem;
}

.points li {
  margin: 0.28rem 0;
}

.pdf-list {
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.pdf-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fafafa;
}

.pdf-title {
  margin: 0 0 0.55rem;
  font-weight: 600;
}

.pdf-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pdf-link {
  text-decoration: none;
  background: var(--brand);
  color: #fff;
  padding: 0.45rem 0.72rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}

.pdf-link.secondary {
  background: #374151;
}

details {
  margin-top: 0.9rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.75rem;
}

summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand);
}

.transcript {
  margin-top: 0.65rem;
  white-space: pre-wrap;
  line-height: 1.45;
  color: #111827;
}

.transcript-loading {
  color: var(--muted);
}

.loading,
.error {
  margin: 0;
  padding: 1rem;
  background: var(--panel);
  border-radius: 10px;
  border: 1px solid var(--line);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: unset;
  }

  #menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

}
