/*
  intro.css
  Cinematic intro sequence — menadawod.de
*/

#intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Share Tech Mono', monospace;
    transition:
        transform 0.9s cubic-bezier(0.4, 0, 0.2, 1),
        filter    0.9s cubic-bezier(0.4, 0, 0.2, 1),
        opacity   0.9s ease;
}

#intro-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 100% 60% at 50% 0%,    rgba(124,58,237,0.12) 0%, transparent 70%),
        radial-gradient(ellipse 60%  40% at 100% 100%, rgba(6,214,240,0.06)  0%, transparent 60%);
    pointer-events: none;
    z-index: 2;
}

#intro-overlay.hidden {
    transform: scale(1.08) translateY(-12px);
    filter: blur(24px);
    opacity: 0;
    pointer-events: none;
}

.intro-grid {
    position: absolute;
    inset: -120px;
    background-image:
        linear-gradient(to right,  rgba(6,214,240,0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(6,214,240,0.06) 1px, transparent 1px);
    background-size: 52px 52px;
    animation: grid-drift 10s linear infinite;
    pointer-events: none;
    transform: translate(var(--parallax-x, 0), var(--parallax-y, 0));
    will-change: transform;
}

[data-theme="light"] .intro-grid {
    background-image:
        linear-gradient(to right,  rgba(3,105,161,0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(3,105,161,0.08) 1px, transparent 1px);
}

@keyframes grid-drift {
    0%   { background-position: 0 0; }
    100% { background-position: 0 52px; }
}

.intro-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        rgba(0,0,0,0.04) 0.5px,
        transparent 1px
    );
    pointer-events: none;
    z-index: 2;
}

[data-theme="light"] .intro-scanlines {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        rgba(0,0,0,0.025) 0.5px,
        transparent 1px
    );
}

.intro-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 38%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
    z-index: 2;
}

.corner {
    position: absolute;
    width: 56px;
    height: 56px;
    opacity: 0;
    animation: corner-appear 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards 2.4s;
    z-index: 5;
}

.corner::before,
.corner::after {
    content: '';
    position: absolute;
    background: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
}

.corner-tl { top: 36px;    left: 36px;  }
.corner-tr { top: 36px;    right: 36px; }
.corner-bl { bottom: 36px; left: 36px;  }
.corner-br { bottom: 36px; right: 36px; }

.corner-tl::before, .corner-tr::before, .corner-bl::before, .corner-br::before { width: 100%; height: 2px; top: 0; left: 0; }
.corner-tl::after,  .corner-tr::after,  .corner-bl::after,  .corner-br::after  { width: 2px; height: 100%; top: 0; left: 0; }

.corner-tr::before { left: auto; right: 0; }
.corner-tr::after  { left: auto; right: 0; }
.corner-bl::before { top: auto;  bottom: 0; }
.corner-bl::after  { top: auto;  bottom: 0; }
.corner-br::before { top: auto;  bottom: 0; left: auto; right: 0; }
.corner-br::after  { top: auto;  bottom: 0; left: auto; right: 0; }

@keyframes corner-appear {
    0%   { opacity: 0; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}

.scan-beam {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent 0%, var(--accent-color) 40%, rgba(255,255,255,0.6) 50%, var(--accent-color) 60%, transparent 100%);
    opacity: 0.6;
    box-shadow: 0 0 12px var(--accent-color);
    animation: scan-move 4s cubic-bezier(0.4, 0, 0.6, 1) forwards;
    pointer-events: none;
    z-index: 3;
}

@keyframes scan-move {
    0%   { transform: translateY(-5vh); }
    100% { transform: translateY(105vh); }
}

.boot-lines {
    position: absolute;
    top: 10%;
    left: 8%;
    right: 8%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    z-index: 5;
}

.boot-line {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.boot-line.visible { opacity: 1; transform: translateX(0); }

.boot-line[data-status="ok"]   span:first-child { color: var(--accent-color);   }
.boot-line[data-status="info"] span:first-child { color: var(--primary-bright); }

.center-content {
    text-align: center;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.intro-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--accent-color);
    letter-spacing: 0.45em;
    opacity: 0;
    animation: fade-in-up 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards 2.6s;
    margin-bottom: 10px;
}

.intro-name {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(48px, 9.5vw, 118px);
    line-height: 0.95;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: scale(0.92) translateY(10px);
    filter: blur(12px);
    animation: name-reveal 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards 2.85s;
    position: relative;
    margin-bottom: 18px;
    text-shadow: none;
}

@keyframes name-reveal {
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

.intro-name::before,
.intro-name::after {
    content: "MENA DAWOD";
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-color);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    clip-path: inset(45% 0 45% 0);
    opacity: 0;
}

[data-theme="light"] .intro-name::before,
[data-theme="light"] .intro-name::after { background: var(--bg-color); }

.intro-name.glitching::before {
    opacity: 0.75;
    left: -3px;
    animation: glitch-a 0.28s infinite;
    filter: hue-rotate(-30deg);
}

