:root {
    color-scheme: light;
    --bg: #f4f7fc;
    --surface: #ffffff;
    --soft: #eaf0f8;
    --text: #334155;
    --heading: #14243b;
    --muted: #52647c;
    --border: #dce4ef;
    --accent: #175cd3;
    --tint: #eaf2ff;
    --green: #247044;
    --warning: #925b09;
    --warning-bg: #fff5df;
    --tag-bg: #eaf0f8;
    --tag-hover: #d7e4f5;
    --cta-fg: #ffffff;
    --mono: "JetBrains Mono", monospace;
    --sans: "Inter", system-ui, sans-serif;
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a1628;
    --surface: #131f35;
    --soft: #1b2b43;
    --text: #d5deec;
    --heading: #fefefe;
    --muted: #a5b4cb;
    --border: #293a53;
    --accent: #4ea1ff;
    --tint: #142e50;
    --green: #81cf9f;
    --warning: #f3c36c;
    --warning-bg: #33291b;
    --tag-bg: #1c2b44;
    --tag-hover: #263c5e;
    --cta-fg: #06121f;
  }
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; scroll-padding-top: 95px; }
  body { margin: 0; background: var(--bg); color: var(--text); }
  .pic-article { font: 16px/1.8 var(--sans); -webkit-font-smoothing: antialiased; }
  .pic-article a { color: var(--accent); text-underline-offset: 4px; }
  .pic-article a:hover { text-decoration-thickness: 2px; }
  .pic-article button { font: inherit; cursor: pointer; }
  .pic-article :focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
  .pic-article h1, .pic-article h2, .pic-article h3 { color: var(--heading); line-height: 1.2; }
  .skip-link { position: fixed; left: 20px; top: -100px; z-index: 100; padding: 10px 20px; background: var(--surface); }
  .skip-link:focus { top: 16px; }
  .pic-progress { position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 60; }
  .pic-progress-bar { height: 100%; width: 0; background: var(--accent); }

  .pic-theme-btn { width: 38px; height: 38px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--heading); }
  .pic-theme-btn::before { content: '◐'; font-size: 22px; }
  .breadcrumb, .pic-hero, .pic-glance, .pic-layout, .pic-mobile-toc, .lab-footer { max-width: 1240px; margin-left: auto; margin-right: auto; }
  .breadcrumb { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 27px; font: 11px/1.7 var(--mono); color: var(--muted); list-style: none; }
  .pic-article .breadcrumb a { color: var(--muted); text-decoration: none; }
  .pic-article .breadcrumb a:hover { color: var(--accent); }

  /* Tag Badges Strip */
  .pic-hero-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 18px 0 24px; font: 11px var(--mono); }
  .pic-tag-label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; margin-right: 4px; }
  .pic-tag-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: var(--tag-bg); color: var(--heading); border: 1px solid var(--border); border-radius: 4px; text-decoration: none; font-size: 11px; transition: background 0.15s, border-color 0.15s; }
  .pic-tag-pill:hover { background: var(--tag-hover); border-color: var(--accent); color: var(--accent); text-decoration: none; }
  .pic-article a.pic-tag-pill { color: var(--heading); }
  .pic-article a.pic-tag-pill:hover { color: var(--accent); }

  /* Hero CTA buttons */
  .pic-hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 26px; }
  .pic-cta-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--cta-fg); font: 600 13px var(--sans); text-decoration: none; transition: filter 0.15s, background 0.15s; }
  .pic-article a.pic-cta-btn { color: var(--cta-fg); }
  .pic-cta-btn.ghost { background: transparent; }
  .pic-article a.pic-cta-btn.ghost { color: var(--accent); background: transparent; }
  .pic-article a.pic-cta-btn.ghost:hover { color: var(--accent); background: var(--tint); text-decoration: none; }
  .pic-cta-btn:hover { filter: brightness(1.12); }
  .pic-article a.pic-cta-btn:hover { color: var(--cta-fg); text-decoration: none; }

  .pic-glance { display: flex; align-items: center; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 25px 0; margin-bottom: 48px; }
  .pic-glance h3 { width: 180px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); }
  .pic-glance-grid { display: grid; grid-template-columns: repeat(4, 1fr); flex: 1; }
  .pic-glance-item { padding: 0 26px; border-left: 1px solid var(--border); }
  .pic-glance-label { display: block; font: 10px var(--mono); text-transform: uppercase; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.8px; }
  .pic-glance-value { font-size: 14px; color: var(--heading); font-weight: 600; }
  .pic-dots { color: var(--green); font-size: 9px; letter-spacing: 2px; margin-right: 5px; }
  .pic-dots .off { opacity: 0.3; }

  .pic-layout { display: grid; grid-template-columns: 238px minmax(0, 1fr) 210px; gap: 48px; align-items: start; }
  .pic-sidebar { position: sticky; top: 25px; max-height: calc(100vh - 50px); overflow-y: auto; padding-bottom: 24px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  .pic-sidebar::-webkit-scrollbar { width: 7px; }
  .pic-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
  .toc { padding-right: 14px; }
  .toc h2 { font: 11px var(--mono); text-transform: uppercase; letter-spacing: 1.8px; margin: 0 0 20px; }
  .toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
  .toc li { counter-increment: toc; }
  .pic-article .toc a { display: flex; gap: 11px; padding: 8px 10px; border-left: 2px solid var(--border); font-size: 11px; line-height: 1.5; text-decoration: none; color: var(--muted); }
  .toc a::before { content: counter(toc, decimal-leading-zero); font: 10px/1.7 var(--mono); opacity: 0.65; }
  .pic-article .toc a:hover, .pic-article .toc a.active { color: var(--accent); background: var(--tint); border-color: var(--accent); }

  /* Right rail: Categories + Tags */
  .pic-cat-rail { position: sticky; top: 25px; max-height: calc(100vh - 50px); overflow-y: auto; padding-bottom: 24px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  .pic-cat-rail::-webkit-scrollbar { width: 7px; }
  .pic-cat-rail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
  .pic-cat-box h2, .pic-tag-box h2 { font: 11px var(--mono); text-transform: uppercase; letter-spacing: 1.8px; margin: 0 0 16px; }
  .pic-cat-current { display: block; padding: 9px 12px; margin-bottom: 14px; border-left: 2px solid var(--accent); background: var(--tint); color: var(--accent); font-size: 11px; font-weight: 650; line-height: 1.5; text-decoration: none; }
  .pic-cat-current:hover { color: var(--heading); }
  .pic-cat-box ul { list-style: none; padding: 0; margin: 0; }
  .pic-cat-box li a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 12px; border-left: 2px solid var(--border); font-size: 11px; line-height: 1.5; text-decoration: none; color: var(--muted); }
  .pic-cat-box li a:hover { color: var(--accent); background: var(--tint); border-color: var(--accent); }
  .pic-cat-count { font: 10px var(--mono); color: var(--muted); opacity: 0.7; white-space: nowrap; }

  .pic-tag-box { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 20px; }
  .pic-rail-tags { display: flex; flex-direction: column; gap: 6px; }
  .pic-rail-tags a { display: block; padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; font: 11px var(--mono); text-decoration: none; color: var(--muted); }
  .pic-rail-tags a:hover { border-color: var(--accent); color: var(--accent); background: var(--tint); }

  .pic-main { min-width: 0; counter-reset: section; padding-bottom: 60px; }
  .pic-main > h2 { counter-increment: section; border-top: 1px solid var(--border); padding-top: 40px; margin: 58px 0 24px; font-size: 28px; letter-spacing: -0.8px; }
  .pic-main > h2:first-child { border: 0; padding-top: 0; margin-top: 0; }
  .pic-main > h2::before { content: counter(section, decimal-leading-zero) ' /'; display: block; color: var(--accent); font: 11px var(--mono); letter-spacing: 1px; margin-bottom: 12px; }
  .pic-main h3 { font-size: 20px; letter-spacing: -0.4px; margin: 30px 0 16px; }
  .pic-main p { margin: 0 0 20px; }
  .pic-main ul, .pic-main ol { padding-left: 23px; margin: 18px 0 26px; }
  .pic-main li { padding-left: 5px; margin: 8px 0; }
  .pic-main li::marker { color: var(--accent); }
  .table-scroll { overflow-x: auto; margin: 24px 0; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
  .pic-main table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; line-height: 1.65; }
  .pic-main th { padding: 13px 17px; background: var(--soft); color: var(--heading); font: 600 10px/1.5 var(--mono); text-transform: uppercase; letter-spacing: 0.7px; }
  .pic-main td { padding: 13px 17px; border-top: 1px solid var(--border); vertical-align: top; min-width: 85px; }
  .pic-main tr:hover td { background: var(--soft); }
  .spec-strip td:first-child { width: 30%; color: var(--muted); }
  .pic-main strong { color: var(--heading); font-weight: 650; }
  .pic-main code { font: 0.85em/1.7 var(--mono); padding: 3px 6px; background: var(--soft); border-radius: 3px; color: var(--accent); overflow-wrap: anywhere; }
  .pic-main pre { position: relative; background: #0a1628; color: #d5deec; border: 1px solid #293a53; border-radius: 0 0 7px 7px; padding: 24px; margin: 0 0 28px; overflow: auto; tab-size: 4; font: 12px/1.85 var(--mono); }
  .pic-main pre code { padding: 0; background: none; color: inherit; font: inherit; overflow-wrap: normal; }
  .code-heading { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #1b2b43; color: #d5deec; border-radius: 7px 7px 0 0; font: 10px var(--mono); gap: 20px; }
  .pic-copy-btn { border: 1px solid #607897; background: transparent; color: #fefefe; border-radius: 4px; padding: 5px 12px; font: 10px var(--mono) !important; }
  .pic-copy-btn:hover, .pic-copy-btn.copied { background: #175cd3; }
  .pic-main figure { margin: 28px 0; border: 1px solid var(--border); background: var(--surface); padding: 18px; border-radius: 7px; }
  .pic-main figure img { display: block; max-width: 100%; height: auto; margin: auto; border-radius: 4px; }
  .pic-main figure svg { display: block; width: 100%; height: auto; margin: auto; }
  .pic-main figcaption { color: var(--muted); text-align: center; font: 11px/1.8 var(--mono); margin-top: 16px; }
  .note, .pic-glance-warn, .verify, .tldr { background: var(--tint); border-left: 3px solid var(--accent); padding: 22px 24px; border-radius: 0 6px 6px 0; font-size: 14px; margin: 24px 0; }
  .pic-glance-warn { background: var(--warning-bg); border-left-color: var(--warning); }
  .tldr { border-left-width: 4px; }
  .tldr h3 { margin: 0 0 10px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: 1.6px; color: var(--accent); }
  .tldr p { margin: 0 0 8px; }
  .tldr p:last-child { margin-bottom: 0; }
  .trouble { padding: 6px 24px; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; }
  .faq-item { border-bottom: 1px solid var(--border); }
  .faq-item summary { list-style: none; padding: 23px 35px 23px 0; cursor: pointer; color: var(--heading); font-weight: 600; position: relative; font-size: 15px; line-height: 1.6; }
  .faq-item summary::-webkit-details-marker { display: none; }
  .faq-item summary::after { content: '+'; position: absolute; right: 5px; color: var(--accent); font: 24px var(--mono); top: 21px; }
  .faq-item[open] summary::after { content: '−'; }
  .faq-item p { color: var(--muted); font-size: 14px; padding-right: 20px; }

  /* Terminal Trace Box */
  .terminal-box {
    background: #000000;
    border: 1px solid #27272a;
    border-radius: 7px;
    padding: 18px;
    font-family: var(--mono);
    font-size: 12px;
    color: #4ade80;
    line-height: 1.6;
    margin: 20px 0 28px;
    overflow-x: auto;
  }
  .term-row { display: flex; gap: 14px; margin-bottom: 4px; flex-wrap: wrap; }
  .term-time { color: #a1a1aa; min-width: 86px; }
  .term-event { color: #38bdf8; font-weight: 600; min-width: 78px; }
  .term-data { color: #fbbf24; font-weight: 700; }
  .term-ack { color: #4ade80; }
  .term-nak { color: #f43f5e; font-weight: 700; }
  .term-sep { border-top: 1px dashed #3f3f46; margin: 8px 0; padding-top: 8px; color: #a1a1aa; }

  /* Code syntax highlighting (dark panel only) */
  .tok-c { color: #6b7f9e; font-style: italic; }
  .tok-s { color: #bae67e; }
  .tok-p { color: #d4a5ff; }
  .tok-n { color: #ffcc66; }
  .tok-k { color: #7ab3ff; font-weight: 600; }
  .tok-t { color: #5ccfe6; }
  .tok-f { color: #ffd580; }

  /* End of Article Tags Section */
  .pic-article-tags { margin-top: 48px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
  .pic-tags-heading { display: block; font: 11px var(--mono); text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 12px; }
  .pic-tag-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font: 12px var(--mono); }
  .pic-tag-group a { text-decoration: none; padding: 5px 12px; background: var(--tag-bg); color: var(--heading); border: 1px solid var(--border); border-radius: 4px; }
  .pic-tag-group a:hover { background: var(--tint); border-color: var(--accent); color: var(--accent); }

  /* Related projects grid */
  .rel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 26px 0 8px; }
  .pic-article .rel-card { display: block; padding: 18px 20px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); text-decoration: none; transition: border-color 0.15s, background 0.15s; }
  .pic-article .rel-card:hover { border-color: var(--accent); background: var(--tint); text-decoration: none; }
  .rel-kicker { display: block; font: 10px var(--mono); text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent); margin-bottom: 8px; }
  .rel-card h3 { margin: 0 0 6px; font-size: 14px; line-height: 1.45; color: var(--heading); }
  .rel-card p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }

  /* References */
  .ref-list { list-style: none; counter-reset: ref; padding: 0; margin: 20px 0; }
  .ref-list li { counter-increment: ref; position: relative; padding: 10px 0 10px 44px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
  .ref-list li::before { content: '[' counter(ref) ']'; position: absolute; left: 0; top: 10px; font: 11px var(--mono); color: var(--accent); }
  .ref-list span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

  .pic-author-box { display: flex; align-items: flex-start; gap: 20px; padding: 28px; background: var(--soft); border-radius: 8px; margin-top: 36px; }
  .pic-author-box img { border-radius: 50%; }
  .pic-author-box h3 { margin: 0 0 4px; }
  .pic-author-role { font-size: 11px; color: var(--muted); }
  .pic-author-box p { font-size: 13px; margin: 10px 0 0; }
  .pic-backtop { position: fixed; bottom: 24px; right: 24px; border: 1px solid var(--border); border-radius: 50%; width: 44px; height: 44px; color: var(--heading); background: var(--surface); visibility: hidden; opacity: 0; transition: opacity 0.2s; }
  .pic-backtop.visible { visibility: visible; opacity: 1; }
  .pic-mobile-toc { display: none; }
  .lab-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; border-top: 1px solid var(--border); padding: 30px 0; color: var(--muted); font: 11px/1.7 var(--mono); }
  .lab-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
  .pic-article .lab-footer a { color: var(--muted); text-decoration: none; }
  .pic-article .lab-footer a:hover { color: var(--accent); }

  /* Editorial masthead and article header */
  .lab-header { background: var(--surface); border-bottom: 1px solid var(--border); }
  .lab-header-inner { max-width: 1320px; min-height: 72px; padding: 16px 40px; margin: auto; display: flex; align-items: center; gap: 28px; }
  .pic-article .lab-brand { color: var(--heading); font-size: 21px; font-weight: 750; letter-spacing: -0.8px; text-decoration: none; line-height: 1.3; }
  .brand-divider { color: var(--accent); font-weight: 400; padding: 0 4px; }
  .lab-nav { display: flex; gap: 26px; margin-left: auto; }
  .pic-article .lab-nav a { color: var(--muted); font-size: 14px; text-decoration: none; font-weight: 500; }
  .pic-article .lab-nav a:hover { color: var(--accent); }
  .pic-hero { display: block; padding: 38px 0 32px; }
  .pic-hero-eyebrow { color: var(--accent); font-size: 13px; font-weight: 650; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 18px; }
  .pic-hero h1 { max-width: 1060px; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.2; font-weight: 750; letter-spacing: -1.2px; margin: 0 0 22px; text-wrap: balance; }
  .pic-hero-summary { max-width: 960px; font-size: 17px; line-height: 1.8; color: var(--muted); margin: 0 0 24px; }
  .pic-hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 22px 30px; padding: 24px 0 0; border-top: 1px solid var(--border); color: var(--heading); font-size: 16px; line-height: 1.5; }
  .meta-author { display: flex; gap: 12px; align-items: center; }
  .hero-author-photo { display: block; width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--soft); border: 1px solid var(--border); }
  .pic-hero-meta a { font-weight: 700; text-decoration: none; }
  .pic-hero-meta a:hover { text-decoration: underline; }
  .meta-date { display: flex; flex-direction: column; gap: 3px; border-left: 1px solid var(--border); padding-left: 28px; }
  .meta-label { font-size: 14px; color: var(--muted); }
  .meta-date time { font-size: 16px; font-weight: 550; }
  .meta-verification { display: flex; gap: 8px; align-items: center; color: var(--green); font-size: 15px; font-weight: 650; padding: 9px 13px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }

  @media(max-width: 1320px) { .breadcrumb, .pic-hero, .pic-glance, .pic-layout, .pic-mobile-toc, .lab-footer { margin-left: 40px; margin-right: 40px; } .pic-layout { gap: 34px; grid-template-columns: 200px minmax(0, 1fr) 180px; } }
  @media(max-width: 1150px) { .pic-layout { grid-template-columns: 190px minmax(0, 1fr); } .pic-cat-rail { display: none; } }
  @media(max-width: 1050px) { .pic-glance h3 { width: 125px; } .pic-glance-item { padding: 0 16px; } .pic-layout { grid-template-columns: 180px minmax(0, 1fr); gap: 30px; } }
  @media(max-width: 800px) { .breadcrumb, .pic-hero, .pic-glance, .pic-layout, .pic-mobile-toc, .lab-footer { margin-left: 24px; margin-right: 24px; } .pic-glance { display: block; margin-bottom: 24px; } .pic-glance h3 { margin: 0 0 22px; width: auto; } .pic-glance-item:first-child { padding-left: 0; border: 0; } .pic-layout { display: block; } .pic-sidebar { display: none; } .pic-mobile-toc { display: block; background: var(--surface); border: 1px solid var(--border); padding: 15px 20px; border-radius: 6px; margin-bottom: 35px; font-size: 13px; } .pic-mobile-toc summary { font-weight: 600; cursor: pointer; } .pic-mobile-toc ol { columns: 2; padding-left: 20px; } .pic-mobile-toc li { margin: 8px 0; } .pic-main > h2 { font-size: 27px; } .rel-grid { grid-template-columns: 1fr; } }
  @media(max-width: 480px) { .pic-theme-btn { margin-left: auto; } .breadcrumb, .pic-hero, .pic-glance, .pic-layout, .pic-mobile-toc, .lab-footer { margin-left: 20px; margin-right: 20px; } .breadcrumb { font-size: 9px; } .pic-glance-grid { grid-template-columns: 1fr 1fr; gap: 24px 0; } .pic-glance-item:nth-child(3) { padding-left: 0; border: 0; } .pic-glance-value { font-size: 13px; } .pic-main { font-size: 15px; } .pic-main td, .pic-main th { padding: 12px; } .pic-main pre { padding: 18px; } .pic-author-box { padding: 20px; gap: 12px; } .pic-mobile-toc ol { columns: 1; } .lab-footer { flex-direction: column; } }
  @media(prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
