:root {
  color-scheme: light;
  --ink: #1a1a2e;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f8f9fb;
  --brand: #4687ff;
  --brand-dark: #2563eb;
  --purple: #5e3bee;
  --tip: #eef4ff;
  --code: #101827;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

img {
  max-width: 100%;
}

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

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--purple));
}

.site-header,
.article-shell,
footer {
  padding-right: clamp(18px, 5vw, 80px);
  padding-left: clamp(18px, 5vw, 80px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(229, 231, 235, .86);
  padding-top: 15px;
  padding-bottom: 15px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  transition: padding .18s ease, background .18s ease, box-shadow .18s ease;
}

.site-header.compact {
  padding-top: 9px;
  padding-bottom: 9px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 10px 28px rgba(26, 26, 46, .08);
}

.header-left,
.header-actions,
.brand,
.main-nav,
.share-row,
.meta-row,
.author-mini {
  display: flex;
  align-items: center;
}

.header-left {
  min-width: 0;
  gap: clamp(18px, 3vw, 34px);
}

.brand {
  gap: 10px;
  font-weight: 950;
}

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

.main-nav,
.header-actions {
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.main-nav a,
.login-link,
.buy-link {
  border-radius: 12px;
  padding: 10px 12px;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.main-nav a:hover,
.login-link:hover,
.buy-link:hover {
  transform: translateY(-1px);
}

.main-nav a:hover,
.login-link {
  color: var(--ink);
  background: #eef2f7;
}

.buy-link {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--purple));
  box-shadow: 0 14px 30px rgba(70, 135, 255, .26);
}

.article-shell {
  padding-top: clamp(24px, 5vw, 54px);
  padding-bottom: 80px;
}

.breadcrumbs {
  max-width: 760px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumbs a {
  color: var(--muted);
}

.breadcrumbs span {
  color: #9ca3af;
}

.article-header {
  max-width: 760px;
  margin: 0 auto;
}

.category {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
  font-weight: 950;
}

.category.security {
  background: #ef4444;
}

.category.guide {
  background: #10b981;
}

.category.knowledge {
  background: var(--purple);
}

.article-header h1 {
  margin-top: 18px;
  font-size: clamp(40px, 6vw, 56px);
  line-height: 1.16;
  letter-spacing: 0;
}

.dek {
  margin-top: 18px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.65;
}

.meta-row {
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 24px;
  color: var(--muted);
}

.avatar {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--purple));
  font-size: 14px;
  font-weight: 950;
}

.author-mini {
  gap: 10px;
  color: var(--ink);
  font-weight: 950;
}

.share-row {
  gap: 8px;
  margin-top: 22px;
}

.share-row button,
.share-row a {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4b5563;
  background: #fff;
  font-weight: 950;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, color .16s ease;
}

.share-row button:hover,
.share-row a:hover {
  color: var(--brand);
  border-color: rgba(70, 135, 255, .42);
  transform: translateY(-2px);
}

.hero-figure {
  max-width: 1040px;
  margin: clamp(28px, 5vw, 50px) auto 0;
}

.hero-figure img {
  display: block;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 18px 52px rgba(26, 26, 46, .14);
  aspect-ratio: 16 / 8;
  object-fit: cover;
  cursor: zoom-in;
}

.hero-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.reader-layout {
  display: grid;
  grid-template-columns: minmax(190px, .28fr) minmax(0, 760px) minmax(170px, .2fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: start;
  max-width: 1240px;
  margin: clamp(34px, 6vw, 64px) auto 0;
}

.toc {
  position: sticky;
  top: 96px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
  color: var(--muted);
  font-size: 14px;
}

.toc strong {
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
}

.toc a {
  display: block;
  border-left: 3px solid transparent;
  margin-left: -18px;
  padding: 7px 0 7px 15px;
  color: var(--muted);
  line-height: 1.35;
}

.toc a.active,
.toc a:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.mobile-toc {
  display: none;
  max-width: 760px;
  margin: 0 auto 24px;
}

.mobile-toc summary {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--soft);
  font-weight: 950;
  cursor: pointer;
}

.mobile-toc nav {
  display: grid;
  gap: 8px;
  padding: 12px 4px;
}

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

.article-content h2 {
  margin: 48px 0 18px;
  font-size: clamp(28px, 4vw, 32px);
  line-height: 1.22;
}

.article-content h3 {
  margin: 34px 0 14px;
  font-size: 23px;
  line-height: 1.3;
}

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

