/* ==========================================================================
   PersonalizedComics - blog layer
   Loads after css/tokens.css and css/style.css, which do the heavy lifting.
   Nothing here invents a colour, a font or a shadow: this file only covers what
   the main site has no component for - article cards, the post masthead, and the
   body of a generated post.
   ========================================================================== */

/* ---------- masthead ---------- */

.pc-blog-head { padding-bottom: clamp(1.6rem, 3vw, 2.4rem); }
.pc-blog-head h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); margin-top: .7rem; }
.pc-blog-head .lede { margin-top: .9rem; }
.pc-archive-head h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); }

.pc-crumbs {
    display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
    font-size: .85rem; color: var(--text-muted); margin-bottom: .9rem;
}
.pc-crumbs a { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.pc-crumbs a:hover { color: var(--cobalt-deep); }

.pc-cat-rail { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }

/* ---------- the lead story ---------- */

.pc-feature { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.pc-feature-media { display: block; position: relative; aspect-ratio: 16 / 10; background: var(--newsprint-deep); }
.pc-feature-media img { width: 100%; height: 100%; object-fit: cover; }
.pc-feature-media .sticker { position: absolute; top: 14px; left: 14px; }
.pc-feature-media:hover { transform: translate(-2px, -2px); box-shadow: 10px 10px 0 var(--ink); }
.pc-feature-media { transition: transform .15s ease, box-shadow .15s ease; }

.pc-feature-body { display: grid; gap: .9rem; justify-items: start; }
.pc-feature-body h2 { font-size: clamp(1.6rem, 3vw, 2.5rem); }
.pc-feature-body h2 a:hover { color: var(--cobalt-deep); }
.pc-feature-body .lede { margin: 0; }
.pc-feature-body .btn { margin-top: .3rem; }

/* ---------- article cards ---------- */

.pc-grid { gap: clamp(1.1rem, 2vw, 1.6rem); }

.pc-card {
    background: var(--paper); border: var(--border); border-radius: var(--radius);
    box-shadow: 4px 4px 0 var(--ink); overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
    display: flex;
}
.pc-card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.pc-card-link { display: flex; flex-direction: column; width: 100%; }

.pc-card-media { position: relative; aspect-ratio: 16 / 10; background: var(--newsprint); border-bottom: var(--border); }
.pc-card-media img { width: 100%; height: 100%; object-fit: cover; }
.pc-card-flag { position: absolute; left: 10px; bottom: 10px; }

/* A post whose attachment no longer resolves still gets a cover, not a hole. */
.pc-card-media-empty { display: grid; place-items: center; padding: 1.2rem; text-align: center; }
.pc-card-media-empty.tint-sun { background: var(--sun-tint); }
.pc-card-media-empty.tint-cobalt { background: var(--cobalt-tint); }
.pc-card-media-empty.tint-news { background: var(--newsprint-deep); }
.pc-card-media-empty.tint-kapow { background: var(--kapow-tint); }
.pc-card-fallback { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; line-height: 1.15; letter-spacing: -.02em; }

.pc-card-body { padding: 1rem 1.1rem 1.15rem; display: grid; gap: .5rem; align-content: start; flex: 1; }
.pc-card-title { font-size: 1.15rem; line-height: 1.2; }
.pc-card:hover .pc-card-title { color: var(--cobalt-deep); }
.pc-card-excerpt {
    font-size: .93rem; color: var(--text-muted); line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.pc-card-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
    font-size: .82rem; color: var(--text-muted); margin-top: auto; padding-top: .2rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- paging ---------- */

.pc-pager {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-top: clamp(2rem, 4vw, 3rem); padding-top: 1.5rem; border-top: var(--border);
}
.pc-pager-slot { min-width: 1px; }
.pc-pager-slot:last-child { text-align: right; }
.pc-pager-count { font-size: .88rem; color: var(--text-muted); }

/* ---------- a single post ---------- */

/* The hero is pulled up into this section, so the padding has to be deep enough for
   the image to eat space rather than the meta line. Posts without one - Outrank's,
   mostly - do not need the room, and keeping it leaves a band of empty newsprint. */
.pc-post-head { padding-bottom: clamp(3.5rem, 7vw, 5.5rem); }
.pc-post-head-solo { padding-bottom: clamp(1.8rem, 3.5vw, 2.6rem); }
.pc-post-head .wrap { max-width: 860px; }
.pc-post-title { font-size: clamp(2rem, 4.4vw, 3.2rem); margin-bottom: 0; }
.pc-post-lede { margin-top: 1rem; max-width: 62ch; font-size: clamp(1.05rem, 1.5vw, 1.2rem); }
.pc-post-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    margin-top: 1.2rem; font-size: .88rem; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* The hero straddles the newsprint masthead and the paper body. */
.pc-post-hero { max-width: 900px; margin: 0 auto; position: relative; z-index: 2; margin-top: calc(-1 * clamp(1.5rem, 4vw, 3rem)); }
.pc-post-hero .media-frame { aspect-ratio: 16 / 9; }
.pc-post-hero img { width: 100%; height: 100%; object-fit: cover; }
.pc-post-hero figure { margin: 0; height: 100%; }
.pc-post-hero figcaption { display: none; }

.pc-post-body { padding-top: clamp(2.2rem, 4vw, 3.2rem); }
.pc-post-body.has-hero { padding-top: clamp(1.8rem, 3vw, 2.6rem); }
.pc-post-tagline { margin: 2.5rem 0 0; max-width: 68ch; padding-top: 1.2rem; border-top: 1px solid var(--rule); }

/* ---------- the article body ---------- */

/* Left-aligned rather than centred: the masthead above it is left-aligned in the same
   860px wrap, and a centred column would step the text edge inward halfway down. */
.pc-prose {
    max-width: 68ch; margin: 0;
    font-size: 1.06rem; line-height: 1.78; color: var(--text-soft);
}
.pc-post-body .wrap { max-width: 860px; }
.pc-prose > *:first-child { margin-top: 0; }
.pc-prose p { margin-bottom: 1.15rem; }
.pc-prose strong { color: var(--ink); font-weight: 600; }
.pc-prose em { font-style: italic; }

.pc-prose h2, .pc-prose h3, .pc-prose h4, .pc-prose [id] { scroll-margin-top: calc(var(--nav-h) + 18px); }

.pc-prose h2 {
    font-size: clamp(1.55rem, 2.6vw, 2rem); color: var(--ink);
    margin: 2.9rem 0 1rem; padding-top: .3rem;
}
.pc-prose h2::before {
    content: ""; display: block; width: 34px; height: 3px;
    background: var(--sun); border: 1.5px solid var(--ink); margin-bottom: .85rem;
}
.pc-prose h3 { font-size: 1.24rem; color: var(--ink); margin: 2.1rem 0 .6rem; }
.pc-prose h4 { font-size: 1.05rem; color: var(--ink); margin: 1.6rem 0 .4rem; font-weight: 600; }

/* :not(.btn) so the call-to-action button dropped into the article keeps its own
   treatment instead of picking up an underline and a tinted hover. */
.pc-prose a:not(.btn) { color: var(--cobalt-deep); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pc-prose a:not(.btn):hover { color: var(--ink); background: var(--sun-tint); }

.pc-prose ul, .pc-prose ol { margin: 1.1rem 0 1.4rem; padding-left: 1.4rem; }
.pc-prose ul { list-style: disc; }
.pc-prose ol { list-style: decimal; }
.pc-prose li { margin-bottom: .55rem; padding-left: .2rem; }
.pc-prose li::marker { color: var(--cobalt); font-weight: 700; }

.pc-prose img { border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin: 2rem auto; }
.pc-prose figure { margin: 2rem 0; }
.pc-prose figure img { margin: 0 auto; }
.pc-prose figcaption { margin-top: .7rem; font-size: .85rem; color: var(--text-muted); text-align: center; }

.pc-prose blockquote {
    margin: 1.8rem 0; padding: 1.1rem 1.3rem;
    background: var(--newsprint); border: var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); color: var(--ink); font-size: 1.08rem;
}
.pc-prose blockquote p:last-child { margin-bottom: 0; }

.pc-prose hr {
    border: 0; border-top: var(--border); width: 64px;
    margin: 2.6rem auto; opacity: 1;
}

/* Tables: wrapped by blog.js so a wide one scrolls instead of stretching the page. */
.pc-tablewrap { overflow-x: auto; margin: 1.8rem 0; border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--paper); }
.pc-prose table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 460px; }
.pc-prose thead th { background: var(--newsprint-deep); font-weight: 700; color: var(--ink); text-align: left; }
.pc-prose th, .pc-prose td { padding: .7rem .85rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.pc-prose tbody tr:last-child td { border-bottom: 0; }
.pc-prose tbody tr:nth-child(even) { background: var(--newsprint); }
.pc-prose table p { margin: 0; }

/* ---------- generated components (mxchat-advanced-content) ---------- */

/* The site's .hl marker sweep is tuned for display headings. At body size and
   line-height 1.78 the band lands across the words and reads as a strikethrough, so
   emphasis here is a soft full tint instead - same colour family, no ambiguity. */
.mxg-highlight {
    background: var(--sun-tint); color: var(--ink); font-weight: 600;
    padding: .08em .25em; border-radius: 4px;
    box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

/* Both of these repeat something the page already states properly: the meta line
   duplicates (and can contradict) the real published date and read time, and the
   SEO blurb is the meta description leaking into the body. */
.pc-prose .mxg-meta,
.pc-prose .mxg-seo-meta { display: none; }

.pc-prose .mxg-section { margin-bottom: .5rem; }
.pc-prose .mxg-divider { width: 64px; }

.pc-prose .mxg-takeaway {
    margin: 2rem 0; padding: 1.15rem 1.3rem;
    background: var(--sun-tint); border: var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); color: var(--ink);
}
.pc-prose .mxg-takeaway-title {
    display: block; font-family: var(--font-sticker); font-size: .95rem;
    letter-spacing: .04em; text-transform: uppercase; color: var(--ink); margin-bottom: .45rem;
}
.pc-prose .mxg-takeaway p:last-child { margin-bottom: 0; }

.pc-prose .mxg-note {
    margin: 1.8rem 0; padding: 1rem 1.2rem;
    background: var(--newsprint); border-left: var(--border-w) solid var(--cobalt);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink);
}
/* The generator sometimes puts a note inside a takeaway. Two nested boxes read as a
   mistake, so the inner one gives up its frame. */
.pc-prose .mxg-takeaway .mxg-note {
    margin: 0; padding: 0; background: none; border-left: 0; border-radius: 0;
}

.pc-prose .mxg-cta {
    margin: 2rem 0; padding: 1.2rem 1.35rem;
    background: var(--cobalt-tint); border: var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.pc-prose .mxg-cta p:last-child { margin-bottom: 0; }

.pc-prose .mxg-faq { display: grid; gap: .9rem; margin: 1.8rem 0; }
.pc-prose .mxg-faq-item {
    padding: 1.1rem 1.25rem; background: var(--paper);
    border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.pc-prose .mxg-faq-item > *:first-child { margin-top: 0; }
.pc-prose .mxg-faq-question, .pc-prose .mxg-faq-item h3 { margin-top: 0; margin-bottom: .5rem; font-size: 1.1rem; }
.pc-prose .mxg-faq-answer { margin-bottom: 0; }

.pc-prose .mxg-idea-list { list-style: none; padding-left: 0; display: grid; gap: .9rem; }
.pc-prose .mxg-idea-item {
    padding: 1.05rem 1.2rem; background: var(--paper);
    border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    margin-bottom: 0; padding-left: 1.2rem;
}
.pc-prose .mxg-idea-number {
    display: inline-block; min-width: 1.9em; font-family: var(--font-sticker);
    font-size: 1.05rem; color: var(--cobalt-deep); letter-spacing: .01em;
}
.pc-prose .mxg-idea-title { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; line-height: 1.2; color: var(--ink); margin-bottom: .45rem; }
.pc-prose .mxg-idea-item p:last-child { margin-bottom: 0; }
.pc-prose .mxg-price { display: inline-block; margin-top: .5rem; font-size: .85rem; font-weight: 600; color: var(--cobalt-deep); }

.pc-prose .mxg-closing { margin-top: 1.6rem; font-size: 1.08rem; color: var(--ink); }
.pc-prose .mxg-anchor { font-weight: 600; }

/* ---------- the in-article call to action ---------- */

.pc-inline-cta {
    display: grid; grid-template-columns: 200px 1fr; gap: 1.4rem; align-items: center;
    margin: 2.6rem 0; padding: 1.4rem;
    background: var(--newsprint); border: var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.pc-inline-cta-art img { width: 100%; aspect-ratio: 1; object-fit: cover; border: var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); margin: 0; }
.pc-inline-cta-body { display: grid; gap: .55rem; }
.pc-inline-cta-body h3 { margin: 0; font-size: 1.3rem; color: var(--ink); line-height: 1.15; }
.pc-inline-cta-body p { margin: 0; font-size: .96rem; color: var(--text-soft); }
.pc-inline-cta-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-top: .35rem; }
.pc-inline-cta-price { font-size: .85rem; color: var(--text-muted); }
.pc-inline-cta-price b { display: block; font-size: .95rem; color: var(--ink); }

/* ---------- the closing band ---------- */

.pc-cta-band .pc-cta-inner { max-width: 40rem; }
.pc-cta-band h2 { margin-top: .7rem; }
.pc-cta-band .lede { margin-top: .9rem; }
.pc-cta-band .btn-group { margin-top: 1.6rem; display: flex; flex-wrap: wrap; gap: .8rem; }
.pc-cta-price { margin-top: 1rem; }

/* ---------- search + 404 ---------- */

.pc-search { display: flex; gap: .6rem; margin-top: 1.4rem; max-width: 520px; }
.pc-search .input { flex: 1; }
.pc-404 { padding-top: clamp(3rem, 7vw, 5rem); }
.pc-404-inner { max-width: 40rem; display: grid; gap: 1rem; justify-items: start; }
.pc-404-inner h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
.pc-404-inner .btn-group { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .4rem; }

/* ---------- exit intent ---------- */

.pc-exit { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 1.25rem; }
.pc-exit[hidden] { display: none; }
body.pc-exit-open { overflow: hidden; }

.pc-exit-backdrop { position: absolute; inset: 0; background: rgba(20, 22, 26, .58); opacity: 0; transition: opacity .2s ease; }
.pc-exit.is-open .pc-exit-backdrop { opacity: 1; }

.pc-exit-card {
    position: relative; width: min(680px, 100%);
    display: grid; grid-template-columns: 232px 1fr;
    background: var(--paper); border: var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); overflow: hidden;
    opacity: 0; transform: translateY(14px) scale(.985);
    transition: opacity .22s ease, transform .22s ease;
}
.pc-exit.is-open .pc-exit-card { opacity: 1; transform: none; }

.pc-exit-art { position: relative; background: var(--newsprint); border-right: var(--border); }
.pc-exit-art img { width: 100%; height: 100%; object-fit: cover; }
.pc-exit-art .sticker { position: absolute; left: 12px; bottom: 12px; }

.pc-exit-body { padding: 1.6rem 1.7rem 1.5rem; display: grid; gap: .7rem; justify-items: start; align-content: center; }
.pc-exit-body h2 { font-size: clamp(1.5rem, 2.6vw, 1.95rem); }
.pc-exit-body p { color: var(--text-soft); font-size: .98rem; }
.pc-exit-body strong { color: var(--ink); font-weight: 600; }
.pc-exit-go { margin-top: .35rem; }
.pc-exit-no { font-size: .9rem; color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.pc-exit-no:hover { color: var(--ink); }
.pc-exit-foot { margin-top: .1rem; }

.pc-exit-x {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    width: 34px; height: 34px; display: grid; place-items: center;
    background: var(--paper); border: 2px solid var(--ink); border-radius: 50%;
    box-shadow: var(--shadow-sm); color: var(--ink);
}
.pc-exit-x:hover { background: var(--sun-tint); }
.pc-exit-x svg { width: 14px; height: 14px; }

/* On phones it becomes a bottom sheet: thumb-reachable, and it never covers the article
   entirely the way a centred card does on a short viewport. */
@media (max-width: 640px) {
    .pc-exit { padding: 0; place-items: end stretch; }
    .pc-exit-card {
        grid-template-columns: 1fr; width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-bottom: 0; box-shadow: none;
        transform: translateY(24px);
    }
    .pc-exit-art { height: 132px; border-right: 0; border-bottom: var(--border); }
    .pc-exit-art img { object-position: center 38%; }
    .pc-exit-body { padding: 1.25rem 1.25rem calc(1.35rem + env(safe-area-inset-bottom)); }
    .pc-exit-body h2 { font-size: 1.45rem; }
    .pc-exit-body h2 br { display: none; }
    .pc-exit-go { width: 100%; justify-content: center; }
    .pc-exit-no { align-self: center; }
    .pc-exit-foot { align-self: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    .pc-exit-backdrop, .pc-exit-card { transition: none; }
    .pc-exit-card { transform: none; }
}

/* ---------- WordPress odds and ends ---------- */

.pc-prose .wp-block-image { margin: 2rem 0; }
.pc-prose .wp-block-image img { margin: 0 auto; }
.pc-prose .wp-block-table { margin: 0; }
.pc-prose .wp-block-table table { min-width: 460px; }
.pc-prose .aligncenter { margin-left: auto; margin-right: auto; }
.pc-prose .alignleft { float: left; margin: .4rem 1.4rem 1rem 0; max-width: 45%; }
.pc-prose .alignright { float: right; margin: .4rem 0 1rem 1.4rem; max-width: 45%; }
.pc-prose .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The MxChat widget sits above the sticky footer bar on phones. */
body.pc-blog .mxchat-container { z-index: 900; }

/* ---------- phones and tablets ---------- */

@media (max-width: 1024px) {
    .pc-feature { grid-template-columns: 1fr; gap: 1.4rem; }
    .g3.pc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .g3.pc-grid { grid-template-columns: 1fr; }
    .pc-blog-head h1 { font-size: clamp(1.9rem, 8vw, 2.5rem); }
    .pc-post-title { font-size: clamp(1.75rem, 7.5vw, 2.3rem); }
    .pc-post-hero { margin-top: calc(-1 * 1.2rem); }
    .pc-prose { font-size: 1.02rem; line-height: 1.72; }
    .pc-prose h2 { font-size: 1.4rem; margin-top: 2.3rem; }
    .pc-prose h3 { font-size: 1.15rem; }
    .pc-inline-cta { grid-template-columns: 1fr; padding: 1.15rem; }
    .pc-inline-cta-art { max-width: 160px; }
    .pc-pager { flex-direction: column; align-items: stretch; text-align: center; gap: .8rem; }
    .pc-pager-slot:last-child { text-align: center; }
    .pc-pager .btn { width: 100%; justify-content: center; }
    .pc-search { flex-direction: column; }
    .pc-search .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .pc-card, .pc-feature-media { transition: none; }
}

/* The dialog takes focus on open so its title is announced first; it is a container,
   not a control, so it should not draw a focus ring of its own. */
.pc-exit-card:focus { outline: none; }
