:root {
  --bg: #f4f7fb;
  --paper: rgba(248, 250, 252, 0.9);
  --paper-strong: rgba(252, 253, 255, 0.96);
  --ink: #1e293b;
  --muted: #526171;
  --teal: #2563eb;
  --gold: #f97316;
  --link: #1d4ed8;
  --link-hover: #1e40af;
  --line: rgba(29, 42, 47, 0.1);
  --shadow: 0 24px 60px rgba(45, 35, 20, 0.1);
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(249, 115, 22, 0.14), transparent 24%),
    radial-gradient(circle at 88% 12%, rgba(37, 99, 235, 0.12), transparent 22%),
    linear-gradient(180deg, #f7fafc 0%, #eef4fb 50%, #e9f0f8 100%);
}

a {
  color: var(--link);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  transition:
    color 160ms ease,
    text-decoration-color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

a:hover,
a:focus-visible {
  color: var(--link-hover);
}

a:focus-visible {
  outline: 2px solid rgba(27, 118, 104, 0.24);
  outline-offset: 3px;
  border-radius: 8px;
}

.shell {
  width: min(calc(100% - 28px), var(--max-width));
  margin: 0 auto;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  width: 100vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 0;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 14px max(18px, calc((100vw - var(--max-width)) / 2 + 18px));
  border-radius: 0 0 28px 28px;
  background: rgba(248, 251, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-top: 0;
  border-left: 0;
  border-right: 0;
  box-shadow: 0 10px 26px rgba(45, 35, 20, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 700;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.nav-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--ink);
  border-color: rgba(37, 99, 235, 0.3);
}

.hero {
  display: grid;
  gap: 18px;
  padding: 28px 0 22px;
}

.article-hero .lede {
  max-width: 66ch;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.hero-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.hero-side {
  display: grid;
  gap: 16px;
}

.hero-side-card {
  padding: 22px;
  border-radius: 26px;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.54);
  box-shadow: var(--shadow);
}

.hero-side-note {
  background: var(--paper-strong);
}

.hero-side-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.hero-stat-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.hero-stat {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
}

.hero-stat strong {
  font-size: 1.32rem;
  line-height: 1;
}

.hero-stat span {
  color: var(--muted);
  line-height: 1.55;
}

.brand-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.brand-line a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.brand-line a:hover,
.brand-line a:focus-visible {
  color: var(--link-hover);
  border-color: rgba(27, 118, 104, 0.24);
}

.brand-line span {
  color: rgba(29, 42, 47, 0.34);
}

.brand-line strong {
  color: var(--ink);
  font-weight: 700;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.publication-frame {
  display: grid;
  gap: 18px;
  padding: 24px;
  margin-bottom: 40px;
  border-radius: 34px;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.54);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.publication-frame::before {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.92), rgba(249, 115, 22, 0.92));
}

.publication-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.publication-header h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.05;
}

.publication-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.editor-note {
  padding: 18px 20px;
  border-radius: 24px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
}

.editor-note p:last-child {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.72;
}

.hero p {
  max-width: 56ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.hero-links {
  margin-top: 2px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 40px;
}

.publication-grid {
  padding-bottom: 0;
}

.card,
.article-shell {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.54);
  box-shadow: var(--shadow);
  min-width: 0;
}

.card {
  padding: 24px;
  border-radius: 28px;
}

.card-feature {
  position: relative;
  overflow: hidden;
}

.card-feature::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.publication-card {
  display: grid;
  align-content: start;
  gap: 0;
  min-height: 280px;
}

.publication-kicker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.issue-pill {
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.1);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.card h2 {
  margin: 8px 0 10px;
  font-size: 1.6rem;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
}

.card-links a:not(.button-primary):not(.button-secondary) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 99, 235, 0.24);
}

.card-links a:not(.button-primary):not(.button-secondary)::after {
  content: "\203A";
  font-size: 1.05em;
  line-height: 1;
}

