/* ═══════════════════════════════
   BASE
═══════════════════════════════ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}
@keyframes gridMove {
    0%   { transform: translateY(0); }
    100% { transform: translateY(40px); }
}
@keyframes scanline {
    0%   { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

.animate-pulse { animation: pulse 2s cubic-bezier(0.4,0,0.6,1) infinite; }
html {
    background: #04050f;
}
body {
    background: #07070c;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
header {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border-bottom: 1px solid rgba(88, 28, 135, 0.3) !important;
    position: relative;
    z-index: 20;
}

main {
    flex: 1;
}
/* Grille holographique teintée bleu/vert */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(200,255,0,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200,255,0,0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    animation: gridMove 10s linear infinite;
    pointer-events: none;
}

/* Scanline */
body::after {
    content: '';
    position: fixed;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(200,255,0,0.12), transparent);
    animation: scanline 7s linear infinite;
    z-index: 0;
    pointer-events: none;
}

.glow-orb-purple {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse 55% 45% at 0% 0%, rgba(107,31,94,0.25) 0%, transparent 60%),
        radial-gradient(ellipse 35% 35% at 100% 100%, rgba(107,31,94,0.15) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.glow-orb-green {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse 45% 35% at 100% 0%, rgba(26,32,64,0.4) 0%, transparent 60%),
        radial-gradient(ellipse 30% 30% at 0% 100%, rgba(200,255,0,0.05) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.gradient-text {
    background: linear-gradient(to right, #a855f7, #c8ff00, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-hover { transition: all 0.5s ease; }
.card-hover:hover { border-color: #c8ff00; box-shadow: 0 20px 50px rgba(200,255,0,0.15); }
.member-card:hover { transform: translateY(-5px); }
/* ═══════════════════════════════
   GLITCH
═══════════════════════════════ */
@keyframes glitch {
    0%   { clip-path: inset(20% 0 60% 0); transform: translate(-3px, 0); }
    20%  { clip-path: inset(60% 0 10% 0); transform: translate(3px, 0);  }
    40%  { clip-path: inset(40% 0 30% 0); transform: translate(-2px, 0); }
    60%  { clip-path: inset(80% 0 5%  0); transform: translate(2px, 0);  }
    80%  { clip-path: inset(10% 0 70% 0); transform: translate(-1px, 0); }
    100% { clip-path: inset(20% 0 60% 0); transform: translate(0, 0);    }
}
.glitch-active {
    animation: glitch 0.15s steps(1) infinite;
    color: #39ff14 !important;
    opacity: 1 !important;
    text-shadow: 2px 0 #a855f7, -2px 0 #39ff14;
}

/* ═══════════════════════════════════════════
   ARTICLES — layout sidebar + contenu
═══════════════════════════════════════════ */
#articles-page {
    display: none;
    position: relative;
}

#articles-layout {
    display: flex;
    height: 100vh;
    margin-top: 0;
    padding-top: 0;
}

#articles-page {
    display: none;
    position: relative;
    margin-top: 0;
    padding-top: 0;
}

/* ── Sidebar ── */
#articles-sidebar {
    width: 260px;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(88,28,135,0.4);
    background: linear-gradient(160deg, #0d0d1a 0%, #110d1f 60%, #0a120a 100%);
    padding: 1.5rem 0 2rem;
    position: sticky;
    top: 0;
}

@keyframes cardIn {
    to { opacity: 1; transform: translateY(0); }
}

#articles-sidebar::-webkit-scrollbar { width: 3px; }
#articles-sidebar::-webkit-scrollbar-track { background: transparent; }
#articles-sidebar::-webkit-scrollbar-thumb { background: rgba(88,28,135,0.5); border-radius: 2px; }
/* ── Terminal home — scroll fonctionnel, barre invisible ── */
#term-output {
    scrollbar-width: none;       /* Firefox */
    -ms-overflow-style: none;    /* Edge / IE legacy */
}
#term-output::-webkit-scrollbar {
    display: none;               /* Chrome / Safari / Edge Chromium */
}
.sb-section { margin-bottom: 0.25rem; }

