:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #23283a;
  --muted: #646b85;
  --line: #d8ddea;
  --red: #7a5c95;
  --yellow: #c5b58d;
  --green: #67b8a5;
  --blue: #4456a8;
  --purple: #8c7aa8;
  --radius: 16px;
  --header-h: 78px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header-h) + 18px);
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #fbfcff 0%, var(--bg) 56%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.65;
}

.site-shell {
  width: min(96vw, 1520px);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background:
    linear-gradient(90deg, rgba(68, 86, 168, 0.14) 0%, rgba(140, 122, 168, 0.12) 45%, rgba(103, 184, 165, 0.09) 100%),
    color-mix(in oklab, var(--surface), transparent 8%);
  border-bottom: 1px solid color-mix(in oklab, var(--blue), white 70%);
  box-shadow: 0 10px 26px rgba(48, 58, 108, 0.14);
}

.header-shell {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  border-radius: 12px;
  padding: 0.3rem 0.45rem;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.logo-link:hover {
  transform: translateY(-1px);
  background: color-mix(in oklab, var(--surface), var(--blue) 9%);
  box-shadow: 0 8px 20px rgba(68, 86, 168, 0.16);
}

.site-logo {
  width: 42px;
  height: 42px;
}

.logo-text {
  letter-spacing: 0.01em;
  color: #32437a;
}

.top-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.nav-pill:hover {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(68, 86, 168, 0.18);
}

.nav-pill.is-active {
  border-color: var(--purple);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--purple), white 30%), 0 8px 18px rgba(140, 122, 168, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #f2eef8 100%);
  color: #504173;
}

.site-main {
  flex: 1;
  padding: 1.2rem 0 2rem;
}

.home-page .site-main {
  display: grid;
  align-items: center;
  min-height: calc(100vh - var(--header-h) - 86px);
}

.home-grid {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

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

.content-card,
.related-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(30, 52, 120, 0.06);
}

.content-card {
  padding: clamp(1rem, 1.5vw, 1.8rem);
}

.landing-content {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  width: min(96vw, 1180px);
}

.content-card :target {
  scroll-margin-top: calc(var(--header-h) + 18px);
}

h1, h2, h3 {
  line-height: 1.2;
  margin-top: 1.25em;
  margin-bottom: 0.45em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.7rem, 2.7vw, 2.5rem);
  margin-top: 0.1em;
  background: linear-gradient(95deg, #2d3568 0%, #5566b5 42%, #8f7db0 75%, #63b49f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

h1 + p,
h1 + .lead {
  margin-top: 0.35rem;
}

h2 {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  color: #394a8a;
}

h3 {
  color: #53508a;
}

p, li {
  color: var(--text);
}

a {
  color: #4456a8;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.8px;
  text-decoration-color: color-mix(in oklab, #4456a8, white 45%);
  font-weight: 650;
  transition: color 0.16s ease, text-decoration-color 0.16s ease;
}

a:hover {
  color: #334282;
  text-decoration-color: #334282;
}

/* Stronger hover treatment where most body links are used */
.content-card a,
.related-card a,
.panel a {
  text-decoration-color: color-mix(in oklab, #4456a8, white 30%);
}

.content-card a:hover,
.related-card a:hover,
.panel a:hover {
  color: #334282;
  text-decoration-color: #334282;
  text-decoration-thickness: 2.2px;
}

a:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--purple), white 30%);
  outline-offset: 2px;
  border-radius: 4px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--green);
}

.lead {
  font-size: 1.1rem;
  color: var(--muted);
}

.hero {
  margin-bottom: 1.2rem;
}

.landing-hero {
  position: relative;
  padding: clamp(1.4rem, 3vw, 2.6rem) 0 clamp(1.2rem, 2.2vw, 1.9rem);
  margin-bottom: 1.2rem;
  isolation: isolate;
  text-align: center;
}

.landing-hero > p {
  max-width: 90ch;
  margin-left: auto;
  margin-right: auto;
}

.landing-hero > h1 {
  max-width: 30ch;
  margin-left: auto;
  margin-right: auto;
  text-wrap: pretty;
}

.landing-hero::before {
  content: "";
  position: absolute;
  left: -6%;
  top: -1.4rem;
  width: min(42vw, 520px);
  height: min(30vw, 360px);
  background: radial-gradient(circle, rgba(85, 102, 181, 0.18) 0%, rgba(85, 102, 181, 0.06) 45%, transparent 72%);
  filter: blur(4px);
  pointer-events: none;
  z-index: -1;
}

