/* ============================================================
   DEFENDT — styles.css
   Design dark/cyber avec rouge signature
============================================================ */

/* ── Variables ─────────────────────────────────────────── */
:root {
    --primary:    #ff0000;
    --primary-d:  #cc0000;
    --accent:     #ff3333;
    --dark:       #000000;
    --dark-2:     #0d0d0d;
    --dark-3:     #111111;
    --gray:       #333333;
    --light:      #ffffff;
    --font-head:  'Rajdhani', sans-serif;
    --font-body:  'Roboto Mono', monospace;
    --transition: 0.3s ease;
    --radius:     8px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--dark);
    color: var(--light);
    overflow-x: hidden;
    line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.2;
}

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

/* ── Skip Link (accessibilité) ─────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--primary);
    color: var(--light);
    padding: 0.5rem 1rem;
    z-index: 9999;
    font-weight: bold;
    text-decoration: none;
    border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
    top: 0;
}

/* ── Scrollbar personnalisée ────────────────────────────── */
::-webkit-scrollbar       { width: 7px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Boutons ────────────────────────────────────────────── */
.btn-primary {
    display: inline-block;
    background-color: var(--primary);
    color: var(--light);
    border: 2px solid var(--primary);
    transition: background-color var(--transition), color var(--transition);
    cursor: pointer;
    text-decoration: none;
}
.btn-primary:hover,
.btn-primary:focus-visible {
    background-color: transparent;
    color: var(--primary);
    outline: none;
}

.btn-outline {
    display: inline-block;
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    transition: background-color var(--transition), color var(--transition);
    cursor: pointer;
    text-decoration: none;
}
.btn-outline:hover,
.btn-outline:focus-visible {
    background-color: var(--primary);
    color: var(--light);
    outline: none;
}

/* Focus visible global */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* ── Navigation ─────────────────────────────────────────── */
.nav-link {
    position: relative;
    padding-bottom: 3px;
    text-decoration: none;
}
.nav-link::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 0; height: 2px;
    background-color: var(--primary);
    transition: width var(--transition);
}
.nav-link:hover::after,
.nav-link:focus-visible::after {
    width: 100%;
}

/* ── Section title ──────────────────────────────────────── */
.section-title {
    position: relative;
    display: inline-block;
    padding-bottom: 1rem;
}
.section-title::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 50%; height: 3px;
    background-color: var(--primary);
}

/* ── Glitch effect (blanc uniquement) ──────────────────── */
.glitch-effect {
    position: relative;
    display: inline-block;
    color: #ffffff;
    font-weight: 700;
    animation: glitch 3s linear infinite;
}
.glitch-effect::before,
.glitch-effect::after {
    content: attr(data-text);
    position: absolute;
    left: 0; top: 0;
    color: #ffffff;
    font-weight: 700;
}
.glitch-effect::before {
    animation: glitch-top 2s linear infinite;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
    opacity: 0.8;
}
.glitch-effect::after {
    animation: glitch-bot 2.5s linear infinite;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
    opacity: 0.8;
}

@keyframes glitch {
    2%, 64%  { transform: translate(1px, 0); }
    4%, 60%  { transform: translate(-1px, 0); }
    62%      { transform: translate(0, 0) skew(2deg); }
    100%     { transform: none; }
}
@keyframes glitch-top {
    2%, 64%  { transform: translate(1px, -1px); }
    4%, 60%  { transform: translate(-1px, 1px); }
    62%      { transform: translate(8px, -1px) skew(-8deg); }
    100%     { transform: none; }
}
@keyframes glitch-bot {
    2%, 64%  { transform: translate(-1px, 0); }
    4%, 60%  { transform: translate(-1px, 0); }
    62%      { transform: translate(-10px, 3px) skew(12deg); }
    100%     { transform: none; }
}

/* ── Red glow text ──────────────────────────────────────── */
.red-glow {
    text-shadow:
        0 0 5px  var(--primary),
        0 0 10px var(--primary),
        0 0 20px var(--primary);
}

