/* Tivio blog. Builds on the marketing site's site.css (tokens, header, footer, buttons) and adds
   everything for reading: a comfortable measure, clear hierarchy, figures with credits, contents rail. */

:root {
    --read: #d2d2d2;
    --read-strong: #f2f2f2;
    --measure: 720px;
}

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 10px 14px; background: var(--mint-500); color: #06241f; font-size: 14px; font-weight: 500; text-decoration: none; }
.skip-link:focus { top: 12px; }

.blog .section { border-bottom: 1px solid var(--line); }

/* ---------- Breadcrumbs ---------- */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 28px; color: var(--text-3); font-size: 14px; }
.crumbs a { color: var(--text-2); text-decoration: none; transition: color 0.15s; }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); }

/* ---------- Blog index ---------- */

.blog-hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(64px, 9vw, 120px) var(--pad) clamp(48px, 6vw, 72px); }
.blog-hero h1 { max-width: 15em; font-size: clamp(40px, 6vw, 76px); line-height: 1.02; }
.blog-hero .lead { max-width: 40em; }

.topic-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 36px; }
.topic-chips a { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); color: var(--text-2); font-size: 14px; text-decoration: none; transition: border-color 0.2s, color 0.2s, background 0.2s; }
.topic-chips a:hover { border-color: var(--text-3); color: var(--text); }
.topic-chips a[aria-current] { border-color: var(--mint-500); background: rgb(60 207 183 / 0.08); color: var(--text); }

.post-featured { display: grid; grid-template-columns: 1.15fr 1fr; }
.post-featured-media { display: block; overflow: hidden; border-right: 1px solid var(--line); background: var(--bg-2); aspect-ratio: 16 / 10; }
.post-featured-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease); }
.post-featured:hover .post-featured-media img { transform: scale(1.025); }
.post-featured-body { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 4vw, 64px) var(--pad); }
.post-featured-title { font-size: clamp(30px, 3.4vw, 44px); font-weight: 300; line-height: 1.1; letter-spacing: -0.035em; }
.post-featured-title a { text-decoration: none; }
.post-featured-title a:hover { color: var(--mint-100); }
.post-featured-excerpt { margin-top: 18px; font-size: 18px; line-height: 1.6; }
.post-featured .btn { align-self: flex-start; margin-top: 28px; }

.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); }
.post-grid > * { background: var(--bg); }

