/* Mr. 6 Ghost theme — matches mr6.com aesthetic.
   All colors are inlined (Ghost themes can't share mr6.com's CSS vars). */

:root {
    --bg:          #F0F4FA;
    --bg-white:    #FFFFFF;
    --text:        #0A0F1E;
    --muted:       #5A6580;
    --accent:      #1A5CFF;
    --accent-glow: #4D8AFF;
    --accent-dark: #0D3FCC;
    --border:      #D4DCED;
    --tag-bg:      #E8F0FF;
    --surface:     #E4EAF5;

    --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif:   'Source Serif 4', Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-display);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.m6-main { flex: 1 0 auto; }
.m6-foot { margin-top: auto; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }

/* ---- NAV (dark navy, matches mr6.com homepage) ---- */
.m6-nav {
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(135deg, #0A0F1E 0%, #111B3A 50%, #0D2147 100%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 16px rgba(10,15,30,0.18);
}
.m6-nav__inner {
    max-width: 1080px; margin: 0 auto;
    padding: 14px 28px;
    display: flex; align-items: center; gap: 18px;
}
.m6-nav__logo { display: inline-flex; align-items: center; margin-right: auto; }
.m6-nav__logo img { display: block; height: 31px; width: auto; }
.m6-nav__links { display: flex; gap: 6px; align-items: center; }
.m6-nav__links a {
    color: rgba(255,255,255,0.72);
    font-weight: 600; font-size: 14px;
    padding: 8px 14px; border-radius: 10px;
    transition: background 0.2s, color 0.2s;
}
.m6-nav__links a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.m6-nav__cta {
    background: linear-gradient(135deg, var(--accent), var(--accent-glow)) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(26,92,255,0.30);
}
.m6-nav__cta:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(26,92,255,0.40); }

.m6-nav__burger {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 10px; padding: 8px 10px;
    cursor: pointer; align-items: center; justify-content: center;
    gap: 3px; flex-direction: column;
}
.m6-nav__burger span {
    display: block; width: 20px; height: 2px; border-radius: 2px;
    background: #fff;
    transition: transform 0.2s, opacity 0.2s;
}
.m6-nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.m6-nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.m6-nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 720px) {
    .m6-nav__inner { padding: 10px 14px; gap: 10px; }
    .m6-nav__burger { display: inline-flex; }
    .m6-nav__links {
        display: none;
        position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; gap: 0;
        background: linear-gradient(180deg, #0D2147 0%, #0A0F1E 100%);
        border-bottom: 1px solid rgba(255,255,255,0.08);
        padding: 10px 14px 14px;
        box-shadow: 0 12px 28px rgba(10,15,30,0.35);
    }
    .m6-nav__links.is-open { display: flex; }
    .m6-nav__links a { padding: 12px 14px; font-size: 15px; }
}

/* ---- HERO ---- */
.m6-hero { padding: 64px 0 24px; }
.m6-hero__inner { max-width: 780px; margin: 0 auto; padding: 0 28px; }
.m6-hero__eyebrow {
    display: inline-block;
    font-family: var(--font-display); font-weight: 700;
    font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent), var(--accent-glow));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 14px;
}
.m6-hero h1 {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(30px, 4.4vw, 52px); line-height: 1.08;
    letter-spacing: -0.025em; margin: 0 0 14px;
    color: var(--text);
}
.m6-hero h1 em {
    font-style: italic;
    background: linear-gradient(135deg, var(--accent), var(--accent-glow));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.m6-hero__sub {
    color: var(--muted); font-size: 17px; line-height: 1.6;
    max-width: 620px; margin: 0;
}

/* ---- POST LIST ---- */
.m6-list { padding: 24px 0 96px; }
.m6-list__inner { max-width: 780px; margin: 0 auto; padding: 0 28px; }

.m6-card { margin-bottom: 32px; }
.m6-card__link {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 22px;
    color: inherit; text-decoration: none;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.m6-card__link:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(13,63,204,0.10);
    border-color: rgba(26,92,255,0.35);
}
.m6-card__cover {
    background-size: cover; background-position: center;
    background-color: var(--tag-bg);
    min-height: 140px;
}
.m6-card__body { padding: 18px 22px 18px 4px; }
.m6-card__tag {
    display: inline-block;
    font-size: 10.5px; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}
.m6-card__title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(19px, 2.2vw, 24px);
    line-height: 1.25; letter-spacing: -0.015em;
    margin: 0 0 8px; color: var(--text);
}
.m6-card__link:hover .m6-card__title { color: var(--accent); }
.m6-card__excerpt {
    color: var(--muted); font-size: 15px; line-height: 1.55;
    margin: 0 0 12px;
}
.m6-card__meta {
    color: var(--muted); font-size: 12.5px;
}
.m6-dot { color: var(--border); }

