/*
 * Brandingul KidsLife pentru partea publică (spec 003, research R11).
 *
 * Tokenii vin de pe kidslife.ro. Contrast verificat pentru text:
 *   --ink   #3b2a63 pe alb ≈ 13:1, pe --bg1 ≈ 12:1
 *   --deep  #4a1fa8 pe alb ≈ 10:1
 *   --muted #7a6a99 pe alb ≈ 4.8:1 (AA), dar pe --bg1 doar ≈ 4.4:1, deci textul
 *           secundar stă numai pe carduri albe
 *   --violet #b05cff pe alb ≈ 3.6:1: doar decorativ sau text mare
 * Fără fonturi, imagini sau scripturi externe (FR-026).
 */
:root {
    --bg1: #f8f2fe;
    --bg2: #fff;
    --bg-end: #efe4ff;
    --deep: #4a1fa8;
    --violet: #b05cff;
    --ink: #3b2a63;
    --muted: #7a6a99;
    --badge: #f1e3ff;
    --line: #e9dcfb;
    --shadow: 0 20px 50px rgba(90, 40, 160, .15);
    --shadow-sm: 0 8px 24px rgba(90, 40, 160, .10);
    --radius: 28px;
    --radius-sm: 18px;
    --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
    --wrap: 1120px;
    --prose: 70ch;
    --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--ink);
    background: linear-gradient(160deg, var(--bg1), var(--bg-end)) fixed;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--deep); text-underline-offset: .18em; }
a:hover { color: var(--violet); }

:focus-visible {
    outline: 3px solid var(--violet);
    outline-offset: 3px;
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -100px;
    z-index: 10;
    padding: 10px 16px;
    background: var(--deep);
    color: #fff;
    border-radius: 999px;
}
.skip-link:focus { top: 12px; color: #fff; }

/* ---- Header & footer ---------------------------------------------------- */

.site-header {
    background: var(--bg2);
    box-shadow: var(--shadow-sm);
    border-radius: 0 0 var(--radius) var(--radius);
}

.site-header__inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 12px var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-logo img { width: 172px; height: auto; }

.site-nav { display: flex; gap: 8px; }
.site-nav a {
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
}
.site-nav a[aria-current="page"] { background: var(--badge); color: var(--deep); }

.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 32px var(--gutter) 56px;
}

.site-footer {
    padding: 24px var(--gutter) 32px;
    text-align: center;
    font-size: .9rem;
    color: var(--ink);
}
.site-footer p { margin: 4px 0; }

/* ---- Componente comune -------------------------------------------------- */

.card {
    background: var(--bg2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--badge);
    color: var(--deep);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-decoration: none;
}
a.badge:hover { background: var(--deep); color: #fff; }

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    font-size: .9rem;
}
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--violet); }
.breadcrumb [aria-current] { color: var(--ink); }

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    color: var(--muted);
    font-size: .92rem;
}

/* ---- Intro (pagini de listă) -------------------------------------------- */

.hero {
    position: relative;
    padding: 36px 28px;
    margin-bottom: 32px;
    text-align: center;
    overflow: hidden;
}
.hero h1 {
    margin: 12px 0 8px;
    font-size: clamp(1.8rem, 5.5vw, 2.6rem);
    line-height: 1.15;
    color: var(--deep);
}
.hero p { max-width: 60ch; margin: 0 auto; color: var(--muted); }
.hero::before, .hero::after {
    content: "✦";
    position: absolute;
    color: var(--violet);
    opacity: .45;
    font-size: 1.6rem;
}
.hero::before { top: 18px; left: 7%; }
.hero::after { bottom: 16px; right: 8%; content: "✧"; }

.topics {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}
.topics a {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 999px;
    background: var(--bg2);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
}
.topics a[aria-current="page"] { background: var(--deep); color: #fff; }

/* ---- Grila de articole --------------------------------------------------- */

.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}
@media (min-width: 640px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }

.post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.post-card:hover { transform: translateY(-4px); box-shadow: 0 26px 60px rgba(90, 40, 160, .2); }
.post-card__media { aspect-ratio: 16 / 10; background: var(--badge); }
/* Fără copertă: casa din logo pe fundal lila, în loc de un dreptunghi gol. */
.post-card__media--empty { background: var(--badge) url("../images/favicon-NSgLNGK.svg") center / 72px no-repeat; }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; }
.post-card__body { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 22px; flex: 1; }
.post-card__title { margin: 0; font-size: 1.2rem; line-height: 1.3; }
.post-card__title a { color: var(--deep); text-decoration: none; }
/* Tot cardul e clicabil, dar linkul rămâne unul singur (titlul). */
.post-card__title a::after { content: ""; position: absolute; inset: 0; }
.post-card__excerpt { margin: 0; color: var(--muted); }
.post-card .badge { position: relative; z-index: 1; align-self: flex-start; }
.post-card .meta { margin-top: auto; }

