/* ============================================================
   Vědátor — veřejný web
   Téma: hlubinný vesmír / observatoř. Dark-default, light toggle.
   Žádné externí fonty (systémový stack), žádné CDN.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
    --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;

    /* Deep space (dark) */
    --bg: #05060d;
    --bg-soft: #0b0e1c;
    --surface: #10142a;
    --surface-2: #161b38;
    --border: #232a52;
    --border-soft: #1a1f3d;

    --text: #e9ecff;
    --text-muted: #a3a9cf;
    --text-dim: #6f76a3;

    --accent: #7cc7ff;          /* hvězdná modř */
    --accent-strong: #4aa9ff;
    --accent-warm: #ffcf6b;     /* zlatá záře */
    --accent-glow: rgba(124, 199, 255, 0.16);

    --verified: #6ee7b7;
    --verified-bg: rgba(110, 231, 183, 0.12);

    --radius: 14px;
    --radius-sm: 9px;
    --maxw: 1180px;
    --read: 70ch;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.85);
    --shadow-glow: 0 0 0 1px var(--border), 0 22px 60px -30px rgba(74, 169, 255, 0.55);

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="light"] {
    --bg: #f5f6fb;
    --bg-soft: #eef0f9;
    --surface: #ffffff;
    --surface-2: #f3f4fb;
    --border: #dbdef0;
    --border-soft: #e7e9f4;

    --text: #14182b;
    --text-muted: #4a5170;
    --text-dim: #767e9c;

    --accent: #1f6fd6;
    --accent-strong: #1559b5;
    --accent-warm: #b97900;
    --accent-glow: rgba(31, 111, 214, 0.10);

    --verified: #0f9d6a;
    --verified-bg: rgba(15, 157, 106, 0.10);

    --shadow: 0 18px 44px -26px rgba(20, 28, 60, 0.35);
    --shadow-glow: 0 0 0 1px var(--border), 0 18px 44px -26px rgba(31, 111, 214, 0.25);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 1.0625rem;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--accent-warm); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.18; letter-spacing: -0.01em; }

/* ---------- Atmosférické pozadí (čistě CSS, žádné obrázky) ---------- */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(1100px 700px at 78% -8%, rgba(74, 169, 255, 0.16), transparent 60%),
        radial-gradient(900px 600px at 8% 4%, rgba(160, 92, 255, 0.12), transparent 58%),
        radial-gradient(1000px 800px at 50% 120%, rgba(255, 207, 107, 0.07), transparent 60%);
    pointer-events: none;
}
[data-theme="light"] body::before {
    background:
        radial-gradient(1100px 700px at 80% -10%, rgba(31, 111, 214, 0.10), transparent 60%),
        radial-gradient(900px 600px at 5% 0%, rgba(120, 80, 220, 0.06), transparent 58%);
}

.starfield {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(1.4px 1.4px at 20% 30%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(1px 1px at 60% 70%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1.2px 1.2px at 80% 20%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 35% 80%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1.6px 1.6px at 90% 60%, rgba(180, 220, 255, 0.85), transparent),
        radial-gradient(1px 1px at 10% 60%, rgba(255, 255, 255, 0.5), transparent),
        radial-gradient(1.1px 1.1px at 48% 12%, rgba(255, 255, 255, 0.7), transparent);
    background-repeat: repeat;
    background-size: 520px 520px;
    opacity: 0.7;
    animation: drift 180s linear infinite;
}
[data-theme="light"] .starfield { display: none; }
@keyframes drift {
    from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
    to   { background-position: 520px 520px, -520px 520px, 520px -520px, -260px 260px, 260px -260px, 0 520px, 520px 0; }
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }
.site-main { padding-block: clamp(2rem, 5vw, 3.5rem) 4rem; }

.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 100;
    background: var(--accent); color: #04101f; padding: 0.6rem 1rem; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
}
.site-header__inner {
    display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.5rem);
    min-height: 68px; padding-block: 0.6rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand__mark {
    color: var(--accent-warm); font-size: 1.35rem; line-height: 1;
    filter: drop-shadow(0 0 8px rgba(255, 207, 107, 0.5));
    animation: twinkle 4s ease-in-out infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.86); } }
.brand__name { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.015em; }

.site-nav { display: flex; gap: 1.1rem; margin-right: auto; }
.site-nav a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); }

.search-form { display: flex; align-items: center; position: relative; }
.search-form input {
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    border-radius: 999px; padding: 0.5rem 2.4rem 0.5rem 1rem; font: inherit; font-size: 0.9rem;
    width: clamp(140px, 20vw, 230px); transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), width 0.25s var(--ease);
}
.search-form input::placeholder { color: var(--text-dim); }
.search-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-form button {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; color: var(--text-muted); cursor: pointer;
    font-size: 1.15rem; padding: 0.25rem 0.5rem; line-height: 1; border-radius: 50%;
}
.search-form button:hover { color: var(--accent); }

