:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #edf4f2;
  --text: #17201b;
  --muted: #59645f;
  --line: #d8dfdc;
  --red: #b54030;
  --blue: #2265a8;
  --green: #2f6b4f;
  --gold: #b9852c;
  --shadow: 0 18px 45px rgba(23, 32, 27, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.55;
  margin: 0;
}

a {
  color: inherit;
}

.site-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand-link {
  align-items: center;
  display: flex;
  gap: 12px;
  text-decoration: none;
}

.brand-link img {
  border: 1px solid rgba(23, 32, 27, 0.18);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(23, 32, 27, 0.16);
  height: 72px;
  object-fit: cover;
  object-position: 50% 18%;
  width: 49px;
}

.brand-link strong,
.brand-link small {
  display: block;
}

.brand-link small,
.eyebrow {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.site-header nav a,
.quick-links a,
.file-row a,
.pager a {
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
}

.site-header nav a {
  background: #ffffff;
  padding: 8px 10px;
}

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

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px 20px 44px;
}

.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 34px);
}

.index-hero {
  align-items: center;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  margin-bottom: 22px;
}

.draft-style-board {
  aspect-ratio: 1 / 1;
  background: #101310;
  border: 1px solid rgba(23, 32, 27, 0.18);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(23, 32, 27, 0.16);
  display: block;
  height: auto;
  justify-self: end;
  max-width: min(100%, 420px);
  object-fit: contain;
  width: min(100%, 420px);
}

.draft-badge {
  background: var(--red);
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 10px;
  padding: 6px 9px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.8rem);
  max-width: 980px;
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

h3 {
  font-size: 1rem;
}

.lede {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  max-width: 900px;
}

.draft-note,
.card-note {
  color: var(--muted);
  font-weight: 700;
}

.draft-note {
  max-width: 880px;
}

.quick-links,
.file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-links {
  margin-top: 18px;
}

.quick-links a,
.file-row a {
  background: var(--surface-soft);
  padding: 8px 10px;
}

.discussion-panel {
  background: #eaf2ef;
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 18px;
  padding: 18px;
}

.episode-board {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 18px 0 0;
  overflow: hidden;
}

.episode-board img {
  aspect-ratio: 1536 / 1024;
  background: #101310;
  display: block;
  height: auto;
  object-fit: contain;
  width: 100%;
}

.episode-board figcaption {
  color: var(--muted);
  font-weight: 800;
  padding: 14px 16px 16px;
}

.discussion-panel > p {
  color: var(--muted);
  font-weight: 700;
  margin: 10px 0 0;
  max-width: 900px;
}

.discussion-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.discussion-item {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 8px;
  padding: 14px;
}

.discussion-item p {
  color: var(--muted);
  margin: 8px 0 0;
}

.draft-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.draft-card,
.episode-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  padding: 18px;
}

.draft-card:first-child {
  grid-column: 1 / -1;
}

.draft-section {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.draft-section:first-of-type {
  border-top: 0;
}

.draft-section p {
  margin: 8px 0 0;
}

ul {
  margin-bottom: 0;
  padding-left: 1.1rem;
}

.episode-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.episode-card {
  display: grid;
  gap: 10px;
}

.episode-card p {
  margin: 0;
}

.pager {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.pager a {
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  padding: 16px;
}

.pager a:last-child {
  text-align: right;
}

.pager span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.back-to-top {
  background: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  min-height: 48px;
  opacity: 0;
  padding: 0 16px;
  pointer-events: none;
  position: fixed;
  right: 18px;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 80;
}

.back-to-top.is-visible {
  opacity: 0.94;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--red);
}

@media (max-width: 900px) {
  .site-header {
    align-items: stretch;
    display: grid;
  }

  .site-header nav {
    justify-content: stretch;
  }

  .site-header nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .mobile-nav-ready .site-header nav.site-nav {
    display: none;
  }

  .mobile-nav-ready .mobile-page-menu {
    display: grid;
    gap: 6px;
  }

  .mobile-page-menu span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
  }

  .mobile-page-menu select {
    appearance: auto;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-weight: 900;
    min-height: 48px;
    padding: 10px 12px;
    width: 100%;
  }

  .draft-grid,
  .discussion-grid,
  .episode-grid,
  .index-hero,
  .pager {
    grid-template-columns: 1fr;
  }

  .draft-style-board {
    max-width: 520px;
    order: -1;
  }

  .draft-card:first-child {
    grid-column: auto;
  }

  .pager a:last-child {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding: 10px 14px;
  }

  main {
    padding: 16px 14px 34px;
  }

  .brand-link img {
    height: 92px;
    width: 63px;
  }

  .back-to-top {
    bottom: calc(88px + env(safe-area-inset-bottom));
    right: 14px;
  }
}
