/* Base palette and type */
:root {
  color-scheme: light;
  --page: #f7f7f7;
  --paper: #fff;
  --body-copy: #676767;
  --muted: #777;
}

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

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--body-copy);
  font-family: Poppins, "Open Sans", Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 28.8px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

::selection {
  color: #fff;
  background: #333;
}

:focus-visible {
  outline: 2px solid #333;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Shared header */
.page-container,
.site-header,
.footer-inner {
  width: min(1168px, calc(100% - 7.8vw));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 12px;
  padding: 8px 12px;
  transform: translateY(-150%);
  border-radius: 3px;
  background: #fff;
  color: #111;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  display: flex;
  height: 72px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 25px;
  margin-bottom: 15px;
  padding: 0 31px;
  border-radius: 10px;
  background: var(--paper);
}

.site-title {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: calc(100% - 180px);
  overflow: hidden;
  transform: translate(-50%, -50%);
  color: #444;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.site-title:hover {
  color: #000;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.social-links a {
  display: inline-flex;
  width: 18px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: #050505;
  transition: opacity 0.2s ease;
}

.social-links a:hover {
  opacity: 0.6;
}

.social-links svg {
  display: block;
  width: 18px;
  height: 18px;
}

.site-header .social-links a {
  width: 24px;
  height: 24px;
}

.site-header .social-links a:first-child {
  color: #ff0033;
}

.site-header .social-links a:last-child {
  color: #1db954;
}

.site-header .social-links svg {
  width: 22px;
  height: 22px;
}

.mobile-menu-trigger {
  display: none;
}

.search-discover {
  position: absolute;
  top: auto;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.search-discover:focus-visible {
  z-index: 20;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  padding: 9px 12px;
  background: #fff;
}

/* Three-column episode archive */
.home-main {
  min-height: 60vh;
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 30px;
  row-gap: 58px;
  padding-bottom: 38px;
}

.episode-card {
  min-width: 0;
}

.episode-card-link {
  display: block;
}

.episode-image-wrap {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #e9e9e9;
}

.episode-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.2, 0.65, 0.3, 1);
}

.episode-card-link:hover .episode-image,
.episode-card-link:focus-visible .episode-image {
  transform: scale(1.045);
}

.episode-card-title {
  max-width: 100%;
  margin: 14px 0 0;
  color: #000;
  font-family: Georgia, "Times New Roman", serif;
  font-size: min(24px, max(18px, 1.3vw));
  font-weight: 400;
  line-height: 1.3;
}

.episode-card-title span {
  background-image: linear-gradient(to right, #000 0, #000 100%);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size 0.55s cubic-bezier(0.2, 0.75, 0.5, 1);
}

.episode-card-link:hover .episode-card-title span,
.episode-card-link:focus-visible .episode-card-title span {
  background-size: 100% 1px;
}

.search-results-label {
  margin: 22px 0;
  color: var(--muted);
  font-size: 13px;
}

.empty-results {
  min-height: 42vh;
  padding: 70px 0;
  text-align: center;
}

.empty-results h1 {
  color: #666;
  font-family: Poppins, "Open Sans", Helvetica, Arial, sans-serif;
  font-size: 30px;
}

.empty-results p {
  color: var(--muted);
}

.empty-results a {
  text-decoration: underline;
}

/* Footer */
.site-footer {
  min-height: 74px;
  margin-top: 35px;
  padding: 17px 0;
  background: transparent;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 12px;
}

.footer-inner p {
  margin: 0;
}

.footer-inner .social-links {
  gap: 14px;
}

.footer-inner .social-links a {
  color: #777;
}

/* Episode detail, video and transcript */
.episode-page {
  padding-bottom: 72px;
}

.episode-title {
  width: min(900px, calc(100% - 40px));
  margin: 58px auto 48px;
  color: #000;
  font-family: Poppins, "Open Sans", Helvetica, Arial, sans-serif;
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-align: center;
}

.episode-article {
  width: min(900px, calc(100% - 64px));
  margin: 0 auto;
}

.video-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #111;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.transcript {
  margin: 28px auto 0;
  color: #444;
  font-family: "Source Serif Pro", Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 30px;
}

.transcript-segment {
  margin: 0 0 24px;
}

