:root {
  color-scheme: light;
  --ink: #10223f;
  --ink-soft: #263b5b;
  --muted: #61708a;
  --blue: #1f6bff;
  --blue-dark: #0d43a8;
  --blue-soft: #eaf1ff;
  --line: #dfe6f0;
  --paper: #f6f9fc;
  --white: #ffffff;
  --accent: #c7ff3d;
  --shadow: 0 18px 50px rgba(22, 53, 98, 0.1);
  --shadow-small: 0 10px 30px rgba(22, 53, 98, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--white);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(31, 107, 255, 0.38);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 9px 13px;
  border-radius: 8px;
  color: var(--white);
  background: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, 100%);
  height: 72px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--white);
  background: var(--blue);
  font-weight: 900;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

.desktop-nav a {
  font-weight: 650;
  text-decoration: none;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  color: var(--blue);
}

.desktop-nav .subscribe {
  padding: 10px 17px;
  border-radius: 9px;
  color: var(--white);
  background: var(--ink);
}

.desktop-nav .subscribe:hover {
  color: var(--white);
  background: var(--blue-dark);
}

.menu-button,
.mobile-nav {
  display: none;
}

.reading-progress {
  position: fixed;
  top: 71px;
  left: 0;
  z-index: 40;
  width: 100%;
  height: 3px;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
}

.home {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  max-width: 860px;
  padding: 76px 0 60px;
}

.eyebrow,
.section-label,
.newsletter-callout > div > span {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.13em;
}

.hero h1 {
  margin: 14px 0 20px;
  font-size: clamp(3rem, 7vw, 5.55rem);
  letter-spacing: -0.065em;
  line-height: 0.94;
}

.hero h1 span {
  color: var(--blue);
}

.hero > p {
  max-width: 690px;
  margin: 0;
  color: var(--muted);
  font-size: 1.23rem;
}

.search-shell {
  position: relative;
  max-width: 680px;
  margin-top: 34px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.search-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(31, 107, 255, 0.11), var(--shadow);
}

.search-icon {
  width: 22px;
  height: 22px;
  color: var(--blue);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.search-wrap input {
  width: 100%;
  height: 60px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search-wrap input::placeholder {
  color: #7d8aa0;
}

.search-results {
  position: absolute;
  top: calc(100% + 9px);
  z-index: 20;
  width: 100%;
  max-height: 430px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.search-results[hidden] {
  display: none;
}

.search-result {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  text-decoration: none;
}

.search-result:hover,
.search-result.active {
  background: var(--paper);
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result small {
  margin-top: 2px;
  color: var(--muted);
}

.search-empty {
  padding: 13px 14px;
  color: var(--muted);
}

.start-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 38px;
  padding: 38px 42px;
  border-radius: 18px;
  color: var(--white);
  background: var(--ink);
}

.start-card .card-label {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.11em;
}

.start-card h2 {
  margin: 8px 0 3px;
  font-size: 1.7rem;
}

.start-card p {
  margin: 0;
  color: #c7d3e8;
}

.primary-button {
  flex: none;
  padding: 13px 18px;
  border-radius: 9px;
  color: var(--ink);
  background: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.primary-button:hover {
  background: #d5ff70;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding: 84px 0 28px;
}

.section-heading.compact {
  padding-top: 70px;
}

.section-heading h2 {
  max-width: 650px;
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.04em;
  line-height: 1.06;
}

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

.problem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  gap: 1px;
}

.problem-link {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 112px;
  padding: 22px 24px;
  background: var(--white);
  text-decoration: none;
}

.problem-link:hover {
  background: var(--paper);
}

.problem-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 0.84rem;
  font-weight: 850;
}

.problem-link strong,
.problem-link small {
  display: block;
}

.problem-link small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.arrow {
  color: var(--blue);
  font-size: 1.3rem;
}

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

.topic-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.topic-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 11px;
  color: var(--blue);
  background: var(--blue-soft);
}

.topic-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.topic-card h2 {
  margin: 18px 0 0;
  font-size: 1.45rem;
}

.topic-card > p {
  margin: 2px 0 18px;
  color: var(--muted);
}

.topic-links {
  border-top: 1px solid var(--line);
}

.topic-links a {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
  font-weight: 620;
  line-height: 1.4;
  text-decoration: none;
}

.topic-links a span:last-child,
.topic-links a:hover {
  color: var(--blue);
}

.newsletter-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  margin: 88px 0;
  padding: 44px;
  border-radius: 18px;
  background: var(--blue-soft);
}

.newsletter-callout h2 {
  margin: 8px 0;
  font-size: 2rem;
}

.newsletter-callout p {
  margin: 0;
  color: var(--muted);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 38px 24px 55px;
  border-top: 1px solid var(--line);
}

footer p {
  margin: 4px 0;
  color: var(--muted);
}

footer > a {
  color: var(--blue);
  font-weight: 750;
}

.guide-shell {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  gap: 70px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 54px 24px 90px;
}

.sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding-right: 12px;
  scrollbar-width: thin;
}

.guide-nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  text-decoration: none;
}

