/* Smooth anchor navigation for the TOC. scroll-padding-top keeps the
   landed heading clear of the fixed top bar / breathing room. */
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
.prose :is(h2, h3) { scroll-margin-top: 24px; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Page-specific: breadcrumb trail, article meta, AEO quick-answer block */
.crumbs { font-family: "IBM Plex Mono", monospace; font-size: 12px;
    color: var(--text-2); list-style: none; padding: 0;
    margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs li::after { content: "/"; margin-left: 8px; color: var(--border); }
.crumbs li:last-child::after { content: ""; }
.crumbs a { color: var(--green); text-decoration: none; }
.crumbs a:hover { color: var(--orange); }
.article-date { font-family: "IBM Plex Mono", monospace; font-size: 13px;
    color: var(--text-2); margin: 14px 0 0; display: flex;
    flex-wrap: wrap; gap: 6px 16px; }
.article-date i { margin-right: 5px; }
.article-date .updated { color: var(--orange-deep); }
.quick-answer { background: rgba(232,93,31,0.08);
    border: 1px solid rgba(232,93,31,0.25); border-radius: 12px;
    padding: 22px 24px; }
.quick-answer .qa-label { font-family: "IBM Plex Mono", monospace;
    font-size: 12px; font-weight: 600; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--orange-deep); margin: 0 0 6px; }
.quick-answer p:last-child { font-size: 16px; margin: 0; }
.article-foot { margin-top: 48px; padding-top: 28px;
    border-top: 1px solid var(--border); }

/* "Skip ahead" table of contents — native <details>, no JS.
   Sticks to the top of the viewport on desktop scroll. */
.toc { margin: 28px 0 0; border: 1px solid var(--border);
    border-radius: 12px; background: var(--bg-2, #faf8f5); }
.toc > summary { font-family: "IBM Plex Mono", monospace;
    font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
    color: var(--text-1); padding: 14px 20px; cursor: pointer;
    list-style: none; display: flex; align-items: center; gap: 8px; }
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary i { color: var(--orange); transition: transform .2s; }
.toc[open] > summary i { transform: rotate(90deg); }
.toc ol { margin: 0; padding: 4px 20px 18px 38px;
    display: flex; flex-direction: column; gap: 8px; }
.toc li { font-size: 15px; }
.toc a { color: var(--green); text-decoration: none; }
.toc a:hover { color: var(--orange); text-decoration: underline; }
/* Wide screens: lift TOC out of the reading column and pin it to the
   right gutter as a quiet outline. Below 1200px it falls back to the
   inline collapsible <details> defined above. */
@media (min-width: 1200px) {
    .toc {
        /* Hidden by default; revealed once the reader scrolls past
           the hero. The .toc--visible class is toggled by the
           IntersectionObserver at the bottom of the document. */
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease-out;
        position: fixed;
        top: 120px;
        /* Anchor to the left gutter: hug the left edge of the
           reading column (half-viewport - 380px) minus the TOC width
           and a 24px gap. max() keeps a 24px viewport margin on
           narrower-but-qualifying screens. */
        left: max(24px, calc(50% - 400px - 220px));
        right: auto;
        width: 220px;
        max-height: calc(100vh - 160px);
        overflow-y: auto;
        background: transparent;
        border: none;
        border-right: 2px solid var(--border);
        border-radius: 0;
        margin: 0;
    }
    .toc > summary { display: none; }
    .toc::before {
        content: "On this page";
        display: block;
        font-family: "IBM Plex Mono", monospace;
        font-size: 11px; font-weight: 600;
        letter-spacing: 0.1em; text-transform: uppercase;
        color: var(--text-2);
        padding: 0 0 10px 18px;
    }
    .toc ol { padding: 0 0 0 18px; gap: 10px; }
    .toc li { font-size: 13.5px; line-height: 1.5; }
    .toc.toc--visible { opacity: 1; pointer-events: auto; }
}

/* Named-author block — builds visible authority for Person schema. */
.author-card { display: flex; gap: 16px; align-items: flex-start; }
.author-card .avatar { width: 56px; height: 56px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
    border: 2px solid var(--border); }
.author-card .avatar-fallback { width: 56px; height: 56px;
    border-radius: 50%; flex-shrink: 0; display: flex;
    align-items: center; justify-content: center;
    background: var(--orange); color: #fff; font-weight: 700;
    font-size: 22px; font-family: "Space Grotesk", sans-serif; }
.author-card .author-name { font-weight: 700; font-size: 17px;
    margin: 0; }
.author-card .author-role { font-family: "IBM Plex Mono", monospace;
    font-size: 12px; color: var(--text-2); margin: 2px 0 8px; }
.author-card .author-bio { font-size: 15px; color: var(--text-1);
    margin: 0; }

/* Tiptap callout blocks (application/services/blog_service.py sanitizer allows
   class="callout callout-<type>" via allowed_classes) and YouTube embeds. */
.prose .callout { margin: 24px 0; padding: 16px 20px; border-radius: 12px;
    border: 1px solid var(--border); border-left-width: 4px; }
.prose .callout > :first-child { margin-top: 0; }
.prose .callout > :last-child { margin-bottom: 0; }
.prose .callout-info { background: rgba(59,130,246,0.08);
    border-left-color: #3b82f6; }
.prose .callout-warning { background: rgba(232,93,31,0.08);
    border-left-color: var(--orange); }
.prose .callout-tip { background: rgba(34,197,94,0.08);
    border-left-color: var(--green); }

/* The sanitizer (application/utils/html_sanitizer.py) preserves the raw
   <iframe> but strips any wrapping div's data-* attributes/classes it can't
   allowlist, so style the iframe directly rather than a wrapper element. */
.prose iframe { display: block; width: 100%; aspect-ratio: 16 / 9;
    height: auto; margin: 24px 0; border-radius: 12px; border: none; }