:root {
  --ink: #151616;
  --paper: #f3f3f0;
  --white: #ffffff;
  --muted: #6e706e;
  --line: #c9cbc7;
  --accent: #ff5a36;
  --signal: #27aa87;
  --max: 1360px;
  --reading: 880px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  color: var(--white);
  background: var(--ink);
  border-bottom: 1px solid #333635;
}

.header-inner {
  width: min(calc(100% - 40px), var(--max));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.brand span {
  font-size: 1rem;
  font-weight: 750;
  text-transform: uppercase;
}

.brand small {
  color: #aeb2af;
  font-size: 0.72rem;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.primary-nav a {
  color: #d8dbd8;
  font-size: 0.78rem;
  text-decoration: none;
  white-space: nowrap;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: var(--accent);
}

.portfolio-hero {
  min-height: min(68vh, 660px);
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: var(--white);
  background: #2b2d2c;
}

.portfolio-hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 44%;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 10, 0.58);
}

.portfolio-hero-content {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  padding: 72px 0 56px;
  position: relative;
  z-index: 1;
}

.section-label,
.section-index,
.card-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.portfolio-hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: 8rem;
  line-height: 0.82;
  font-weight: 850;
  letter-spacing: 0;
}

.portfolio-hero-content > p:last-child {
  margin: 26px 0 0;
  color: #e1e3e1;
  font-size: 1.05rem;
}

.section-band {
  border-top: 1px solid var(--line);
}

.section-inner {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  padding: 82px 0;
}

.articles-band {
  background: var(--white);
}

.section-heading,
.split-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.52fr);
  gap: 56px;
  align-items: end;
}

.section-heading {
  margin-bottom: 42px;
}

.section-heading h2,
.split-heading h2 {
  margin: 0;
  font-size: 4.6rem;
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: 0;
}

.section-heading > p,
.empty-state {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.article-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper);
}

.card-media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #d8dad7;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

.article-card:hover .card-media img {
  transform: scale(1.025);
}

.card-body {
  min-height: 290px;
  padding: 26px;
  display: flex;
  flex-direction: column;
}

.card-body h3 {
  margin: 0 0 14px;
  font-size: 1.45rem;
  line-height: 1.24;
}

.card-body h3 a,
.text-link {
  text-decoration: none;
}

.card-body > p:not(.card-kicker) {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.94rem;
}

.text-link {
  margin-top: auto;
  font-size: 0.86rem;
  font-weight: 700;
}

.text-link span {
  color: var(--accent);
}

.quiet-band {
  color: var(--white);
  background: var(--ink);
  border-color: #343635;
}

.quiet-band .empty-state {
  color: #939793;
}

.light-band {
  background: #e4e6e3;
}

.accent-band {
  background: var(--signal);
  border-color: #16866b;
}

.accent-band .section-index,
.accent-band .empty-state {
  color: #0e4b3d;
}

.site-footer {
  min-height: 130px;
  padding: 32px max(20px, calc((100vw - var(--max)) / 2));
  color: #aeb2af;
  background: var(--ink);
  border-top: 1px solid #343635;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: 0.78rem;
}

.site-footer div {
  display: flex;
  gap: 12px;
}

.site-footer strong {
  color: var(--white);
}

.article-page {
  background: var(--white);
}

.article-hero {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  padding: 54px 0 42px;
}

.article-hero-inner {
  max-width: 1040px;
}

.back-link {
  display: inline-block;
  margin-bottom: 46px;
  color: var(--muted);
  font-size: 0.84rem;
  text-decoration: none;
}

.article-hero h1 {
  max-width: 1020px;
  margin: 0;
  font-size: 5.2rem;
  line-height: 0.98;
  font-weight: 820;
  letter-spacing: 0;
}

.article-summary {
  max-width: 760px;
  margin: 28px 0 44px;
  color: var(--muted);
  font-size: 1.08rem;
}

.article-cover {
  margin: 0;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: var(--paper);
}

.article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-shell {
  width: min(calc(100% - 40px), 1440px);
  margin: 0 auto;
  padding: 60px 0 100px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.article-aside {
  position: sticky;
  top: 104px;
}

.toc {
  border-top: 2px solid var(--ink);
  padding-top: 14px;
}

.toc summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 750;
}

.toc nav {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
}

.toc a {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  text-decoration: none;
}

.toc a[data-level="h3"] {
  padding-left: 24px;
}

.toc a[data-level="h2"] {
  padding-left: 12px;
}

.toc a[data-level="h4"] {
  padding-left: 36px;
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--accent);
}

