/* ChangCloude — "release notes" theme, light: white + cool-grey surfaces, dot-grid, 1px hairlines,
   electric blue -> violet gradient used sparingly, Bai Jamjuree display, IBM Plex Sans Thai body, mono metadata */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #0b0d12;
  --muted: #545c6b;          /* 6.4:1 on --bg */
  --line: #e1e4ea;
  --line-2: #cfd4dc;
  --dot: #d9dde4;
  --blue: #2563eb;
  --violet: #7c3aed;
  --grad: linear-gradient(90deg, #2563eb, #7c3aed);
  --accent: #3b3fd8;         /* gradient midpoint as text: 6.9:1 on white */
  --accent-soft: #eef0ff;
  --ok: #0f7b53;
  --news: #1d4ed8;
  --article: #6d28d9;
  --review: #a14a00;
  --radius: 12px;
  --ring: 0 0 0 1px var(--line);
  --shadow: 0 1px 2px rgb(11 13 18 / .04), 0 4px 16px rgb(11 13 18 / .04);
  --display: "Bai Jamjuree", "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  --body: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", "Thonburi", system-ui, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Sans Thai", ui-monospace, SFMono-Regular, Menlo, monospace;
  --dotgrid: radial-gradient(var(--dot) 1px, transparent 1.2px) 0 0 / 20px 20px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); overflow-wrap: anywhere; letter-spacing: -.005em; }
