:root {
  --line: rgba(129, 196, 230, 0.26);
  --line-strong: rgba(129, 196, 230, 0.42);
  --text: #e8f6ff;
  --muted: #9ebccc;
  --accent: #76efc7;
  --accent2: #6fd2ff;
  --bg-1: #05101b;
  --bg-2: #061827;
  --bg-3: #071d2d;
  --card-1: rgba(8, 33, 49, 0.9);
  --card-2: rgba(6, 25, 37, 0.88);
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(900px 420px at 90% -5%, rgba(111, 210, 255, 0.18), transparent 68%),
    radial-gradient(720px 420px at -10% 8%, rgba(118, 239, 199, 0.14), transparent 68%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2) 42%, var(--bg-3) 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(165, 217, 245, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(165, 217, 245, 0.04) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at center, #000 26%, transparent 84%);
}

.read-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 100;
  background: rgba(8, 27, 39, 0.8);
}

.read-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #76efc7, #6fd2ff);
  box-shadow: 0 0 16px rgba(98, 232, 188, 0.7);
}

.bg-glow {
  position: fixed;
  pointer-events: none;
  width: 42vw;
  height: 42vw;
  filter: blur(56px);
  border-radius: 50%;
  opacity: 0.22;
  z-index: -1;
}

.bg-glow-a {
  left: -10vw;
  top: -6vw;
  background: radial-gradient(circle, #76efc7 0%, transparent 72%);
}

.bg-glow-b {
  right: -10vw;
  bottom: -10vw;
  background: radial-gradient(circle, #6fd2ff 0%, transparent 72%);
}

.wrap {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 80px;
}

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg, var(--card-1), var(--card-2));
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 0;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.brand {
  color: #f2fbff;
  text-decoration: none;
  font-family: "Unbounded", sans-serif;
  font-size: 28px;
  position: relative;
}

.brand::after {
  content: "";
  position: absolute;
  right: -14px;
  top: 50%;
  width: 8px;
  height: 8px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.back {
  position: relative;
  overflow: hidden;
  color: #cce8f7;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  background: rgba(8, 31, 45, 0.72);
  font-weight: 800;
  isolation: isolate;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, color 0.22s ease;
}

.back::before,
.back::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.back::before {
  z-index: -2;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(111, 210, 255, 0.18), transparent 44%),
    linear-gradient(135deg, rgba(7, 31, 45, 0.82), rgba(5, 21, 33, 0.92));
}

.back::after {
  inset: -1px auto -1px -64%;
  width: 48%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transform: skewX(-18deg);
  transition: left .55s ease;
}

.back:hover {
  transform: translateY(-2px);
  border-color: rgba(118, 239, 199, 0.62);
  box-shadow: 0 16px 30px rgba(0,0,0,.28), 0 0 24px rgba(118,239,199,.12);
}

.back:hover::after {
  left: 120%;
}

.back:focus-visible,
.btn:focus-visible,
.toc-link:focus-visible,
.related-card:focus-visible {
  outline: 2px solid rgba(118, 239, 199, 0.85);
  outline-offset: 2px;
}

.article-hero {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 34px 34px 32px;
  isolation: isolate;
}

.article-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 14% 0%, rgba(118, 239, 199, 0.16), transparent 40%),
    radial-gradient(circle at 86% 18%, rgba(111, 210, 255, 0.12), transparent 34%);
  pointer-events: none;
}

.article-hero::after {
  content: "";
  position: absolute;
  top: 0;
  left: 34px;
  right: 34px;
  z-index: 2;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--accent), rgba(111, 210, 255, 0.45), transparent);
  opacity: 0.74;
}

.article-hero > * {
  position: relative;
  z-index: 1;
}

.article-hero .eyebrow {
  order: 1;
}

.article-hero h1 {
  order: 2;
}

.article-hero .hero-meta {
  order: 3;
}

.article-hero .hero-tags {
  order: 4;
}

.article-hero .hero-cover {
  order: 5;
}