.landing-hero::after {
  content: "";
  position: absolute;
  right: -4%;
  top: -0.6rem;
  width: min(36vw, 430px);
  height: min(24vw, 300px);
  background: radial-gradient(circle, rgba(143, 125, 176, 0.16) 0%, rgba(99, 180, 159, 0.09) 46%, transparent 74%);
  filter: blur(3px);
  pointer-events: none;
  z-index: -1;
}

.landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.05rem;
  justify-content: center;
}

.landing-cta-btn {
  text-decoration: none;
  color: #3f4b85;
  border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--purple), white 52%);
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, #fff 10%, #f3eff9 100%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.landing-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(92, 108, 176, 0.22);
}

.landing-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(1rem, 1.8vw, 1.4rem);
  margin-top: 0.2rem;
  padding-bottom: 0.5rem;
  justify-items: center;
}

.landing-link-item {
  padding: 0.1rem 0 0.3rem;
  border-bottom: 1px solid color-mix(in oklab, var(--line), white 10%);
  width: min(100%, 360px);
  text-align: center;
}

.landing-link-item h2 {
  margin-top: 0.35rem;
}

.landing-link-item a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
}

.landing-link-item a::after {
  content: "->";
  transition: transform 0.16s ease;
}

.landing-link-item a:hover::after {
  transform: translateX(2px);
}

/* Code block surface + controls */
pre {
  position: relative;
  border-radius: 12px;
  border: 1px solid #d6dcef;
  overflow: auto;
  background: linear-gradient(180deg, #f8faff 0%, #f2f5fc 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), 0 10px 22px rgba(56, 68, 128, 0.1);
}

pre code {
  display: block;
  font-size: 0.9rem;
  line-height: 1.72;
  padding: 2.7rem 1.25rem 1.3rem;
  color: #2f3455;
}

.code-lang {
  position: absolute;
  left: 0.85rem;
  top: 0.65rem;
  border: 1px solid #ccd5ef;
  background: #edf1fb;
  color: #3f4c89;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  pointer-events: none;
}

.copy-btn {
  position: absolute;
  right: 0.7rem;
  top: 0.65rem;
  border: 1px solid #ccd5ef;
  background: #f1f5ff;
  color: #3f4c89;
  border-radius: 8px;
  font-size: 0.76rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.copy-btn:hover {
  background: #e6edff;
  transform: translateY(-1px);
}

/* Prism token colors tuned to Twilight Mist palette */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #868aa1;
}

.token.punctuation {
  color: #59608a;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #5a66b7;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #2f9f86;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #927f5b;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #4655a8;
}

.token.function,
.token.class-name {
  color: #7b66a5;
}

.token.regex,
.token.important,
.token.variable {
  color: #5b729a;
}

/* Restore markdown table presentation */
table {
  width: 100%;
  max-width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  display: table;
  overflow-x: visible;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

th,
td {
  border: 1px solid var(--line);
  padding: 0.62rem;
  text-align: left;
  white-space: normal;
  vertical-align: top;
  word-break: normal;
  overflow-wrap: break-word;
}

th {
  background: var(--surface-2);
  color: #4e4a79;
}

/* Keep tables readable on smaller screens without forcing odd desktop wrapping */
@media (max-width: 980px) {
  table {
    display: block;
    overflow-x: auto;
    border-collapse: separate;
    border-spacing: 0;
  }

  table thead,
  table tbody,
  table tr {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }

  th,
  td {
    min-width: 140px;
    white-space: normal;
  }
}

/* Remove dot/bullet markers from markdown task list checkboxes */
ul.contains-task-list,
ol.contains-task-list {
  padding-left: 0;
}

li.task-list-item,
li[class*="task-list-item"] {
  list-style: none;
  margin-left: 0;
}

li.task-list-item::marker,
li[class*="task-list-item"]::marker {
  content: "";
}

.task-list-item input[type="checkbox"] {
  margin-right: 0.5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: auto;
  background: linear-gradient(180deg, #fff 0%, #f3f5fb 100%);
}

.footer-shell {
  padding: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.footer-nav a {
  text-decoration: none;
}

@media (min-width: 1080px) {
  .main-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}

@media (max-width: 760px) {
  .logo-text {
    display: none;
  }

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

  .landing-hero {
    padding-top: 1rem;
  }

  .home-page .site-main {
    min-height: auto;
  }
}