.theme-toggle {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    cursor: pointer; display: grid; place-items: center; font-size: 1.1rem; line-height: 1;
    transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(-18deg); }
.theme-toggle__icon { grid-area: 1 / 1; transition: opacity 0.25s var(--ease), transform 0.4s var(--ease); }
.theme-toggle__icon--light { opacity: 0; transform: scale(0.4) rotate(90deg); color: var(--accent-warm); }
.theme-toggle__icon--dark { opacity: 1; }
[data-theme="light"] .theme-toggle__icon--dark { opacity: 0; transform: scale(0.4) rotate(-90deg); }
[data-theme="light"] .theme-toggle__icon--light { opacity: 1; transform: scale(1) rotate(0); }

/* ---------- Chips & badges ---------- */
.chip {
    display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-glow); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    padding: 0.22rem 0.6rem; border-radius: 999px;
}
.chip--light { color: var(--accent-warm); background: rgba(255, 207, 107, 0.14); border-color: rgba(255, 207, 107, 0.35); }
.chip--ghost { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-muted); background: var(--surface-2); border-color: var(--border); }
.chip--ghost:hover { color: var(--accent); border-color: var(--accent); }

.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
    padding: 0.22rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.badge--verified { color: var(--verified); background: var(--verified-bg); border: 1px solid color-mix(in srgb, var(--verified) 35%, transparent); }
.badge--ai { color: var(--accent-warm); background: rgba(255, 207, 107, 0.12); border: 1px solid rgba(255, 207, 107, 0.3); }

/* ---------- Hero ---------- */
.hero { margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.hero__link {
    display: block; position: relative; color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(74, 169, 255, 0.08), transparent 55%),
        var(--surface);
    padding: clamp(1.75rem, 5vw, 3.5rem);
    overflow: hidden; box-shadow: var(--shadow);
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}
.hero__link::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(600px 320px at 85% -10%, var(--accent-glow), transparent 70%);
    opacity: 0; transition: opacity 0.4s var(--ease);
}
.hero__link:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow-glow); color: var(--text); }
.hero__link:hover::after { opacity: 1; }
.hero__content { position: relative; max-width: 56ch; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1.1rem; }
.hero__title { font-size: clamp(1.9rem, 5vw, 3.2rem); margin: 0 0 0.9rem; }
.hero__excerpt { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--text-muted); margin: 0 0 1.5rem; line-height: 1.6; }
.hero__cta { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 600; color: var(--accent); }
.hero__link:hover .hero__cta span { transform: translateX(4px); }
.hero__cta span { transition: transform 0.25s var(--ease); }

/* ---------- Sections ---------- */
.section { margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section__title { font-size: clamp(1.4rem, 3vw, 1.95rem); margin: 0; position: relative; padding-left: 1rem; }
.section__title::before {
    content: ""; position: absolute; left: 0; top: 0.15em; bottom: 0.15em; width: 4px; border-radius: 4px;
    background: linear-gradient(var(--accent), var(--accent-warm));
}
.section__sub { color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 0.2rem 1rem; }
.section__more { font-weight: 600; font-size: 0.9rem; }
.section__more span { transition: transform 0.25s var(--ease); display: inline-block; }
.section__more:hover span { transform: translateX(3px); }

/* ---------- Grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }

.card {
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
    overflow: hidden; transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
    position: relative;
}
.card::before {
    content: ""; position: absolute; inset-inline: 0; top: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0; transition: opacity 0.3s var(--ease);
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card__body { padding: 1.35rem 1.4rem 1.5rem; display: flex; flex-direction: column; gap: 0.7rem; height: 100%; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.card__title { font-size: 1.18rem; margin: 0; line-height: 1.3; }
.card__title a { color: var(--text); }
.card__title a:hover { color: var(--accent); }
.card__excerpt { color: var(--text-muted); font-size: 0.94rem; margin: 0; flex-grow: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__date { color: var(--text-dim); font-size: 0.8rem; }

.empty {
    color: var(--text-muted); font-size: 1.05rem; text-align: center;
    padding: 3rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg-soft);
}

/* ---------- Article ---------- */
.article {
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: clamp(1.5rem, 5vw, 3.5rem); box-shadow: var(--shadow); margin-bottom: 3rem;
}
.article__header { margin-bottom: 2rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--border-soft); }
.breadcrumb { display: flex; gap: 0.5rem; align-items: center; color: var(--text-dim); font-size: 0.85rem; margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.article__title { font-size: clamp(1.9rem, 5vw, 3.1rem); margin: 0 0 1.2rem; max-width: 22ch; }
.article__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; color: var(--text-muted); font-size: 0.9rem; }
.article__meta .dot { color: var(--text-dim); }
.tag-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 1.25rem 0 0; }

