/*
Theme Name: Cap-REL Dolibarr
Theme URI: https://cap-rel.fr
Author: Cap-REL
Author URI: https://cap-rel.fr
Description: Theme WordPress pour Cap-REL, specialiste Dolibarr - modules, integration et services SaaS.
Version: 1.0.0
License: GNU General Public License v3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: caprel
*/

/* ========================================
   Variables & Reset
   ======================================== */
:root {
    --color-primary: #1a2744;
    --color-accent: #2563eb;
    --color-accent-hover: #1d4ed8;
    --color-accent-light: #dbeafe;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-bg-dark: #0f172a;
    --color-border: #e2e8f0;
    --color-success: #059669;
    --color-warning: #d97706;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --max-width: 1200px;
    --header-height: 72px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --transition: 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    padding-top: var(--header-height);
}

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

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-accent-hover);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-primary);
    line-height: 1.2;
    font-weight: 700;
}

h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.25rem; margin-bottom: 0.5rem; }

p {
    margin-bottom: 1rem;
    color: var(--color-text-light);
}

/* ========================================
   Layout
   ======================================== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 5rem 0;
}

.section--alt {
    background-color: var(--color-bg-alt);
}

.section--dark {
    background-color: var(--color-bg-dark);
    color: #ffffff;
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
    color: #ffffff;
}

.section--dark p {
    color: #94a3b8;
}

.section__header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 3rem;
}

.section__subtitle {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

/* ========================================
   Header
   ======================================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
    transition: box-shadow var(--transition);
}

.site-header--scrolled {
    box-shadow: var(--shadow-md);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
}

.site-logo img,
.site-logo .custom-logo-link img,
.custom-logo-link img.custom-logo {
    height: 40px;
    width: auto;
    max-height: 40px;
    object-fit: contain;
}

.site-logo:hover {
    color: var(--color-primary);
}

/* Navigation */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 0.25rem;
}

.main-nav a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.main-nav a:hover,
.main-nav .current-menu-item a {
    color: var(--color-accent);
    background: var(--color-accent-light);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--color-primary);
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn--primary {
    background: var(--color-accent);
    color: #ffffff;
    border-color: var(--color-accent);
}

.btn--primary:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: #ffffff;
}

.btn--outline {
    background: transparent;
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.btn--outline:hover {
    background: var(--color-accent);
    color: #ffffff;
}

.btn--white {
    background: #ffffff;
    color: var(--color-primary);
    border-color: #ffffff;
}

.btn--white:hover {
    background: var(--color-accent-light);
    border-color: var(--color-accent-light);
}

.btn--lg {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ========================================
   Hero
   ======================================== */
.hero {
    padding: 6rem 0 5rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, #1e3a5f 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.hero .container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero h1 {
    font-size: 3rem;
    color: #ffffff;
    margin-bottom: 1.5rem;
    line-height: 1.15;
}

.hero h1 span {
    color: #60a5fa;
}

.hero p {
    font-size: 1.125rem;
    color: #cbd5e1;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero__visual {
    display: flex;
    justify-content: center;
}

.hero__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
}

.hero__stat {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero__stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: #60a5fa;
    line-height: 1;
}

.hero__stat-label {
    font-size: 0.8125rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

/* ========================================
   Cards
   ======================================== */
.cards-grid {
    display: grid;
    gap: 1.5rem;
}

.cards-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.cards-grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all var(--transition);
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--color-accent-light);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
}

.card__title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card__description {
    font-size: 0.9375rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.card__tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.card__link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-top: 0.5rem;
}

.card__link:hover {
    gap: 0.5rem;
}

.card__features {
    list-style: none;
    margin-top: 1rem;
}

.card__features li {
    padding: 0.375rem 0;
    font-size: 0.875rem;
    color: var(--color-text-light);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.card__features li::before {
    content: '\2713';
    color: var(--color-success);
    font-weight: 700;
    flex-shrink: 0;
}

/* ========================================
   Module detail card (larger)
   ======================================== */
.module-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.module-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.module-card__header {
    padding: 1.5rem 2rem;
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.module-card__icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: var(--color-accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.module-card__name {
    font-size: 1.375rem;
    color: var(--color-primary);
}

.module-card__tagline {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-top: 0.125rem;
}

.module-card__body {
    padding: 2rem;
}

.module-card__body p {
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

.module-card__meta {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.module-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-text-light);
    padding: 0.25rem 0.75rem;
    background: var(--color-bg-alt);
    border-radius: 9999px;
}

/* ========================================
   Values / Features row
   ======================================== */
.values-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.value-item {
    text-align: center;
    padding: 2rem 1rem;
}

.value-item__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--color-accent-light);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.value-item__title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.value-item__desc {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* ========================================
   Page content (WordPress editor output)
   ======================================== */
.page-content h2 {
    font-size: 1.75rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-accent-light);
}

.page-content h2:first-child {
    margin-top: 0;
}

.page-content h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--color-accent);
}