.intro-name.glitching::after {
    opacity: 0.75;
    left: 3px;
    animation: glitch-b 0.28s infinite;
    filter: hue-rotate(30deg);
}

@keyframes glitch-a {
    0%   { clip-path: inset(10% 0 62% 0); }
    25%  { clip-path: inset(42% 0 8%  0); }
    50%  { clip-path: inset(78% 0 4%  0); }
    75%  { clip-path: inset(18% 0 44% 0); }
    100% { clip-path: inset(10% 0 62% 0); }
}

@keyframes glitch-b {
    0%   { clip-path: inset(52% 0 18% 0); }
    25%  { clip-path: inset(8%  0 62% 0); }
    50%  { clip-path: inset(22% 0 42% 0); }
    75%  { clip-path: inset(76% 0 4%  0); }
    100% { clip-path: inset(52% 0 18% 0); }
}

.intro-divider {
    width: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-color), transparent);
    margin: 14px 0;
    opacity: 0.6;
    animation: divider-expand 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards 3.4s;
    box-shadow: 0 0 12px var(--accent-color);
}

@keyframes divider-expand {
    to { width: 320px; }
}

.intro-title {
    font-size: 13px;
    color: var(--text-color);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0;
    animation: fade-in 0.5s ease forwards 3.4s;
    margin-bottom: 10px;
}

.intro-role-container {
    height: 26px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 17px;
    color: var(--accent-color);
    letter-spacing: 0.04em;
}

.intro-cursor {
    width: 2px;
    height: 20px;
    background: var(--primary-bright);
    animation: cursor-blink 1s infinite;
    border-radius: 1px;
}

.progress-container {
    width: 300px;
    margin-top: 44px;
    opacity: 0;
    animation: fade-in 0.5s ease forwards 4s;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.progress-track {
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.08);
    position: relative;
    overflow: visible;
}

.progress-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0%;
    background: var(--gradient);
    transition: width 0.1s linear;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color), 0 0 16px var(--accent-color);
}

.enter-btn {
    margin-top: 52px;
    background: transparent;
    border: 1px solid rgba(6,214,240,0.35);
    color: var(--text-color);
    padding: 14px 40px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.2em;
    cursor: pointer;
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
    z-index: 100;
    pointer-events: none;
    border-radius: 2px;
}

.enter-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(6,214,240,0.06), rgba(124,58,237,0.06));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.enter-btn.visible {
    pointer-events: auto;
    animation:
        btn-reveal       0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards,
        btn-glow-pulse   2.2s ease-in-out infinite 0.6s;
}

.enter-btn:hover {
    border-color: var(--accent-color);
    letter-spacing: 0.3em;
    box-shadow: 0 0 40px rgba(6,214,240,0.25), 0 0 80px rgba(6,214,240,0.1);
    color: var(--accent-color);
}

.enter-btn:hover::before { opacity: 1; }

@keyframes btn-reveal {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes btn-glow-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(6,214,240,0.15); }
    50%       { box-shadow: 0 0 28px rgba(6,214,240,0.4), 0 0 50px rgba(124,58,237,0.15); }
}

#matrix-canvas {
    position: absolute;
    inset: -5% -5%;
    width: 110%;
    height: 110%;
    opacity: 0.12;
    pointer-events: none;
    z-index: 1;
    will-change: transform;
}

#intro-cursor {
    position: fixed;
    width: 7px;
    height: 7px;
    background: var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    box-shadow: 0 0 12px var(--accent-color), 0 0 24px rgba(6,214,240,0.4);
    transform: translate(-50%, -50%);
    transition: width 0.2s ease, height 0.2s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

body.intro-active { overflow: hidden; }

main, nav, footer { opacity: 0; }

body.content-fade-in main,
body.content-fade-in nav,
body.content-fade-in footer {
    opacity: 1 !important;
    transition: opacity 1.5s ease;
}

@media (max-width: 640px) {
    .boot-lines {
        top: 7%;
        left: 4%;
        right: 4%;
        font-size: 9.5px;
        gap: 3px;
    }

    .boot-line {
        word-break: break-word;
        line-height: 1.3;
    }

    .corner { width: 28px; height: 28px; }
    .corner-tl { top: 14px;    left: 14px;  }
    .corner-tr { top: 14px;    right: 14px; }
    .corner-bl { bottom: 14px; left: 14px;  }
    .corner-br { bottom: 14px; right: 14px; }

    .intro-name { font-size: clamp(38px, 13vw, 76px); }

    .intro-divider { width: min(82%, 300px); }
    @keyframes divider-expand { to { width: min(82%, 300px); } }

    .progress-container { width: 82%; max-width: 300px; }

    .enter-btn { padding: 11px 26px; font-size: 12px; }
}

@media (max-width: 380px) {
    .boot-lines           { font-size: 9px; }
    .intro-title          { font-size: 12px; }
    .intro-role-container { font-size: 15px; }
}