.post-card { position: relative; display: flex; flex-direction: column; transition: background 0.25s; }
.post-card:hover { background: var(--bg-2); }
.post-card-media { display: block; overflow: hidden; aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.post-card:hover .post-card-media img { transform: scale(1.035); }
.post-card-placeholder { display: grid; width: 100%; height: 100%; place-items: center; background: radial-gradient(120% 90% at 0% 0%, rgb(60 207 183 / 0.22), transparent 55%), linear-gradient(135deg, #191919, #121212); color: var(--mint-300); font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; }
.post-card-body { display: flex; flex: 1; flex-direction: column; padding: 28px clamp(22px, 2.4vw, 34px) 32px; }
.post-card-topic { color: var(--mint-500); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.post-card-title { margin-top: 12px; font-size: 22px; font-weight: 400; line-height: 1.28; letter-spacing: -0.02em; }
.post-card-title a { text-decoration: none; }
.post-card-title a::after { content: ''; position: absolute; inset: 0; }
.post-card-title a:focus-visible { outline: none; }
.post-card-title a:focus-visible::after { outline: 2px solid var(--mint-500); outline-offset: -2px; }
.post-card-excerpt { margin-top: 12px; font-size: 16px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 20px; color: var(--text-3); font-size: 14px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 32px var(--pad); }
.pager-count { color: var(--text-3); font-size: 14px; }

.blog-empty { padding: clamp(64px, 9vw, 120px) var(--pad); text-align: center; }
.blog-empty .eyebrow { justify-content: center; }
.blog-empty h2 { max-width: 16em; margin-inline: auto; }
.blog-empty .lead { margin-inline: auto; }

.blog-cta h2 { font-size: clamp(36px, 5vw, 68px); }

.related-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 40px var(--pad) 28px; }
.related-head .eyebrow { margin: 0; }
.related-all { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 15px; text-decoration: none; }
.related-all:hover { color: var(--text); }
.related-all .arrow { width: 14px; height: 14px; }

/* ---------- Article ---------- */

.read-progress { position: fixed; inset: 0 0 auto; z-index: 60; height: 2px; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--mint-700), var(--mint-500), var(--mint-100)); transform: scaleX(var(--progress, 0)); transform-origin: 0 50%; }

.preview-banner { position: relative; z-index: 40; padding: 12px var(--pad); border-bottom: 1px solid rgb(250 204 21 / 0.35); background: rgb(250 204 21 / 0.1); color: #fde68a; font-size: 15px; text-align: center; }
.preview-banner strong { color: #fef3c7; }

.post-hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(56px, 8vw, 104px) var(--pad) clamp(40px, 5vw, 64px); }
.post-hero h1 { max-width: 20em; font-size: clamp(36px, 5.2vw, 64px); line-height: 1.05; letter-spacing: -0.045em; }
.post-dek { max-width: 42em; margin-top: 24px; color: var(--text-2); font-size: clamp(19px, 1.6vw, 22px); line-height: 1.55; text-wrap: pretty; }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 28px; color: var(--text-3); font-size: 15px; }
.post-meta span:first-child { color: var(--text-2); }

.post-cover { margin: 0; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.post-cover img { width: 100%; max-height: 640px; object-fit: cover; }
.post-cover figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 14px var(--pad); color: var(--text-3); font-size: 13px; }

.post-layout { display: grid; grid-template-columns: minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.post-layout.has-toc { grid-template-columns: 290px minmax(0, 1fr); }
.post-aside { border-right: 1px solid var(--line); }
.post-aside-inner { position: sticky; top: var(--header); display: flex; flex-direction: column; gap: 32px; max-height: calc(100vh - var(--header)); padding: 56px 28px 32px; }
.post-toc { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.post-aside-title { margin: 0 0 14px; color: var(--text-3); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.post-toc ol, .toc-mobile ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.post-toc a { display: block; padding: 6px 0 6px 14px; border-left: 1px solid var(--line); color: var(--text-3); font-size: 14px; line-height: 1.4; text-decoration: none; transition: color 0.15s, border-color 0.15s; }
.post-toc .level-3 a { padding-left: 28px; font-size: 13px; }
.post-toc a:hover { color: var(--text); }
.post-toc a.is-current { border-left-color: var(--mint-500); color: var(--text); }
.post-aside .post-share { flex: none; padding-top: 24px; border-top: 1px solid var(--line); }

.post-main { width: 100%; max-width: calc(var(--measure) + 2 * var(--pad)); padding: clamp(40px, 5vw, 64px) var(--pad) clamp(56px, 7vw, 96px); }
.post-layout:not(.has-toc) .post-main { margin-inline: auto; }

.toc-mobile { display: none; margin-bottom: 32px; border: 1px solid var(--line); background: var(--bg-2); }
.toc-mobile summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; list-style: none; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: '+'; color: var(--mint-500); font-size: 22px; font-weight: 200; transition: transform 0.25s var(--ease); }
.toc-mobile[open] summary::after { transform: rotate(45deg); }
.toc-mobile ol { padding: 0 18px 16px; }
.toc-mobile a { display: block; padding: 6px 0; color: var(--text-2); font-size: 15px; text-decoration: none; }
.toc-mobile .level-3 a { padding-left: 16px; font-size: 14px; }

.answer { position: relative; margin-bottom: 28px; padding: 24px 28px; border: 1px solid rgb(60 207 183 / 0.35); background: linear-gradient(135deg, rgb(60 207 183 / 0.09), rgb(60 207 183 / 0.02) 60%); }
.answer::before { content: ''; position: absolute; inset: -1px auto -1px -1px; width: 3px; background: var(--mint-500); }
.answer-label, .takeaways-label { margin-bottom: 10px; color: var(--mint-500); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.answer-text { color: var(--read-strong); font-size: 19px; line-height: 1.65; }

.takeaways { margin-bottom: 40px; padding: 24px 28px; border: 1px solid var(--line); background: var(--bg-2); }
.takeaways ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.takeaways li { position: relative; padding-left: 30px; color: var(--read); font-size: 17px; line-height: 1.55; }
.takeaways li::before { content: ''; position: absolute; top: 4px; left: 0; width: 18px; height: 18px; border-radius: 50%; background: rgb(60 207 183 / 0.16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%233ccfb7' stroke-width='2.2'%3E%3Cpath d='m5.5 10.5 3 3 6-7'/%3E%3C/svg%3E") center / 12px no-repeat; }

/* ---------- Article body typography ---------- */

.article-body { color: var(--read); font-size: 19px; font-weight: 300; line-height: 1.75; }
.article-body > * + * { margin-top: 1.15em; }
.article-body p { color: var(--read); }
.article-body strong { color: var(--read-strong); font-weight: 500; }
.article-body h2 { margin-top: 2.4em; color: var(--text); font-size: clamp(26px, 2.6vw, 32px); font-weight: 400; line-height: 1.22; letter-spacing: -0.025em; scroll-margin-top: calc(var(--header) + 24px); }
.article-body h3 { margin-top: 1.9em; color: var(--text); font-size: 22px; font-weight: 500; line-height: 1.3; letter-spacing: -0.015em; scroll-margin-top: calc(var(--header) + 24px); }
.article-body h4 { margin-top: 1.6em; color: var(--text); font-size: 18px; font-weight: 600; }
.article-body h2 + *, .article-body h3 + *, .article-body h4 + * { margin-top: 0.7em; }
.article-body .anchor { margin-left: 0.4em; color: var(--mint-500); font-weight: 300; text-decoration: none; opacity: 0; transition: opacity 0.15s; }
.article-body :is(h2, h3):hover .anchor, .article-body .anchor:focus { opacity: 0.8; }
.article-body a:not(.anchor) { color: var(--mint-300); text-decoration: underline; text-decoration-color: rgb(127 230 211 / 0.4); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color 0.15s, text-decoration-color 0.15s; }
.article-body a:not(.anchor):hover { color: var(--mint-100); text-decoration-color: currentColor; }
.article-body a.external::after { content: '↗'; margin-left: 2px; font-size: 0.75em; vertical-align: 0.15em; }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li { padding-left: 0.2em; }
.article-body li + li { margin-top: 0.45em; }
.article-body li::marker { color: var(--mint-500); }
.article-body ol li::marker { font-weight: 500; }
.article-body blockquote { margin-inline: 0; padding: 6px 0 6px 24px; border-left: 2px solid var(--mint-500); color: var(--read-strong); font-size: 21px; font-weight: 300; line-height: 1.6; }
.article-body blockquote p { color: inherit; }
.article-body hr { height: 1px; margin-block: 2.6em; border: 0; background: var(--line); }
.article-body code { padding: 0.12em 0.4em; border: 1px solid var(--line); background: var(--bg-3); color: var(--mint-100); font: 0.86em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.article-body pre { overflow-x: auto; padding: 20px 22px; border: 1px solid var(--line); background: #0d0d0d; }
.article-body pre code { padding: 0; border: 0; background: none; color: #e5e5e5; font-size: 14px; line-height: 1.65; }
.article-body figure { margin-inline: 0; margin-block: 2em; }
.article-body figure img, .article-body > p > img { width: 100%; border: 1px solid var(--line); background: var(--bg-2); }
.article-body figcaption, .post-cover figcaption { color: var(--text-3); font-size: 14px; line-height: 1.5; }
.article-body figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-top: 10px; }
.credit { color: var(--text-3); font-size: 13px; text-decoration: none; }
a.credit:hover { color: var(--text-2); text-decoration: underline; }
.article-body .table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.article-body table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.5; }
.article-body th, .article-body td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.article-body th { background: var(--bg-2); color: var(--text); font-weight: 500; white-space: nowrap; }
.article-body tr:last-child td { border-bottom: 0; }
.article-body tbody tr:hover td { background: rgb(255 255 255 / 0.02); }
.article-body input[type='checkbox'] { accent-color: var(--mint-500); margin-right: 8px; }

/* ---------- FAQ, sources, footer ---------- */

.post-faq { margin-top: 64px; }
.post-faq h2, .post-sources h2 { margin-bottom: 16px; font-size: clamp(24px, 2.4vw, 30px); font-weight: 400; letter-spacing: -0.025em; scroll-margin-top: calc(var(--header) + 24px); }
.post-faq details { border-top: 1px solid var(--line); }
.post-faq details:last-child { border-bottom: 1px solid var(--line); }
.post-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 0; color: var(--text); font-size: 18px; font-weight: 400; cursor: pointer; list-style: none; }
.post-faq summary::-webkit-details-marker { display: none; }
.post-faq summary::after { content: '+'; flex: none; color: var(--mint-500); font-size: 26px; font-weight: 200; line-height: 1; transition: transform 0.3s var(--ease); }
.post-faq details[open] summary::after { transform: rotate(45deg); }
.post-faq details p { padding: 0 40px 22px 0; color: var(--read); font-size: 17px; line-height: 1.7; }

.post-sources { margin-top: 56px; }
.post-sources ol { display: grid; gap: 10px; margin: 0; padding-left: 1.4em; color: var(--text-3); font-size: 15px; line-height: 1.55; }
.post-sources a { color: var(--text-2); text-underline-offset: 3px; }
.post-sources a:hover { color: var(--text); }

.post-footer { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; padding: 0; list-style: none; }
.post-tags li { padding: 6px 12px; border: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.author-box { display: flex; gap: 18px; align-items: flex-start; padding: 22px 24px; border: 1px solid var(--line); background: var(--bg-2); }
.author-box img { flex: none; width: 44px; height: 44px; }
.author-name { margin-bottom: 4px; color: var(--text); font-size: 16px; font-weight: 500; }
.author-box p { font-size: 15px; line-height: 1.6; }
.author-box a { color: var(--text); text-underline-offset: 3px; }

.post-share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font: 400 14px/1 Inter, ui-sans-serif, system-ui, sans-serif; text-decoration: none; cursor: pointer; transition: border-color 0.2s, color 0.2s; }
.share-btn:hover { border-color: var(--text-3); color: var(--text); }
.share-btn svg { width: 16px; height: 16px; }
.post-footer .post-share { margin-top: 28px; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .post-layout.has-toc { grid-template-columns: minmax(0, 1fr); }
    .post-aside { display: none; }
    .post-main { margin-inline: auto; }
    .toc-mobile { display: block; }
    .post-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
    .post-featured { grid-template-columns: 1fr; }
    .post-featured-media { border-right: 0; border-bottom: 1px solid var(--line); }
    .post-grid { grid-template-columns: 1fr; }
    .article-body { font-size: 18px; }
    .answer, .takeaways { padding: 20px; }
    .pager .btn { min-width: 0; padding: 0 18px; }
    .pager-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .read-progress { display: none; }
}

@media print {
    .site-header, .site-footer, .post-aside, .toc-mobile, .blog-cta, .related, .read-progress, .post-share, .preview-banner { display: none !important; }
    body { background: #fff; color: #000; }
    .article-body, .article-body p, .article-body li, .answer-text { color: #111; }
}