.hero-cover {
  display: none;
  width: 100%;
  height: 0;
  border-radius: 16px;
  margin: 0;
  border: 1px solid rgba(129, 196, 230, 0.2);
  background-image: radial-gradient(circle at 22% 28%, rgba(118, 239, 199, 0.34), transparent 58%),
    linear-gradient(135deg, #12364b, #0a2437);
  background-size: cover;
  background-position: center;
}

.article-hero.has-cover .hero-cover,
.hero-cover.has-image {
  display: block;
  height: clamp(180px, 20vw, 286px);
  min-height: 0;
  max-height: 286px;
  margin: 24px 0 0;
  background-color: #082032;
  opacity: 0.82;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-family: "Unbounded", sans-serif;
  max-width: 1120px;
  font-size: clamp(34px, 4vw, 62px);
  line-height: 1.04;
  letter-spacing: -0.01em;
}

.sub {
  display: none;
  margin: 14px 0 0;
  color: var(--muted);
  max-width: 940px;
  font-size: 17px;
  line-height: 1.55;
}

.hero-meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #95b8c9;
  font-size: 14px;
}

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

.tag {
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(125, 196, 230, 0.3);
  background: rgba(8, 31, 45, 0.72);
  color: #cce6f6;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.article-layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: clamp(248px, 22vw, 280px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.article-side {
  padding: 16px;
  position: sticky;
  top: 12px;
}

.article-side h3 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1;
  font-family: "Unbounded", sans-serif;
  letter-spacing: -0.02em;
}

#toc {
  display: grid;
  gap: 8px;
}

.toc-link {
  color: #cbe6f5;
  text-decoration: none;
  padding: 8px 10px;
  border: 1px solid rgba(124, 197, 230, 0.2);
  border-radius: 10px;
  background: rgba(9, 31, 44, 0.6);
  font-size: 13px;
  line-height: 1.3;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.toc-link:hover {
  border-color: rgba(125, 196, 230, 0.48);
  transform: translateX(2px);
}

.toc-link.level-3 {
  margin-left: 12px;
  font-size: 12px;
  opacity: 0.92;
}

.toc-link.is-active {
  border-color: rgba(118, 239, 199, 0.74);
  color: #dff8f1;
}

.toc-empty {
  margin: 0;
  color: #afcddd;
  font-size: 13px;
  padding: 10px;
  border: 1px dashed rgba(124, 197, 230, 0.24);
  border-radius: 10px;
  background: rgba(9, 31, 44, 0.45);
}

.article-side.no-toc #toc {
  display: none;
}

.article-side.no-toc .toc-empty {
  display: block;
}

.article-side .toc-empty {
  display: none;
}

.side-cta {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(133, 196, 227, 0.24);
  display: grid;
  gap: 8px;
}

.side-cta p {
  margin: 0;
  color: #c2dcea;
  font-size: 14px;
  line-height: 1.5;
}

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 16px;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid transparent;
  isolation: isolate;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}

.btn::before,
.btn::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.btn::before {
  z-index: -2;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(118, 239, 199, 0.24), transparent 44%),
    linear-gradient(135deg, rgba(11,45,61,.96), rgba(5,21,33,.96));
}

.btn::after {
  inset: -1px auto -1px -64%;
  width: 48%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transform: skewX(-18deg);
  transition: left .55s ease;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: rgba(118, 239, 199, 0.62);
  box-shadow: 0 16px 30px rgba(0,0,0,.28), 0 0 24px rgba(118,239,199,.12);
}

.btn:hover::after {
  left: 120%;
}

.btn-primary {
  color: #eafff8;
  border-color: rgba(118, 239, 199, 0.72);
  box-shadow: inset 0 0 0 1px rgba(118,239,199,.14), 0 12px 26px rgba(118, 239, 199, 0.12);
}

.btn-secondary {
  color: #d8edf8;
  border-color: rgba(129, 196, 230, 0.32);
}

.btn-secondary::before {
  background:
    radial-gradient(circle at 50% 0%, rgba(111, 210, 255, 0.16), transparent 44%),
    linear-gradient(135deg, rgba(7,31,45,.82), rgba(5,21,33,.9));
}

.article-content {
  padding: 22px;
}

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

.article-content > *:last-child {
  margin-bottom: 0;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  color: #eef9ff;
  scroll-margin-top: 90px;
}

.article-content h2 {
  margin: 0 0 12px;
  font-size: clamp(28px, 2.6vw, 38px);
  line-height: 1.15;
  font-family: "Unbounded", sans-serif;
  letter-spacing: -0.02em;
}

.article-content h3 {
  margin: 22px 0 10px;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.22;
}

.article-content h4 {
  margin: 18px 0 8px;
  font-size: clamp(18px, 1.6vw, 22px);
}

