:root {
  --blue-900: #0b4f8a;
  --blue-800: #0e5d9e;
  --blue-700: #2a79bb;
  --ink-900: #182430;
  --ink-700: #2c3c4c;
  --muted-300: #d5dde6;
  --muted-200: #e6ecf2;
  --panel-bg: #f6f8fb;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI Variable", "Helvetica Neue", Helvetica, sans-serif;
  color: var(--ink-900);
  background: linear-gradient(180deg, #eff4fa 0%, #f7f9fc 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-800));
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 10px;
  gap: 16px;
}

.series-title {
  margin: 0;
  font-size: clamp(1.3rem, 1.1rem + 1vw, 2rem);
  line-height: 1.1;
  font-weight: 700;
}

.brand-block {
  white-space: nowrap;
  font-weight: 600;
  opacity: 0.95;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  padding: 0 18px 8px;
  scrollbar-width: thin;
}

.tab-btn {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  font-size: 1.05rem;
  line-height: 1;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tab-btn:hover,
.tab-btn:focus-visible {
  color: var(--white);
}

.tab-btn[aria-current="page"] {
  color: var(--white);
  border-bottom-color: var(--white);
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 44px minmax(360px, 42vw) minmax(420px, 1fr);
  gap: 0;
  min-height: calc(100vh - 115px);
}

.section-rail {
  position: sticky;
  top: 112px;
  align-self: start;
  height: calc(100vh - 112px);
  background: var(--blue-900);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
}

.rail-link {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: transparent;
  text-indent: -9999px;
  overflow: hidden;
}

.rail-link.active {
  background: var(--white);
}

.content-panel {
  background: var(--panel-bg);
  border-right: 1px solid var(--muted-300);
}

.content-card {
  min-height: 100%;
  background: var(--white);
  margin: 0;
}

.content-meta {
  padding: 14px 20px;
  border-bottom: 1px solid var(--muted-300);
  color: var(--blue-900);
  font-weight: 600;
}

.article {
  padding: 24px 22px 36px;
}

.article h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 1.7rem + 1vw, 3.2rem);
  line-height: 1.05;
  color: #0d6a1f;
}

.overview-intro {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: var(--ink-700);
}

.overview-list {
  margin: 0;
  padding-left: 1.1rem;
}

.overview-list li {
  margin: 0 0 0.55rem;
}

.overview-list a {
  color: var(--blue-900);
  font-size: 1.08rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.overview-group {
  margin: 0 0 1.3rem;
}

.overview-group-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  color: var(--ink-700);
}

.subsection-index {
  margin: 0 0 22px;
}

.subsection-index ul {
  margin: 0;
  padding-left: 22px;
}

.subsection-index li {
  margin: 0 0 6px;
}

.subsection-index a {
  color: var(--blue-900);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.subsection-index a:hover,
.subsection-index a:focus-visible {
  color: var(--blue-700);
}

.story-section {
  margin-bottom: 26px;
  scroll-margin-top: 140px;
}

.section-title {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--ink-700);
}

.section-body {
  font-size: 1.08rem;
  line-height: 1.65;
}

.section-body p {
  margin: 0 0 1rem;
}

.section-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.75rem 0 1rem;
  border-radius: 4px;
}

.section-body h4,
.inline-subheading {
  margin: 1.4rem 0 0.45rem;
  font-size: 1.95rem;
  line-height: 1.12;
  color: var(--ink-700);
}

.section-media img {
  max-width: 100%;
  border-radius: 6px;
  margin-top: 10px;
}

.section-media a {
  color: var(--blue-800);
}

.media-panel {
  background: var(--muted-200);
  padding: 0;
}

.media-card {
  position: sticky;
  top: 112px;
  min-height: calc(100vh - 112px);
  background: #d4dbe3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-image {
  width: 100%;
  height: calc(100vh - 112px);
  object-fit: cover;
  display: none;
}

.hero-image.visible {
  display: block;
}

.hero-empty {
  color: #4b5d6f;
  font-size: 1rem;
}

.hero-empty.hidden {
  display: none;
}

.error {
  border: 1px solid #cf4f4f;
  background: #fff3f3;
  color: #742a2a;
  padding: 14px;
  border-radius: 8px;
}

@media (max-width: 1050px) {
  .layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .section-rail {
    display: none;
  }

  .content-panel {
    border-right: 0;
    border-bottom: 1px solid var(--muted-300);
  }

  .media-card {
    position: static;
    min-height: 280px;
  }

  .hero-image {
    height: min(58vh, 440px);
  }
}
