/* =========================================
   Mirage Mir – custom theme styles
   ========================================= */

/* ----- Root tokens ----- */

:root {
    --mm-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    --mm-serif: "Georgia", "Iowan Old Style", "Times New Roman", serif;

    /* farby */
    --mm-bg: #ffffff;
    --mm-surface: #f3f3f5;
    --mm-card-bg: #ffffff;
    --mm-border: rgba(0, 0, 0, 0.1);
    --mm-text: #030213;
    --mm-muted: #717182;
    --mm-accent: #030213;
    --mm-accent-soft: #e9ebef;

    /* layout */
    --mm-nav-h: 72px;            /* doladíš, ak sa výška top baru líši */
    --mm-sticky-gap: 24px;       /* stabilná medzera pod top barom */
    --mm-sticky-top: calc(var(--mm-nav-h) + var(--mm-sticky-gap));

    /* book layout */
    --mm-book-toc-w: 280px;
    --mm-book-linked-w: 360px;
    --mm-book-gutter: 56px;      /* medzera medzi stĺpcami */
    --mm-book-panel-pad: 24px;

    /* center column */
    --mm-book-content-max: 760px;
}

/* ----- Global body / layout ----- */

body {
    font-family: var(--mm-sans);
    background: var(--mm-bg);
    color: var(--mm-text);
}

.gh-main {
    padding: 56px 0 80px;
    background: var(--mm-surface);
}

.gh-main-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

/* =========================================
   FEED (News list)
   ========================================= */

.mm-feed-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
    gap: 32px;
    align-items: flex-start;
}

.mm-feed-header {
    margin-bottom: 24px;
    text-align: left;
}

.mm-feed-title {
    font-family: var(--mm-serif);
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--mm-text);
}

.mm-feed-subtitle {
    font-size: 14px;
    color: var(--mm-muted);
}

.mm-feed-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ----- Feed card ----- */

.mm-feed-card {
    background: var(--mm-card-bg);
    border-radius: 10px;
    border: 1px solid var(--mm-border);
    padding: 24px 28px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.mm-feed-card-topline {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #4f46e5;
    margin-bottom: 8px;
}

.mm-feed-card-topline a {
    color: inherit;
    text-decoration: none;
}

.mm-feed-card-title {
    font-family: var(--mm-serif);
    font-size: 22px;
    line-height: 1.35;
    margin: 0 0 6px;
}

.mm-feed-card-title a {
    color: var(--mm-text);
    text-decoration: none;
}

.mm-feed-card-title a:hover {
    text-decoration: underline;
}

.mm-feed-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: #4b5563;
    margin: 0 0 10px;
}

.mm-feed-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--mm-muted);
    margin-top: 8px;
}

.mm-feed-card-meta-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mm-feed-card-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----- Buttons ----- */

.mm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
}

.mm-btn-primary {
    background: #030213;
    color: #ffffff;
}

.mm-btn-primary:hover {
    background: #05051f;
}

.mm-btn-ghost {
    background: transparent;
    color: #030213;
    border-color: #d1d5db;
}

.mm-btn-ghost:hover {
    background: #f3f4f6;
}

.mm-feed-card-actions {
    display: flex;
    gap: 8px;
}

/* =========================================
   FEED SIDEBAR
   ========================================= */

.mm-feed-sidebar {
    position: sticky;
    top: 32px;
}

.mm-author-card {
    background: var(--mm-card-bg);
    border-radius: 10px;
    border: 1px solid var(--mm-border);
    padding: 20px 18px;
    box-shadow: 0 10px 35px rgba(15, 23, 42, 0.06);
    text-align: left;
}

.mm-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #030213;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 16px;
}

.mm-author-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.mm-author-bio {
    font-size: 13px;
    color: var(--mm-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* =========================================
   POST DETAIL (news detail view)
   ========================================= */

.mm-post-layout {
    max-width: 760px;
}

.mm-post-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--mm-muted);
    text-decoration: none;
    margin-bottom: 16px;
}

.mm-post-back:hover {
    text-decoration: underline;
}

.mm-post-tagline {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4f46e5;
    margin-bottom: 8px;
}

