/* papers.css — Deep Sight editorial style for vblog-post output.
 * Scoped to .vblog-post; uses --motif-* variables from motif.css only.
 * Target: deepsightconsulting Papers section.
 */

/* ── ARTICLE SHELL ──────────────────────────────────────────────────── */
.vblog-post {
    width: 100%;
    max-width: min(760px, 100%);
    min-width: 0;
    margin: 0 auto;
    padding-bottom: 5rem;
}

.blog-post-shell,
.blog-post-layout,
.blog-post-sidebar,
.blog-post-main,
.vblog-post__header,
.vblog-post__body {
    min-width: 0;
}

.blog-post-layout {
    display: grid;
    grid-template-columns: minmax(11rem, 15.5rem) minmax(0, 760px);
    column-gap: clamp(2rem, 5vw, 4.75rem);
    align-items: start;
    justify-content: center;
}

.blog-post-sidebar {
    padding-top: 4rem;
}

.blog-post-main {
    width: 100%;
    max-width: 760px;
}

.blog-post-sections {
    position: sticky;
    top: calc(var(--layout-nav-height) + 2rem);
    max-height: calc(100svh - var(--layout-nav-height) - 4rem);
    overflow-y: auto;
    padding: 0.25rem 0 1rem;
    counter-reset: blog-section;
    scrollbar-width: thin;
}

.blog-post-sections > span {
    display: block;
    margin: 0 0 1rem 0.75rem;
    font-family: var(--motif-font-mono);
    font-size: var(--motif-type-caption);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--motif-color-text-muted);
}

.blog-post-sections > a {
    counter-increment: blog-section;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.45rem 0.75rem;
    border-left: 2px solid transparent;
    font-family: var(--motif-font-body);
    font-size: 0.875rem;
    line-height: 1.38;
    color: var(--motif-color-text-muted);
    text-decoration: none;
    transition:
        border-color var(--motif-motion-duration-fast) var(--motif-motion-ease-standard),
        color var(--motif-motion-duration-fast) var(--motif-motion-ease-standard);
}

.blog-post-sections > a::before {
    content: counter(blog-section, decimal-leading-zero);
    font-family: var(--motif-font-mono);
    font-size: var(--motif-type-caption);
    letter-spacing: 0.08em;
    color: var(--motif-color-accent-tertiary);
}

.blog-post-sections > a:hover,
.blog-post-sections > a:focus-visible {
    border-left-color: var(--motif-color-accent-primary);
    color: var(--motif-color-text-primary);
}

.blog-post-sections > a:hover::before,
.blog-post-sections > a:focus-visible::before {
    color: var(--motif-color-accent-primary);
}

/* ── HERO IMAGE ─────────────────────────────────────────────────────── */
.vblog-post__hero {
    margin: 0 0 0;
    line-height: 0;
}

.vblog-post__hero img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ── POST HEADER (generated from frontmatter) ───────────────────────── */
.vblog-post__header {
    padding: 4rem 0 2.5rem;
    border-bottom: 1px solid var(--motif-border-subtle);
    margin-bottom: 3rem;
    position: relative;
}

/* Eyebrow: mono label above the title */
.vblog-post__header::before {
    content: 'Whitepaper Ejecutivo';
    display: block;
    font-family: var(--motif-font-mono);
    font-size: var(--motif-type-caption);
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--motif-color-accent-primary);
    margin-bottom: 1.5rem;
}

html:lang(en) .vblog-post__header::before {
    content: 'Executive Whitepaper';
}

/* Title */
.vblog-post__header h1 {
    font-family: var(--motif-font-h1);
    font-weight: 300;
    font-size: clamp(2.75rem, 6.5vw, 5.5rem);
    line-height: 1.04;
    letter-spacing: -0.012em;
    color: var(--motif-color-text-primary);
    margin: 0 0 1.25rem;
    text-wrap: pretty;
    overflow-wrap: break-word;
}

.vblog-post__header h1 em {
    font-style: italic;
    color: var(--motif-color-accent-primary);
}