/* Lead (first) card = hero-style: cover on top, larger title. */
.m6-card--lead .m6-card__link { grid-template-columns: 1fr; }
.m6-card--lead .m6-card__cover { min-height: 260px; }
.m6-card--lead .m6-card__body { padding: 24px 32px 28px; }
.m6-card--lead .m6-card__title { font-size: clamp(24px, 3vw, 34px); }

@media (max-width: 640px) {
    .m6-card__link { grid-template-columns: 1fr; }
    .m6-card__cover { min-height: 180px; }
    .m6-card__body { padding: 18px 22px 22px; }
}

.m6-pager {
    display: flex; gap: 18px; justify-content: center; align-items: center;
    padding: 24px 0 8px;
    color: var(--muted);
}
.m6-pager a {
    color: var(--accent); font-weight: 600;
    padding: 8px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg-white);
}
.m6-pager a:hover { background: var(--tag-bg); }

/* ---- SINGLE ARTICLE ---- */
.m6-article { padding: 40px 0 96px; }
.m6-article__inner {
    max-width: 720px; margin: 0 auto; padding: 0 28px;
}
.m6-back {
    display: inline-block; color: var(--muted);
    font-size: 13px; margin-bottom: 20px;
}
.m6-back:hover { color: var(--accent); }

.m6-article__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.m6-article__tag {
    font-size: 10.5px; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--accent); background: var(--tag-bg);
    padding: 4px 10px; border-radius: 999px;
}

.m6-article__title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(30px, 4.4vw, 52px);
    line-height: 1.1; letter-spacing: -0.025em;
    margin: 0 0 14px;
}
.m6-article__meta {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    color: var(--muted); font-size: 13.5px;
    margin-bottom: 32px;
}

.m6-article__cover {
    margin: 0 0 36px; border-radius: 14px; overflow: hidden;
    background: var(--tag-bg);
}
.m6-article__cover img { display: block; width: 100%; height: auto; }
.m6-article__cover figcaption {
    padding: 8px 4px; font-size: 13px; color: var(--muted);
    text-align: center;
}

/* Body typography — serif for reading comfort */
.m6-article__body {
    font-family: var(--font-serif);
    font-size: 18px; line-height: 1.72;
    color: var(--text);
}
.m6-article__body > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.m6-article__body p { margin: 0 0 20px; }
.m6-article__body h2 {
    font-family: var(--font-display); font-weight: 700;
    font-size: 26px; line-height: 1.2; letter-spacing: -0.02em;
    margin: 44px auto 14px;
}
.m6-article__body h3 {
    font-family: var(--font-display); font-weight: 700;
    font-size: 20px; line-height: 1.25;
    margin: 32px auto 12px;
}
.m6-article__body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.m6-article__body a:hover { color: var(--accent-dark); }
.m6-article__body blockquote {
    border-left: 3px solid var(--accent);
    padding: 6px 0 6px 20px;
    color: var(--muted);
    font-style: italic;
}
.m6-article__body figure { margin: 28px auto; text-align: center; max-width: 720px; }
.m6-article__body figure img { max-width: 100%; height: auto; border-radius: 8px; }
.m6-article__body figcaption {
    margin-top: 8px; font-size: 13px; color: var(--muted);
    font-family: var(--font-display);
}
.m6-article__body img { max-width: 100%; height: auto; border-radius: 8px; }
.m6-article__body pre {
    background: #0A0F1E; color: #C7D1E5;
    padding: 20px; border-radius: 12px; overflow-x: auto;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 14px; line-height: 1.6;
    margin: 22px auto;
}
.m6-article__body code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.9em; background: var(--tag-bg); color: var(--accent);
    padding: 2px 6px; border-radius: 4px;
}
.m6-article__body pre code { background: transparent; color: inherit; padding: 0; border-radius: 0; }
.m6-article__body ul, .m6-article__body ol { margin: 0 auto 20px; padding-left: 22px; }
.m6-article__body li { margin-bottom: 8px; }
.m6-article__body hr { border: none; border-top: 1px solid var(--border); margin: 36px auto; }

/* Ghost Koenig cards — let big media escape the reading column */
.m6-article__body .kg-width-wide { max-width: 900px; }
.m6-article__body .kg-width-full { max-width: 100%; }
.m6-article__body .kg-image-card,
.m6-article__body .kg-gallery-card,
.m6-article__body .kg-embed-card,
.m6-article__body .kg-bookmark-card,
.m6-article__body .kg-video-card,
.m6-article__body .kg-callout-card,
.m6-article__body .kg-toggle-card { margin: 28px auto; }
.m6-article__body .kg-bookmark-container {
    display: flex; border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden; text-decoration: none; color: var(--text);
    background: var(--bg-white);
    transition: box-shadow 0.2s, border-color 0.2s;
}
.m6-article__body .kg-bookmark-container:hover {
    border-color: rgba(26,92,255,0.35);
    box-shadow: 0 8px 24px rgba(13,63,204,0.10);
}
.m6-article__body .kg-bookmark-content { padding: 18px 22px; flex: 1; }
.m6-article__body .kg-bookmark-title { font-weight: 700; font-family: var(--font-display); margin-bottom: 6px; }
.m6-article__body .kg-bookmark-description { color: var(--muted); font-size: 14px; }
.m6-article__body .kg-callout-card {
    padding: 18px 22px; border-radius: 12px;
    background: var(--tag-bg); color: var(--text);
}

