/* PhoneProof blog: index, article pages and the landing-page "From the blog" cards.
   Loaded after styles.css, so it reuses its tokens (--ink, --muted, --primary, --soft, --surface...). */

/* ---------- Post cards (blog index + landing) ---------- */
.post-grid { display: grid; gap: clamp(1.25rem, 1rem + 1vw, 2rem); grid-template-columns: 1fr; }
@media (min-width: 720px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }

.post-card { position: relative; display: flex; flex-direction: column; gap: .9rem; }
.post-card a.post-card-link { color: inherit; text-decoration: none; }
.post-card a.post-card-link::after { content: ""; position: absolute; inset: 0; border-radius: 20px; }
.post-card a.post-card-link:focus-visible { outline: none; }
.post-card:has(a.post-card-link:focus-visible) .post-thumb { outline: 3px solid var(--primary); outline-offset: 3px; }

.post-thumb {
  position: relative; overflow: hidden; border-radius: 20px;
  aspect-ratio: 1200 / 630; background: var(--surface-2);
  box-shadow: 0 1px 0 var(--hair) inset;
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.post-card:hover .post-thumb img { transform: scale(1.03); }
.read-badge {
  position: absolute; left: 14px; bottom: 14px;
  display: inline-flex; align-items: center; gap: .4em;
  padding: .38em .8em; border-radius: 999px;
  background: rgb(11 11 15 / .72); color: #fff;
  font-size: .8125rem; font-weight: 600; letter-spacing: .01em;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.read-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.post-kicker { display: flex; flex-wrap: wrap; gap: .35em .9em; font-size: var(--step--1); color: var(--muted); }
.post-kicker .cat { color: var(--primary-text); font-weight: 600; }
.post-card h3 { font-size: var(--step-1); line-height: 1.22; letter-spacing: -.015em; }
.post-card p.dek { color: var(--muted); font-size: var(--step--1); line-height: 1.55; }
.post-card:hover h3 { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

/* Featured (newest) post on the blog index */
.post-card.featured { gap: 1.1rem; }
.post-card-text { display: flex; flex-direction: column; gap: .9rem; }
@media (min-width: 900px) {
  .post-card.featured { display: grid; grid-template-columns: 1.35fr 1fr; align-items: center; gap: clamp(2rem, 1rem + 3vw, 4rem); }
  .post-card.featured .post-thumb { grid-row: span 4; }
}
.post-card.featured h3 { font-size: var(--step-3); line-height: 1.04; letter-spacing: -.03em; font-stretch: 90%; }
.post-card.featured p.dek { font-size: var(--step-0); }

/* ---------- Blog index ---------- */
.blog-hero { padding-block: clamp(3rem, 2rem + 4vw, 6rem) clamp(2rem, 1.5rem + 2vw, 3.5rem); }
.blog-hero .eyebrow-link { font-weight: 600; color: var(--primary-text); font-size: var(--step--1); }
.blog-hero h1 { margin-top: .6rem; font-size: var(--step-4); line-height: .98; letter-spacing: -.04em; font-stretch: 86%; max-width: 14ch; }
.blog-hero p { margin-top: 1.2rem; color: var(--muted); font-size: var(--step-1); max-width: 40rem; }
.blog-featured { padding-bottom: clamp(3rem, 2rem + 3vw, 5rem); }
.blog-list-title { font-size: var(--step-2); letter-spacing: -.02em; margin-bottom: 1.75rem; }

/* ---------- Download band (blog index, article end, landing) ---------- */
.dl-band {
  display: grid; gap: 1.25rem; align-items: center;
  padding: clamp(1.75rem, 1.2rem + 2vw, 3rem);
  border-radius: 28px; background: var(--card); color: var(--card-text);
}
@media (min-width: 860px) { .dl-band { grid-template-columns: auto 1fr auto; gap: 2rem; } }
.dl-band img.dl-icon { width: 64px; height: 64px; border-radius: 22.5%; }
.dl-band h2 { font-size: var(--step-2); line-height: 1.08; letter-spacing: -.025em; font-stretch: 92%; }
.dl-band p { margin-top: .4rem; color: var(--card-muted); }
.dl-band .store-btn { background: #fff; color: #0B0B0F; }

/* ---------- Article ---------- */
.post { padding-top: clamp(2rem, 1.5rem + 2vw, 3.5rem); }
.post-wrap { max-width: calc(44rem + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.post-wide { max-width: calc(64rem + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }

.crumbs { font-size: var(--step--1); color: var(--muted); display: flex; gap: .5em; flex-wrap: wrap; }
.crumbs a { color: var(--primary-text); font-weight: 600; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.post-head h1 { margin-top: .9rem; font-size: var(--step-3); line-height: 1.04; letter-spacing: -.034em; font-stretch: 88%; }
.post-dek { margin-top: 1rem; font-size: var(--step-1); line-height: 1.45; color: var(--muted); }
.post-meta { margin-top: 1.25rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4em .9em; font-size: var(--step--1); color: var(--muted); }
.post-meta .by { color: var(--ink); font-weight: 600; display: inline-flex; align-items: center; gap: .5em; }
.post-meta .by img { width: 24px; height: 24px; border-radius: 22.5%; }
.post-meta .dot::before { content: "·"; }

.post-hero { margin-block: clamp(1.75rem, 1.2rem + 2vw, 3rem); }
.post-hero img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: 24px; display: block; background: var(--surface-2); }

.post-body { font-size: var(--step-0); line-height: 1.7; }
.post-body > * + * { margin-top: 1.15rem; }
.post-body h2 { margin-top: 2.75rem; font-size: var(--step-2); line-height: 1.15; letter-spacing: -.022em; font-stretch: 92%; scroll-margin-top: 90px; }
.post-body h3 { margin-top: 2rem; font-size: var(--step-1); line-height: 1.25; letter-spacing: -.012em; scroll-margin-top: 90px; }
.post-body h2 + *, .post-body h3 + * { margin-top: .7rem; }
.post-body p, .post-body li { color: var(--ink); }
.post-body a { color: var(--primary-text); text-underline-offset: 3px; }
.post-body ul, .post-body ol { padding-left: 1.3em; }
.post-body li + li { margin-top: .45rem; }
.post-body li::marker { color: var(--muted); }
.post-body strong { font-weight: 650; }
.post-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; padding: .1em .35em; border-radius: 6px; background: var(--surface-2); }
.post-body hr { border: 0; border-top: 1px solid var(--hair); margin-block: 2.5rem; }

/* Key takeaways (answer-first summary for readers, search snippets and AI answers) */
.tldr { padding: 1.4rem 1.5rem; border-radius: 20px; background: var(--pc); color: var(--on-pc); }
.tldr h2 { margin: 0 0 .6rem; font-size: var(--step--1); letter-spacing: .06em; text-transform: uppercase; font-stretch: 100%; color: inherit; }
.tldr ul { padding-left: 1.1em; }
.tldr li { color: inherit; }
.tldr li::marker { color: inherit; }

/* Numbered steps */
.post-body .steps { list-style: none; padding: 0 !important; counter-reset: step; display: grid; gap: .9rem; grid-template-columns: 1fr; }
.post-body .steps > li { counter-increment: step; position: relative; padding: 1rem 1.1rem 1rem 3.4rem; border-radius: 16px; background: var(--surface-2); margin: 0 !important; }
.post-body .steps > li::before {
  content: counter(step); position: absolute; left: 1rem; top: 1rem;
  width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); font-size: .85rem; font-weight: 700; line-height: 1;
}
.post-body .steps > li strong:first-child { display: block; }

/* Callouts */
.callout { padding: 1.1rem 1.25rem; border-radius: 16px; border: 1px solid var(--hair); background: var(--surface); }
.callout.warn { border-color: transparent; background: var(--warn-c); color: var(--warn-text); }
.callout.warn p, .callout.warn li { color: inherit; }
.callout > :first-child { margin-top: 0; }
.callout > * + * { margin-top: .6rem; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--hair); }
.post-body table { width: 100%; border-collapse: collapse; font-size: var(--step--1); line-height: 1.5; }
.post-body th, .post-body td { padding: .75rem .9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hair); }
.post-body thead th { background: var(--surface-2); font-weight: 650; }
.post-body tbody tr:last-child td { border-bottom: 0; }

/* Diagrams: inline SVG that uses currentColor and the site tokens, so it follows light and dark mode */
.diagram { margin-block: 2rem; padding: clamp(1rem, .8rem + 1vw, 1.75rem); border-radius: 20px; background: var(--soft); }
.diagram svg { display: block; width: 100%; height: auto; overflow: visible; color: var(--ink); }
.diagram figcaption { margin-top: .9rem; font-size: var(--step--1); color: var(--muted); line-height: 1.5; }
.diagram .d-ink { stroke: var(--ink); }
.diagram .d-muted { stroke: var(--muted); }
.diagram .d-hair { stroke: var(--hair); }
.diagram .d-primary { stroke: var(--primary); }
.diagram .d-warn { stroke: var(--warn); }
.diagram .f-ink { fill: var(--ink); }
.diagram .f-muted { fill: var(--muted); }
.diagram .f-primary { fill: var(--primary); }
.diagram .f-warn { fill: var(--warn); }
.diagram .f-surface { fill: var(--surface); }
.diagram .f-track { fill: var(--track); }
.diagram .f-pc { fill: var(--pc); }
.diagram svg { font: 500 13px var(--font); }
.diagram text { fill: var(--muted); } /* size comes from the svg, or a font-size attribute on the text */
.diagram text.t-ink { fill: var(--ink); font-weight: 600; }
.diagram text.t-primary { fill: var(--primary-text); font-weight: 600; }
.diagram text.t-warn { fill: var(--warn-text); font-weight: 600; }

/* Diagram animation hooks. Add data-inview to the <figure>; main.js adds .in-view when it scrolls into view.
   .a-draw   : path draws itself (give the path pathLength="1")
   .a-grow   : bar grows from the bottom (scaleY)
   .a-growx  : bar grows from the left (scaleX)
   .a-pop    : element fades and scales in
   .a-pulse  : gentle repeating pulse once in view
   Stagger with style="--d: 200ms". Without JS or with reduced motion, the final state shows. */
@media (prefers-reduced-motion: no-preference) {
  .js [data-inview] .a-draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .js [data-inview].in-view .a-draw { animation: b-draw 1.4s var(--ease) var(--d, 0ms) forwards; }
  .js [data-inview] :is(.a-grow, .a-growx, .a-pop) { transform-box: fill-box; }
  .js [data-inview] .a-grow { transform-origin: bottom; transform: scaleY(0); }
  .js [data-inview] .a-growx { transform-origin: left; transform: scaleX(0); }
  .js [data-inview] .a-pop { transform-origin: center; transform: scale(.6); opacity: 0; }
  .js [data-inview].in-view :is(.a-grow, .a-growx, .a-pop) { animation: b-settle .9s var(--ease) var(--d, 0ms) forwards; }
  .js [data-inview].in-view .a-pulse { transform-box: fill-box; transform-origin: center; animation: b-pulse 2.4s ease-in-out var(--d, 0ms) infinite; }
}
@keyframes b-draw { to { stroke-dashoffset: 0; } }
@keyframes b-settle { to { transform: none; opacity: 1; } }
@keyframes b-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(1.12); } }

/* Mid-article call to action */
.cta-inline {
  display: grid; gap: .9rem; align-items: center;
  padding: 1.25rem 1.4rem; border-radius: 20px;
  border: 1px solid var(--hair); background: var(--surface);
}
@media (min-width: 640px) { .cta-inline { grid-template-columns: auto 1fr auto; } }
.cta-inline img { width: 48px; height: 48px; border-radius: 22.5%; }
.cta-inline p { margin: 0; font-size: var(--step--1); color: var(--muted); line-height: 1.5; }
.cta-inline p strong { display: block; color: var(--ink); font-size: var(--step-0); }
.cta-inline .btn { white-space: nowrap; text-decoration: none; color: var(--on-primary); }

/* "For the technically curious" */
.tech-note { padding: 1.25rem 1.4rem; border-radius: 20px; background: var(--soft); border-left: 4px solid var(--primary); }
.tech-note h2, .tech-note h3 { margin-top: 0 !important; font-size: var(--step--1); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-stretch: 100%; }
.tech-note p, .tech-note li { font-size: var(--step--1); line-height: 1.65; }
.tech-note > * + * { margin-top: .7rem; }

/* FAQ inside an article */
.post-faq { display: grid; gap: .6rem; }
.post-faq details { border-radius: 16px; background: var(--surface-2); padding: 0 1.1rem; }
.post-faq summary { cursor: pointer; padding: 1rem 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.post-faq summary::-webkit-details-marker { display: none; }
.post-faq summary::after { content: "+"; color: var(--muted); font-weight: 500; }
.post-faq details[open] summary::after { content: "−"; }
.post-faq details > :not(summary) { padding-bottom: 1rem; margin-top: 0; }

/* Sources */
.sources { margin-top: 3rem !important; padding-top: 1.5rem; border-top: 1px solid var(--hair); }
.sources h2 { margin-top: 0 !important; font-size: var(--step--1); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-stretch: 100%; }
.sources ol { margin-top: .75rem; font-size: var(--step--1); color: var(--muted); }
.sources li { color: var(--muted); }
.sources a { word-break: break-word; }

.post-end { padding-block: clamp(3rem, 2rem + 3vw, 5rem); }
.post-related { padding-block: var(--section-y); background: var(--soft); }
.post-related h2 { font-size: var(--step-2); letter-spacing: -.02em; margin-bottom: 1.75rem; }

/* Landing-page blog section */
.blog-teaser .teaser-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem); }
.blog-teaser .teaser-head p { color: var(--muted); font-size: var(--step-1); max-width: 34rem; margin-top: .9rem; }
