/*
 * Pulse theme — main CSS (chargé async after critical).
 *
 * Architecture mobile-first :
 *   - 0 → 639px : base styles (mobile)
 *   - 640px+   : tablet
 *   - 1024px+  : desktop
 *
 * Variables CSS surchargeables par assets/sites/{slug}/override.css per site.
 * Cible : PSI mobile 95+ (pas de framework, pas de JS bloquant, pas de fonts externes par défaut).
 */

/* === Variables base (surchargeables par override.css) === */
:root {
    --color-bg: #ffffff;
    --color-text: #0f1115;
    --color-muted: #6b7280;
    --color-muted-bg: #f3f4f6;
    --color-accent: #2563eb;
    --color-border: #e5e7eb;
    --font-heading: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --max-content: 65ch;
    --max-page: 72rem;
    --radius: .5rem;
    --radius-lg: .75rem;
    --shadow-sm: 0 1px 2px rgba(15, 17, 21, .04);
    --shadow-md: 0 4px 16px rgba(15, 17, 21, .06);
}

/* === Accessibility === */
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* === Layout pages === */
.site-main {
    max-width: var(--max-page);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}
.site-main--article,
.site-main--page {
    max-width: 50rem;
}

.page-header {
    margin: 1.5rem 0 2rem;
}
.page-eyebrow {
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-muted);
    margin: 0 0 .5rem;
    font-weight: 600;
}
.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 5vw, 3rem);
    margin: 0 0 .75rem;
    line-height: 1.1;
    letter-spacing: -.01em;
}
.page-subtitle {
    color: var(--color-muted);
    font-size: 1.0625rem;
    max-width: 38rem;
    margin: 0;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
}

/* === Posts grid === */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
@media (min-width: 640px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 2rem; }
}
@media (min-width: 1024px) {
    .posts-grid { grid-template-columns: repeat(3, 1fr); }
}

/* === Post card === */
.post-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, box-shadow .15s ease;
}
.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.post-card-thumb { display: block; aspect-ratio: 3 / 2; overflow: hidden; }
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body {
    padding: 1.125rem 1.125rem 1.25rem;
    display: flex; flex-direction: column; gap: .5rem; flex: 1;
}
.post-card-category {
    display: inline-block;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}
.post-card h2 {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    line-height: 1.3;
    margin: 0;
}
.post-card h2 a {
    color: var(--color-text);
    text-decoration: none;
    background-image: linear-gradient(var(--color-accent), var(--color-accent));
    background-size: 0 1px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size .2s ease;
}
.post-card h2 a:hover {
    background-size: 100% 1px;
}
.post-card-excerpt {
    color: var(--color-muted);
    font-size: .9375rem;
    margin: 0;
    flex: 1;
}
.post-card-meta {
    font-size: .8125rem;
    color: var(--color-muted);
    margin: 0;
    display: flex; flex-wrap: wrap; gap: .5rem;
}
.post-card-meta .sep { color: var(--color-border); }

/* === Single article === */
.entry-header { margin: 2rem 0 1.5rem; }
.entry-category {
    display: inline-block;
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
    margin-bottom: .75rem;
}
.entry-category::before { content: ''; }
.entry-title {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 4.5vw, 2.75rem);
    line-height: 1.15;
    margin: 0 0 1rem;
    letter-spacing: -.01em;
}
.entry-meta {
    color: var(--color-muted);
    font-size: .9375rem;
    margin: 0;
    display: flex; flex-wrap: wrap; gap: .5rem;
}
.entry-meta a { color: var(--color-text); text-decoration: none; font-weight: 500; }
.entry-meta a:hover { color: var(--color-accent); }

.entry-featured {
    margin: 1.5rem 0 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.entry-featured img { width: 100%; height: auto; display: block; }

.entry-content {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--color-text);
}
.entry-content > * { max-width: var(--max-content); }
.entry-content > .alignwide,
.entry-content > .alignfull,
.entry-content > figure { max-width: 100%; }
.entry-content h2 {
    font-family: var(--font-heading);
    font-size: 1.625rem;
    margin: 2.25rem 0 .75rem;
    line-height: 1.2;
    letter-spacing: -.005em;
}
.entry-content h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin: 1.75rem 0 .5rem;
}
.entry-content p { margin: 0 0 1.25rem; }
.entry-content ul,
.entry-content ol { margin: 0 0 1.25rem; padding-left: 1.25rem; }
.entry-content li + li { margin-top: .375rem; }
.entry-content a { color: var(--color-accent); text-underline-offset: .15em; }
.entry-content blockquote {
    border-left: 3px solid var(--color-accent);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--color-muted);
}
.entry-content figure { margin: 1.5rem 0; }
.entry-content figure img { border-radius: var(--radius); }
.entry-content figcaption {
    font-size: .875rem;
    color: var(--color-muted);
    margin-top: .5rem;
    text-align: center;
}
.entry-content code {
    background: var(--color-muted-bg);
    padding: .125rem .375rem;
    border-radius: 4px;
    font-size: .9em;
}
.entry-content pre {
    background: var(--color-muted-bg);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: .875rem;
}

