/* =====================================================
   COURS CSS3 - STYLESHEET
   Créé par Geoffroy Streit - 2025
   ===================================================== */

:root {
    --primary: #264de4;
    --secondary: #2965f1;
    --accent: #00d4ff;
    --bg: #0a0f1a;
    --bg2: #0f1829;
    --card: #141e33;
    --text: #e8f0ff;
    --muted: #8ba3c7;
    --dim: #5a7094;
    --border: #1e3a5f;
    --green: #10b981;
    --purple: #a855f7;
    --pink: #ec4899;
    --orange: #f59e0b;
    --red: #ef4444;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

/* === LAYOUT === */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* === HEADER === */
header {
    position: sticky;
    top: 0;
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding: 16px 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 4px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

nav a:hover {
    background: var(--card);
    color: var(--text);
}

nav a.active-section {
    background: var(--primary);
    color: white;
}

/* === HAMBURGER MENU === */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    flex-direction: column;
    gap: 5px;
    transition: transform 0.3s ease;
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* === HERO === */
.hero {
    padding: 70px 0 50px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: radial-gradient(ellipse at top, rgba(38, 77, 228, 0.1) 0%, transparent 60%);
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text), var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.hero p {
    color: var(--muted);
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.05rem;
}

/* === TOC === */
.toc {
    padding: 35px 0;
    border-bottom: 1px solid var(--border);
}

.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.88rem;
    transition: all 0.2s;
}

.toc-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    background: rgba(38, 77, 228, 0.1);
}

.toc-num {
    width: 26px;
    height: 26px;
    background: var(--primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* === SECTIONS === */
section {
    padding: 55px 0;
    border-bottom: 1px solid var(--border);
}

.sec-header {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 30px;
}

.sec-num {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    flex-shrink: 0;
}

section:nth-child(odd) .sec-num {
    background: linear-gradient(135deg, var(--purple), #7c3aed);
}

section:nth-child(3n) .sec-num {
    background: linear-gradient(135deg, var(--pink), #db2777);
}

section:nth-child(4n) .sec-num {
    background: linear-gradient(135deg, var(--green), #059669);
}

.sec-title {
    font-size: 1.7rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.sec-sub {
    color: var(--dim);
    font-size: 0.95rem;
}

h3 {
    font-size: 1.15rem;
    margin: 28px 0 14px;
    color: var(--accent);
}

p,
li {
    color: var(--muted);
    margin-bottom: 8px;
}

ul {
    list-style: none;
    padding-left: 0;
}

li {
    padding-left: 22px;
    position: relative;
}

li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* === CODE BLOCKS === */
.code {
    background: #080c14;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 14px 0;
    overflow: hidden;
}

.code-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #0f1829;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--dim);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.r {
    background: #ff5f56;
}

.dot.y {
    background: #ffbd2e;
}

.dot.g {
    background: #27ca40;
}

pre {
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    overflow-x: auto;
}

.sel {
    color: var(--orange);
}

.prop {
    color: var(--accent);
}

.val {
    color: var(--green);
}

.c {
    color: var(--dim);
}

.unit {
    color: var(--pink);
}

/* === DEMOS === */
.demo {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 22px;
    margin: 14px 0;
}

.demo-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--dim);
    margin-bottom: 14px;
}

.demo-box {
    padding: 20px;
    background: var(--bg2);
    border-radius: 8px;
    margin: 8px 0;
}

/* === GRIDS === */
.grid2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.grid3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

/* === TIP BOX === */
.tip {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--green);
    padding: 14px 18px;
    border-radius: 0 10px 10px 0;
    margin: 14px 0;
}

.tip strong {
    color: var(--green);
}

.info {
    background: rgba(38, 77, 228, 0.1);
    border-left: 3px solid var(--primary);
    padding: 14px 18px;
    border-radius: 0 10px 10px 0;
    margin: 14px 0;
}

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

/* === REFERENCE CARDS === */
.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.ref-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.ref-card h4 {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.ref-card code {
    color: var(--orange);
    background: var(--bg);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.78rem;
    margin: 2px;
    display: inline-block;
    position: relative;
    cursor: help;
}

/* Tooltip Styles */
.ref-card code .tt {
    visibility: hidden;
    width: 260px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 12px;
    position: absolute;
    z-index: 100;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    line-height: 1.5;
    white-space: normal;
}

.ref-card code .tt::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--primary) transparent transparent transparent;
}

.ref-card code:hover .tt {
    visibility: visible;
    opacity: 1;
    bottom: 125%;
}

.tt b {
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
    font-size: 0.8rem;
}

.tt i {
    color: var(--green);
    display: block;
    margin-top: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-style: normal;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 4px;
}

/* === TABLES === */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.88rem;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--card);
    color: var(--accent);
    font-weight: 600;
}

td {
    color: var(--muted);
}

td code {
    color: var(--orange);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
}

/* === FOOTER === */
footer {
    padding: 40px 0;
    text-align: center;
    color: var(--dim);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

footer strong {
    color: var(--muted);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    /* Show hamburger, adapt nav for mobile */
    .hamburger {
        display: flex;
    }

    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--card);
        border-left: 1px solid var(--border);
        flex-direction: column;
        gap: 0;
        padding: 80px 20px 20px;
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }

    nav.active {
        right: 0;
    }

    nav a {
        width: 100%;
        padding: 14px 20px;
        border-radius: 8px;
        border-bottom: 1px solid var(--border);
        font-size: 1rem;
    }

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

    /* Overlay */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(10, 15, 26, 0.8);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 999;
    }

    .nav-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .sec-header {
        flex-direction: column;
    }

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

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}