.transcript-time {
  display: inline-block;
  margin-bottom: 4px;
  color: #222;
  font-size: 16px;
  line-height: 24px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.transcript-time:hover {
  color: #000;
}

.transcript-segment p {
  margin: 0;
  font: inherit;
}

/* A site-native static 404 */
.not-found-page {
  display: grid;
  min-height: 58vh;
  place-items: center;
  padding: 48px 24px;
  text-align: center;
}

.not-found-inner {
  max-width: 640px;
}

.not-found-code {
  margin: 0 0 8px;
  color: #777;
  font-size: 14px;
  letter-spacing: 0.15em;
}

.not-found-inner h1 {
  margin: 0 0 22px;
  color: #555;
  font-family: Poppins, "Open Sans", Helvetica, Arial, sans-serif;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.15;
}

.not-found-inner a {
  text-decoration: underline;
}

/* Search and mobile menu overlays */
.search-backdrop,
.menu-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  animation: fade-in 0.2s ease both;
}

.search-panel {
  position: relative;
  display: grid;
  width: min(900px, calc(100% - 48px));
  min-height: 100%;
  margin: 0 auto;
  align-items: center;
}

.search-panel form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-panel input[type="search"] {
  width: 100%;
  padding: 14px 2px 16px;
  border: 0;
  border-bottom: 1px solid #222;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: #222;
  font-size: clamp(24px, 4vw, 42px);
}

.search-panel input[type="search"]::placeholder {
  color: #777;
}

.search-panel form span {
  color: #777;
  font-size: 13px;
}

.close-control {
  position: absolute;
  z-index: 2;
  top: 25px;
  right: 0;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: #111;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.close-control:hover {
  background: rgba(0, 0, 0, 0.12);
}

.offcanvas-menu {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  width: min(380px, 88vw);
  height: 100%;
  flex-direction: column;
  gap: 24px;
  padding: 90px 32px 32px;
  background: #fff;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.12);
  animation: slide-in 0.25s ease both;
}

.offcanvas-menu > a {
  font-size: 20px;
  font-weight: 600;
}

.offcanvas-menu .social-links {
  margin-top: auto;
  justify-content: flex-start;
}

.menu-search {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: #555;
  cursor: pointer;
  text-align: left;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive layout */
@media (max-width: 1300px) and (min-width: 1000px) {
  .episode-title {
    font-size: 48px;
    line-height: 1.12;
  }
}

@media (max-width: 999px) and (min-width: 691px) {
  .episode-card-title {
    font-size: 20px;
  }

  .episode-title {
    margin: 48px auto 40px;
    font-size: 40px;
    line-height: 1.15;
  }
}

@media (max-width: 690px) {
  .page-container,
  .site-header,
  .footer-inner {
    width: calc(100% - 36px);
  }

  .site-header {
    height: 64px;
    margin-top: 14px;
    margin-bottom: 13px;
    padding: 0 15px;
  }

  .site-title {
    max-width: calc(100% - 112px);
    font-size: clamp(14px, 4vw, 18px);
    letter-spacing: -0.5px;
  }

  .mobile-menu-trigger {
    display: flex;
    width: 25px;
    height: 26px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    margin-right: auto;
    padding: 3px;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .mobile-menu-trigger span {
    width: 18px;
    height: 1px;
    background: #111;
  }

  .social-links {
    gap: 12px;
  }

  .social-links a {
    width: 16px;
  }

  .social-links svg {
    width: 16px;
    height: 16px;
  }

  .site-header .social-links {
    gap: 10px;
  }

  .site-header .social-links a {
    width: 24px;
    height: 24px;
  }

  .site-header .social-links svg {
    width: 20px;
    height: 20px;
  }

  .episode-grid {
    grid-template-columns: 1fr;
    row-gap: 33px;
    padding-bottom: 20px;
  }

  .episode-card-title {
    margin-top: 16px;
    font-size: 18px;
  }

  .site-footer {
    margin-top: 20px;
  }

  .footer-inner {
    font-size: 10px;
  }

  .episode-page {
    padding-bottom: 52px;
  }

  .episode-title {
    width: calc(100% - 36px);
    margin: 36px auto 20px;
    font-size: 34px;
    line-height: 1.15;
  }

  .episode-article {
    width: calc(100% - 36px);
  }

  .transcript {
    margin-top: 23px;
    font-size: 18px;
    line-height: 1.55;
  }

  .transcript-time {
    font-size: 15px;
    line-height: 1.45;
  }

  .transcript-segment {
    margin-bottom: 20px;
  }

  .search-panel {
    width: calc(100% - 36px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