/* Dek — italic editorial subtitle from frontmatter description */
.vblog-post__dek {
    font-family: var(--motif-font-quote) !important;
    font-style: italic !important;
    font-weight: 300 !important;
    font-size: clamp(1.125rem, 1.9vw, 1.375rem) !important;
    color: var(--motif-color-text-secondary) !important;
    line-height: 1.55 !important;
    margin: 0 0 1.5rem !important;
    border-radius: 0;
    max-width: 600px;
    text-wrap: pretty;
}

/* Meta — date · author · category */
.vblog-post__meta {
    font-family: var(--motif-font-mono) !important;
    font-size: var(--motif-type-caption) !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    color: var(--motif-color-text-muted) !important;
    line-height: 1.9 !important;
    margin: 0 0 0.5rem !important;
}

.vblog-post__meta time {
    color: var(--motif-color-text-muted);
}

/* Taxonomy — tags */
.vblog-post__taxonomy {
    font-family: var(--motif-font-mono) !important;
    font-size: var(--motif-type-caption) !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    color: var(--motif-color-text-muted) !important;
    margin: 0 !important;
    opacity: 0.7;
}

.vblog-post__taxonomy span {
    color: var(--motif-color-accent-primary);
}

/* ── BODY TYPOGRAPHY ────────────────────────────────────────────────── */
.vblog-post__body {
    font-family: var(--motif-font-body);
    overflow-wrap: break-word;
}

/* Body paragraphs */
.vblog-post__body p {
    font-size: clamp(1rem, 1.55vw, 1.125rem);
    font-weight: 300;
    line-height: 1.88;
    color: var(--motif-color-text-secondary);
    margin-bottom: 1.375rem;
    text-wrap: pretty;
}

/* First paragraph in the body — the bold subtitle from markdown */
.vblog-post__body > p:first-child {
    font-family: var(--motif-font-quote);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.125rem, 1.8vw, 1.3125rem);
    color: var(--motif-color-text-muted);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

/* Second paragraph (italic mono metadata line) */
.vblog-post__body > p:nth-child(2) {
    font-family: var(--motif-font-mono);
    font-size: 0.9375rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--motif-color-text-muted);
    margin-bottom: 0;
}

.vblog-post__body p strong {
    color: var(--motif-color-text-primary);
    font-weight: 500;
}

.vblog-post__body p em {
    font-style: italic;
    font-family: var(--motif-font-quote);
    color: var(--motif-color-accent-primary);
    font-size: 1.05em;
}

/* Markdown separators are source-only; section headings provide the visible rhythm. */
.vblog-post__body hr {
    display: none;
}

/* ── H2 — Section headers ───────────────────────────────────────────── */
.vblog-post__body h2 {
    font-family: var(--motif-font-h2);
    font-weight: 400;
    font-size: clamp(1.625rem, 3.2vw, 2.25rem);
    color: var(--motif-color-text-primary);
    line-height: 1.18;
    letter-spacing: -0.005em;
    margin: 5rem 0 0;
    scroll-margin-top: calc(var(--layout-nav-height) + 1.75rem);
    text-wrap: balance;
}

.vblog-post__body h2 em {
    font-style: italic;
    color: var(--motif-color-accent-primary);
}

/* Teal rule beneath section header */
.vblog-post__body h2::after {
    content: '';
    display: block;
    width: 44px;
    height: 1px;
    background: var(--motif-color-accent-primary);
    margin-top: 0.875rem;
    margin-bottom: 1.5rem;
}

/* ── H3 — Subsection headers ────────────────────────────────────────── */
.vblog-post__body h3 {
    font-family: var(--motif-font-h2);
    font-weight: 400;
    font-size: clamp(1.1875rem, 1.9vw, 1.375rem);
    color: var(--motif-color-text-primary);
    line-height: 1.3;
    margin: 3rem 0 1rem;
    letter-spacing: 0;
}

.vblog-post__body h3 em {
    font-style: italic;
    color: var(--motif-color-accent-primary);
}

