:root {
  color-scheme: light dark;
  --bg: #f6f8f9;
  --surface: #ffffff;
  --surface-muted: #edf3f2;
  --text: #17232a;
  --muted: #61707a;
  --line: #d9e2e5;
  --line-strong: #c4d1d6;
  --accent: #0b7f5c;
  --accent-bg: #e1f3ed;
  --accent-ink: #f7fffc;
  --warning-bg: #fff6df;
  --warning-line: #ead59a;
  --shadow: 0 18px 40px rgba(23, 35, 42, 0.08);
  --radius-card: 8px;
  --radius-pill: 999px;
  --max: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1519;
    --surface: #121f25;
    --surface-muted: #182a31;
    --text: #edf3f5;
    --muted: #a7b5bc;
    --line: #2d3e45;
    --line-strong: #40545d;
    --accent: #37c99c;
    --accent-bg: #12362d;
    --accent-ink: #082019;
    --warning-bg: #2f2712;
    --warning-line: #6c5724;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  }
}

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

html {
  scroll-behavior: smooth;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  line-height: 1.65;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  background: var(--surface-muted);
}

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

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

button,
input {
  font: inherit;
}

.skip-link {
  position: absolute;
  top: 1rem;
  left: -999px;
  z-index: 10;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--line);
}

.skip-link:focus {
  left: 1rem;
}

.site-header,
main,
.site-footer {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.brand {
  display: grid;
  gap: 0.05rem;
}

.brand-mark {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.1;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.top-nav a {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 0.55rem 0.85rem;
  color: var(--muted);
  font-weight: 650;
}

.top-nav a:hover,
.top-nav a:focus-visible,
.top-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.ad-box {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, var(--surface-muted), transparent),
    var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: var(--radius-card);
  overflow: hidden;
}

.ad-box span,
.mock-ad {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ad-leaderboard {
  min-height: 96px;
  margin: 0.3rem 0 1.25rem;
}

.ad-infeed {
  min-height: 140px;
  margin: 1.1rem 0;
}

.ad-rectangle {
  width: 100%;
  min-height: 250px;
}

.ad-article {
  min-height: 260px;
  margin: 1.6rem 0;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.4rem;
}

.hero-copy,
.hero-media,
.feature-story,
.article-card,
.side-panel,
.tool-hero,
.checklist-panel,
.layout-tool,
.implementation-note,
.takeaway,
.toc,
.related-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(1.25rem, 3vw, 2.35rem);
  display: grid;
  align-content: center;
}

.eyebrow,
.article-meta {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-copy h1,
.tool-hero h1,
.article-header h1 {
  margin: 0;
  color: var(--text);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-copy h1 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 5vw, 5rem);
}

.hero-copy p,
.feature-story p,
.article-card p,
.side-panel li,
.tool-hero p,
.implementation-note p,
.article-body p,
.dek,
.byline {
  color: var(--muted);
}

.hero-copy > p:not(.eyebrow) {
  max-width: 38rem;
  margin: 1rem 0 0;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.68rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: 760;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.button:hover,
.button:focus-visible,
.tab-button:hover,
.tab-button:focus-visible {
  transform: translateY(-1px);
}

.button:active,
.tab-button:active,
.check-row:active {
  transform: translateY(1px);
}

.button.primary {
  color: var(--accent-ink);
  background: var(--accent);
}

.button.secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--line-strong);
}

.hero-media {
  overflow: hidden;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
}

.section-head {
  margin: 1.8rem 0 1rem;
}

