/* =============================================================
   Leveredge Media — single.css
   Loaded on all single blog post pages.
   v1.0.0
============================================================= */


/* ── SECTION BACKGROUNDS ────────────────────────────────────── */

#post-header       { background: var(--ink-2); padding: 148px 24px 52px; border-bottom: 1px solid var(--border); }
#post-body         { background: var(--ink);   padding: 72px 24px; }
#related-posts     { background: var(--ink-2); padding: 80px 24px; border-top: 1px solid var(--border); }
#post-cta          { background: var(--ink);   padding: 80px 24px; position: relative; overflow: hidden; }

#post-cta::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 70% 80% at 50% 110%, rgba(255, 95, 31, 0.08) 0%, transparent 55%);
    pointer-events: none;
}


/* ============================================================
   READING PROGRESS BAR
============================================================= */

.reading-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 201;            /* above the fixed header at z-index 200 */
    background: transparent;
    pointer-events: none;
}
.reading-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--orange);
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}


/* ============================================================
   POST HEADER
============================================================= */

.post-meta-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.post-cat-chip {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--orange);
    background: var(--orange-soft);
    border: 1px solid var(--orange-border);
    padding: 4px 11px;
    border-radius: 100px;
    transition: background 0.2s;
}
.post-cat-chip:hover { background: rgba(255, 95, 31, 0.18); }

.post-meta-sep {
    width: 3px; height: 3px;
    background: var(--muted-2);
    border-radius: 50%;
    flex-shrink: 0;
}

.post-date,
.post-reading-time {
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--muted-2);
    font-weight: 500;
}

.post-title {
    font-family: var(--font-display);
    font-size: clamp(32px, 5.5vw, 58px);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.1;
    color: var(--white);
    max-width: 820px;
}


/* ============================================================
   FEATURED IMAGE
============================================================= */

/* ============================================================
   POST HERO — full-bleed featured image behind title
============================================================= */

#post-header {
    position: relative;
    background: var(--ink-2);
    padding: clamp(88px, 12vw, 148px) 24px clamp(44px, 6vw, 72px);
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
#post-header.has-image { min-height: clamp(320px, 50vw, 480px); }

/* Background image wrapper */
.post-hero-img {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.post-hero-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    display: block;
    /* Override any post-thumbnail sizing rules */
    max-width: none;
    border-radius: 0;
    aspect-ratio: unset;
    margin: 0;
    border: none;
}
/* Gradient overlay so title is readable against any image */
.post-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(8, 11, 18, 0.62) 0%,
        rgba(8, 11, 18, 0.88) 100%
    );
}

/* Inner wrapper sits above the image */
.post-header-inner {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    /* Remove fixed min-height — hero height follows content */
    #post-header.has-image { min-height: 0; }
    /* Add image opacity reduction on mobile for cleaner title legibility */
    .post-hero-img img { opacity: 0.55; }
}


/* ============================================================
   ARTICLE LAYOUT
============================================================= */

.article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 56px;
    align-items: start;
    max-width: var(--max);
    margin: 0 auto;
}


/* ============================================================
   ARTICLE BODY TYPOGRAPHY
============================================================= */

.article-body {
    font-size: 18px;
    line-height: 1.8;
    color: var(--muted);
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Headings */
.article-body h2 {
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 700;
    letter-spacing: -0.022em;
    color: var(--white);
    margin: 52px 0 16px;
    line-height: 1.25;
    scroll-margin-top: 100px;
}
.article-body h2:first-child { margin-top: 0; }

.article-body h3 {
    font-family: var(--font-display);
    font-size: clamp(19px, 2.5vw, 23px);
    font-weight: 700;
    color: var(--white);
    margin: 38px 0 13px;
    line-height: 1.3;
    scroll-margin-top: 100px;
}

.article-body h4 {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--white-2);
    margin: 28px 0 10px;
}

/* Paragraphs */
.article-body p  { margin-bottom: 20px; }
.article-body p:last-child { margin-bottom: 0; }
.article-body strong { color: var(--white); font-weight: 600; }
.article-body em     { font-style: italic; }

/* Links */
.article-body a {
    color: var(--orange);
    text-decoration: underline;
    text-decoration-color: var(--orange-border);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}
.article-body a:hover { text-decoration-color: var(--orange); }