.wrap { max-width: 1240px; margin-inline: auto; padding: 0 16px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 0; background: var(--text); color: #fff; padding: 8px 12px; z-index: 50; font-weight: 600; }
.skip:focus { left: 8px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- header: one slim bar + a tab row of sections ---------- */
.site-header {
  background: rgb(255 255 255 / .86); color: var(--text); position: relative; z-index: 20;
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
}
.header-row { display: flex; align-items: center; gap: 14px; min-height: 58px; }
.logo { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.logo:hover { color: inherit; }
.logo img { border-radius: 8px; }
.logo-text { font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: -.02em; line-height: 1; color: var(--text); }
.logo-text b { font-weight: 700; margin-left: 1px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sys { flex: none; display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: .72rem; }
.sys i { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgb(22 163 74 / .18); }
.sys .ver { padding: 0 6px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--text); }
.latest-commit {
  margin-left: auto; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 10px;
  padding: 5px 12px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: .86rem; color: var(--text);
}
.latest-commit:hover { border-color: var(--accent); }
.lc-label { flex: none; font-family: var(--mono); font-weight: 600; font-size: .7rem; color: #fff; background: var(--text); padding: 1px 9px; border-radius: 999px; }
.lc-label::before { content: ">_ "; color: #a5b4fc; }
.lc-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { border-top: 1px solid var(--line); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav ul::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; gap: 6px; padding: 9px 12px; white-space: nowrap; position: relative;
  font-family: var(--display); font-weight: 500; font-size: .93rem; color: var(--muted);
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--grad); border-radius: 2px; }
.nav-ico { font-size: .9em; }

/* breadcrumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 18px auto 0; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-2); }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--text); }
.crumbs li:last-child span { display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ---------- shared bits ---------- */
section { margin-top: 48px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-title { display: flex; align-items: baseline; gap: 10px; font-weight: 700; font-size: 1.55rem; line-height: 1.3; margin: 0 0 18px; }
.section-title::before {
  content: "//"; font-family: var(--mono); font-weight: 600; font-size: .7em; letter-spacing: -.05em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title-th { font-family: var(--body); font-weight: 500; font-size: .62em; color: var(--muted); }
.label-title {
  margin: 0 0 4px; font-family: var(--mono); font-weight: 600; font-size: .8rem; color: var(--muted);
  display: flex; align-items: center; gap: 8px; text-transform: lowercase;
}
.label-title::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--grad); }
.tag, code.count {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-weight: 600; font-size: .72rem; line-height: 1.5;
  padding: 0 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}

/* ---------- home: typographic hero ---------- */
.hero { margin-top: 0; padding-top: 44px; background: var(--surface) var(--dotgrid); border-bottom: 1px solid var(--line); }
.hero-post { position: relative; }
.hero-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.hero-flag { padding: 1px 9px; border-radius: 6px; color: #fff; background: var(--grad); font-weight: 600; }
.hero-post h2 {
  margin: 0; max-width: 24ch; font-size: clamp(2.1rem, 5.4vw, 4.4rem); font-weight: 700; line-height: 1.18; letter-spacing: -.025em;
}
.hero-post h2 a:hover { color: inherit; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 40px; align-items: end; margin: 22px 0 28px; }
.hero-sub { margin: 0; max-width: 62ch; font-size: 1.18rem; line-height: 1.6; color: var(--muted); }
.hero-foot .meta { white-space: nowrap; }
.hero-go { margin-left: 12px; color: var(--accent); font-weight: 600; }
.hero-strip { position: relative; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: var(--surface-2); }
.hero-strip img { width: 100%; aspect-ratio: 1200 / 360; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.hero-strip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad); }
.hero-post:hover .hero-strip img { transform: scale(1.02); }

/* trending row under the hero */
.also { margin-top: 28px; }
.also ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.also li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 16px 20px 4px 0; position: relative; }
.also li + li { padding-left: 20px; border-left: 1px dashed var(--line); }
.num { font-family: var(--mono); font-weight: 600; font-size: 1.05rem; line-height: 1.6; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mini-sec { margin: 0; font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.also h3 { font-size: 1.04rem; font-weight: 600; line-height: 1.45; margin: 2px 0 4px; }
.also h3 a::after { content: ""; position: absolute; inset: 0; }
.also time { font-family: var(--mono); font-size: .7rem; color: var(--muted); }

/* ---------- docs layout: sticky left rail + main column ---------- */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; align-items: start; margin-top: 40px; }
.docs-page { margin-top: 20px; }
.docs-main > section:first-child, .docs-main > .doc-head:first-child { margin-top: 0; }
.rail { position: sticky; top: 120px; padding: 4px 0; }
.rail-title { margin: 0 0 10px; padding-left: 10px; font-family: var(--mono); font-weight: 600; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.rail ul { list-style: none; margin: 0; padding: 0 0 0 0; border-left: 1px solid var(--line); }
.rail a {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px; margin-left: -1px; min-height: 34px;
  border-left: 2px solid transparent; font-size: .94rem; color: var(--muted); border-radius: 0 6px 6px 0;
}
.rail a:hover { color: var(--text); background: var(--surface-2); }
.rail a[aria-current="page"] { color: var(--text); font-weight: 600; border-left-color: var(--accent); background: var(--accent-soft); }
.rail-ico { width: 18px; text-align: center; font-size: .9em; }
.rail-name { flex: 1; min-width: 0; }
.rail a[aria-current="page"] .count { color: var(--accent); border-color: #d5daff; background: var(--surface); }

/* stream: mixed card sizes, every few items a full-width one */
.stream { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stream-item { display: flex; min-width: 0; }
.stream-item.wide { grid-column: 1 / -1; }
.card {
  display: flex; flex-direction: column; width: 100%; background: var(--surface); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: var(--line-2); box-shadow: 0 12px 32px rgb(37 99 235 / .08), 0 2px 6px rgb(11 13 18 / .05); }
.card-img { display: block; overflow: hidden; background: var(--surface-2); }
.card-img img { aspect-ratio: 16/9; object-fit: cover; width: 100%; height: 100%; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card-img img { transform: scale(1.03); }
.card-body { padding: 16px 18px 16px; display: flex; flex-direction: column; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
.card h3 { font-size: 1.12rem; font-weight: 600; line-height: 1.45; margin: 10px 0 6px; }
.card .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: auto; padding-top: 10px; }
.wide .card { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.wide .card-img img { aspect-ratio: auto; min-height: 260px; }
.wide .card-body { padding: 24px 26px; justify-content: center; }
.wide .card h3 { font-size: clamp(1.3rem, 2vw, 1.65rem); font-weight: 700; line-height: 1.35; }
.wide .card .sub { -webkit-line-clamp: 3; font-size: 1rem; }
.wide .card .meta { margin-top: 6px; }

/* changelog timeline */
.changelog ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); font-size: .96rem; }
.changelog li {
  display: grid; grid-template-columns: 150px 150px minmax(0, 1fr); gap: 16px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px dashed var(--line); position: relative;
}
.changelog time { display: flex; gap: 10px; font-family: var(--mono); font-size: .78rem; color: var(--muted); white-space: nowrap; }
.changelog time b { color: var(--text); font-weight: 600; }
.changelog .tag { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.changelog a { display: inline-block; padding: 2px 0; font-weight: 500; line-height: 1.5; }
.changelog li:first-child time b { color: var(--accent); }
.changelog li:first-child a::after { content: "latest"; margin-left: 8px; padding: 0 6px; border-radius: 4px; font-family: var(--mono); font-size: .66rem; font-weight: 600; color: #fff; background: var(--grad); vertical-align: .15em; }

/* section groups shown as tabs */
.tabs { margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tabs ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs ul::-webkit-scrollbar { display: none; }
.tabs a { display: block; padding: 7px 12px; white-space: nowrap; font-family: var(--display); font-weight: 500; font-size: .92rem; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); border-bottom-color: var(--accent); }
.group { margin-top: 28px; scroll-margin-top: 130px; }
.group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.group-tab {
  margin: 0 0 -1px; position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px; font-size: 1.08rem; font-weight: 700; line-height: 1.4;
  background: var(--surface); border: 1px solid var(--line); border-bottom-color: var(--surface); border-radius: 10px 10px 0 0;
  box-shadow: inset 0 2px 0 var(--accent);
}
.group-head .more { margin-bottom: 8px; }
.group-panel {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius);
}
.group-lead { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: start; }
.group-lead img { border-radius: 8px; aspect-ratio: 4/3; object-fit: cover; box-shadow: var(--ring); }
.group-lead-text { display: flex; flex-direction: column; gap: 4px; }
.group-lead-title { font-family: var(--display); font-weight: 600; font-size: 1.12rem; line-height: 1.42; }
.group-lead time, .group-list time { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.group-lead:hover { color: inherit; }
.group-lead:hover .group-lead-title { color: var(--accent); }
.group-list { list-style: none; margin: 0; padding: 0; }
.group-list li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 7px 0; }
.group-list li + li { border-top: 1px dashed var(--line); }
.group-list a { font-weight: 500; font-size: .96rem; line-height: 1.45; }
.panel-solo { grid-template-columns: minmax(0, 1fr); }

/* ---------- docs page (section / author / 404) ---------- */
.doc-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.doc-path { margin: 0 0 6px; font-family: var(--mono); font-size: .78rem; color: var(--accent); }
.doc-head h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 0; font-weight: 700; font-size: clamp(1.9rem, 4.2vw, 2.8rem); line-height: 1.2; letter-spacing: -.015em; }
.doc-ico { width: 52px; height: 52px; display: grid; place-items: center; font-size: 1.5rem; background: var(--surface) var(--dotgrid); border: 1px solid var(--line-2); border-radius: 12px; }
.doc-head h1 small { font-family: var(--mono); font-size: .38em; font-weight: 500; color: var(--accent); padding: 2px 8px; border: 1px solid #d5daff; border-radius: 6px; background: var(--accent-soft); }
.doc-intro { margin: 12px 0 0; color: var(--muted); max-width: 66ch; }
.doc-intro a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.docs-main > .ad-slot { padding: 0; }

.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  position: relative; display: grid; grid-template-columns: 112px minmax(0, 1fr) 176px; gap: 24px; align-items: start;
  padding: 22px 0; border-bottom: 1px solid var(--line);
}
.entry time { display: flex; flex-direction: column; font-family: var(--mono); font-size: .76rem; color: var(--muted); line-height: 1.5; padding-top: 3px; white-space: nowrap; }
.entry time b { font-size: .86rem; color: var(--text); font-weight: 600; }
.entry-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 4px; }
.entry h3 { margin: 0 0 6px; font-size: 1.22rem; font-weight: 600; line-height: 1.42; }
.entry .sub { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry img { border-radius: 8px; aspect-ratio: 16/10; object-fit: cover; box-shadow: var(--ring); }
.entry:hover h3 a { color: var(--accent); }
.entry::before { content: ""; position: absolute; left: -16px; top: 22px; bottom: 22px; width: 2px; border-radius: 2px; background: var(--grad); opacity: 0; transition: opacity .15s; }
.entry:hover::before { opacity: 1; }
.pager { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 36px; font-family: var(--mono); font-size: .85rem; }
.pager a { border: 1px solid var(--line-2); background: var(--surface); padding: 6px 14px; border-radius: 8px; font-weight: 500; }
.pager a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- article: rail | reading column | on-this-page ---------- */
.article-layout { grid-template-columns: 200px minmax(0, 1fr) 240px; gap: 48px; margin-top: 20px; }
.post { min-width: 0; max-width: 760px; }
.post-head h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 700; line-height: 1.28; margin: 14px 0 12px; letter-spacing: -.015em; }
.feature-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.post-head .type { padding: 1px 8px; border: 1px solid currentColor; border-radius: 6px; min-height: 24px; display: inline-flex; align-items: center; }
.cat { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.post-sub { font-size: 1.18rem; color: var(--muted); margin: 0 0 16px; line-height: 1.6; }
.byline-inline { display: none; align-items: center; gap: 10px; padding: 12px 0; border-block: 1px solid var(--line); }
.byline-inline a { font-family: var(--body); font-weight: 600; color: var(--text); }
.avatar {
  width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; flex: none;
  background: var(--grad); color: #fff; font-family: var(--display); font-weight: 700; font-size: .95rem;
}
.post-cover { margin: 22px 0; }
.post-cover img { border-radius: var(--radius); width: 100%; aspect-ratio: 1200/630; object-fit: cover; box-shadow: var(--ring); }
.post-body { font-size: 1.1rem; line-height: 1.85; }
.post-body .lead { font-size: 1.18rem; padding: 2px 0 2px 18px; border-left: 3px solid; border-image: linear-gradient(180deg, var(--blue), var(--violet)) 1; }
.post-body h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.35; margin: 38px 0 8px; scroll-margin-top: 130px; }
.post-body h2::before { content: "## "; font-family: var(--mono); font-size: .7em; color: var(--accent); }
.post-body img { border-radius: var(--radius); margin: 24px 0; width: 100%; box-shadow: var(--ring); }
.post-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-body strong { font-weight: 600; }
.post-body ul { list-style: none; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 8px; }
.post-body li { display: flex; gap: 10px; }
.post-body li::before { content: "→"; flex: none; font-family: var(--mono); font-weight: 600; color: var(--accent); }
.post-foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.post-foot a { color: var(--text); font-weight: 600; }
.post-foot code { font-family: var(--mono); }
.related { margin-top: 44px; }
.related .section-title { font-size: 1.3rem; }
.related-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.related-list li { display: grid; grid-template-columns: 84px 140px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.related-list time { font-family: var(--mono); font-size: .76rem; color: var(--muted); white-space: nowrap; }
.related-list .tag { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.related-list a { font-weight: 500; line-height: 1.5; }

.onpage { position: sticky; top: 120px; font-size: .9rem; }
.facts { margin: 12px 0 0; padding: 4px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.facts div { display: grid; gap: 2px; padding: 10px 0; }
.facts div + div { border-top: 1px dashed var(--line); }
.facts dt { font-family: var(--mono); font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.facts time { font-family: var(--mono); font-size: .82rem; }
.facts a:hover { color: var(--accent); }
.toc { margin-top: 20px; }
.toc-title { margin: 0 0 8px; font-family: var(--mono); font-weight: 600; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); line-height: 1.45; }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.to-top-mini { display: inline-block; margin-top: 18px; padding: 4px 0; font-family: var(--mono); font-size: .76rem; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { margin-top: 80px; background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; position: relative; }
.site-footer::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--grad); }
.site-footer a { color: var(--text); }
.site-footer a:hover { color: var(--accent); }
.footer-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 56px; padding-top: 48px; padding-bottom: 32px; }
.footer-brand p { margin: 14px 0 0; line-height: 1.7; max-width: 44ch; }
.footer-brand .footer-tagline { margin-top: 8px; font-family: var(--mono); font-size: .76rem; }
.footer-tagline::before { content: "~/changcloude $ "; color: var(--accent); font-weight: 600; }
.footer-title { margin: 4px 0 14px; color: var(--text); font-family: var(--mono); font-weight: 600; font-size: .8rem; }
.footer-title::before { content: "// "; color: var(--accent); }
.footer-col ul, .footer-latest { list-style: none; margin: 0; padding: 0; }
.footer-sections { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-sections a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-family: var(--mono); font-size: .8rem; }
.footer-sections a:hover { border-color: var(--accent); }
.footer-latest-wrap { padding-top: 24px; padding-bottom: 40px; border-top: 1px dashed var(--line); }
.footer-latest { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.footer-latest a { padding: 2px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; font-weight: 500; }
.footer-latest time { display: block; margin-bottom: 4px; font-family: var(--mono); font-size: .72rem; }
.footer-bottom { border-top: 1px solid var(--line); background: var(--bg) var(--dotgrid); }
.footer-bottom-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; padding-bottom: 16px; font-family: var(--mono); font-size: .76rem; }
.footer-bottom p { margin: 0; }
.eof { margin-left: 8px; color: var(--accent); }
.site-footer .to-top { color: var(--muted); display: inline-block; padding: 6px 0; }

/* ---------- chips, badges, type labels ---------- */
.more {
  flex: none; font-family: var(--mono); font-weight: 500; font-size: .8rem; color: var(--text);
  padding: 5px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface);
}
.more:hover { border-color: var(--accent); color: var(--accent); }
.badge {
  position: relative; z-index: 2; min-height: 24px;
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 7px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #d5daff;
  font-family: var(--mono); font-weight: 600; font-size: .74rem; line-height: 1.6; border-radius: 6px;
}
.badge:hover { color: var(--accent); border-color: var(--accent); }
.type { font-family: var(--mono); font-weight: 600; font-size: .7rem; letter-spacing: .02em; text-transform: lowercase; }
.type::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 1px; background: currentColor; vertical-align: .12em; }
.type-news { color: var(--news); }
.type-article { color: var(--article); }
.type-review { color: var(--review); }
.sub { color: var(--muted); margin: 0 0 8px; font-size: .95rem; line-height: 1.6; }
.meta { margin: 0; font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }

/* terminal block (404) */
.term {
  margin: 18px 0 0; max-width: 560px; padding: 14px 16px 14px; border-radius: 10px; background: #0d1017; color: #d6dbe6;
  font-family: var(--mono); font-size: .82rem; line-height: 1.7; box-shadow: 0 10px 30px rgb(11 13 18 / .16);
  overflow-x: auto; white-space: pre;
}
.term .p { color: #818cf8; }
.term .e { color: #fca5a5; }
.term .c { color: #7d8597; }

/* ad slots: code comes from the admin app (zone ads) */
.ad-slot { display: flex; flex-direction: column; align-items: center; gap: 16px; margin: 24px auto; max-width: 1280px; padding: 0 16px; text-align: center; overflow: hidden; }
.ad-unit { width: 100%; max-width: 100%; overflow: hidden; }
.post-body + .ad-slot, .post-cover + .ad-slot, .docs-main > .ad-slot { padding: 0; }

/* broken image: replaced by the site logo (script in layout.html), centred on the logo's own background */
img.img-fallback { object-fit: contain !important; background: #4338ca; filter: none !important; }
.post-body img.img-fallback, .post-cover img.img-fallback { aspect-ratio: 16/9; max-height: 420px; }

/* mobile: the last breadcrumb (article title) shrinks to the screen instead of pushing the page wider */
.crumbs li:last-child { display: flex; min-width: 0; max-width: 100%; }
.crumbs li:last-child span { min-width: 0; max-width: 60ch; }
/* tap targets: at least 24px tall */
.site-footer .to-top { display: inline-block; padding: 6px 0; }

/* empty state: no posts yet */
.empty { text-align: center; padding: 64px 24px; background: var(--surface) var(--dotgrid); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty-ico { font-size: 2.6rem; margin: 0; line-height: 1; }
.empty h2 { font-size: 1.7rem; margin: 12px 0 6px; }
.empty p { margin: 0; color: var(--muted); }
.empty p:last-child { font-family: var(--mono); font-size: .85rem; }
.doc-intro code, .post-body code { font-family: var(--mono); font-size: .85em; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }

/* ---------- responsive ---------- */
@media (min-width: 761px) {
  .site-header { position: sticky; top: 0; }
}
@media (max-width: 1180px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 40px; }
  .article-layout > .rail { display: none; }
  .post { max-width: none; }
}
@media (max-width: 1080px) {
  .docs { grid-template-columns: 190px minmax(0, 1fr); gap: 32px; }
  .article-layout { grid-template-columns: minmax(0, 1fr) 220px; }
  .group-panel { grid-template-columns: minmax(0, 1fr); }
  .footer-latest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .docs, .article-layout { grid-template-columns: minmax(0, 1fr); }
  .docs > .rail { display: none; }
  .onpage { display: none; }
  .byline-inline { display: flex; }
  .hero-foot { grid-template-columns: minmax(0, 1fr); }
  .hero-foot .meta { white-space: normal; }
  .footer-top { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
@media (max-width: 760px) {
  .latest-commit { display: none; }
  .header-row { min-height: 54px; }
  .sys { margin-left: auto; }
  .nav .wrap { padding: 0; }
  .nav ul { padding: 0 8px; }
  .hero { padding-top: 28px; }
  .hero-strip img { aspect-ratio: 16 / 7; }
  .also ol { grid-template-columns: minmax(0, 1fr); }
  .also li, .also li + li { padding: 12px 0 8px; border-left: 0; }
  .also li + li { border-top: 1px dashed var(--line); }
  .stream { grid-template-columns: minmax(0, 1fr); }
  .wide .card { display: flex; }
  .wide .card-img img { aspect-ratio: 16/9; min-height: 0; }
  .wide .card-body { padding: 16px 18px; }
  .changelog li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .changelog a { grid-column: 1 / -1; }
  .changelog .tag { justify-self: end; }
  .group-lead { grid-template-columns: 120px minmax(0, 1fr); }
  .entry { grid-template-columns: minmax(0, 1fr) 104px; gap: 6px 16px; padding: 18px 0; }
  .entry time { grid-column: 1 / -1; flex-direction: row; gap: 10px; padding: 0; }
  .entry h3 { font-size: 1.08rem; }
  .entry .sub { display: none; }
  .entry::before { display: none; }
  .related-list li { grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; }
  .related-list a { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .group-panel { padding: 14px; }
  .group-tab { font-size: 1rem; padding: 7px 12px; }
  .footer-latest { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .footer-bottom-row { flex-direction: column; align-items: flex-start; }
  .term { font-size: .74rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .hero-post:hover .hero-strip img, .card:hover .card-img img { transform: none; }
}

/* sidebar ad zone: fits the column it sits in */
.ad-slot.ad-sidebar { margin: 0 0 16px; padding: 0; max-width: 100%; }
/* an ad never widens the page: the slot takes its parent's width and clips anything wider */
.ad-slot { width: 100%; min-width: 0; box-sizing: border-box; }
.ad-unit > * { max-width: 100%; }