.article-content p {
  margin: 0 0 14px;
  color: #c9dfeb;
  line-height: 1.72;
  font-size: 17px;
}

.article-content a {
  color: #90f3d7;
  text-underline-offset: 2px;
}

.article-content ul,
.article-content ol {
  margin: 0 0 14px;
  padding-left: 22px;
  color: #c9dfeb;
  display: grid;
  gap: 8px;
}

.article-content li {
  line-height: 1.66;
  font-size: 16px;
}

.article-content blockquote {
  margin: 16px 0;
  padding: 12px 14px;
  border-left: 3px solid rgba(118, 239, 199, 0.88);
  border-radius: 0 12px 12px 0;
  background: rgba(9, 32, 47, 0.62);
  color: #d6ebf6;
}

.article-content img {
  display: block;
  width: 100%;
  height: auto;
  margin: 14px 0;
  border-radius: 14px;
  border: 1px solid rgba(129, 196, 230, 0.22);
  background: #0a2538;
}

.article-content figure {
  margin: 18px 0;
}

.article-content figcaption {
  margin-top: 8px;
  color: #9ebdcc;
  font-size: 13px;
}

.article-content pre,
.article-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.article-content pre {
  margin: 14px 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(7, 24, 35, 0.95);
  border: 1px solid rgba(129, 196, 230, 0.2);
  overflow-x: auto;
}

.article-content code {
  font-size: 0.92em;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 15px;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(129, 196, 230, 0.22);
}

.article-content th,
.article-content td {
  border: 1px solid rgba(129, 196, 230, 0.16);
  padding: 10px;
  text-align: left;
}

.article-content th {
  background: rgba(10, 35, 50, 0.86);
  color: #e4f7ff;
}

.article-content td {
  color: #c7deea;
}

.article-bottom {
  margin-top: 14px;
  padding: 18px;
}

.bottom-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.bottom-head h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.06;
  font-family: "Unbounded", sans-serif;
}

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

.related-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(129, 196, 230, 0.25);
  border-radius: 14px;
  padding: 12px;
  background: rgba(8, 29, 42, 0.72);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.24s ease, transform 0.24s ease, box-shadow 0.24s ease;
}

.related-card:hover {
  border-color: rgba(118, 239, 199, 0.48);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,.22), 0 0 18px rgba(118,239,199,.08);
}

.related-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.related-card p {
  margin: 0;
  color: #aac9d9;
  font-size: 14px;
  line-height: 1.45;
}

.related-meta {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  color: #8fb2c7;
  font-size: 12px;
}

.related-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px;
  border: 1px dashed rgba(129, 196, 230, 0.3);
  border-radius: 12px;
  color: #aecbda;
  background: rgba(8, 29, 42, 0.55);
}

.sticky-mobile-cta {
  display: none;
}

@media (max-width: 1400px) {
  .wrap {
    width: min(1240px, calc(100% - 24px));
  }

  h1 {
    font-size: clamp(32px, 3.7vw, 58px);
  }

  .article-content h2 {
    font-size: clamp(28px, 2.4vw, 36px);
  }

  .article-side h3 {
    font-size: 28px;
  }
}

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

  .article-side {
    position: static;
  }

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

@media (max-width: 860px) {
  .topbar {
    flex-wrap: wrap;
  }

  .top-actions {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .wrap {
    width: min(1240px, calc(100% - 20px));
    padding-bottom: 92px;
  }

  .brand {
    font-size: 24px;
  }

  .top-actions .back {
    padding: 8px 10px;
    font-size: 12px;
  }

  .article-hero {
    padding: 22px 18px 20px;
    border-radius: 18px;
  }

  .article-hero::after {
    left: 18px;
    right: 18px;
  }

  .hero-cover {
    border-radius: 14px;
  }

  .article-hero.has-cover .hero-cover,
  .hero-cover.has-image {
    height: clamp(150px, 34vw, 220px);
    margin: 18px 0 0;
  }

  h1 {
    font-size: clamp(31px, 8.2vw, 48px);
  }

  .article-side h3 {
    font-size: 26px;
  }

  .article-content {
    padding: 16px;
    border-radius: 18px;
  }

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

  .article-content h2 {
    font-size: 28px;
  }

  .article-content h3 {
    font-size: 22px;
  }

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

  .sticky-mobile-cta {
    display: block;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 80;
  }

  .sticky-mobile-cta .btn {
    width: 100%;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