.guide-nav a:hover {
  color: var(--blue);
  background: var(--paper);
}

.guide-nav .all-guides {
  margin-bottom: 20px;
  color: var(--blue);
  font-weight: 800;
}

.guide-nav section {
  margin: 0 0 22px;
}

.guide-nav h3 {
  margin: 0 0 5px 10px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-nav a.current {
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 750;
}

.mobile-guide-nav {
  display: none;
}

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

.back-link {
  display: none;
}

.article-topic {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

article h1 {
  margin: 12px 0 20px;
  font-size: clamp(2.35rem, 5vw, 4rem);
  letter-spacing: -0.05em;
  line-height: 1.02;
}

.dek {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1.25rem;
}

.article-meta {
  display: flex;
  gap: 22px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.article-toc {
  margin: 28px 0 8px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.article-toc strong {
  display: block;
  margin-bottom: 8px;
}

.article-toc ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 26px;
  margin: 0;
  padding-left: 20px;
}

.article-toc a {
  color: var(--ink-soft);
  text-decoration-color: #b7c4d7;
  text-underline-offset: 3px;
}

.article-toc a:hover {
  color: var(--blue);
}

.article-body {
  padding-top: 24px;
  color: var(--ink-soft);
}

.article-body h2,
.article-body h3,
.article-body h4 {
  color: var(--ink);
  scroll-margin-top: 92px;
}

.article-body h2 {
  margin: 48px 0 14px;
  font-size: 1.75rem;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.article-body h3 {
  margin: 34px 0 10px;
  font-size: 1.35rem;
}

.article-body p {
  margin: 0 0 18px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 22px;
  padding-left: 24px;
}

.article-body li {
  margin: 8px 0;
  padding-left: 6px;
}

.article-body a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-body code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--paper);
  font-size: 0.9em;
}

.external-article-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 24px 0 8px;
  padding: 22px;
  border: 1px solid #c9d9f5;
  border-radius: 12px;
  background: var(--blue-soft);
}

.external-article-card p {
  margin: 0;
}

.external-article-card a {
  flex: none;
  font-weight: 800;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.pager a {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
}

.pager a:hover {
  border-color: #b7c7df;
  box-shadow: var(--shadow-small);
}

.pager small,
.pager span {
  display: block;
}

.pager small {
  color: var(--muted);
}

.pager span {
  margin-top: 4px;
  font-weight: 700;
  line-height: 1.35;
}

.pager .next {
  text-align: right;
}

.not-found {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 220px);
  padding: 80px 24px;
  text-align: center;
}

.not-found div {
  max-width: 620px;
}

.not-found .error-code {
  color: var(--blue);
  font-weight: 850;
  letter-spacing: 0.12em;
}

.not-found h1 {
  margin: 12px 0;
  font-size: clamp(2.6rem, 7vw, 5rem);
  letter-spacing: -0.055em;
  line-height: 1;
}

.not-found p {
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 1.12rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 800px) {
  body.menu-open::after {
    content: "";
    position: fixed;
    inset: 72px 0 0;
    z-index: 20;
    background: rgba(16, 34, 63, 0.18);
  }

  .desktop-nav {
    display: none;
  }

  .menu-button {
    display: block;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: var(--white);
    font-weight: 700;
  }

  .mobile-nav.open {
    position: relative;
    z-index: 30;
    display: grid;
    gap: 6px;
    padding: 12px 24px 18px;
    border-top: 1px solid var(--line);
    background: var(--white);
  }

  .mobile-nav a {
    padding: 9px 0;
    font-weight: 700;
    text-decoration: none;
  }

  .hero {
    padding: 58px 0 48px;
  }

  .start-card,
  .newsletter-callout,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .problem-grid,
  .topic-grid {
    grid-template-columns: 1fr;
  }

  .guide-shell {
    display: block;
    padding-top: 32px;
  }

  .sidebar {
    display: none;
  }

  .back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--blue);
    font-weight: 750;
    text-decoration: none;
  }

  .mobile-guide-nav {
    display: block;
    margin: 0 0 34px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
  }

  .mobile-guide-nav summary {
    padding: 13px 15px;
    cursor: pointer;
    font-weight: 750;
  }

  .mobile-guide-nav .guide-nav {
    max-height: 55vh;
    overflow: auto;
    padding: 4px 10px 16px;
    border-top: 1px solid var(--line);
  }

  .article-meta {
    flex-direction: column;
    gap: 3px;
  }

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

  .external-article-card,
  .pager {
    grid-template-columns: 1fr;
  }

  .external-article-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .pager .next {
    text-align: left;
  }

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

@media (max-width: 520px) {
  .header-inner,
  .home,
  .guide-shell,
  footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .hero h1 {
    font-size: 3.35rem;
  }

  .start-card,
  .newsletter-callout,
  .topic-card {
    padding: 25px;
  }

  .section-heading {
    padding-top: 62px;
  }

  .problem-link {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    padding: 19px 17px;
  }

  .article-body h2 {
    font-size: 1.5rem;
  }
}

@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;
  }
}