/* ── H4 — Small mono label ──────────────────────────────────────────── */
.vblog-post__body h4 {
    font-family: var(--motif-font-mono);
    font-size: var(--motif-type-caption);
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--motif-color-accent-primary);
    font-weight: 400;
    margin: 2.25rem 0 0.875rem;
}

/* ── BLOCKQUOTE — pull-quote ────────────────────────────────────────── */
.vblog-post__body blockquote {
    font-family: var(--motif-font-quote);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.125rem, 2.4vw, 1.5rem);
    line-height: 1.52;
    color: var(--motif-color-text-primary);
    border-top: 1px solid var(--motif-color-accent-primary);
    border-bottom: 1px solid var(--motif-border-subtle);
    border-left: 0;
    padding: 2rem 0;
    margin: 3rem 0;
    text-wrap: pretty;
}

.vblog-post__body blockquote p {
    font-family: inherit;
    font-style: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    margin: 0;
}

.vblog-post__body blockquote strong {
    color: var(--motif-color-accent-primary);
    font-weight: 400;
    font-style: normal;
    font-family: var(--motif-font-quote);
}

/* ── UNORDERED LISTS ────────────────────────────────────────────────── */
.vblog-post__body ul {
    list-style: none;
    margin: 1.375rem 0;
    padding: 0;
}

.vblog-post__body ul li {
    font-size: clamp(1rem, 1.5vw, 1.09375rem);
    font-weight: 300;
    line-height: 1.75;
    color: var(--motif-color-text-secondary);
    margin-bottom: 0.625rem;
    padding-left: 1.375rem;
    position: relative;
}

.vblog-post__body ul li::before {
    content: '·';
    position: absolute;
    left: 0;
    color: var(--motif-color-accent-primary);
    font-size: 1.35em;
    line-height: 1.25;
    font-weight: 400;
}

/* ── ORDERED LISTS ──────────────────────────────────────────────────── */
.vblog-post__body ol {
    list-style: none;
    counter-reset: paper-ol;
    margin: 1.375rem 0;
    padding: 0;
}

.vblog-post__body ol li {
    counter-increment: paper-ol;
    font-size: clamp(1rem, 1.5vw, 1.09375rem);
    font-weight: 300;
    line-height: 1.75;
    color: var(--motif-color-text-secondary);
    margin-bottom: 0.625rem;
    padding-left: 2rem;
    position: relative;
}

.vblog-post__body ol li::before {
    content: counter(paper-ol, decimal-leading-zero);
    position: absolute;
    left: 0;
    font-family: var(--motif-font-mono);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    color: var(--motif-color-accent-primary);
    top: 0.3125rem;
    font-weight: 400;
}

.vblog-post__body li strong {
    color: var(--motif-color-text-primary);
    font-weight: 500;
}

.vblog-post__body li em {
    font-style: italic;
    font-family: var(--motif-font-quote);
    color: var(--motif-color-text-muted);
}

/* ── TABLES ─────────────────────────────────────────────────────────── */
/* display:table (default) lets width:100% work through the browser's
 * table layout algorithm, filling the content area. overflow-x:auto
 * creates a scrollbar when a table is intrinsically wider than the
 * viewport (e.g. the MEO 5-year table on mobile). */
.vblog-post__body table {
    display: block;
    width: max-content;
    max-width: 100%;
    border-collapse: collapse;
    font-family: var(--motif-font-mono);
    font-size: 0.875rem;
    margin: 2.25rem 0;
    border: 1px solid var(--motif-border-subtle);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.vblog-post__body table thead th {
    background: var(--motif-color-canvas-950);
    color: var(--motif-color-accent-primary);
    padding: 0.75rem 1rem;
    text-align: left;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--motif-color-accent-primary);
    font-size: var(--motif-type-caption);
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
}

.vblog-post__body table tbody tr {
    border-bottom: 1px solid var(--motif-border-subtle);
}

.vblog-post__body table tbody tr:last-child {
    border-bottom: none;
}

.vblog-post__body table tbody td {
    padding: 0.6875rem 1rem;
    color: var(--motif-color-text-secondary);
    vertical-align: top;
    line-height: 1.55;
}

