/* code.mikirinstudio.com/blog: the archived mikirinkode.online posts. Hand-written (scripts/build-blog.py keeps it).
   Tokens only; the page shell comes from ds/ and code.css. */

.nav__links a[aria-current="page"] { color: var(--c-ink); }

/* ---------- Chips: category filter and a post's categories ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-4); border-radius: var(--r-md); background: var(--c-fill); color: var(--c-ink-muted); font: var(--t-small-strong); transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.chip:hover { background: var(--c-fill-strong); color: var(--c-ink); }
.chip[aria-current="page"] { background: var(--c-blue-tint); color: var(--c-blue); }
.chip--sm { padding: 0 var(--s-3); font: var(--t-caption); }
.chip__n { margin-left: var(--s-2); font: var(--t-caption); color: var(--c-ink-muted); }
.chip[aria-current="page"] .chip__n { color: inherit; }
/* Smaller categories wait behind "+ n lainnya" (blog.js opens them). The current category is never hidden. */
.chip--more { border: 0; cursor: pointer; background: transparent; color: var(--c-blue); }
.chip--more:hover { background: var(--c-blue-tint); color: var(--c-blue); }
.chip--more__close { display: none; }
[data-chips].is-open .chip--more__open { display: none; }
[data-chips].is-open .chip--more__close { display: inline; }
[data-chips].is-collapsed:not(.is-open) .chip--extra { display: none; }

/* ---------- Index and category pages ---------- */
.index { padding-top: var(--s-12); padding-bottom: var(--s-16); }
@media (min-width: 768px) { .index { padding-top: var(--s-16); } }
.index__head { margin-bottom: var(--s-8); }
.index__h { font-size: 40px; }

.search { position: relative; max-width: 480px; margin-bottom: var(--s-4); }
.search .ic { position: absolute; left: var(--s-4); top: 50%; transform: translateY(-50%); color: var(--c-ink-muted); pointer-events: none; }
.search input { width: 100%; min-height: 48px; padding: 0 var(--s-4) 0 calc(var(--s-4) + 28px); border: 1px solid var(--c-edge); border-radius: var(--r-md); background: var(--c-ground); color: var(--c-ink); font: var(--t-body); transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.search input::placeholder { color: var(--c-ink-muted); }
.search input:focus { outline: none; border-color: var(--c-blue); box-shadow: 0 0 0 3px var(--c-blue-tint); }
.search__empty { margin-top: var(--s-8); color: var(--c-ink-muted); }

.year { margin-top: var(--s-10, var(--s-12)); }
.year .title { margin-bottom: var(--s-3); }
.year[hidden] { display: none; }

.post-list { border-top: 1px solid var(--c-fill-strong); }
.post-list li { border-bottom: 1px solid var(--c-fill-strong); }
.post-list li[hidden] { display: none; }
.post-row { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-2); margin: 0 calc(-1 * var(--s-2)); border-radius: var(--r-sm); color: var(--c-ink); transition: background var(--dur-fast) var(--ease-out); }
.post-row:hover { background: var(--c-fill); }
.post-row:hover .post-row__title { color: var(--c-blue); }
.post-row__title { font: var(--t-body-strong); text-wrap: pretty; transition: color var(--dur-fast) var(--ease-out); }
@media (min-width: 720px) { .post-row__title { font-size: 18px; } }
.post-row__meta { font: var(--t-small); color: var(--c-ink-muted); }

/* ---------- Post page ---------- */
.post-wrap { padding-top: var(--s-8); padding-bottom: var(--s-16); }
@media (min-width: 768px) { .post-wrap { padding-top: var(--s-12); padding-bottom: var(--s-24); } }
.post { max-width: 720px; }
@media (min-width: 1100px) {
  .post.has-toc { max-width: none; display: grid; grid-template-columns: minmax(0, 720px) 260px; grid-template-areas: "head toc" "body toc"; column-gap: var(--s-16); align-items: start; }
  .post.has-toc .post__head { grid-area: head; }
  .post.has-toc .prose { grid-area: body; }
  .post.has-toc .toc { grid-area: toc; position: sticky; top: calc(var(--nav-h) + var(--s-4)); margin-top: 0; max-height: calc(100vh - var(--nav-h) - var(--s-8)); overflow-y: auto; }
}

