/**
 * Jeddy Wellness blog — WordPress-only additions.
 *
 * Printed LAST in <head>: after WordPress's styles and after the main site's
 * stylesheets (public_html/css/*). Everything the blog shares with the main
 * site — tokens, typography, header, footer, cards, buttons — comes from
 * those; this file only covers what WordPress adds that the main site never
 * renders:
 *   1. the admin bar (logged-in editors only)
 *   2. WordPress utility classes
 *   3. archive / single-post extras
 *   4. block-editor content inside .article-body
 *
 * Rules: tokens only, no raw hex. Never style the shared header or footer
 * here — fix those in the main site so both stay identical. Content rules are
 * scoped under .article-body so nothing can leak onto the site chrome.
 */

/* ── 1. Admin bar ─────────────────────────────────────────────────────────
   #wpadminbar is fixed at 32px (46px ≤782px) and becomes absolute ≤600px,
   so the sticky header has to sit below it. main.js reads the header's
   computed top, so its "is-stuck" shadow keeps working at these offsets. */
.admin-bar .site-header { top: 32px; }
html:has(> body.admin-bar) { scroll-padding-top: calc(var(--header-height) + 32px + 1rem); }
@media (max-width: 782px) {
    .admin-bar .site-header { top: 46px; }
    html:has(> body.admin-bar) { scroll-padding-top: calc(var(--header-height) + 46px + 1rem); }
}
@media (max-width: 600px) {
    .admin-bar .site-header { top: 0; }
    html:has(> body.admin-bar) { scroll-padding-top: calc(var(--header-height) + 1rem); }
}
/* The mobile drawer and pricing modal are full-screen overlays; lift them
   above the admin bar (z-index 99999) so their close buttons stay reachable. */
.admin-bar .mobile-nav,
.admin-bar .pricing-modal { z-index: 100000; }

/* ── 2. WordPress utility classes ─────────────────────────────────────── */
.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── 3. Archive + single extras ───────────────────────────────────────── */
.pagination__prev svg { transform: rotate(180deg); }

.blog-empty {
    padding-block: var(--space-16);
    text-align: center;
}
.blog-empty h2 { font-size: var(--text-2xl); }
.blog-empty p {
    margin: var(--space-3) auto var(--space-6);
    color: var(--color-text-secondary);
}

.blog-404-search {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-8);
}

.article-share__status {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-success);
}

.article-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Shown only if the main site cannot be loaded (see functions.php). */
.jw-fallback {
    display: flex;
    gap: var(--space-6);
    padding: var(--space-5) var(--space-6);
    font-family: var(--font-display, sans-serif);
    font-weight: var(--weight-semibold, 600);
}

/* ── 4. Block-editor content ──────────────────────────────────────────────
   The main site styles .article-body's direct children (pages.css). The
   block editor nests content — quotes hold <p>s, groups and columns hold
   anything — and the site's global reset zeroes every margin, so nested
   content needs its own rhythm. */
.article-body::after { content: ''; display: table; clear: both; }

/* :is() (not :where()) so these (0,2,0) rules beat the site's
   `.article-body h2/h3` (0,1,1) top margins inside nested containers. */
.article-body :is(blockquote, li, details,
    .wp-block-group, .wp-block-column, .wp-block-media-text__content,
    .wp-block-cover__inner-container) > * + * { margin-top: var(--space-4); }
.article-body :is(.wp-block-group, .wp-block-column, .wp-block-media-text__content,
    .wp-block-cover__inner-container) > :first-child { margin-top: 0; }

/* Lists — base.css strips bullets from any classed list (ul[class]); state
   them explicitly so the editor's ul.wp-block-list never depends on order. */
.article-body ul.wp-block-list { list-style: disc; }
.article-body ol.wp-block-list { list-style: decimal; }
.article-body :is(ul, ol) ul { list-style: circle; }
/* …but the editor also builds LAYOUTS out of <ul> — legacy galleries
   (ul.blocks-gallery-grid), social links, latest posts. The site's prose list
   styles (bullets, indent, li spacing) would break them apart. (0,3,1)/(0,3,2)
   beats `.article-body ul` and `.article-body li + li`. */
.article-body :is(ul[class*="wp-block-"]:not(.wp-block-list), ul.blocks-gallery-grid) {
    padding-left: 0;
    list-style: none;
}
.article-body :is(ul[class*="wp-block-"]:not(.wp-block-list), ul.blocks-gallery-grid) > li + li { margin-top: 0; }
/* Gallery tiles are <figure>s too; the site's 2.5rem figure margin opened
   tall gaps between gallery rows. */
