/*
Theme Name: RasRobot
Theme URI: https://rasrobot.com
Author: William
Author URI: https://rasrobot.com
Description: Thème dark tech pour rasrobot.com - Robotique, IA et Raspberry Pi
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: rasrobot
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
*/

/* ========================================
   Variables CSS
======================================== */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #06B6D4;
    --accent-hover: #22d3ee;
    --accent-dim: rgba(6, 182, 212, 0.15);
    --border: #30363d;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --font-system: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --transition: 0.2s ease;
}

/* ========================================
   Reset & Base
======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-system);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

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

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

a:hover, a:focus {
    color: var(--accent-hover);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }

p {
    margin-bottom: 1rem;
}

code, pre {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

code {
    padding: 0.2em 0.4em;
    font-size: 0.9em;
}

pre {
    padding: 1rem;
    overflow-x: auto;
}

/* ========================================
   Layout
======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
}

.section {
    padding: 3rem 0;
}

@media (min-width: 768px) {
    .section {
        padding: 4rem 0;
    }
}

.section-title {
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

/* ========================================
   Header
======================================== */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    gap: 1rem;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-logo {
    width: 40px;
    height: 40px;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    color: var(--text-primary);
}

.site-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

/* Navigation */
.main-nav {
    display: none;
}

@media (min-width: 768px) {
    .main-nav {
        display: block;
    }
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-menu a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.current {
    color: var(--accent);
    text-decoration: none;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition);
}

.nav-menu a:hover::after,
.nav-menu a.current::after {
    width: 100%;
}

/* Mobile menu toggle */
.menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

.mobile-nav {
    display: none;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 1rem;
}

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

.mobile-nav a {
    display: block;
    padding: 0.75rem 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.mobile-nav a:last-child {
    border-bottom: none;
}

/* ========================================
   Hero
======================================== */
.hero {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .hero {
        padding: 6rem 0;
    }
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, var(--accent-dim) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 148, 158, 0.05) 0%, transparent 40%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-tagline {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    margin-bottom: 1.5rem;
}

.hero-title .accent {
    color: var(--accent);
}

.hero-description {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-ctas {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

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

.btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--bg-primary);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ========================================
   Cards
======================================== */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

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

.card-image {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

.card:hover .card-image img {
    transform: scale(1.05);
}

.card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
}

.card-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.card-body {
    padding: 1.25rem;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
    color: var(--accent);
}

.badge-robot {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}

.badge-diy {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.badge-article {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.card-title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.card-title a {
    color: var(--text-primary);
}

.card-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

.card-excerpt {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========================================
   Newsletter
======================================== */
.newsletter-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.newsletter-inner {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.newsletter-title {
    margin-bottom: 0.75rem;
}

.newsletter-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 480px) {
    .newsletter-form {
        flex-direction: row;
    }
}

.newsletter-form input[type="email"] {
    flex: 1;
    padding: 0.875rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.newsletter-form input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
}

.newsletter-form input[type="email"]::placeholder {
    color: var(--text-muted);
}

.newsletter-consent {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: left;
    margin-top: 0.5rem;
}

.newsletter-consent a {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* ========================================
   Footer
======================================== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1.5rem;
}

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

@media (min-width: 640px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

.footer-brand {
    max-width: 300px;
}

.footer-brand .site-title {
    margin-bottom: 1rem;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.footer-nav h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.footer-nav ul {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-nav a {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

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

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
}

@media (min-width: 640px) {
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.social-links a:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.social-links svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Single Post/Page
======================================== */
.single-header {
    padding: 3rem 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
    .single-header {
        padding: 4rem 0;
    }
}

.single-header .container {
    max-width: 800px;
}

.single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.single-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    margin-bottom: 1rem;
}

.single-excerpt {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.single-content {
    padding: 3rem 0;
}

.single-content .container {
    max-width: 800px;
}

.single-content .entry-content {
    line-height: 1.8;
}

.single-content .entry-content h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.single-content .entry-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.single-content .entry-content p {
    margin-bottom: 1.25rem;
}

.single-content .entry-content ul,
.single-content .entry-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.single-content .entry-content li {
    margin-bottom: 0.5rem;
    list-style: disc;
}

.single-content .entry-content ol li {
    list-style: decimal;
}

.single-content .entry-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.single-content .entry-content blockquote p:last-child {
    margin-bottom: 0;
}

.single-content .entry-content img {
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
}

/* Featured image */
.single-featured-image {
    margin-bottom: 2rem;
}

.single-featured-image img {
    width: 100%;
    border-radius: var(--radius-lg);
}

/* ========================================
   Robot Fiche specific
======================================== */
.robot-specs {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 2rem 0;
}

.robot-specs h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .specs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.spec-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.spec-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.spec-value {
    font-weight: 600;
    color: var(--accent);
}

/* ========================================
   DIY Project specific
======================================== */
.diy-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.difficulty-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.difficulty-facile {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.difficulty-intermediaire {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.difficulty-avance {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
}

.diy-materials {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 2rem 0;
}

.diy-materials h3 {
    margin-bottom: 1rem;
}

.diy-materials ul {
    padding-left: 1.5rem;
}

.diy-materials li {
    list-style: disc;
    margin-bottom: 0.5rem;
}

/* ========================================
   Archive
======================================== */
.archive-header {
    padding: 3rem 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.archive-title {
    margin-bottom: 0.5rem;
}

.archive-description {
    color: var(--text-secondary);
}

.archive-content {
    padding: 3rem 0;
}

/* ========================================
   404
======================================== */
.error-404 {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 3rem 0;
}

.error-code {
    font-size: clamp(6rem, 20vw, 10rem);
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-title {
    margin-bottom: 1rem;
}

.error-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   Pagination
======================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition);
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.pagination .current {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

/* ========================================
   Accessibility
======================================== */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    clip: auto !important;
    color: var(--text-primary);
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 1rem;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent);
    color: var(--bg-primary);
    padding: 0.75rem 1rem;
    z-index: 9999;
    font-weight: 600;
    transition: top var(--transition);
}

.skip-link:focus {
    top: 0;
    outline: none;
}

/* Focus styles */
:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ========================================
   WordPress Classes
======================================== */
.alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.gallery-item {
    margin: 0;
}

.gallery-item img {
    border-radius: var(--radius-md);
}

/* ========================================
   Print
======================================== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .site-header,
    .site-footer,
    .newsletter-section,
    .hero-ctas {
        display: none;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
}

/* =============================================================================
   UX ENHANCEMENTS (merged from mu-plugin)
   ============================================================================= */
.back-to-top-btn {
    position: fixed; bottom: 20px; right: 20px;
    width: 44px; height: 44px; border-radius: 50%;
    background: #00e5ff; color: #fff; border: none;
    cursor: pointer; z-index: 9998;
    display: none; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.back-to-top-btn.visible { display: flex; }

.reading-progress {
    position: fixed; top: 0; left: 0; height: 3px;
    background: #00e5ff; z-index: 99999;
    width: 0%; transition: width 0.1s linear;
}
