:root {
  color-scheme: light;
  --red: #d71920;
  --red-dark: #9d1117;
  --ink: #111214;
  --muted: #665f5b;
  --paper: #fffdf8;
  --line: rgba(17, 18, 20, 0.14);
  --gold: #e0b23b;
  --shadow: 0 22px 70px rgba(17, 18, 20, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(215, 25, 32, 0.07), transparent 36%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand span {
  min-width: 0;
}

.brand img {
  width: 52px;
  aspect-ratio: 0.707 / 1;
  object-fit: cover;
  border: 1px solid rgba(17, 18, 20, 0.18);
  box-shadow: 0 10px 22px rgba(17, 18, 20, 0.16);
}

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

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.brand small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(17, 18, 20, 0.08);
  white-space: nowrap;
}

.btn-primary {
  border-color: var(--red);
  color: white;
  background: var(--red);
}

.btn-secondary {
  color: var(--ink);
  background: white;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--red-dark);
  outline: none;
}

.icon-xs {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 360px);
  gap: clamp(24px, 6vw, 72px);
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: clamp(34px, 7vw, 86px) clamp(16px, 6vw, 84px);
}

.hero-copy {
  max-width: 780px;
}

.hero-copy p,
.section-intro p {
  margin: 0 0 10px;
  color: var(--red-dark);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.4rem, 11vw, 8.8rem);
  line-height: 0.94;
  overflow-wrap: anywhere;
}

.hero-media {
  justify-self: center;
  width: min(100%, 330px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.hero-media img {
  display: block;
  width: 100%;
  border-radius: 4px;
}

.download-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  width: min(calc(100vw - clamp(32px, 12vw, 168px)), 720px);
  max-width: none;
  margin-top: clamp(24px, 4vw, 42px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, white 0%, #fff7f1 100%);
  box-shadow: 0 18px 50px rgba(17, 18, 20, 0.12);
}

.download-copy {
  min-width: 0;
}

.download-copy p {
  margin: 0 0 14px;
  color: var(--red-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.download-copy h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 2.05vw, 2.35rem);
  line-height: 1;
  white-space: nowrap;
}

.download-action {
  display: grid;
  grid-template-columns: auto;
  gap: 6px;
  justify-items: center;
  padding: 10px;
  border: 1px solid rgba(17, 18, 20, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.qr-link {
  display: block;
  width: 104px;
  padding: 8px;
  border: 1px solid rgba(17, 18, 20, 0.16);
  border-radius: 8px;
  background: white;
  box-shadow: inset 0 0 0 4px #fff7f1;
}

.qr-link img {
  display: block;
  width: 100%;
}

.download-btn {
  min-width: 128px;
  min-height: 38px;
  box-shadow: none;
}

.reading-section {
  padding: 32px clamp(16px, 4vw, 56px) 56px;
}

.section-intro {
  max-width: 1280px;
  margin: 0 auto 14px;
}

.section-intro h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}

.toc-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(180deg, rgba(17, 18, 20, 0.16), rgba(17, 18, 20, 0.86)),
    var(--red);
}

.section-nav {
  display: grid;
  gap: 8px;
}

.section-group {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.section-heading {
  margin: 4px 2px 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-link {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
  cursor: pointer;
}

.section-link:hover,
.section-link:focus-visible,
.section-link.is-active {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}

.section-link span {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 750;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reader-panel {
  min-height: 72vh;
  overflow: hidden;
  border: 1px solid rgba(17, 18, 20, 0.18);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.reader-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.7);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  box-shadow: 0 8px 18px rgba(17, 18, 20, 0.08);
  text-decoration: none;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--red);
  outline: none;
}

.icon-button span {
  font-size: 1.45rem;
  line-height: 1;
}

.progress-wrap {
  height: 7px;
  overflow: hidden;
  background: rgba(17, 18, 20, 0.12);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 180ms ease;
}

.article-panel {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: clamp(22px, 5vw, 64px);
  outline: none;
}

.article-kicker {
  margin: 0 0 10px;
  color: var(--red-dark);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.article-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 28px;
}

.article-meta span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fffaf0;
  font-size: 0.82rem;
  font-weight: 800;
}

.article-body {
  display: grid;
  gap: 1rem;
  color: #25201d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.03rem, 1.25vw, 1.2rem);
  line-height: 1.74;
}

.article-body p {
  margin: 0;
}

.article-body .text-heading {
  margin-top: 0.55rem;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  line-height: 1.45;
  text-transform: uppercase;
}

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

  .hero-section {
    min-height: auto;
  }

  .hero-media {
    justify-self: start;
    max-width: 260px;
  }

  .download-panel {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .download-copy h2 {
    white-space: normal;
  }

  .toc-panel {
    position: static;
    max-height: none;
  }

  .section-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 78vw);
    overflow-x: auto;
    padding-bottom: 3px;
    scroll-snap-type: x proximity;
  }

  .section-group {
    margin-bottom: 0;
    scroll-snap-align: start;
  }
}

@media (min-width: 641px) {
  .hero-copy h1 {
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 10px 12px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .reading-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .download-panel {
    grid-template-columns: 1fr;
  }

  .download-action {
    justify-self: stretch;
  }

  .download-copy h2 {
    font-size: clamp(2rem, 8vw, 3rem);
    white-space: normal;
  }

  .qr-link {
    justify-self: center;
    width: min(48vw, 140px);
  }

  .hero-section {
    display: block;
    padding: 24px 12px 26px;
  }

  .hero-media {
    display: none;
  }

  .btn {
    width: 100%;
    min-height: 40px;
    padding-inline: 10px;
    font-size: 0.82rem;
    white-space: normal;
  }

  .reader-controls {
    justify-content: flex-start;
  }

  .toc-panel {
    padding: 12px;
    max-height: 58vh;
    overflow-y: auto;
  }

  .section-nav {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    overflow-x: visible;
    padding-bottom: 0;
    scroll-snap-type: none;
  }

  .section-group {
    margin-bottom: 14px;
    scroll-snap-align: none;
  }

  .section-link {
    min-height: 44px;
    padding: 11px 12px;
  }

  .section-link span {
    -webkit-line-clamp: 3;
  }

  .reader-panel {
    min-height: auto;
  }

  .article-panel {
    padding: 18px;
  }

  .article-panel h2 {
    font-size: clamp(1.75rem, 9vw, 2.6rem);
  }

  .article-body {
    font-size: 1rem;
    line-height: 1.68;
  }
}

@media (max-width: 400px) {
  .brand {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
  }

  .brand img {
    width: 44px;
  }

  .brand strong {
    font-size: 1.08rem;
  }

  .brand small {
    font-size: 0.68rem;
  }

  .header-actions {
    grid-template-columns: 1fr;
  }

  .icon-xs {
    width: 16px;
    height: 16px;
  }
}
