/* brisk. Direction D: article detail pages. Loaded after studio.css. */

.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.progress i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--read, 0)); }

/* ---------- header ---------- */
.a-head { position: relative; padding: 132px 0 0; overflow: hidden; }
.a-head::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(var(--grid) 1.2px, transparent 1.3px); background-size: 20px 20px; -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 20%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse 70% 80% at 50% 20%, #000 30%, transparent 75%); pointer-events: none; }
.a-head-in { position: relative; max-width: 820px; margin: 0 auto; text-align: center; }
.crumbs { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.a-cat { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; margin-top: 18px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-family: var(--f-display); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.a-title { margin-top: 16px; font-family: var(--f-display); font-weight: 700; font-size: clamp(32px, 3.8vw, 46px); line-height: 1.08; letter-spacing: -.03em; color: var(--ink); text-wrap: balance; }
.a-title .acc { color: var(--accent); }
.a-sub { margin: 16px auto 0; max-width: 60ch; font-size: clamp(16px, 1.4vw, 18px); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.a-meta { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 22px; font-size: 13.5px; color: var(--muted); }
.a-meta .who { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; font-family: var(--f-display); }
.a-meta img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.a-meta .dot::before { content: '·'; }
.a-cover { position: relative; max-width: 1000px; margin: 40px auto 0; padding: 0; overflow: hidden; }
.a-cover img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

/* ---------- layout ---------- */
.a-layout { display: grid; grid-template-columns: 220px minmax(0, 700px) 220px; justify-content: center; gap: 48px; padding: 56px 0 24px; }
.toc { position: sticky; top: 104px; align-self: start; max-height: calc(100vh - 128px); overflow: auto; scrollbar-width: none; }
.toc-head { font-family: var(--f-display); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: 13.5px; line-height: 1.4; color: var(--muted); text-decoration: none; transition: color .2s, border-color .2s; }
.toc li a:hover { color: var(--ink); }
.toc li a.on { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-m { display: none; margin-bottom: 28px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.toc-m summary { cursor: pointer; padding: 14px 16px; font-family: var(--f-display); font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; }
.toc-m summary::-webkit-details-marker { display: none; }
.toc-m summary::after { content: '+'; color: var(--accent); }
.toc-m[open] summary::after { content: '−'; }
.toc-m ol { margin: 0; padding: 0 16px 14px 34px; }
.toc-m li { padding: 4px 0; font-size: 14px; }
.toc-m a { color: var(--ink-2); text-decoration: none; }
.aside-r { position: sticky; top: 104px; align-self: start; }
.aside-card { padding: 18px; }
.aside-card p { font-size: 13.5px; color: var(--ink-2); margin: 8px 0 14px; }
.aside-card .btn { width: 100%; justify-content: center; }

/* ---------- in short ---------- */
.in-short { padding: 18px 20px; margin-bottom: 36px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: var(--r); }
.in-short b { display: block; font-family: var(--f-display); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.in-short p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink); }

/* ---------- prose ---------- */
.prose { font-family: var(--f-body); font-size: 17px; line-height: 1.72; color: var(--ink-2); }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 2.2em; font-family: var(--f-display); font-weight: 700; font-size: clamp(22px, 2.2vw, 26px); line-height: 1.22; letter-spacing: -.02em; color: var(--ink); scroll-margin-top: 110px; text-wrap: balance; }
.prose h3 { margin-top: 1.8em; font-family: var(--f-display); font-weight: 700; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); scroll-margin-top: 110px; }
.prose h2 + *, .prose h3 + * { margin-top: .6em; }
.prose > :first-child { margin-top: 0; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose ul, .prose ol { padding-left: 0; list-style: none; }
.prose ul li, .prose ol li { position: relative; padding-left: 26px; }
.prose li + li { margin-top: .45em; }
.prose ul li::before { content: ''; position: absolute; left: 6px; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.prose ol { counter-reset: n; }
.prose ol li { counter-increment: n; }
.prose ol li::before { content: counter(n); position: absolute; left: 0; top: .2em; width: 19px; height: 19px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-family: var(--f-display); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); font-size: 18px; color: var(--ink); }
.prose code { font-family: var(--f-mono); font-size: .86em; padding: .12em .38em; border-radius: 3px; background: var(--card-2); border: 1px solid var(--line); color: var(--ink); }
.prose pre { position: relative; margin: 1.5em 0; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.prose pre code { padding: 0; border: 0; background: none; color: var(--panel-ink); font-size: inherit; white-space: pre; }
.copy-code { position: absolute; top: 8px; right: 8px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); color: var(--panel-muted); font: 500 11.5px var(--f-display); cursor: pointer; opacity: 0; transition: opacity .2s, color .2s; }
.prose pre:hover .copy-code, .copy-code:focus-visible { opacity: 1; }
.copy-code.done { color: var(--panel-accent); opacity: 1; }
.table-wrap { margin: 1.6em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.prose th { text-align: left; padding: 11px 14px; background: var(--card-2); color: var(--ink); font-family: var(--f-display); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.prose td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.prose tr:first-child td { border-top: 0; }
.prose img { display: block; width: 100%; height: auto; margin: 1.8em 0 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.prose .post-image-caption { margin-top: 10px; font-size: 13.5px; color: var(--muted); text-align: center; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

/* ---------- end of article ---------- */
.share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.share .label { font-family: var(--f-display); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
.share a, .share button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); font: 500 13px var(--f-display); text-decoration: none; cursor: pointer; transition: border-color .2s, color .2s; }
.share a:hover, .share button:hover { border-color: var(--accent); color: var(--accent); }
.share svg { width: 15px; height: 15px; }
.author { display: flex; align-items: center; gap: 16px; margin-top: 28px; padding: 20px 22px; }
.author img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.author div { flex: 1; }
.author strong { font-family: var(--f-display); font-size: 16px; color: var(--ink); }
.author p { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.a-cta { margin-top: 28px; }
.a-cta .cta-card { text-align: left; padding: clamp(24px, 3.4vw, 40px); }
.a-cta .cta-row { justify-content: flex-start; }

/* related grid: same card as the index */
.rel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 28px; }
.art { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; }
.art:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.art-img { display: block; overflow: hidden; background: var(--card-2); border-bottom: 1px solid var(--line); }
.art-img img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 1s var(--ease); }
.art:hover .art-img img { transform: scale(1.04); }
.art-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 20px; flex: 1; }
.art-tag { align-self: flex-start; font-family: var(--f-display); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.art .h3 { font-size: 16.5px; line-height: 1.32; }
.art-sub { font-size: 14px; line-height: 1.55; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.art-meta { display: flex; gap: 14px; margin-top: auto; padding-top: 10px; font-size: 12.5px; color: var(--muted); }
.art-meta span + span::before { content: '·'; margin-right: 14px; }

@media (max-width: 1180px) {
  .a-layout { grid-template-columns: 200px minmax(0, 700px); gap: 40px; }
  .aside-r { display: none; }
}
@media (max-width: 900px) {
  .a-layout { grid-template-columns: minmax(0, 1fr); padding-top: 36px; }
  .toc { display: none; }
  .toc-m { display: block; }
  .rel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .a-head { padding-top: 112px; }
  .a-cover { margin-top: 28px; }
  .prose { font-size: 16.5px; }
  .a-meta .who { flex-basis: 100%; justify-content: center; }
  .a-meta .who + .dot { display: none; }
  .author { flex-wrap: wrap; }
}
@media (min-width: 601px) and (max-width: 900px) { .rel-grid { grid-template-columns: repeat(2, 1fr); } .rel-grid > :nth-child(3) { display: none; } }

/* Mobile: long URLs and tokens wrap instead of widening the page; copy buttons
   are always visible and easy to tap on touch screens (no hover there). */
.prose p, .prose li, .prose td, .prose a, .prose code { overflow-wrap: anywhere; }
@media (hover: none) {
  .copy-code { opacity: 1; height: 34px; padding: 0 14px; }
}