/* Lists */
.article-body ul,
.article-body ol {
    margin: 20px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding: 0;
}
.article-body ul li,
.article-body ol li {
    padding-left: 24px;
    position: relative;
    line-height: 1.72;
    list-style: none;
}
.article-body ul li::before {
    content: '';
    position: absolute;
    left: 0; top: 11px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--orange);
    opacity: 0.65;
}
.article-body ol { counter-reset: artol; }
.article-body ol li { counter-increment: artol; }
.article-body ol li::before {
    content: counter(artol) '.';
    position: absolute; left: 0; top: 0;
    font-family: var(--font-display);
    font-size: 14px; font-weight: 700;
    color: var(--orange); opacity: 0.8;
}

/* Blockquote */
.article-body blockquote {
    border-left: 3px solid var(--orange);
    padding: 18px 22px;
    margin: 28px 0;
    background: var(--card);
    border-radius: 0 var(--r) var(--r) 0;
}
.article-body blockquote p {
    font-size: 18px;
    font-style: italic;
    color: var(--white-2);
    margin: 0;
    line-height: 1.65;
}
.article-body blockquote cite {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    font-style: normal;
    color: var(--muted-2);
}

/* Inline code */
.article-body :not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--card-2);
    padding: 2px 7px;
    border-radius: 4px;
    color: var(--orange);
    border: 1px solid var(--border);
}

/* Code blocks */
.article-body pre {
    background: var(--card);
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    padding: 22px 24px;
    overflow-x: auto;
    margin: 28px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}
.article-body pre code {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--white-2);
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    line-height: 1.7;
}

/* Images */
.article-body img,
.article-body figure img {
    max-width: 100%;
    height: auto;
    border-radius: var(--r);
    display: block;
    border: 1px solid var(--border);
}
.article-body figure { margin: 32px 0; }
.article-body figcaption {
    font-size: 13px; color: var(--muted-2);
    text-align: center; margin-top: 10px;
    font-style: italic; line-height: 1.5;
}

/* ── Gutenberg block image alignment ───────────────────────── */
/* wp-block-image wraps every block editor image               */
.article-body .wp-block-image          { margin: 32px 0; }
.article-body .wp-block-image img      {
    max-width: 100%;
    height: auto;
    border-radius: var(--r);
    display: block;
    border: 1px solid var(--border);
}
.article-body .wp-block-image figcaption {
    font-size: 13px; color: var(--muted-2);
    text-align: center; margin-top: 10px;
    font-style: italic;
}

/* Alignment classes output by Gutenberg */
.article-body .alignleft,
.article-body .wp-block-image.alignleft {
    float: left;
    margin: 8px 32px 16px 0;
    max-width: 48%;
}
.article-body .alignright,
.article-body .wp-block-image.alignright {
    float: right;
    margin: 8px 0 16px 32px;
    max-width: 48%;
}
.article-body .aligncenter,
.article-body .wp-block-image.aligncenter {
    display: block;
    margin: 32px auto;
    text-align: center;
}
.article-body .alignwide,
.article-body .wp-block-image.alignwide {
    max-width: calc(100% + 80px);
    margin-left:  -40px;
    margin-right: -40px;
}
.article-body .alignfull,
.article-body .wp-block-image.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left:  calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    border-radius: 0;         /* full-bleed should not have radius */
}

/* Clear floats after aligned images */
.article-body p:has(+ .alignleft),
.article-body p:has(+ .alignright) { overflow: hidden; }
.article-body::after { content: ''; display: table; clear: both; }

/* Horizontal rule */
.article-body hr {
    border: none; height: 1px;
    background: var(--border); margin: 40px 0;
}

/* Tables — wrapped for horizontal scroll on mobile */
.article-body table {
    width: 100%; border-collapse: collapse;
    margin: 28px 0; font-size: 15px;
    border: 1px solid var(--border);
    border-radius: var(--r); overflow: hidden;
}
.article-body .wp-block-table,
.article-body figure.wp-block-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 28px 0;
}
.article-body th {
    background: var(--card-2);
    font-family: var(--font-display); font-size: 12px;
    font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--muted-2);
    padding: 12px 16px; text-align: left;
    border-bottom: 1px solid var(--border-2);
}
.article-body td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--muted); vertical-align: top;
}
.article-body tr:last-child td { border-bottom: none; }

/* WordPress-generated alignment classes */
.article-body .alignleft  { float: left;  margin: 0 24px 16px 0; }
.article-body .alignright { float: right; margin: 0 0 16px 24px; }
.article-body .aligncenter { margin: 0 auto 16px; display: block; }