.back { min-height: var(--tap); margin-bottom: var(--s-4); }
.back:hover .ic { transform: translateX(-3px); }
.post__title { font: var(--t-display); font-size: 32px; letter-spacing: var(--track-display); color: var(--c-ink); text-wrap: balance; }
@media (min-width: 768px) { .post__title { font-size: 42px; line-height: 1.1; } }
.post__meta { margin-top: var(--s-3); font: var(--t-small); color: var(--c-ink-muted); }
.post__author { color: var(--c-ink); font-weight: 600; text-decoration: none; }
.post__author:hover { color: var(--c-blue); text-decoration: underline; text-underline-offset: 3px; }
.post__head .chips { margin-top: var(--s-4); }
.post__note { margin-top: var(--s-4); font: var(--t-small); color: var(--c-ink-muted); }

/* Table of contents: a details box, opened on wide screens by blog.js, where it sits beside the post. */
.toc { margin-top: var(--s-8); border-radius: var(--r-lg); background: var(--c-fill); padding: 0 var(--s-5); }
.toc summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; font: var(--t-small-strong); color: var(--c-ink); cursor: pointer; list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: ""; width: 8px; height: 8px; margin-right: var(--s-1); border-right: 2px solid var(--c-ink-muted); border-bottom: 2px solid var(--c-ink-muted); transform: rotate(45deg) translateY(-2px); transition: transform var(--dur-fast) var(--ease-out); }
.toc[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc ol { display: flex; flex-direction: column; padding-bottom: var(--s-4); }
.toc a { display: block; padding: var(--s-2) 0; font: var(--t-small); color: var(--c-ink-muted); }
.toc a:hover { color: var(--c-blue); }
.toc__l3 a { padding-left: var(--s-4); }

/* ---------- Article typography ---------- */
.prose { margin-top: var(--s-10); font: var(--t-lead); color: var(--c-ink); max-width: 68ch; overflow-wrap: break-word; }
.prose > * + * { margin-top: var(--s-5); }
.prose > h2 { margin-top: var(--s-12); font: var(--t-display); font-size: 26px; letter-spacing: var(--track-display); text-wrap: balance; }
.prose > h3 { margin-top: var(--s-10); font: var(--t-title); font-size: 22px; letter-spacing: var(--track-title); }
.prose > h4 { margin-top: var(--s-8); font: var(--t-title); letter-spacing: var(--track-title); }
.prose > h5, .prose > h6 { margin-top: var(--s-6); font: var(--t-body-strong); }
.prose > h2 + *, .prose > h3 + *, .prose > h4 + *, .prose > h5 + *, .prose > h6 + * { margin-top: var(--s-3); }
.prose a { color: var(--c-blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.prose ul, .prose ol { padding-left: var(--s-6); }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li, .prose li > ul, .prose li > ol { margin-top: var(--s-2); }
.prose li::marker { color: var(--c-ink-muted); }
.prose hr { border: 0; height: 2px; background: var(--c-fill-strong); margin: var(--s-10) 0; }
.prose blockquote { padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--c-blue-tint); }
.prose :not(pre) > code { font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace; font-size: 0.86em; padding: 0.1em 0.35em; border-radius: 6px; background: var(--c-fill); overflow-wrap: anywhere; }

/* Pictures sit on the fill, whole, at most their own size. */
.prose figure:not(.code):not(.table) { padding: var(--s-3); border-radius: var(--r-lg); background: var(--c-fill); }
.prose figure img { height: auto; margin: 0 auto; border-radius: var(--r-sm); background: var(--c-ground); }
.prose figcaption { margin-top: var(--s-3); text-align: center; font: var(--t-small); color: var(--c-ink-muted); }
.prose .gallery { display: grid; gap: var(--s-3); }
@media (min-width: 640px) { .prose .gallery { grid-template-columns: repeat(2, 1fr); align-items: start; } }
.prose .gallery figure { padding: 0; }
.prose .media-text { display: grid; gap: var(--s-5); align-items: start; }
@media (min-width: 640px) { .prose .media-text { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.prose .media-text__body > * + * { margin-top: var(--s-4); }

/* Tables: cells on the fill, split by the 2px white gap. */
.prose .table { overflow-x: auto; }
.prose table { border-collapse: separate; border-spacing: 2px; margin: -2px; font: var(--t-body); min-width: 50%; }
.prose th, .prose td { padding: var(--s-2) var(--s-3); background: var(--c-fill); text-align: left; vertical-align: top; }
.prose th, .prose thead td { background: var(--c-fill-strong); font-weight: 700; }
.prose tr:first-child > td:first-child { border-top-left-radius: var(--r-sm); }
.prose tr:last-child > td:last-child { border-bottom-right-radius: var(--r-sm); }

/* Code: highlighted at build time; the colours are token roles (each 6:1 or better on the fill). */
.prose .code { position: relative; border-radius: var(--r-lg); background: var(--c-fill); overflow: hidden; }
.code__label { padding: var(--s-3) var(--s-5) 0; font: var(--t-caption); color: var(--c-ink-muted); text-align: left; margin: 0; }
.prose .code figcaption { margin-top: 0; text-align: left; font: var(--t-caption); }
.code pre { margin: 0; padding: var(--s-4) var(--s-5); overflow-x: auto; font: 400 14px/1.65 ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace; tab-size: 4; color: var(--c-ink); }
.code__label + pre { padding-top: var(--s-2); }
.code__copy { position: absolute; top: var(--s-2); right: var(--s-2); min-height: 36px; min-width: var(--tap); padding: 0 var(--s-3); border-radius: var(--r-sm); background: var(--c-ground); color: var(--c-ink-muted); font: var(--t-caption); opacity: 0; transition: opacity var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.code:hover .code__copy, .code__copy:focus-visible, .code__copy.is-done { opacity: 1; }
@media (hover: none) { .code__copy { opacity: 1; } }
.code__copy:hover { color: var(--c-blue); }
.code__copy.is-done { color: var(--c-good); }
.code .k, .code .kc, .code .kd, .code .kn, .code .kp, .code .kr, .code .kt, .code .ow, .code .nt { color: var(--c-blue); }
.code .s, .code .s1, .code .s2, .code .sa, .code .sb, .code .sc, .code .sd, .code .se, .code .sh, .code .si, .code .sx, .code .sr, .code .ss, .code .cpf { color: var(--c-good); }
.code .c, .code .c1, .code .cm, .code .cs, .code .ch, .code .cd { color: var(--c-ink-muted); font-style: italic; }
.code .m, .code .mi, .code .mf, .code .mh, .code .mo, .code .mb, .code .il, .code .na { color: var(--c-sun-ink); }
.code .cp, .code .nb, .code .bp, .code .nd, .code .nv, .code .vg { color: var(--c-bad); }
.code .nf, .code .fm, .code .nc, .code .nn { font-weight: 700; }
.code .err { color: inherit; background: none; border: 0; }

/* Embeds */
.prose .video { aspect-ratio: 16 / 9; border-radius: var(--r-lg); overflow: hidden; background: var(--c-fill); }
.prose .video iframe { width: 100%; height: 100%; border: 0; display: block; }
.prose .embed-link { padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--c-fill); font: var(--t-body); }

/* The HTML tutorials' forms, shown live as they were written. */
.prose .demo { padding: var(--s-5); border-radius: var(--r-lg); background: var(--c-fill); font: var(--t-body); }
.prose .demo input:not([type="radio"]):not([type="checkbox"]), .prose .demo select, .prose .demo textarea { max-width: 100%; padding: var(--s-2) var(--s-3); border: 1px solid var(--c-edge); border-radius: 8px; background: var(--c-ground); }
.prose .demo input[type="submit"], .prose .demo input[type="reset"], .prose .demo button { cursor: pointer; padding: var(--s-2) var(--s-4); border: 1px solid var(--c-edge); border-radius: 8px; background: var(--c-ground); }
.prose .demo textarea { width: 100%; }

/* ---------- Like ---------- */
.post__end { margin-top: var(--s-12); max-width: 68ch; }
.like { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-4); border-radius: var(--r-full); background: var(--c-fill); color: var(--c-ink); font: var(--t-small-strong); transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out); }
.like:hover { background: var(--c-fill-strong); }
.like:active { transform: scale(0.96); }
.like[aria-pressed="true"] { background: var(--c-blue-tint); color: var(--c-blue); }
.like[aria-pressed="true"] .ic { fill: currentColor; }
.like__n:empty { display: none; }
.like__n { color: var(--c-ink-muted); }
.like[aria-pressed="true"] .like__n { color: var(--c-blue); }
.like[hidden], .post__views[hidden] { display: none; }

/* ---------- Previous / next ---------- */
.pager { display: grid; gap: 2px; margin-top: var(--s-16); border-radius: var(--r-lg); overflow: hidden; max-width: 720px; }
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager__link, .pager__gap { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-5); background: var(--c-fill); color: var(--c-ink); transition: background var(--dur-fast) var(--ease-out); }
.pager__link:hover { background: var(--c-fill-strong); }
.pager__link .caption { display: inline-flex; align-items: center; gap: 6px; }
.pager__next { text-align: right; align-items: flex-end; }
.pager__title { font: var(--t-body-strong); text-wrap: pretty; }
@media (max-width: 639px) { .pager__gap { display: none; } }