.sb-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 1rem;
    cursor: pointer;
    user-select: none;
    color: #7c3aed;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color 0.2s;
    background: none;
    border: none;
    text-align: left;
}
.sb-section-toggle:hover { color: #39ff14; }

.sb-section-icon { display: flex; align-items: center; gap: 0.4rem; }

.sb-caret {
    width: 10px; height: 10px;
    transition: transform 0.22s ease;
    color: #6b21a8;
    flex-shrink: 0;
}
.sb-caret.open { transform: rotate(90deg); }

.sb-items { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.sb-items.open { max-height: 1000px; }

.sb-article-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 1rem 0.3rem 1.75rem;
    font-size: 0.8rem;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    border-left: 2px solid transparent;
    line-height: 1.4;
    background: none;
    width: 100%;
    text-align: left;
}
.sb-article-link:hover {
    color: #d1fae5;
    background: rgba(57,255,20,0.04);
    border-left-color: rgba(57,255,20,0.3);
}
.sb-article-link.active {
    color: #39ff14;
    background: rgba(57,255,20,0.07);
    border-left-color: #39ff14;
    font-weight: 600;
}

.sb-sep { height: 1px; background: rgba(88,28,135,0.2); margin: 0.6rem 1rem; }

/* ── Contenu ── */
#articles-content {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    padding: 2.5rem 4rem;
    background: transparent;
}

#articles-content::-webkit-scrollbar { width: 4px; }
#articles-content::-webkit-scrollbar-track { background: transparent; }
#articles-content::-webkit-scrollbar-thumb { background: rgba(88,28,135,0.4); border-radius: 2px; }

#art-render { width: 100%; }
#art-render > div { max-width: 100%; }

#art-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
    pointer-events: auto;
}

/* ── Sections d'article — style "outline" (timeline verticale) ── */
#art-render h1 { font-size: 2.5rem; }
#acc-wrap { width: 100%; }
#acc-wrap > div { width: 100%; }

.article-section {
    display: flex;
    gap: 1.1rem;
    width: 100%;
    padding-bottom: 2rem;
}
.article-section-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 34px;
}
.article-section-index {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    color: #a78bfa;
    background: rgba(124,58,237,0.12);
    border: 1px solid rgba(124,58,237,0.4);
    border-radius: 8px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.article-section-line {
    flex: 1;
    width: 1px;
    margin-top: 6px;
    background: linear-gradient(to bottom, rgba(124,58,237,0.35), rgba(124,58,237,0.05));
}
.article-section:last-child .article-section-line { display: none; }
.article-section-content {
    flex: 1;
    min-width: 0;
    background: rgba(17,17,17,0.55);
    border: 1px solid rgba(55,65,81,0.5);
    border-radius: 10px;
    padding: 1.1rem 1.4rem 1.35rem;
    transition: border-color 0.2s, background 0.2s;
}
.article-section-content:hover { border-color: rgba(124,58,237,0.45); background: rgba(20,20,26,0.7); }
.article-section-heading {
    display: flex; align-items: center; gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.article-section-body p.text-gray-300       { font-size: 0.95rem; line-height: 1.8; }
.article-section-body ul li span.text-gray-300 { font-size: 0.95rem; line-height: 1.7; }
.article-section-body img { width: 100%; max-width: 100%; }

/* ── Bloc schéma (Mermaid) ── */
.diagram-block {
    background: rgba(10,10,15,0.6);
    border: 1px solid rgba(124,58,237,0.25);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}
.diagram-block .mermaid { display: flex; justify-content: center; }
/* ── Bouton "View in Graph" — affiché sous la section atteinte via le Graph View ── */
.view-in-graph-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 6px 14px;
    background: rgba(57,255,20,0.08);
    border: 1px solid rgba(57,255,20,0.3);
    border-radius: 6px;
    color: #4ade80;
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.view-in-graph-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}
.view-in-graph-wrap .view-in-graph-btn {
    margin-top: 0;
}
.view-in-graph-btn:hover {
    border-color: #39ff14;
    background: rgba(57,255,20,0.15);
}
/* ── Mobile ── */
@media (max-width: 768px) {
    #home-page { padding: 16px 16px 40px !important; }

    #home-page section:first-child > div {
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    #term-output {
        min-height: 160px !important;
        max-height: 240px !important;
        font-size: 11px !important;
    }

    #members-page, #writeups-page, #joinus-page {
        padding: 16px 16px 40px !important;
    }

    #members-page h2, #writeups-page h2, #joinus-page h2 {
        font-size: 2rem !important;
    }
     /* Cards writeups : 2 colonnes max sur mobile */
    #writeups-search-container .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    }
    #home-page .grid.md\:grid-cols-2,
    #members-page .grid.md\:grid-cols-2,
    #joinus-page .grid.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    #writeups-search-container {
        overflow-x: hidden !important;
    }

    #writeups-search-container > * {
        min-width: 0 !important;
    }

    #articles-layout { flex-direction: column !important; height: auto !important; }
    #articles-sidebar { width: 100% !important; position: relative !important; border-right: none !important; border-bottom: 1px solid rgba(88,28,135,0.4) !important; }
    #articles-content { padding: 1.5rem 1rem !important; }
}

