/* Medium-inspired reading experience */

:root {
  --text: rgba(0, 0, 0, 0.84);
  --text-soft: rgba(0, 0, 0, 0.68);
  --text-muted: rgba(0, 0, 0, 0.54);
  --text-faint: rgba(0, 0, 0, 0.38);
  --bg: #ffffff;
  --bg-subtle: #f9f9f9;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.15);
  --accent: #1a8917;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --article: 680px;
  --layout: 1080px;
  --masthead-h: 57px;
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 20px;
  line-height: 1.58;
  letter-spacing: -0.003em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--text);
  z-index: 300;
  transition: width 0.1s linear;
}

/* Masthead */
.masthead {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--masthead-h);
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.masthead__inner {
  max-width: var(--layout);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.masthead__logo {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}

/* Layout: TOC + article */
.layout {
  max-width: var(--layout);
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--masthead-h) + 32px);
  padding-top: 48px;
}

.toc__title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc__list li {
  margin-bottom: 8px;
}

.toc__list a {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 0;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -12px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc__list a:hover,
.toc__list a:focus-visible {
  color: var(--text);
}

.toc__list a.is-active {
  color: var(--text);
  border-left-color: var(--text);
  font-weight: 500;
}

.article-wrap {
  min-width: 0;
}

.article {
  max-width: var(--article);
  margin: 0 auto;
  padding-top: 32px;
}

/* Article header — Medium pattern */
.article-header {
  margin-bottom: 40px;
}

.article-tag {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.article-title {
  margin: 0 0 24px;
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

.article-subtitle {
  margin: 0 0 32px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.003em;
  color: var(--text-soft);
}

.byline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.byline__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #242424;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
}

.byline__text {
  margin: 0;
}

.byline__author {
  margin: 0 0 2px;
  font-size: 14px;
  line-height: 1.4;
}

.byline__author a {
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.byline__author a:hover,
.byline__author a:focus-visible {
  text-decoration: underline;
}

.byline__meta {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Hero figure */
.figure {
  margin: 0 0 48px;
}

.figure--hero figcaption {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

.arch-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 28px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.arch-flow__step {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
}

.arch-flow__arrow {
  font-size: 16px;
  color: var(--text-faint);
  user-select: none;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* Sections */
.story-section {
  scroll-margin-top: calc(var(--masthead-h) + 24px);
}

.story-section__title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.story-section__lede {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Manager pull quote */
.pull-quote {
  margin: 0;
  padding: 0 0 0 24px;
  border-left: 3px solid var(--text);
}

.pull-quote p {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.45;
  letter-spacing: -0.003em;
  color: var(--text-soft);
}

.pull-quote p:last-child {
  margin-bottom: 0;
}

.pull-quote__emphasis {
  font-style: italic;
  color: var(--text);
}

/* Body text — Medium article rhythm */
.body-text {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.58;
  letter-spacing: -0.003em;
  color: var(--text);
}

.body-text p {
  margin: 0 0 24px;
}

.body-text ul {
  margin: 0 0 24px;
  padding-left: 30px;
}

.body-text li {
  margin-bottom: 8px;
}

.body-text li:last-child {
  margin-bottom: 0;
}

.first-paragraph::first-letter {
  font-size: 68px;
  line-height: 0.85;
  float: left;
  margin: 6px 10px 0 0;
  font-weight: 700;
  color: var(--text);
}

.inline-heading {
  margin: 40px 0 8px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chapter-heading {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.chapter-heading--closing {
  margin-top: 48px;
}

.subchapter {
  margin: 36px 0 12px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.highlight-box {
  margin-top: 32px !important;
  padding: 24px 28px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--text);
  font-size: 20px;
  line-height: 1.55;
}

/* Article footer */
.article-footer {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.author-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.author-card__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #242424;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
}

.author-card__label {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.author-card__name {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}

.author-card__name a {
  text-decoration: none;
  color: var(--text);
}

.author-card__name a:hover,
.author-card__name a:focus-visible {
  text-decoration: underline;
}

.author-card__link {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.author-card__link:hover,
.author-card__link:focus-visible {
  text-decoration: underline;
}

.article-footer__note {
  margin: 0;
  font-size: 13px;
  color: var(--text-faint);
}

/* Responsive */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-bottom: 48px;
  }

  .toc {
    position: static;
    padding: 24px 0 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
  }

  .toc__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  .toc__list a {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    font-size: 13px;
  }

  .toc__list a.is-active {
    border-left: none;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 18px;
  }

  .article {
    padding-top: 16px;
  }

  .article-subtitle {
    font-size: 20px;
  }

  .body-text {
    font-size: 18px;
  }

  .pull-quote p {
    font-size: 20px;
  }

  .first-paragraph::first-letter {
    font-size: 56px;
  }

  .arch-flow {
    flex-direction: column;
    gap: 10px;
  }

  .arch-flow__arrow {
    transform: rotate(90deg);
  }
}