.empty { padding: 32px 24px; text-align: center; color: var(--muted); }

/* ---- Paginare ------------------------------------------------------------ */

.pagination ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 40px 0 0;
    padding: 0;
    list-style: none;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--bg2);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    text-decoration: none;
}
.pagination [aria-current="page"] { background: var(--deep); color: #fff; }

/* ---- Articol ------------------------------------------------------------- */

.article { max-width: 820px; margin: 0 auto; }

.article__header { padding: 28px 28px 8px; }
.article__header h1 {
    margin: 12px 0 14px;
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    line-height: 1.18;
    color: var(--deep);
}
.article__lead { margin: 0 0 18px; font-size: 1.15rem; color: var(--muted); }

.byline { display: flex; align-items: center; gap: 12px; }
.byline a { font-weight: 700; text-decoration: none; }

.avatar {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
.avatar--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--violet), var(--deep));
    color: #fff;
    font-weight: 700;
}
.avatar--md { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar--lg { width: 120px; height: 120px; font-size: 2.4rem; }

.article__cover { margin: 20px 0 0; }
.article__cover img { width: 100%; border-radius: var(--radius-sm); aspect-ratio: auto; }

.article__body { padding: 8px 28px 32px; }

/* Paginile statice (spec 004): același card și aceeași tipografie ca articolul. */
.page { max-width: 820px; margin: 0 auto; padding: 28px 28px 32px; }
.page__title {
    max-width: var(--prose);
    margin: 0 auto 18px;
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    line-height: 1.18;
    color: var(--deep);
}

/* Conținutul din editor: doar H2–H4, paragrafe, liste, citate, tabele, imagini. */
.prose { max-width: var(--prose); margin: 0 auto; font-size: 1.1rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3, .prose h4 { color: var(--deep); line-height: 1.25; margin: 1.8em 0 .5em; }
.prose h2 { font-size: 1.6rem; }
.prose h3 { font-size: 1.3rem; }
.prose h4 { font-size: 1.1rem; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose li + li { margin-top: .35em; }
.prose blockquote {
    margin: 1.6em 0;
    padding: 16px 22px;
    border-left: 5px solid var(--violet);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--bg1);
    font-style: italic;
}
.prose picture, .prose img { margin: 1.6em auto; border-radius: var(--radius-sm); }
.prose hr { border: 0; border-top: 2px dashed var(--line); margin: 2em 0; }
/* Un tabel lat derulează singur, nu toată pagina (fără scroll orizontal la 320 px). */
.prose .table-scroll { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--badge); color: var(--deep); }

.article__footer { padding: 0 28px 28px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---- Autor --------------------------------------------------------------- */

.author-box { display: flex; gap: 18px; align-items: flex-start; margin: 32px auto 0; max-width: 820px; padding: 24px 28px; }
.author-box h2 { margin: 0 0 4px; font-size: 1.15rem; }
.author-box h2 a { text-decoration: none; }
.author-box p { margin: 4px 0 0; color: var(--muted); }

.profile { text-align: center; }
.profile .avatar--lg { margin: 0 auto 12px; }
.profile__job { margin: 0; color: var(--muted); font-weight: 700; }
.profile__bio { max-width: var(--prose); margin: 18px auto 0; text-align: left; color: var(--ink); }
.profile__links { display: flex; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

.section-title { margin: 36px 0 18px; text-align: center; color: var(--deep); }

/* ---- Articole similare --------------------------------------------------- */

.related { margin: 48px 0 0; }
.related > h2 { margin: 0 0 18px; text-align: center; color: var(--deep); }

/* ---- Previzualizare (doar admin) ------------------------------------------ */

.preview-banner {
    max-width: var(--wrap);
    margin: 16px auto 0;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: #fff4d6;
    color: #5c4300;
    font-weight: 700;
    text-align: center;
}

/* ---- Erori --------------------------------------------------------------- */

.error-page { max-width: 560px; margin: 24px auto; padding: 40px 28px; text-align: center; }
.error-page h1 { color: var(--deep); font-size: clamp(1.6rem, 5vw, 2.1rem); margin: 12px 0; }
.error-page p { color: var(--muted); }
.button {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 24px;
    border-radius: 999px;
    background: var(--deep);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}
.button:hover { background: var(--violet); color: #fff; }

/* ---- Mobil îngust -------------------------------------------------------- */

@media (max-width: 480px) {
    .site-main { padding-top: 20px; }
    .site-logo img { width: 140px; }
    .hero { padding: 28px 18px; }
    .article__header, .article__body, .article__footer { padding-left: 18px; padding-right: 18px; }
    .author-box { flex-direction: column; padding: 20px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