.page-content p {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.page-content ul {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.page-content ul li {
    padding: 0.5rem 0 0.5rem 1.75rem;
    position: relative;
    font-size: 0.9375rem;
    color: var(--color-text);
    line-height: 1.6;
    border-bottom: 1px solid var(--color-border);
}

.page-content ul li:last-child {
    border-bottom: none;
}

.page-content ul li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: 700;
}

.page-content ol {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
}

.page-content ol li {
    padding: 0.375rem 0;
    font-size: 0.9375rem;
    color: var(--color-text);
    line-height: 1.6;
}

.page-content hr {
    border: none;
    height: 1px;
    background: var(--color-border);
    margin: 3rem 0;
}

.page-content a {
    color: var(--color-accent);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.page-content a:hover {
    color: var(--color-accent-hover);
}

.page-content strong {
    color: var(--color-primary);
}

.page-content em {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.page-content blockquote {
    border-left: 4px solid var(--color-accent);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--color-bg-alt);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.page-content blockquote p {
    margin-bottom: 0;
    font-style: italic;
    color: var(--color-text);
}

.page-content img {
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
}

.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
}

.page-content table th,
.page-content table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.page-content table th {
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-bg-alt);
}

.page-content table tr:hover td {
    background: var(--color-bg-alt);
}

/* Post content (articles) */
.post-content h2 { font-size: 1.75rem; margin-top: 2.5rem; margin-bottom: 1rem; }
.post-content h3 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }
.post-content p { font-size: 1rem; line-height: 1.8; color: var(--color-text); }
.post-content ul { margin: 0 0 1.5rem; padding-left: 1.5rem; }
.post-content ul li { padding: 0.25rem 0; line-height: 1.7; }
.post-content img { border-radius: var(--radius-lg); margin: 1.5rem 0; }
.post-content a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.post-content blockquote { border-left: 4px solid var(--color-accent); padding: 1rem 1.5rem; margin: 1.5rem 0; background: var(--color-bg-alt); border-radius: 0 var(--radius) var(--radius) 0; }

/* ========================================
   WordPress native button overrides
   ======================================== */
.wp-block-button .wp-block-button__link,
.wp-block-button.btn .wp-block-button__link {
    background: var(--color-accent) !important;
    color: #ffffff !important;
    border: 2px solid var(--color-accent) !important;
    border-radius: var(--radius) !important;
    padding: 0.75rem 1.5rem !important;
    font-family: var(--font-sans) !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: all var(--transition) !important;
    box-shadow: none !important;
    outline: none !important;
}

.wp-block-button .wp-block-button__link:hover {
    background: var(--color-accent-hover) !important;
    border-color: var(--color-accent-hover) !important;
}

.wp-block-button.is-style-outline .wp-block-button__link {
    background: transparent !important;
    color: var(--color-accent) !important;
    border: 2px solid var(--color-accent) !important;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
    background: var(--color-accent) !important;
    color: #ffffff !important;
}

.wp-block-buttons {
    margin-top: 1.5rem;
    gap: 1rem;
}

/* ========================================
   CTA Section
   ======================================== */
.cta-section {
    padding: 5rem 0;
    background: linear-gradient(135deg, var(--color-accent) 0%, #1d4ed8 100%);
    color: #ffffff;
    text-align: center;
}

.cta-section h2 {
    color: #ffffff;
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.cta-section p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
    background: var(--color-bg-dark);
    color: #94a3b8;
    padding: 4rem 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
}

.footer-col h4 {
    color: #ffffff;
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.footer-col p {
    font-size: 0.875rem;
    color: #94a3b8;
    line-height: 1.7;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.5rem;
}

.footer-col ul a {
    color: #94a3b8;
    font-size: 0.875rem;
    transition: color var(--transition);
}

.footer-col ul a:hover {
    color: #ffffff;
}

.footer-bottom {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
}

.footer-legal {
    display: flex;
    gap: 1.5rem;
}

.footer-legal a {
    color: #64748b;
}

.footer-legal a:hover {
    color: #ffffff;
}

/* ========================================
   Contact form
   ======================================== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.contact-info-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.contact-info-item__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--color-accent-light);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.125rem;
}

.contact-info-item__label {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.contact-info-item__value {
    font-size: 1rem;
    color: var(--color-text);
    margin-top: 0.125rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.375rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* ========================================
   Page header (internal pages)
   ======================================== */
.page-header {
    padding: 4rem 0 3rem;
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.page-header p {
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero__visual {
        display: none;
    }

    .hero__stats {
        max-width: 500px;
        margin: 3rem auto 0;
    }

    .cards-grid--3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }

    .hero {
        padding: 4rem 0 3rem;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .section {
        padding: 3rem 0;
    }

    .menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-md);
        padding: 1rem;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }

    .main-nav a {
        padding: 0.75rem 1rem;
    }

    .cards-grid--3,
    .cards-grid--2 {
        grid-template-columns: 1fr;
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .hero__stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .btn-group {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}