@supports (padding-top: env(safe-area-inset-top)) {
    #side-nav { padding-top: calc(30px + env(safe-area-inset-top)) !important; }
}

@media (pointer: fine) {
    * { cursor: none !important; }

    #pdf-viewer-modal * { cursor: none !important; }

    #htb-cursor-wrap {
        position: fixed;
        width: 20px;
        height: 20px;
        pointer-events: none;
        z-index: 999999;
        transform: translate(-50%,-50%);
        perspective: 600px;
        transition: transform 0.1s;
        filter: drop-shadow(0 0 4px rgba(57,255,20,0.6));
    }

    #htb-cube {
        width: 20px;
        height: 20px;
        position: relative;
        transform-style: preserve-3d;
        animation: rotateCube 2s linear infinite;
    }

    @keyframes rotateCube {
        0%   { transform: rotateX(0deg)   rotateY(0deg); }
        100% { transform: rotateX(360deg) rotateY(360deg); }
    }

    .cube-face {
        position: absolute;
        width: 20px;
        height: 20px;
        border: 1px solid rgba(57,255,20,0.8);
        background: rgba(57,255,20,0.04);
        backdrop-filter: blur(2px);
    }

    .cube-face.front  { transform: translateZ(10px); }
    .cube-face.back   { transform: rotateY(180deg) translateZ(10px); }
    .cube-face.left   { transform: rotateY(-90deg) translateZ(10px); }
    .cube-face.right  { transform: rotateY(90deg)  translateZ(10px); }
    .cube-face.top    { transform: rotateX(90deg)  translateZ(10px); }
    .cube-face.bottom { transform: rotateX(-90deg) translateZ(10px); }

    #htb-cursor-dot {
        position: fixed;
        width: 4px;
        height: 4px;
        background: #39ff14;
        border-radius: 50%;
        pointer-events: none;
        z-index: 999999;
        transform: translate(-50%,-50%);
        box-shadow: 0 0 8px #39ff14;
    }
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}
/* ═══════════════════════════════
   TYPEWRITER HOLOGRAPHIQUE
═══════════════════════════════ */
#writeups-typing {
    font-family: 'Courier New', monospace;
    color: #ffffff;
    letter-spacing: 0.08em;
}

.holo-char.resolved {
    color: #ffffff !important;
    text-shadow: none !important;
}

.holo-char.scrambling {
    color: #39ff14;
    text-shadow: 0 0 8px #39ff14, 0 0 20px #39ff1480;
    opacity: 0.75;
}

.holo-cursor {
    color: #39ff14;
    animation: blink 0.7s step-end infinite;
    text-shadow: 0 0 8px #39ff14;
}
/* ═══════════════════════════════
   SIDEBAR SCROLL
═══════════════════════════════ */
#side-nav nav::-webkit-scrollbar { display: none; }
#side-nav nav { scrollbar-width: none; }
/* ═══════════════════════════════
   CAROUSEL 3D — Mobile
═══════════════════════════════ */
@media (max-width: 480px) {
    .carousel-stage { min-height: 460px !important; }
    .carousel-card   { width: 220px !important; }
}
/* ═══════════════════════════════
   JOIN FORM — carte centrée, logo en fondu discret derrière
═══════════════════════════════ */
.joinform-stage {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    min-height: 680px;
    padding: 60px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joinform-logo-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 900px;
    height: 900px;
    transform: translate(-50%, -50%);
    object-fit: contain;
    opacity: 0.1;
    filter: grayscale(0.3) brightness(1.1) saturate(1.1);
    -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 75%);
            mask-image: radial-gradient(circle at center, black 30%, transparent 75%);
    pointer-events: none;
    z-index: 0;
}

.joinform-card-side {
    position: relative;
    z-index: 1;
    width: 100%;
}

@media (max-width: 700px) {
    .joinform-logo-bg { width: 500px; height: 500px; opacity: 0.08; }
}