/* === Entry footer (tags) === */
.entry-footer { margin: 2rem 0; }
.entry-tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.entry-tags a {
    display: inline-block;
    padding: .25rem .625rem;
    background: var(--color-muted-bg);
    border-radius: 999px;
    font-size: .8125rem;
    color: var(--color-muted);
    text-decoration: none;
}
.entry-tags a:hover { color: var(--color-accent); }

/* === Author bio block (single) === */
.author-bio {
    margin: 3rem 0;
    padding: 1.5rem;
    background: var(--color-muted-bg);
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 1.25rem;
    align-items: start;
}
.author-bio-img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}
.author-bio-name {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 .25rem;
}
.author-bio-name a {
    color: var(--color-text);
    text-decoration: none;
}
.author-bio-role {
    color: var(--color-muted);
    font-size: .9375rem;
    margin: 0 0 .5rem;
}
.author-bio-text {
    margin: 0 0 .75rem;
    color: var(--color-text);
    line-height: 1.55;
}
.author-bio-link {
    font-size: .9375rem;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}
.author-bio-link:hover { text-decoration: underline; }

/* === Author archive page === */
.author-header {
    margin: 2rem 0 2.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 640px) {
    .author-header {
        grid-template-columns: 200px 1fr;
        gap: 2rem;
        align-items: start;
    }
}
.author-header-img {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-lg);
    object-fit: cover;
}
.author-header-role {
    color: var(--color-accent);
    font-weight: 600;
    margin: 0 0 .75rem;
    font-size: 1rem;
}
.author-header-bio {
    color: var(--color-text);
    line-height: 1.65;
    max-width: 38rem;
}
.author-header-bio p { margin: 0 0 .75rem; }
.author-header-speciality {
    color: var(--color-muted);
    font-size: .9375rem;
    margin: .75rem 0 0;
}

/* === Related posts === */
.related-posts {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--color-border);
}
.related-heading {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin: 0 0 1.5rem;
}

/* === Search form === */
.search-form {
    display: flex;
    gap: .5rem;
    max-width: 32rem;
    margin: 1rem 0;
}
.search-field {
    flex: 1;
    padding: .625rem .875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--color-bg);
    color: var(--color-text);
}
.search-field:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-color: var(--color-accent);
}
.search-submit {
    padding: .625rem 1.125rem;
    background: var(--color-accent);
    color: #fff;
    border: 0;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.search-submit:hover { filter: brightness(.95); }

/* === Pagination === */
.navigation.pagination {
    margin: 2.5rem 0 1rem;
    text-align: center;
}
.nav-links { display: inline-flex; gap: .375rem; flex-wrap: wrap; justify-content: center; }
.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 .625rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    text-decoration: none;
    font-size: .9375rem;
}
.page-numbers.current {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}
.page-numbers:hover:not(.current) { border-color: var(--color-accent); color: var(--color-accent); }

/* === No results === */
.no-results {
    color: var(--color-muted);
    font-size: 1.0625rem;
    text-align: center;
    margin: 3rem 0;
}

/* === Footer === */
.site-footer {
    background: var(--color-muted-bg);
    border-top: 1px solid var(--color-border);
    margin-top: 4rem;
    padding: 2.5rem 1.25rem;
}
.site-footer-inner {
    max-width: var(--max-page);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .site-footer-inner {
        grid-template-columns: 1fr auto;
        align-items: center;
    }
}
.site-footer-brand .site-branding {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-text);
}
.site-footer-brand .site-description {
    color: var(--color-muted);
    font-size: .9375rem;
    margin: .25rem 0 0;
}
.site-footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}
.site-footer-nav a {
    color: var(--color-muted);
    text-decoration: none;
    font-size: .9375rem;
}
.site-footer-nav a:hover { color: var(--color-accent); }
.site-footer-credit {
    grid-column: 1 / -1;
    color: var(--color-muted);
    font-size: .8125rem;
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