.mm-post-title {
    font-family: var(--mm-serif);
    font-size: 32px;
    line-height: 1.2;
    margin: 0 0 6px;
    color: var(--mm-text);
}

.mm-post-meta {
    font-size: 13px;
    color: var(--mm-muted);
    margin-bottom: 20px;
}

.mm-post-content {
    font-size: 16px;
    line-height: 1.8;
    color: #111827;
}

.mm-post-content p {
    margin-bottom: 18px;
}

.mm-post-cta-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin: 28px 0;
}

/* =========================================
   BOOK READER + TOC + LINKED NEWS (3-column)
   ========================================= */

/* 1) top bar má byť stále prítomný a NESMIE prekryť obsah (Ghost ho pri scrolle vie prepnúť na fixed/transform) */
body.page-book #gh-navigation {
    position: fixed !important; /* donútime stabilné správanie aj keď Ghost pri scrolle prepína štýly */
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;

    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);

    /* aby sa header pri scrolle „nešmýkal“/neskrýval cez transform */
    transform: none !important;
}

body.page-book #gh-navigation .gh-navigation-inner {
    min-height: var(--mm-nav-h);
    align-items: center;
}

/* keďže header je fixed, musíme posunúť obsah POD neho (inak sa pri scrolle prekryje) */
body.page-book .gh-main {
    padding-top: calc(56px + var(--mm-nav-h));
    padding-bottom: 56px;
}

/* 2) aby TOC linky / :target neskončili pod top barom */
html {
    scroll-padding-top: var(--mm-sticky-top);
}

/* istota: anchor skoky aj sticky panely vždy rátajú s fixed headerom */
body.page-book {
    scroll-padding-top: var(--mm-sticky-top);
}


/* 4) 3-stĺpcová mriežka (Facebook-like) */
body.page-book .gh-main-inner.mm-book-layout {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 24px;

    display: grid;
    grid-template-columns:
        minmax(220px, var(--mm-book-toc-w))
        minmax(0, 1fr)
        minmax(300px, var(--mm-book-linked-w));
    column-gap: var(--mm-book-gutter);
    align-items: start;
}

/* ľavý panel (TOC) – sticky s medzerou pod nav */
body.page-book .mm-book-toc {
    position: sticky;
    top: var(--mm-sticky-top);
    align-self: start;
    font-size: 13px;
}

body.page-book .mm-book-toc-title {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 8px;
}

body.page-book .mm-book-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

body.page-book .mm-book-toc-list li {
    margin-bottom: 6px;
}

body.page-book .mm-book-toc-list a {
    text-decoration: none;
    color: #6b7280;
    font-size: 13px;
}

body.page-book .mm-book-toc-list a:hover {
    color: #111827;
}

body.page-book .mm-book-toc-list .is-active a {
    font-weight: 600;
    color: #111827;
}

/* pravý panel (Linked news) – sticky s medzerou pod nav */
body.page-book .mm-book-linked-sidebar {
    position: sticky;
    top: var(--mm-sticky-top);
    align-self: start;

    padding: var(--mm-book-panel-pad);
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(6px);
    border-radius: 16px;
}

body.page-book .mm-linked-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

body.page-book .mm-linked-title {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #111827;
}

body.page-book .mm-linked-close {
    display: none;
}

body.page-book .mm-linked-summary {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #4338ca;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 14px;
}

body.page-book .mm-linked-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 14px 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    margin-bottom: 12px;
}

body.page-book .mm-linked-date {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

body.page-book .mm-linked-card-title {
    font-family: var(--mm-serif);
    font-size: 18px;
    line-height: 1.25;
    margin: 0 0 8px;
    color: #111827;
}

body.page-book .mm-linked-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
    margin: 0 0 10px;
}

body.page-book .mm-linked-link {
    font-size: 14px;
    color: #4f46e5;
    text-decoration: none;
}

body.page-book .mm-linked-link:hover {
    text-decoration: underline;
}

/* stred – kniha (centrum stabilné pri zoom) */
body.page-book .mm-book-main {
    font-family: var(--mm-serif);
    width: 100%;
    max-width: var(--mm-book-content-max);
    justify-self: center;
    margin: 0;
}

