/*
Theme Name: GAS Light
Theme URI: https://gas.local/
Author: GAS
Description: Thème WordPress léger pour sites GAS hybrides, sans builder ni jQuery.
Version: 0.2.0
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: gas-light
*/

html {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    color: var(--gas-color-text, #161616);
    background: var(--gas-color-background, #fff);
    font-family: var(--gas-font-family-body, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    line-height: 1.6;
}

a {
    color: var(--gas-color-primary, #1a73e8);
}

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

.gas-light-skip-link {
    position: absolute;
    left: 1rem;
    top: 1rem;
    z-index: 100000;
    transform: translateY(-150%);
    background: var(--gas-color-surface, #fff);
    color: var(--gas-color-text, #161616);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gas-color-border, #d0d0d0);
    border-radius: var(--gas-radius-sm, 0.375rem);
}

.gas-light-skip-link:focus {
    transform: translateY(0);
}

.gas-light-main {
    width: min(100%, var(--gas-content-max-width, 72rem));
    margin-inline: auto;
    padding: var(--gas-space-6, 2rem) var(--gas-space-4, 1rem);
}

.gas-light-main--full {
    width: min(100%, var(--gas-wide-max-width, 92rem));
}

.gas-light-main--canvas {
    width: 100%;
    max-width: none;
    padding: 0;
}

/* WP align-wide / align-full pour le mode standard */
.gas-light-main .alignwide {
    width: min(100%, var(--gas-wide-max-width, 92rem));
    margin-inline: auto;
    max-width: none;
}

.gas-light-main .alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.gas-light-entry {
    display: grid;
    gap: var(--gas-space-4, 1rem);
}

.gas-light-entry__title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
}

.gas-light-entry__content > :first-child {
    margin-top: 0;
}

.gas-light-entry__content > :last-child {
    margin-bottom: 0;
}

.gas-light-entry__pages {
    margin-top: var(--gas-space-4, 1rem);
    font-size: 0.95em;
}

.gas-light-entry__pages-label {
    margin-right: var(--gas-space-2, 0.5rem);
    font-weight: 600;
}

/* Header fallback (plugin absent / shortcode désactivé) */
.gas-light-header-fallback {
    display: flex;
    align-items: center;
    gap: var(--gas-space-4, 1rem);
    width: min(100%, var(--gas-content-max-width, 72rem));
    margin-inline: auto;
    padding: var(--gas-space-4, 1rem);
    border-bottom: 1px solid var(--gas-color-border, #e0e0e0);
}

.gas-light-header-fallback__brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--gas-color-text, #161616);
}

.gas-light-header-fallback .custom-logo-link img {
    max-height: 3rem;
    width: auto;
}

.gas-light-nav-fallback,
.gas-light-footer-fallback {
    width: min(100%, var(--gas-content-max-width, 72rem));
    margin-inline: auto;
    padding: var(--gas-space-4, 1rem);
}

.gas-light-header-fallback .gas-light-nav-fallback {
    width: auto;
    margin-inline: 0 0;
    margin-left: auto;
    padding: 0;
}

.gas-light-nav-fallback ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gas-space-3, 0.75rem);
    list-style: none;
    padding: 0;
    margin: 0;
}

.gas-light-footer-fallback {
    color: var(--gas-color-text-muted, #555);
    border-top: 1px solid var(--gas-color-border, #e0e0e0);
}

.gas-light-404 {
    min-height: 40vh;
    display: grid;
    align-content: center;
    gap: var(--gas-space-3, 0.75rem);
}

/* Archive (post listings, taxonomies) */
.gas-light-archive__header {
    margin-bottom: var(--gas-space-5, 1.5rem);
    padding-bottom: var(--gas-space-3, 0.75rem);
    border-bottom: 1px solid var(--gas-color-border, #e0e0e0);
}

.gas-light-archive__title {
    margin: 0 0 var(--gas-space-2, 0.5rem) 0;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.gas-light-archive__list {
    display: grid;
    gap: var(--gas-space-5, 1.5rem);
}

.gas-light-archive__item-title {
    margin: 0 0 var(--gas-space-1, 0.25rem) 0;
    font-size: 1.5rem;
}

.gas-light-archive__item-title a {
    text-decoration: none;
}

.gas-light-archive__meta {
    color: var(--gas-color-text-muted, #555);
    font-size: 0.9em;
}

.gas-light-archive__pagination {
    margin-top: var(--gas-space-6, 2rem);
}

/* Comments */
.gas-light-comments {
    margin-top: var(--gas-space-7, 3rem);
    padding-top: var(--gas-space-5, 1.5rem);
    border-top: 1px solid var(--gas-color-border, #e0e0e0);
}

.gas-light-comments__title {
    margin-top: 0;
    font-size: 1.5rem;
}

.gas-light-comments__list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--gas-space-5, 1.5rem) 0;
    display: grid;
    gap: var(--gas-space-4, 1rem);
}

.gas-light-comments__list .comment-body {
    padding: var(--gas-space-3, 0.75rem);
    background: var(--gas-color-surface, #f8f9fa);
    border-radius: var(--gas-radius-md, 0.5rem);
}

/* Mode dark : seulement si l'utilisateur le demande au niveau OS,
 * et seulement si les tokens GAS ne sont pas chargés (fallback CSS).
 * Si les tokens existent, le plugin pilote déjà le thème. */
@media (prefers-color-scheme: dark) {
    body:not([class*="gas-theme-"]) {
        color: #e8e8e8;
        background: #161616;
    }
    body:not([class*="gas-theme-"]) .gas-light-skip-link {
        background: #2a2a2a;
        color: #e8e8e8;
        border-color: #444;
    }
    body:not([class*="gas-theme-"]) .gas-light-header-fallback,
    body:not([class*="gas-theme-"]) .gas-light-footer-fallback,
    body:not([class*="gas-theme-"]) .gas-light-archive__header {
        border-color: #333;
    }
    body:not([class*="gas-theme-"]) .gas-light-comments__list .comment-body {
        background: #1f1f1f;
    }
}

/* Préférence accessibilité : réduire les animations */
@media (prefers-reduced-motion: reduce) {
    .gas-light-skip-link {
        transition: none;
    }
}

/* ── Fil d'Ariane (plugin APH Gestion : [gas_breadcrumb] / gas_breadcrumb()) ── */
.gas-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4em;
    margin: 0 0 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--gas-light-muted, #64748b);
}
.gas-breadcrumb a {
    color: inherit;
    text-decoration: none;
}
.gas-breadcrumb a:hover {
    text-decoration: underline;
}
.gas-breadcrumb [aria-current="page"] {
    color: var(--gas-light-text, #0f172a);
    font-weight: 600;
}
.gas-breadcrumb__sep {
    opacity: 0.55;
}
.gas-breadcrumb--placeholder {
    font-style: italic;
    opacity: 0.7;
}