/* Level switcher */
.level-switcher {
    display: inline-flex; gap: 0.25rem; padding: 0.3rem; margin-bottom: 2rem;
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
}
.level-btn {
    border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
    font: inherit; font-weight: 600; font-size: 0.9rem; padding: 0.5rem 1.25rem; border-radius: 999px;
    transition: color 0.2s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.level-btn:hover { color: var(--text); }
.level-btn.is-active {
    color: #04101f; background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: 0 4px 14px -4px var(--accent-glow);
}
[data-theme="light"] .level-btn.is-active { color: #fff; }

/* Prose (long-form) */
.prose { max-width: var(--read); font-size: 1.12rem; line-height: 1.75; color: var(--text); }
.prose > * + * { margin-top: 1.3em; }
.prose h2 { font-size: 1.7rem; margin-top: 2.4em; margin-bottom: 0.2em; }
.prose h3 { font-size: 1.32rem; margin-top: 1.8em; margin-bottom: 0.2em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose p { margin: 0; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent-warm); }
.prose strong { color: var(--text); font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.4em; margin-block: 1.3em; }
.prose li + li { margin-top: 0.5em; }
.prose blockquote {
    margin: 1.8em 0; padding: 0.6em 1.4em; border-left: 3px solid var(--accent);
    color: var(--text-muted); font-style: italic; background: var(--bg-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--bg-soft); padding: 0.15em 0.4em; border-radius: 5px; border: 1px solid var(--border-soft); }
.prose pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.1em 1.3em; overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose img { border-radius: var(--radius-sm); margin-block: 1.6em; }
.prose figure { margin: 1.8em 0; }
.prose figcaption { color: var(--text-dim); font-size: 0.86rem; text-align: center; margin-top: 0.6em; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-block: 1.6em; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.6em 0.85em; text-align: left; }
.prose th { background: var(--bg-soft); }

/* FAQ */
.faq { max-width: var(--read); margin-top: 3.5rem; }
.faq > h2, .sources > h2 { font-size: 1.6rem; margin: 0 0 1.25rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-soft); }
.faq__list { display: flex; flex-direction: column; gap: 0.6rem; }
.faq__item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-soft); overflow: hidden; }
.faq__item summary {
    cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; font-family: var(--font-display); font-size: 1.08rem;
    list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; line-height: 1; transition: transform 0.25s var(--ease); }
.faq__item[open] summary::after { transform: rotate(45deg); }
.faq__answer { padding: 0 1.25rem 1.15rem; color: var(--text-muted); }

/* Sources */
.sources { max-width: var(--read); margin-top: 3.5rem; }
.sources__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.sources__item {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
    padding: 0.85rem 1.1rem; background: var(--bg-soft); border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm); border-left: 3px solid var(--accent);
}
.sources__item a { font-weight: 500; word-break: break-word; }

.related { margin-top: 1rem; }

/* ---------- Search page ---------- */
.search-page__form { display: flex; gap: 0.6rem; max-width: 640px; margin: 0 0 2rem; }
.search-page__form input {
    flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--text);
    border-radius: 999px; padding: 0.85rem 1.3rem; font: inherit;
}
.search-page__form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-page__form button {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #04101f;
    border: 0; border-radius: 999px; padding: 0.85rem 1.6rem; font: inherit; font-weight: 700; cursor: pointer;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
[data-theme="light"] .search-page__form button { color: #fff; }
.search-page__form button:hover { transform: translateY(-2px); box-shadow: 0 8px 22px -8px var(--accent-glow); }
.search-page__count { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; flex-wrap: wrap; }
.pager__link {
    display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600;
    padding: 0.6rem 1.2rem; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text); transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.pager__link:hover { border-color: var(--accent); color: var(--accent); }
.pager__link.is-disabled { opacity: 0.4; pointer-events: none; }
.pager__status { color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border-soft); background: var(--bg-soft);
    padding-block: 2.5rem 3rem; margin-top: 2rem; color: var(--text-muted); font-size: 0.9rem;
}
.site-footer p { margin: 0 0 0.7rem; max-width: 70ch; }
.site-footer__ai { display: flex; align-items: center; gap: 0.5rem; color: var(--text); font-weight: 500; }
.site-footer__disclaimer { color: var(--text-dim); font-size: 0.85rem; line-height: 1.6; }
.site-footer__copy { color: var(--text-dim); font-size: 0.82rem; margin-top: 1.25rem; }

/* ---------- Page-load reveal ---------- */
@media (prefers-reduced-motion: no-preference) {
    .hero, .section { animation: rise 0.6s var(--ease) both; }
    .section:nth-of-type(2) { animation-delay: 0.05s; }
    .section:nth-of-type(3) { animation-delay: 0.1s; }
    .section:nth-of-type(4) { animation-delay: 0.15s; }
    @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .site-nav { display: none; }
    .search-form { margin-left: auto; }
    .search-form input { width: clamp(120px, 40vw, 200px); }
    .grid { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
    .brand__name { font-size: 1.2rem; }
    .search-form input { width: 130px; }
}