.article-content {
  min-width: 0;
  font-size: 1rem;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  line-height: 1.2;
  letter-spacing: 0;
  scroll-margin-top: 100px;
}

.heading-number {
  display: inline-block;
  min-width: 2.5em;
  margin-right: 0.28em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.article-content h1 {
  margin: 84px 0 24px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  font-size: 2.2rem;
}

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

.article-content h2 {
  margin: 62px 0 20px;
  font-size: 1.7rem;
}

.article-content h3 {
  margin: 42px 0 16px;
  font-size: 1.3rem;
}

.article-content h4 {
  margin: 32px 0 12px;
  font-size: 1.05rem;
}

.article-content p,
.article-content li {
  color: var(--ink);
  line-height: 1.72;
}

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

.article-content li + li {
  margin-top: 7px;
}

.article-content img,
.article-content video {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border: 1px solid #dcdfdc;
  border-radius: 2px;
  background: var(--paper);
}

.article-content video {
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #101111;
}

.doc-media {
  min-width: 0;
  margin: 28px 0;
}

.doc-media figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
  text-align: center;
  white-space: pre-line;
}

.doc-grid {
  display: grid;
  gap: 10px;
  margin: 22px 0;
  align-items: start;
}

.doc-column {
  min-width: 0;
}

.doc-column > :first-child {
  margin-top: 0;
}

.doc-column > :last-child {
  margin-bottom: 0;
}

.doc-grid .doc-media {
  margin: 0;
}

.doc-grid .doc-column > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: center;
}

.doc-callout {
  display: block;
  margin: 22px 0;
  padding: 16px 18px;
  border: 0;
  background: #fff3f2;
}

.doc-callout p:first-child,
.doc-callout ul:first-child,
.doc-callout ol:first-child {
  margin-top: 0;
}

.doc-callout p:last-child,
.doc-callout ul:last-child,
.doc-callout ol:last-child {
  margin-bottom: 0;
}

.doc-table-wrap {
  width: 100%;
  margin: 28px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--white);
  scrollbar-gutter: stable;
}

.article-content .doc-table {
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.78rem;
  line-height: 1.45;
}

.article-content .doc-table th,
.article-content .doc-table td {
  padding: 8px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.article-content .doc-table th {
  background: #f2f3f5;
  font-weight: 700;
}

.article-content .doc-table p {
  margin: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.article-content .doc-table p + p {
  margin-top: 5px;
}

.article-content .doc-table ul,
.article-content .doc-table ol {
  margin: 0;
  padding-left: 1.1rem;
}

.article-content .doc-table li {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.article-content .doc-table .doc-media {
  margin: 0;
}

.article-content .doc-table img {
  border: 0;
}

@media (max-width: 900px) {
  .header-inner {
    min-height: 86px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }

  .primary-nav {
    width: 100%;
    padding-bottom: 2px;
  }

  .article-shell {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .portfolio-hero h1 {
    font-size: 5.5rem;
  }

  .section-heading h2,
  .split-heading h2 {
    font-size: 3.6rem;
  }

  .article-hero h1 {
    font-size: 4rem;
  }

  .article-aside {
    position: static;
  }

  .toc nav {
    max-height: 260px;
  }
}

@media (max-width: 680px) {
  .header-inner,
  .portfolio-hero-content,
  .section-inner,
  .article-hero,
  .article-shell {
    width: min(calc(100% - 28px), var(--max));
  }

  .brand small {
    display: none;
  }

  .primary-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 16px;
    padding-bottom: 10px;
    overflow: visible;
  }

  .primary-nav a {
    font-size: 0.7rem;
  }

  .portfolio-hero {
    min-height: 500px;
  }

  .portfolio-hero h1 {
    font-size: 4.6rem;
  }

  .section-inner {
    padding: 58px 0;
  }

  .section-heading,
  .split-heading {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .section-heading {
    margin-bottom: 28px;
  }

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

  .card-body {
    min-height: 250px;
    padding: 22px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .article-hero {
    padding-top: 36px;
  }

  .back-link {
    margin-bottom: 34px;
  }

  .article-hero h1 {
    font-size: 2.8rem;
  }

  .article-cover {
    aspect-ratio: 4 / 3;
  }

  .article-shell {
    padding-top: 38px;
  }

  .article-content h1 {
    font-size: 1.8rem;
  }

  .article-content h2 {
    font-size: 1.45rem;
  }

  .heading-number {
    display: block;
    min-width: 0;
    margin: 0 0 5px;
    font-size: 0.64em;
  }

  .doc-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 18px;
  }

  .article-content .doc-table {
    font-size: 0.72rem;
  }
}