.vblog-post__body table tbody tr:nth-child(odd) td {
    background: color-mix(in oklch, var(--motif-color-canvas-950) 45%, transparent);
}

.vblog-post__body table tbody td strong {
    color: var(--motif-color-text-primary);
    font-weight: 600;
}

/* ── ARTICLE SVG / IMAGE EXHIBITS ───────────────────────────────────── */
.vblog-post__body img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 2.25rem auto 1.25rem;
    border: 1px solid var(--motif-border-subtle);
    background: var(--motif-color-canvas-950);
}

/* ── CODE ────────────────────────────────────────────────────────────── */
.vblog-post__body code {
    font-family: var(--motif-font-mono);
    font-size: 0.875em;
    color: var(--motif-color-accent-primary);
    background: color-mix(in oklch, var(--motif-color-canvas-800) 70%, transparent);
    padding: 0.125rem 0.375rem;
    letter-spacing: 0.02em;
}

.vblog-post__body pre {
    background: var(--motif-color-canvas-800);
    border-left: 3px solid var(--motif-color-accent-primary);
    padding: 1.5rem 1.25rem;
    margin: 2rem 0;
    overflow-x: auto;
}

.vblog-post__body pre code {
    background: none;
    padding: 0;
    font-size: var(--motif-type-caption);
    color: var(--motif-color-text-secondary);
    letter-spacing: 0;
}

/* ── LINKS ───────────────────────────────────────────────────────────── */
.vblog-post__body a {
    color: var(--motif-color-accent-primary);
    text-decoration: underline;
    text-decoration-color: color-mix(in oklch, var(--motif-color-accent-primary) 36%, transparent);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}

.vblog-post__body a:hover {
    text-decoration-color: var(--motif-color-accent-primary);
}

/* ── READING PROGRESS — CSS scroll-driven (modern browsers only) ────── */
@supports (animation-timeline: scroll()) {
    .vblog-post::before {
        content: '';
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--motif-color-accent-primary);
        transform-origin: left;
        transform: scaleX(0);
        animation: vblog-reading-progress linear both;
        animation-timeline: scroll(root block);
        z-index: 200;
        pointer-events: none;
        box-shadow: 0 0 8px color-mix(in oklch, var(--motif-color-accent-primary) 50%, transparent);
    }
}

@keyframes vblog-reading-progress {
    to { transform: scaleX(1); }
}

/* ── CTA BLOCK ───────────────────────────────────────────────────────── */
/* Sits outside .vblog-post (sibling in the shell); match the article column
 * so the CTA aligns with the body text. */
.blog-post-cta {
    max-width: min(760px, 100%);
    margin: 0 auto;
    padding-top: 4rem;
    padding-bottom: 2rem;
}

.blog-post-cta p {
    font-family: var(--motif-font-body);
    font-size: 1rem;
    color: var(--motif-color-text-muted);
    margin-bottom: 1.25rem;
    font-weight: 300;
    line-height: 1.7;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
    .blog-post-layout {
        grid-template-columns: minmax(0, 760px);
    }

    .blog-post-sidebar {
        padding-top: 2rem;
    }

    .blog-post-sections {
        position: static;
        max-height: none;
        margin-bottom: 1rem;
        padding: 1rem 0;
        border-top: 1px solid var(--motif-border-subtle);
        border-bottom: 1px solid var(--motif-border-subtle);
    }

    .blog-post-sections > span {
        margin-left: 0;
    }

    .blog-post-sections > a {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 640px) {
    .blog-post-sidebar {
        padding-top: 0;
    }

    .blog-post-sections > a {
        grid-template-columns: 1.75rem minmax(0, 1fr);
        font-size: 0.8125rem;
    }

    .vblog-post__header {
        padding-top: 2.75rem;
    }

    .vblog-post__header h1 {
        font-size: clamp(2.35rem, 12vw, 3.25rem);
    }

    .vblog-post__body h2 {
        margin-top: 3.5rem;
    }

    .vblog-post__body blockquote {
        font-size: 1.0625rem;
    }

    .vblog-post__body table {
        font-size: 0.8125rem;
    }
}
