:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --line: #eceef2;
  --line-strong: #dde1e7;
  --text: #1f2329;
  --muted: #6b7280;
  --muted-soft: #9098a4;
  --orange: #ff6900;
  --orange-soft: #fff3ea;
  --orange-line: #ffd7bd;
  --green: #16a168;
  --red: #e94848;
  --blue: #3976d8;
  --shadow: 0 10px 28px rgba(31, 35, 41, 0.06);
  --shadow-soft: 0 4px 14px rgba(31, 35, 41, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.article-page {
  max-width: 920px;
}

.archive-page {
  max-width: 1120px;
}

.topbar,
.footer,
.section-title,
.brief-grid {
  display: flex;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid rgba(236, 238, 242, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.brand::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #ff8a2a, var(--orange));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.navlinks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.navlinks a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  transition: color 160ms ease, background 160ms ease;
}

.navlinks a:hover,
.navlinks a:focus-visible {
  background: var(--orange-soft);
  color: var(--orange);
  outline: none;
}

.index-hero,
.article-hero {
  padding-bottom: 18px;
}

.intro,
.article-headline {
  padding: 54px 4px 34px;
}

.compact-intro {
  padding: 54px 4px 34px;
}

.kicker,
.label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin: 14px 0 14px;
  color: #15181d;
  font-size: clamp(34px, 4.8vw, 58px);
  line-height: 1.08;
  letter-spacing: 0;
}

.article-headline h1 {
  max-width: 780px;
  font-size: clamp(32px, 4.2vw, 48px);
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.section,
.article-section,
.article-card,
.archive-category-card,
.archive-item,
.insight-grid article,
.rule-list article,
.stat-table div,
.note-list article,
.archive-callout,
.primary-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.section,
.article-section {
  margin-top: 16px;
  padding: 26px;
}

.section-title {
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 20px;
}

.section-title h2,
.article-section h2,
.archive-callout h2 {
  margin-bottom: 0;
  color: #161a20;
  font-size: 26px;
  line-height: 1.25;
}

.section-title p {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.article-section h2 {
  position: relative;
  padding-left: 13px;
  margin-bottom: 16px;
}

.article-section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 4px;
  height: 22px;
  border-radius: 999px;
  background: var(--orange);
}

.article-section h3 {
  margin: 22px 0 8px;
  color: #20242a;
  font-size: 18px;
  line-height: 1.35;
}

.article-section p,
.article-section li,
.article-section blockquote {
  color: #3f4650;
  font-size: 16px;
  line-height: 1.9;
}

.article-section p:last-child {
  margin-bottom: 0;
}

.article-section blockquote {
  margin: 22px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--orange-line);
  border-left: 4px solid var(--orange);
  border-radius: 10px;
  background: var(--orange-soft);
  color: #3a2c22;
}

.article-section .text-link {
  color: var(--orange);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-figure {
  margin: 22px 0 0;
}

.article-figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.article-figure figcaption {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

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

.article-card {
  overflow: hidden;
  scroll-margin-top: 78px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.article-card:hover,
.article-card:focus-within {
  border-color: var(--orange-line);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.article-card a {
  display: block;
  height: 100%;
  padding: 22px;
}

.article-card-head,
.tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.article-card-head {
  justify-content: space-between;
  margin-bottom: 18px;
}

.article-card time {
  color: var(--muted-soft);
  font-size: 13px;
}

.category-pill,
.tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f4f5f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.category-pill {
  background: var(--orange-soft);
  color: var(--orange);
}

.article-card h3 {
  margin-bottom: 10px;
  color: #1d2128;
  font-size: 22px;
  line-height: 1.32;
}

.article-card p,
.category-grid p {
  color: var(--muted);
  line-height: 1.75;
}

.tag-row {
  margin-top: 18px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.archive-category-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.archive-category-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 100%;
  padding: 18px 44px 18px 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.archive-category-card::after {
  content: "›";
  position: absolute;
  right: 18px;
  top: 16px;
  color: #b8bfc8;
  font-size: 26px;
  line-height: 1;
}

.archive-category-card:hover,
.archive-category-card:focus-visible {
  border-color: var(--orange-line);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  outline: none;
}

.archive-category-card:hover::after,
.archive-category-card:focus-visible::after {
  color: var(--orange);
}

.category-grid h3 {
  margin: 4px 0 0;
  color: #1d2128;
  font-size: 19px;
  line-height: 1.3;
}

.category-grid p {
  margin-bottom: 0;
  font-size: 14px;
}

.category-grid strong {
  display: inline-block;
  width: fit-content;
  margin-top: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 13px;
}

.insight-grid,
.rule-list,
.stat-table {
  display: grid;
  gap: 14px;
}

.insight-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}

.insight-grid article,
.rule-list article {
  padding: 18px;
  background: var(--panel-soft);
  box-shadow: none;
}

.insight-grid h3,
.rule-list h3 {
  margin: 12px 0 8px;
}

.stat-table {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0 22px;
}

.stat-table div {
  padding: 16px;
  background: var(--panel-soft);
  box-shadow: none;
}

.stat-table span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-table strong {
  display: block;
  margin-top: 10px;
  color: var(--orange);
  font-size: 24px;
  line-height: 1.2;
}

.data-table {
  overflow-x: auto;
  margin: 18px 0 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.data-table table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: #3f4650;
  font-size: 15px;
  line-height: 1.55;
}

.data-table th {
  background: #fff8f3;
  color: #252a31;
  font-weight: 800;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.rule-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.final-note {
  border-color: var(--orange-line);
  background: linear-gradient(135deg, #fff7f1, #ffffff 62%);
}

.archive-group {
  scroll-margin-top: 78px;
}

.archive-group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.archive-group-head h2 {
  margin: 6px 0 0;
  padding-left: 0;
  color: #1d2128;
  font-size: 25px;
}

.archive-group-head h2::before {
  content: none;
}

.archive-group-head strong {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 14px;
}

.group-desc {
  max-width: 760px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.archive-item {
  padding: 16px;
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.archive-item:hover {
  border-color: var(--orange-line);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.archive-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--muted-soft);
  font-size: 12px;
}

.archive-item-meta span {
  color: var(--orange);
  font-weight: 750;
}

.archive-item h3 {
  margin: 0 0 9px;
  font-size: 17px;
  line-height: 1.35;
}

.archive-item h3 a {
  color: #1d2128;
}

.archive-item h3 a:hover,
.archive-item h3 a:focus-visible {
  color: var(--orange);
  outline: none;
}

.archive-item p {
  margin-bottom: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.72;
}

.archive-item p strong {
  color: #1d2128;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f4f5f7;
  color: var(--orange);
}

.footer {
  justify-content: space-between;
  gap: 16px;
  padding: 28px 4px 0;
  color: var(--muted-soft);
  font-size: 14px;
}

.note-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.note-list article,
.primary-card,
.metric-card {
  padding: 20px;
}

.metric-card strong {
  display: block;
  margin: 18px 0 8px;
  color: var(--orange);
  font-size: 34px;
}

.archive-callout {
  background: linear-gradient(135deg, #fff7f1, #ffffff 62%);
}

@media (max-width: 980px) {
  .archive-category-grid,
  .stat-table {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .page {
    width: min(100% - 24px, 640px);
    padding-top: 12px;
  }

  .topbar {
    top: 8px;
    align-items: flex-start;
  }

  .intro,
  .article-headline,
  .compact-intro {
    padding: 38px 2px 24px;
  }

  h1,
  .article-headline h1 {
    font-size: 34px;
  }

  .lead {
    font-size: 16px;
  }

  .section,
  .article-section {
    padding: 20px;
  }

  .brief-grid,
  .note-list,
  .article-index,
  .category-grid,
  .archive-category-grid,
  .archive-list,
  .insight-grid,
  .rule-list,
  .stat-table {
    grid-template-columns: 1fr;
  }

  .section-title,
  .archive-group-head,
  .footer,
  .topbar {
    flex-direction: column;
  }

  .navlinks {
    width: 100%;
  }
}