/* Subscribe CTA on posts */
.m6-subscribe {
    margin: 48px auto 0;
    max-width: 640px;
    padding: 28px;
    background: linear-gradient(135deg, var(--bg-white) 0%, #EEF3FC 100%);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-align: center;
}
.m6-subscribe h3 {
    font-family: var(--font-display); font-weight: 700; font-size: 22px;
    margin: 0 0 8px; letter-spacing: -0.01em;
}
.m6-subscribe p { color: var(--muted); margin: 0 0 16px; font-family: var(--font-display); }

.m6-article__foot {
    display: flex; gap: 14px; flex-wrap: wrap;
    margin: 48px auto 0; padding-top: 28px;
    border-top: 1px solid var(--border);
    max-width: 640px;
}

.m6-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 11px 20px; border-radius: 10px;
    font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
    cursor: pointer; border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.m6-btn--primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-glow));
    color: #fff; box-shadow: 0 6px 18px rgba(26,92,255,0.28);
}
.m6-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(26,92,255,0.38); }
.m6-btn--ghost {
    background: var(--bg-white); color: var(--accent);
    border: 1px solid var(--accent);
}
.m6-btn--ghost:hover { background: var(--tag-bg); }

/* ---- FOOTER ---- */
.m6-foot {
    border-top: 1px solid var(--border);
    background: var(--bg-white);
    padding: 24px 0; margin-top: 64px;
}
.m6-foot__inner {
    max-width: 1080px; margin: 0 auto; padding: 0 28px;
    display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    font-size: 13px; color: var(--muted);
}
.m6-foot a { color: var(--accent); }

/* ============================================================
   MOBILE PASS — everything below 640px
   ============================================================ */
@media (max-width: 640px) {
    /* Tighter container padding across the board. */
    .m6-hero__inner,
    .m6-list__inner,
    .m6-article__inner,
    .m6-foot__inner { padding-left: 20px; padding-right: 20px; }

    /* Hero — tighter top spacing on small screens. */
    .m6-hero { padding: 40px 0 20px; }
    .m6-hero__sub { font-size: 16px; }

    /* Article body reads better at 16-17px on phones. */
    .m6-article { padding: 24px 0 64px; }
    .m6-article__meta { font-size: 12.5px; gap: 6px; margin-bottom: 24px; }
    .m6-article__cover { border-radius: 10px; margin-bottom: 24px; }
    .m6-article__body { font-size: 17px; line-height: 1.68; }
    .m6-article__body h2 { font-size: 22px; margin-top: 32px; }
    .m6-article__body h3 { font-size: 18px; margin-top: 24px; }
    .m6-article__body pre { padding: 14px; font-size: 13px; border-radius: 8px; margin-left: -8px; margin-right: -8px; }
    .m6-article__body blockquote { padding-left: 16px; }

    /* Ghost Koenig wide/full cards — let big media reach edge-to-edge. */
    .m6-article__body .kg-width-full img { border-radius: 0; }

    /* Article-foot buttons stack full-width instead of side-by-side. */
    .m6-article__foot { flex-direction: column; align-items: stretch; padding-top: 20px; }
    .m6-article__foot .m6-btn { justify-content: center; }

    /* Subscribe CTA sits tighter. */
    .m6-subscribe { padding: 22px 20px; margin-top: 36px; }
    .m6-subscribe h3 { font-size: 20px; }

    /* Footer stacks vertically. */
    .m6-foot__inner { flex-direction: column; gap: 6px; align-items: flex-start; }
    .m6-foot { padding: 20px 0; margin-top: 40px; }

    /* List cards already collapse to single-column at 640 (rule earlier);
       just tighten spacing. */
    .m6-card { margin-bottom: 24px; }
    .m6-card--lead .m6-card__cover { min-height: 200px; }
    .m6-card--lead .m6-card__body { padding: 20px 22px 24px; }
    .m6-card__body { padding: 16px 20px 20px; }
}

@media (max-width: 420px) {
    .m6-hero__inner,
    .m6-list__inner,
    .m6-article__inner { padding-left: 16px; padding-right: 16px; }
    .m6-article__title { font-size: 28px; }
    .m6-hero h1 { font-size: 28px; }
}