/* ── Animated background ────────────────────────────────── */
.animated-bg {
    background: linear-gradient(135deg, #000, #0a0a0a, #111, #0a0a0a, #000);
    background-size: 400% 400%;
    animation: bg-shift 18s ease infinite;
}
@keyframes bg-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── Parallax section ───────────────────────────────────── */
.parallax {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    overflow: hidden;
}
/* Fallback iOS (pas de background-attachment: fixed) */
@supports (-webkit-touch-callout: none) {
    .parallax { background-attachment: scroll; }
}

/* ── Terminal window ────────────────────────────────────── */
.terminal-window {
    background-color: var(--dark-2);
    border: 1px solid var(--gray);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.terminal-header {
    background-color: #1a1a1a;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid #222;
}
.terminal-btn {
    width: 12px; height: 12px;
    border-radius: 50%;
    margin-right: 7px;
    flex-shrink: 0;
}
.terminal-close    { background-color: #ff5f56; }
.terminal-minimize { background-color: #ffbd2e; }
.terminal-maximize { background-color: #27c93f; }

.terminal-body {
    padding: 20px;
    font-family: var(--font-body);
    color: #00cc44;
    font-size: 13px;
    line-height: 1.6;
    min-height: 220px;
}

/* Cursor clignotant */
.cursor {
    display: inline-block;
    width: 8px; height: 15px;
    background-color: var(--primary);
    vertical-align: middle;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}
@keyframes blink {
    0%, 100% { background-color: transparent; }
    50%       { background-color: var(--primary); }
}

/* Typing text with caret */
.typing-cursor {
    border-right: 2px solid var(--primary);
    padding-right: 2px;
}

/* ── Hero section ───────────────────────────────────────── */
#home {
    background: radial-gradient(ellipse at center, #1a0000 0%, #000000 70%);
}

/* ── Matrix background ──────────────────────────────────── */
.matrix-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}
.matrix-line {
    position: absolute;
    top: -100%;
    font-family: var(--font-body);
    color: rgba(255, 0, 0, 0.35);
    white-space: nowrap;
    animation: matrix-fall linear infinite;
    user-select: none;
}
@keyframes matrix-fall {
    0%   { transform: translateY(-100%); }
    100% { transform: translateY(110vh); }
}

/* ── Scroll reveal ──────────────────────────────────────── */
.reveal {
    transform: translateY(60px);
    opacity: 0;
    transition: transform 0.8s ease, opacity 0.8s ease;
}
.reveal.active {
    transform: translateY(0);
    opacity: 1;
}

/* ── Hexagons ───────────────────────────────────────────── */
.hexagon {
    position: relative;
    width: 70px; height: 40px;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition), background-color var(--transition);
}
.hexagon::before,
.hexagon::after {
    content: '';
    position: absolute;
    width: 0;
    border-left: 35px solid transparent;
    border-right: 35px solid transparent;
}
.hexagon::before {
    bottom: 100%;
    border-bottom: 20px solid var(--primary);
}
.hexagon::after {
    top: 100%;
    border-top: 20px solid var(--primary);
}

/* ── Skill bars ─────────────────────────────────────────── */
.skill-bar {
    height: 8px;
    background-color: var(--gray);
    border-radius: 4px;
    overflow: hidden;
}
.skill-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    width: 0;
    transition: width 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Progress circles ───────────────────────────────────── */
.progress-circle {
    position: relative;
    width: 120px; height: 120px;
}
.progress-circle svg {
    transform: rotate(-90deg);
}
.progress-circle circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}
.progress-circle .bg       { stroke: var(--gray); }
.progress-circle .progress {
    stroke: var(--primary);
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-circle .percentage {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: 700;
}

/* ── Cyber grid ─────────────────────────────────────────── */
.cyber-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* ── Cyber card ─────────────────────────────────────────── */
.cyber-card {
    background-color: rgba(10, 10, 10, 0.85);
    border: 1px solid var(--gray);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.cyber-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: scan 2.5s linear infinite;
}
@keyframes scan {
    0%   { left: -100%; }
    100% { left: 100%; }
}
.cyber-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 0, 0, 0.25);
    border-color: var(--primary);
}

/* ── Service card ───────────────────────────────────────── */
.service-card {
    background-color: rgba(0, 0, 0, 0.75);
    border: 1px solid var(--gray);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    overflow: hidden;
}
.service-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 12px 35px rgba(255, 0, 0, 0.25);
}
.service-card:hover .card-icon {
    color: var(--accent);
    text-shadow: 0 0 15px var(--primary);
}

/* ── Formulaire ─────────────────────────────────────────── */
input, select, textarea {
    font-family: var(--font-body);
}
.form-error {
    display: block;
}

/* ── Video aspect ratio ─────────────────────────────────── */
.aspect-video {
    aspect-ratio: 16 / 9;
    width: 100%;
    border: none;
}

/* ── Footer ─────────────────────────────────────────────── */
footer a {
    text-decoration: none;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 767px) {
    .parallax {
        background-attachment: scroll;
        min-height: 60vh;
    }

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

    .section-title::after {
        width: 40%;
    }

    .terminal-body {
        font-size: 11px;
        padding: 14px;
    }

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

@media (max-width: 480px) {
    .hexagon { width: 55px; height: 32px; }
    .hexagon::before { border-bottom-width: 16px; border-left-width: 27.5px; border-right-width: 27.5px; }
    .hexagon::after  { border-top-width: 16px;    border-left-width: 27.5px; border-right-width: 27.5px; }
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
    .matrix-bg, #particles-js,
    .cyber-card::before, #back-to-top, #site-header {
        display: none !important;
    }
    body { background: white; color: black; }
    .red-glow { text-shadow: none; }
}