.article-content p {
  margin-bottom: 24px;
}

.article-content ol,
.article-content ul {
  display: grid;
  gap: 12px;
  margin: 0 0 26px;
  padding-left: 26px;
}

.article-content li::marker {
  color: var(--brand);
  font-weight: 950;
}

.article-content a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content a:hover {
  color: var(--brand-dark);
}

blockquote {
  margin: 34px 0;
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  padding: 20px 22px;
  color: #374151;
  background: #f3f6fb;
  font-style: italic;
}

pre {
  position: relative;
  overflow: auto;
  border-radius: 14px;
  padding: 18px;
  color: #e5e7eb;
  background: var(--code);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.copy-code {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  border-radius: 8px;
  padding: 7px 9px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  cursor: pointer;
}

.tip-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  margin: 30px 0;
  border-left: 4px solid var(--brand);
  border-radius: 14px;
  padding: 18px 20px;
  background: var(--tip);
}

.tip-box strong,
.tip-box p {
  margin: 0;
}

.inline-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 40px 0;
  border-radius: 18px;
  padding: clamp(22px, 4vw, 34px);
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--purple));
}

.inline-cta p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .86);
}

.inline-cta a {
  flex-shrink: 0;
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--ink);
  background: #fff;
  font-weight: 950;
  text-decoration: none;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 42px;
}

.tags span {
  border-radius: 999px;
  padding: 7px 10px;
  color: #4b5563;
  background: #f3f4f6;
  font-size: 13px;
  font-weight: 850;
}

.author-card,
.feedback-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  background: var(--soft);
}

.author-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  margin-top: 30px;
}

.author-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.feedback-card {
  margin-top: 24px;
  text-align: center;
}

.feedback-card div {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.feedback-card button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: #fff;
  cursor: pointer;
}

.related {
  max-width: 1040px;
  margin: 70px auto 0;
}

.related h2 {
  font-size: 30px;
}

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

.related-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 32px rgba(26, 26, 46, .08);
  transition: transform .16s ease, box-shadow .16s ease;
}

.related-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 54px rgba(26, 26, 46, .14);
}

.related-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.related-card strong {
  display: block;
  padding: 16px;
  line-height: 1.4;
}

.newsletter-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .72fr);
  gap: 22px;
  align-items: center;
  max-width: 1040px;
  margin: 60px auto 0;
  border-radius: 24px;
  padding: clamp(28px, 5vw, 48px);
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--purple));
}

.newsletter-wide p,
.newsletter-wide small {
  color: rgba(255, 255, 255, .84);
}

.newsletter-wide p {
  margin-top: 8px;
}

.newsletter-wide form {
  display: flex;
  gap: 10px;
}

.newsletter-wide input,
.newsletter-wide button {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  font: inherit;
}

.newsletter-wide input {
  min-width: 0;
  width: 100%;
  padding: 0 14px;
}

.newsletter-wide button {
  padding: 0 16px;
  color: #fff;
  background: var(--ink);
  font-weight: 950;
  cursor: pointer;
}

.newsletter-wide small {
  grid-column: 1 / -1;
}

.side-share {
  position: sticky;
  top: 116px;
  display: grid;
  gap: 8px;
}

.side-share a,
.side-share button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #4b5563;
  font-weight: 950;
  cursor: pointer;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 34px;
  padding-bottom: 34px;
  background: var(--soft);
}

footer .brand img {
  width: 32px;
  height: 32px;
}

footer p {
  margin-top: 8px;
  color: var(--muted);
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-weight: 900;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .78);
}

.lightbox.open {
  display: grid;
}

.lightbox img {
  max-height: 88vh;
  border-radius: 16px;
}

@media (max-width: 1120px) {
  .reader-layout {
    grid-template-columns: 1fr;
  }

  .toc,
  .side-share {
    display: none;
  }

  .mobile-toc {
    display: block;
  }

  .article-content {
    margin: 0 auto;
  }
}

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

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

  .main-nav,
  .header-actions {
    width: 100%;
    overflow-x: auto;
  }

  .article-header h1 {
    font-size: 38px;
  }

  .article-content p,
  .article-content li {
    font-size: 18px;
  }

  .hero-figure img {
    aspect-ratio: 16 / 10;
  }

  .inline-cta,
  .newsletter-wide,
  .author-card {
    grid-template-columns: 1fr;
  }

  .inline-cta,
  .newsletter-wide form {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-cta a,
  .newsletter-wide button {
    width: 100%;
  }

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