.card-links a:not(.button-primary):not(.button-secondary):hover,
.card-links a:not(.button-primary):not(.button-secondary):focus-visible {
  color: var(--link-hover);
  border-color: rgba(30, 64, 175, 0.45);
  transform: translateX(1px);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.button-primary {
  background: linear-gradient(135deg, var(--teal) 0%, #1e3a8a 100%);
  color: #f8faf8;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  color: var(--ink);
}

.article-shell {
  padding: 26px;
  border-radius: 30px;
  margin: 22px 0 40px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  min-width: 0;
}

.meta-pill {
  min-height: 34px;
  max-width: 100%;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.article-content {
  max-width: 760px;
  min-width: 0;
}

.article-side {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.side-card {
  padding: 20px;
  border-radius: 24px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  min-width: 0;
}

.side-card h2 {
  margin: 8px 0 10px;
  font-size: 1.45rem;
}

.side-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.toc-card {
  padding-bottom: 18px;
}

.toc-links {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.toc-links p {
  margin: 0;
}

.toc-link {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.45;
  background: rgba(37, 99, 235, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.08);
}

.toc-sub {
  margin-left: 14px;
  font-size: 0.94rem;
  color: var(--muted);
}

.article-content h1 {
  margin: 24px 0 16px;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.article-content h2 {
  margin: 28px 0 12px;
  font-size: clamp(1.6rem, 3vw, 2.05rem);
  line-height: 1.08;
  scroll-margin-top: 100px;
}

.article-content h3 {
  margin: 20px 0 10px;
  font-size: 1.3rem;
  scroll-margin-top: 100px;
}

.article-content h1:first-child {
  margin-top: 0;
}

.article-content p,
.article-content li {
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.78;
}

.article-content ul,
.article-content ol {
  padding-left: 1.35rem;
}

.article-content pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 18px;
  background: rgba(28, 43, 47, 0.94);
  color: #eff6f2;
}

.article-content a {
  color: var(--link);
  text-underline-offset: 0.16em;
}

.article-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 30px 0;
}

.article-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.article-content p code,
.article-content li code {
  padding: 0.14em 0.4em;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
}

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

  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-side {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .publication-header {
    flex-direction: column;
    align-items: start;
  }

  .publication-meta {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(calc(100% - 20px), var(--max-width));
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 12px 14px;
    border-radius: 0 0 24px 24px;
    top: 0;
  }

  .nav-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-links a {
    flex: 0 0 auto;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid var(--line);
  }

  .brand-line {
    font-size: 0.88rem;
  }

  .card-links a:not(.button-primary):not(.button-secondary) {
    width: 100%;
    justify-content: space-between;
  }

  .button {
    width: 100%;
  }

  .card-links {
    flex-direction: column;
  }

  .article-shell,
  .card {
    padding: 20px;
  }

  .publication-frame {
    padding: 18px;
    border-radius: 26px;
  }

  .hero-side-card {
    padding: 18px;
    border-radius: 22px;
  }

  .publication-card {
    min-height: auto;
  }

  .article-side {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .article-meta,
  .hero-pills,
  .publication-meta {
    gap: 8px;
  }

  .article-content p,
  .article-content li {
    font-size: 1rem;
    line-height: 1.72;
  }

  .article-content h2,
  .article-content h3 {
    scroll-margin-top: 84px;
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 18px 0;
  }

  .brand span {
    max-width: 12ch;
    line-height: 1.04;
  }

  .article-shell,
  .card,
  .side-card,
  .hero-side-card,
  .editor-note {
    padding: 16px;
  }

  .card h2,
  .side-card h2 {
    line-height: 1.05;
  }

  .button,
  .nav-links a,
  .card-links a:not(.button-primary):not(.button-secondary) {
    min-height: 46px;
  }

  .article-content pre {
    padding: 14px;
    border-radius: 14px;
  }
}
