@scope (.legacy-post-body) {

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :scope {
    --bg: #f7f2e8;
    --fg: #101416;
    --fg-muted: #59686a;
    --border: rgba(16, 20, 22, 0.12);
    --line-strong: rgba(16, 20, 22, 0.18);
    --surface: rgba(255, 255, 255, 0.64);
    --surface-hover: rgba(255, 255, 255, 0.84);
    --code-bg: rgba(16, 20, 22, 0.06);
    --accent: #ff6a32;
    --max-w: 720px;
    --font-serif: "Chillax", "Synonym", sans-serif;
    --font-sans: "Synonym", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
  }

  html { font-size: 18px; -webkit-font-smoothing: antialiased; }
  body { font-family: var(--font-sans); color: var(--fg); background: var(--bg); line-height: 1.72; }

  .article { max-width: var(--max-w); margin: 0 auto; padding: 60px 24px 120px; }

  .article-header { margin-bottom: 48px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
  .article-header h1 { font-family: var(--font-serif); font-size: 2.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 16px; }
  .article-header .subtitle { font-size: 1.25rem; color: var(--fg-muted); font-style: italic; line-height: 1.5; }
  .article-header .meta { margin-top: 20px; font-family: var(--font-sans); font-size: 0.78rem; color: var(--fg-muted); letter-spacing: 0.02em; text-transform: uppercase; }

  h2 { font-family: var(--font-serif); font-size: 1.55rem; font-weight: 700; margin: 48px 0 16px; letter-spacing: -0.01em; }
  h3 { font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin: 36px 0 12px; color: var(--fg-muted); }
  p { margin-bottom: 20px; }
  code { font-family: var(--font-mono); font-size: 0.85em; background: var(--code-bg); padding: 2px 6px; border-radius: 3px; }
  blockquote { border-left: 3px solid var(--fg); padding-left: 20px; margin: 28px 0; font-style: italic; color: var(--fg-muted); }
  hr { border: none; border-top: 1px solid var(--border); margin: 48px 0; }

  .demo-section { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 32px; margin: 36px -16px; }
  .demo-section h3 { margin-top: 0; color: var(--fg); }

  button { font-family: var(--font-sans); font-size: 0.82rem; cursor: pointer; border: 1px solid var(--border); background: var(--bg); color: var(--fg); padding: 8px 18px; border-radius: 4px; transition: background 0.15s, border-color 0.15s; letter-spacing: 0.01em; }
  button:hover { background: var(--surface-hover); border-color: var(--line-strong); }
  button:disabled { opacity: 0.4; cursor: not-allowed; }
  button.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
  button.primary:hover { background: #2c3b3d; }
  button.primary:disabled { background: var(--fg-muted); border-color: var(--fg-muted); }
  button.sm { padding: 5px 12px; font-size: 0.75rem; }

  .audio-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
  .audio-controls label.file-label { font-family: var(--font-sans); font-size: 0.82rem; cursor: pointer; border: 1px dashed var(--border); padding: 8px 18px; border-radius: 4px; transition: border-color 0.15s; }
  .audio-controls label.file-label:hover { border-color: var(--fg-muted); }
  .audio-controls input[type="file"] { display: none; }
  .audio-status { font-family: var(--font-sans); font-size: 0.78rem; color: var(--fg-muted); }

  canvas { width: 100%; border-radius: 4px; display: block; }
  .canvas-wrap { position: relative; }
  .canvas-wrap canvas.overlay { position: absolute; top: 0; left: 0; pointer-events: none; border: 1px solid transparent; }
  .canvas-pair { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
  .canvas-label { font-family: var(--font-sans); font-size: 0.72rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }

  .cb-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 16px 0; user-select: none; }
  .cb-btn { font-family: var(--font-mono); font-size: 0.72rem; padding: 8px 2px; text-align: center; border-radius: 3px; min-width: 0; transition: all 0.12s; position: relative; }
  .cb-btn.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
  .cb-btn.off { background: var(--bg); color: var(--fg-muted); border-color: var(--border); }
  .cb-btn.range-start { box-shadow: 0 0 0 2px var(--accent); z-index: 1; }
  .cb-btn.in-range { background: rgba(16, 20, 22, 0.72); color: var(--bg); border-color: rgba(16, 20, 22, 0.72); }
  .cb-hint { font-family: var(--font-sans); font-size: 0.72rem; color: var(--fg-muted); margin-top: 6px; min-height: 1.2em; }
  .presets { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

  .metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
  .metric-card { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 14px; text-align: center; }
  .metric-card .label { font-family: var(--font-sans); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); margin-bottom: 4px; }
  .metric-card .value { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 600; }

  .progress-bar { width: 100%; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin: 12px 0; }
  .progress-bar .fill { height: 100%; background: var(--fg); width: 0%; transition: width 0.3s; }
  .status-text { font-family: var(--font-sans); font-size: 0.78rem; color: var(--fg-muted); min-height: 1.4em; }
  .playback-row { display: flex; gap: 12px; align-items: center; margin: 16px 0; flex-wrap: wrap; }

  .credit-callout {
    font-family: var(--font-sans);
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--fg-muted);
    background: rgba(255, 255, 255, 0.5);
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
    padding: 12px 18px;
    margin: 0 0 8px;
  }
  .credit-callout strong { color: var(--fg); font-weight: 600; }

  /* Demo panels inside .post-body: drop the negative horizontal margin (no room to bleed), soften the panel. */
  .demo-section { margin: 28px 0; border-radius: 14px; padding: 28px; }

  /* Widen the prose column so the interactive widgets have room to breathe. */
  .post-body { max-width: 900px; }

  /* Center the post header (title, meta) */
  .post-header .container { text-align: center; }
  .post-full-title { max-width: none; margin-left: auto; margin-right: auto; }

  /* Sticky header so the brand + current post title stay visible while scrolling. */
  .header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(247, 242, 232, 0.86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .nav-title {
    flex: 1;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: -0.01em;
    color: var(--fg);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 24px;
    pointer-events: none;
    min-width: 0;
  }
  .nav-title.visible { opacity: 1; transform: translateY(0); }

  @media (max-width: 700px) {
    .nav-title { display: none; }
  }

  @media (max-width: 600px) {
    .demo-section { margin: 20px 0; padding: 18px; }
    .cb-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .canvas-pair { grid-template-columns: 1fr; }
  }
  .author-x-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #000;
    color: #fff;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease;
    vertical-align: middle;
  }
  .author-x-pill svg { width: 13px; height: 13px; display: block; }
  .author-x-pill:hover { background: #222; transform: translateY(-1px); }

}
.legacy-post-body { --font-sans: var(--sans); --font-display: var(--serif); --font-mono: ui-monospace, monospace; width: 100%; }

/* Compatibility tokens stay inside the restored article, not the site shell. */
.legacy-post-body {
  --bg: var(--paper);
  --bg-2: #f0e9dc;
  --accent: var(--orange);
  --accent-soft: rgba(164, 69, 37, .12);
  --surface: rgba(255, 255, 255, .64);
  --surface-strong: rgba(255, 255, 255, .84);
  --line-strong: rgba(25, 37, 42, .18);
  --electric: #1bb6ab;
}