body.page-book .mm-book-image {
    margin: 0 0 24px;
}

body.page-book .mm-book-image img {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 16px;
}

body.page-book .mm-book-header {
    margin-bottom: 32px;
}

body.page-book .mm-book-title {
    font-size: 28px;
    line-height: 1.3;
    font-weight: 700;
    margin: 0 0 8px;
}

body.page-book .mm-book-subtitle {
    font-size: 14px;
    color: var(--mm-muted);
}

body.page-book .mm-book-content {
    font-size: 17px;
    line-height: 1.8;
    color: #111827;
}

body.page-book .mm-book-content p {
    margin-bottom: 20px;
}

body.page-book .mm-book-content h2 {
    font-size: 20px;
    margin: 28px 0 8px;
}

body.page-book .mm-book-content :target {
    background: #fff7c2;
    transition: background 0.4s ease-out;
}

/* =========================================
   BOOK: anchor badge – vľavo od odseku
   ========================================= */

body.page-book .mm-book-content p.mm-book-anchor-target {
    position: relative;
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-indent: 0 !important;
}

body.page-book .mm-anchor-badge {
    all: unset;
    position: absolute;
    left: 0;
    top: 0.45em;
    transform: translateX(calc(-100% - 0.75rem));

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;

    padding: 0.125rem 0.75rem;
    border-radius: 9999px;

    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;

    font-family: var(--mm-sans);
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;

    white-space: nowrap;
    cursor: pointer;

    text-transform: none;
    letter-spacing: 0;

    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

body.page-book .mm-anchor-badge::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    background-repeat: no-repeat;
    background-size: 12px 12px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234338CA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
    margin-right: 4px;
}

body.page-book .mm-anchor-badge:hover {
    background: #e0e7ff;
    transform: translateX(calc(-100% - 0.75rem)) translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

body.page-book .mm-book-anchor-highlight {
    background: #fff7c2;
    transition: background 0.4s ease-out;
}

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

@media (max-width: 1200px) {
    :root {
        --mm-book-toc-w: 240px;
        --mm-book-linked-w: 320px;
        --mm-book-gutter: 32px;
        --mm-nav-h: 68px;
        --mm-sticky-top: calc(var(--mm-nav-h) + var(--mm-sticky-gap));
    }
}

@media (max-width: 1024px) {
    :root {
        --mm-book-toc-w: 220px;
        --mm-book-linked-w: 300px;
        --mm-book-gutter: 24px;
    }
}

@media (max-width: 960px) {
    /* feed */
    .mm-feed-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .mm-feed-sidebar {
        position: static;
        margin-top: 24px;
    }

    .mm-post-cta-row {
        flex-direction: column;
    }

    /* book: priorita text, ostatné pod seba */
    body.page-book .gh-main-inner.mm-book-layout {
        max-width: 1120px;
        margin: 0 auto;
        padding: 0 24px;
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    body.page-book .mm-book-main {
        max-width: var(--mm-book-content-max);
        width: 100%;
        order: 0;
    }

    body.page-book .mm-book-toc {
        order: 1;
        position: static;
        top: auto;
    }

    body.page-book .mm-book-linked-sidebar {
        order: 2;
        position: static;
        top: auto;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        backdrop-filter: none;
    }

    body.page-book .mm-linked-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 999px;
        border: 1px solid rgba(0, 0, 0, 0.12);
        background: #fff;
        cursor: pointer;
    }

    /* badge na mobile pri texte */
    body.page-book .mm-anchor-badge {
        left: 0;
        transform: translateX(0);
        margin-bottom: 8px;
        position: relative;
        top: 0;
    }

    body.page-book .mm-anchor-badge:hover {
        transform: translateY(-1px);
    }
}

/* =========================================
   MOBILE: About sekcia má byť prvá (Feed)
   ========================================= */

@media (max-width: 960px) {
    .mm-feed-layout {
        display: flex;
        flex-direction: column;
    }

    .mm-feed-sidebar {
        order: -1;
        margin-bottom: 24px;
    }

    .mm-feed-main {
        order: 0;
    }
}