.section-head h2,
.side-panel h2,
.takeaway h2,
.toc h2,
.related-box h2,
.implementation-note h2 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.section-head h2 {
  max-width: 16ch;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.feature-story {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  align-items: center;
}

.feature-story img,
.article-card img,
.tool-hero img {
  border-radius: calc(var(--radius-card) - 2px);
  border: 1px solid var(--line);
  aspect-ratio: 1200 / 760;
  object-fit: cover;
}

.feature-story h3,
.article-card h3 {
  margin: 0 0 0.45rem;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.feature-story h3 {
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
}

.feature-story p,
.article-card p {
  margin: 0;
}

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

.article-card {
  padding: 0.8rem;
}

.article-card h3 {
  font-size: 1.18rem;
}

.article-card img {
  margin-bottom: 0.8rem;
}

.home-sidebar {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.side-panel {
  padding: 1rem;
}

.side-panel h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.compact-list {
  padding-left: 1.2rem;
  margin: 0;
}

.compact-list li + li {
  margin-top: 0.55rem;
}

.sticky-ad {
  position: sticky;
  top: 1rem;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 740px) 300px;
  gap: 1.6rem;
  align-items: start;
  justify-content: center;
}

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

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 1rem;
}

.article-header {
  margin-bottom: 1.3rem;
}

.article-header h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.dek {
  margin: 0.9rem 0 0;
  font-size: 1.15rem;
}

.byline {
  margin-top: 0.85rem;
  font-size: 0.94rem;
}

.article-body h2 {
  margin: 2.1rem 0 0.7rem;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.article-body h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  line-height: 1.25;
}

.article-body p {
  margin: 0 0 1rem;
  font-size: 1.04rem;
}

.takeaway,
.toc,
.related-box,
.implementation-note,
.checklist-panel,
.layout-tool {
  padding: 1.1rem;
}

.takeaway {
  background: var(--warning-bg);
  border-color: var(--warning-line);
  margin: 1.2rem 0;
}

.takeaway ul {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
}

.toc {
  display: grid;
  gap: 0.5rem;
  margin: 1.2rem 0;
}

.toc a,
.related-box a {
  color: var(--accent);
  font-weight: 700;
}

.process-list {
  display: grid;
  gap: 0.8rem;
  margin: 1.1rem 0 0;
}

.process-list section {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 1rem;
  background: var(--surface);
}

.article-sidebar {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.related-box {
  display: grid;
  gap: 0.65rem;
  margin: 1.6rem 0 0;
}

.tool-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1rem;
}

.tool-hero h1 {
  font-size: clamp(2.1rem, 4vw, 3.8rem);
  max-width: 13ch;
}

.tool-hero p:not(.eyebrow) {
  max-width: 38rem;
  margin: 0.9rem 0 0;
}

.checklist-panel {
  display: grid;
  gap: 0.7rem;
}

.check-row {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  cursor: pointer;
  background: var(--surface);
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.check-row input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.28rem;
  accent-color: var(--accent);
}

.check-row span {
  display: grid;
  gap: 0.2rem;
}

.check-row em {
  color: var(--muted);
  font-style: normal;
}

.check-row.is-checked {
  background: var(--accent-bg);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.layout-tool {
  margin-bottom: 1rem;
}

.segmented {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.28rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  margin-bottom: 1rem;
}

.tab-button {
  min-height: 2.35rem;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0.55rem 0.9rem;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.tab-button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(23, 35, 42, 0.08);
}

.layout-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
}

.mock-article,
.mock-sidebar {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 1rem;
  background: var(--surface-muted);
}

.mock-title,
.mock-line,
.mock-ad {
  border-radius: 6px;
}

.mock-title {
  width: min(480px, 100%);
  height: 52px;
  background: var(--text);
  opacity: 0.92;
  margin-bottom: 1rem;
}

.mock-line {
  width: 78%;
  height: 22px;
  background: color-mix(in srgb, var(--muted) 28%, transparent);
  margin-bottom: 0.7rem;
}

.mock-line.wide {
  width: 100%;
}

.mock-line.short {
  width: 52%;
}

.mock-ad {
  min-height: 118px;
  border: 1px dashed color-mix(in srgb, var(--accent) 54%, var(--line));
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-bg);
  margin: 0.9rem 0;
  text-align: center;
  padding: 0.8rem;
}

.mock-ad.square {
  min-height: 250px;
}

.layout-preview[data-mode="mobile"] {
  grid-template-columns: 1fr;
  max-width: 430px;
}

.layout-preview[data-mode="mobile"] .mock-sidebar {
  display: none;
}

.implementation-note {
  margin-bottom: 1rem;
}

.implementation-note pre {
  margin: 0.9rem 0 0;
  overflow-x: auto;
  padding: 1rem;
  border-radius: var(--radius-card);
  color: #e8f6f0;
  background: #263238;
}

.implementation-note code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

.site-footer {
  margin-top: 1.5rem;
  padding: 1.3rem 0 2rem;
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .home-hero,
  .feature-story,
  .article-card,
  .tool-hero,
  .article-header,
  .takeaway,
  .toc {
    animation: rise-in 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .article-card:nth-child(2) {
    animation-delay: 70ms;
  }

  .article-card:nth-child(3) {
    animation-delay: 120ms;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1040px) {
  .home-hero,
  .home-layout,
  .article-layout,
  .tool-hero {
    grid-template-columns: 1fr;
  }

  .home-sidebar,
  .article-sidebar,
  .sticky-ad {
    position: static;
  }

  .home-sidebar .ad-rectangle,
  .article-sidebar .ad-rectangle {
    display: none;
  }

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

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav a {
    padding-inline: 0.7rem;
  }

  .ad-leaderboard {
    min-height: 104px;
  }

  .home-hero,
  .feature-story,
  .tool-hero {
    gap: 0.8rem;
  }

  .hero-copy h1,
  .tool-hero h1,
  .article-header h1 {
    max-width: 11ch;
    font-size: clamp(2.15rem, 12vw, 3.25rem);
  }

  .feature-story,
  .article-grid,
  .layout-preview {
    grid-template-columns: 1fr;
  }

  .article-card,
  .feature-story,
  .hero-copy,
  .tool-hero,
  .checklist-panel,
  .layout-tool,
  .implementation-note,
  .takeaway,
  .toc,
  .related-box {
    padding: 0.9rem;
  }

  .ad-article {
    min-height: 220px;
  }
}