/* Post pagination */
.post-pagination {
    margin-top: 40px; padding-top: 28px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display); font-size: 14px; color: var(--muted-2);
}
.post-pagination span { background: var(--card); border: 1px solid var(--border-2); border-radius: 6px; padding: 5px 12px; }
.post-pagination a    { color: var(--orange); }


/* ============================================================
   ARTICLE SIDEBAR
============================================================= */

.article-sidebar {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.article-sidebar::-webkit-scrollbar       { width: 4px; }
.article-sidebar::-webkit-scrollbar-track { background: transparent; }
.article-sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* TOC card */
.article-toc-card {
    background: var(--card);
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    padding: 22px 20px;
}

/* Article CTA widget */
.article-cta-widget {
    background: var(--card);
    border: 1px solid var(--orange-border);
    border-radius: var(--r-lg);
    padding: 24px 20px;
}
.acw-overline {
    font-family: var(--font-display); font-size: 11px;
    font-weight: 700; letter-spacing: 0.09em;
    text-transform: uppercase; color: var(--orange);
    margin-bottom: 8px;
}
.acw-title {
    font-family: var(--font-display); font-size: 18px;
    font-weight: 700; letter-spacing: -0.015em;
    color: var(--white); margin-bottom: 9px; line-height: 1.3;
}
.acw-body { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 18px; }


/* ============================================================
   RELATED POSTS
============================================================= */

.related-header { max-width: 480px; margin-bottom: 40px; }
.related-title  { font-size: clamp(24px, 3.5vw, 36px); margin-top: 6px; }

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: var(--max);
    margin: 0 auto;
}

.related-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: border-color 0.28s, transform 0.28s;
}
.related-card:hover { border-color: var(--orange-border); transform: translateY(-3px); }

.related-thumb { display: block; overflow: hidden; aspect-ratio: 16 / 9; }
.related-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
    border-radius: 0;
    border: none;
}
.related-card:hover .related-thumb img { transform: scale(1.04); }

.related-card-body { padding: 22px 20px; }
.related-card-title {
    font-family: var(--font-display);
    font-size: 16px; font-weight: 700;
    letter-spacing: -0.012em; color: var(--white);
    margin: 10px 0 8px; line-height: 1.35;
}
.related-card-title a { color: inherit; }
.related-card-title a:hover { color: var(--orange); }
.related-card-excerpt {
    font-size: 14px; color: var(--muted);
    line-height: 1.6; margin-bottom: 14px;
}
.related-read-more {
    font-family: var(--font-display); font-size: 13px;
    font-weight: 700; color: var(--orange);
    letter-spacing: -0.01em;
}
.related-read-more:hover { opacity: 0.8; }


/* ============================================================
   BOTTOM CTA
============================================================= */

.post-cta-inner {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    position: relative; z-index: 1;
}
.post-cta-title { font-size: clamp(26px, 4vw, 46px); margin-bottom: 16px; }
.post-cta-sub   { font-size: 18px; color: var(--muted); line-height: 1.68; margin-bottom: 36px; }


/* ============================================================
   RESPONSIVE
============================================================= */

@media (max-width: 1080px) {
    .article-layout { grid-template-columns: 1fr 260px; gap: 40px; }
}

@media (max-width: 860px) {
    .article-layout   { grid-template-columns: 1fr; }
    .article-sidebar  { position: static; max-height: none; overflow: visible; }
    .article-toc-card { display: none; }
    .related-grid     { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    #post-header      { padding: 112px 24px 40px; }
    #related-posts    { padding: clamp(48px, 8vw, 80px) 24px; }
    #post-cta         { padding: clamp(48px, 8vw, 80px) 24px; }
    .post-title       { font-size: clamp(28px, 7vw, 48px); }
    .article-layout   { gap: 28px; }
}

@media (max-width: 580px) {
    #post-header      { padding-top: 108px; }
    .related-grid     { grid-template-columns: 1fr; }
    .article-body     { font-size: 17px; }
    .article-cta-widget { display: none; }
    .post-meta-bar    { flex-wrap: wrap; gap: 6px; }
}

@media (max-width: 480px) {
    #post-header   { padding: 100px 16px 36px; }
    #related-posts { padding: 40px 16px; }
    #post-cta      { padding: 40px 16px; }
    .post-title    { font-size: clamp(24px, 8vw, 38px); }
    .article-body  { font-size: 16px; }
    .related-grid  { gap: 12px; }
}