.article-body .wp-block-gallery figure,
.article-body .blocks-gallery-grid figure { margin: 0; }

/* Headings below h3 (the site's scale stops at h4, and h5/h6 have none) */
.article-body h4 { margin-top: var(--space-8); font-size: var(--text-lg); }
.article-body h5,
.article-body h6 { margin-top: var(--space-6); font-size: var(--text-base); }

/* Images — the site's `figure img { width: 100% }` would stretch a small or
   medium image to the full 44rem column; let images keep their size. */
.article-body figure img { width: auto; max-width: 100%; }
.article-body .wp-block-image.size-full img,
.article-body .wp-block-image.size-large img { width: 100%; }
.article-body img { border-radius: var(--radius-md); }
.article-body .aligncenter { margin-inline: auto; text-align: center; }
.article-body img.aligncenter { display: block; }
.article-body .alignleft {
    float: left;
    max-width: 50%;
    margin: var(--space-2) var(--space-6) var(--space-4) 0;
}
.article-body .alignright {
    float: right;
    max-width: 50%;
    margin: var(--space-2) 0 var(--space-4) var(--space-6);
}
/* No wide/full alignment support: keep any legacy content in the column. */
.article-body :is(.alignwide, .alignfull) { max-width: 100%; margin-inline: 0; }
.article-body .wp-caption { max-width: 100%; }
.article-body .wp-caption-text,
.article-body .gallery-caption {
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    text-align: center;
}
.article-body :is(video, iframe) { max-width: 100%; }
.article-body video { width: 100%; border-radius: var(--radius-md); }
.article-body .wp-block-embed,
.article-body .wp-block-video { margin-block: var(--space-10); }

/* Quotes — paragraphs inside take the quote's colour and size, not .article-body p's */
.article-body blockquote p { color: inherit; }
.article-body blockquote cite {
    display: block;
    margin-top: var(--space-3);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-style: normal;
    color: var(--color-text-secondary);
}
.article-body .wp-block-pullquote {
    padding-block: var(--space-8);
    border-block: 2px solid var(--color-border);
    text-align: center;
}
.article-body .wp-block-pullquote blockquote {
    padding: 0;
    border-left: 0;
}

/* Tables */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
/* wp-block-library draws a full 1px currentColor grid plus 3px head/foot
   rules; replace them with the site's hairline row dividers. */
.article-body th,
.article-body td {
    padding: var(--space-3) var(--space-4);
    border: 0;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}
.article-body thead th {
    border-bottom: 2px solid var(--color-steel);
    font-family: var(--font-display);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
}
.article-body .wp-block-table { overflow-x: auto; }
.article-body .wp-block-table :is(thead, tfoot) { border: 0; }

/* Code */
.article-body code,
.article-body kbd {
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
}
.article-body pre {
    overflow-x: auto;
    padding: var(--space-5) var(--space-6);
    border-radius: var(--radius-md);
    background: var(--color-primary-deep);
    color: var(--color-text-inverse);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
}
.article-body pre code {
    padding: 0;
    background: none;
    color: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: inherit;
}

/* Separator — the site's hairline, not WordPress's 2px currentColor rule */
.article-body hr,
.article-body .wp-block-separator {
    margin-block: var(--space-10);
    border: 0;
    border-top: 1px solid var(--color-border);
}

/* Buttons block → the site's two button tiers (.btn--accent / .btn--outline).
   (0,2,0) so it beats `.article-body a` underlining and the global a:hover. */
.article-body .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.85rem 1.75rem;
    border: 2px solid var(--color-cta);
    border-radius: var(--radius-md);
    background: var(--color-cta);
    color: var(--color-on-cta);
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    line-height: 1.2;
    text-decoration: none;
    transition: all var(--transition-fast);
}
.article-body .wp-block-button__link:hover {
    border-color: var(--color-cta-hover);
    background: var(--color-cta-hover);
    color: var(--color-on-cta);
}
.article-body .is-style-outline > .wp-block-button__link {
    border-color: var(--color-steel);
    background: transparent;
    color: var(--color-primary);
}
.article-body .is-style-outline > .wp-block-button__link:hover {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-white);
}

/* Coloured blocks — the site gives headings and paragraphs an explicit
   colour, which would turn white text on a dark Cover/Group dark-on-dark. */
.article-body :is(.has-text-color, .wp-block-cover) :is(h1, h2, h3, h4, h5, h6, p, li, blockquote) {
    color: inherit;
}

.article-body mark {
    padding: 0 0.15em;
    border-radius: var(--radius-sm);
    background: var(--color-accent-soft);
    color: inherit;
}
