@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&display=swap');

:root {
    /* -- Background -- */
    --color-bg:              #0d1117;
    --color-bg-surface:      #161b22;
    --color-bg-surface-2:    rgba(22, 27, 34, 0.92);

    /* -- Borders -- */
    --color-border:          #30363d;
    --color-border-subtle:   #21262d;

    /* -- Accent (blue) -- */
    --color-accent:          #58a6ff;

    /* -- Gradient stops -- */
    --color-grad-1:          #7ee8fa;
    --color-grad-2:          #58a6ff;
    --color-grad-3:          #a78bfa;
    --color-grad-4:          #c084fc;

    /* -- Text -- */
    --color-text:            #c9d1d9;
    --color-text-muted:      #6e7681;

    /* -- Dot colors -- */
    --color-dot-red:         #ff5f57;
    --color-dot-yellow:      #ffbd2e;
    --color-dot-green:       #28c940;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Fira Code', monospace;
    background-color: var(--color-bg);
}

/* -- Preloader -- */

.page-hidden {
    opacity: 0;
    visibility: hidden;
}

#page {
    transition: opacity 0.4s ease;
}

#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-logo {
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--color-grad-1) 0%, var(--color-grad-2) 35%, var(--color-grad-3) 70%, var(--color-grad-4) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 2s linear infinite;
}

.preloader-bar {
    width: 200px;
    height: 3px;
    background: var(--color-border-subtle);
    border-radius: 99px;
    overflow: hidden;
}

.preloader-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-grad-2), var(--color-grad-3));
    border-radius: 99px;
    transition: width 0.35s ease;
}

/* -- Hero Section -- */
.hero {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#code-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.7;
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(13,17,23,0.2) 0%, rgba(13,17,23,0.8) 100%);
    pointer-events: none;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 1rem;
    width: 100%;
    max-width: 680px;
}

.info {
    text-align: center;
}

.info h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 600;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--color-grad-1) 0%, var(--color-grad-2) 25%, #7b9fff 45%, var(--color-grad-3) 65%, var(--color-grad-4) 85%, var(--color-grad-1) 100%);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
    to { background-position: 200% center; }
}

.info p {
    font-size: clamp(0.8rem, 2vw, 0.95rem);
    color: var(--color-text-muted);
    margin: 0;
    letter-spacing: 0.04em;
}

/* -- Coding animation -- */
.terminal {
    width: 100%;
    background: var(--color-bg-surface-2);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(8px);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(88, 166, 255, 0.06),
        0 0 48px rgba(88, 166, 255, 0.04);
}

.terminal-header {
    background: var(--color-bg-surface);
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--color-border-subtle);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.dot.red    { background: var(--color-dot-red);    box-shadow: 0 0 5px rgba(255,95,87,0.6); }
.dot.yellow { background: var(--color-dot-yellow); box-shadow: 0 0 5px rgba(255,189,46,0.6); }
.dot.green  { background: var(--color-dot-green);  box-shadow: 0 0 5px rgba(40,201,64,0.6); }

.terminal-title {
    color: var(--color-text-muted);
    font-size: 0.76rem;
    margin-left: 6px;
}

.terminal-body {
    padding: 20px 24px;
    min-height: 180px;
}

#code-output {
    color: var(--color-text);
    font-size: 0.875rem;
    line-height: 1.65;
    white-space: pre;
    margin: 0;
    font-family: 'Fira Code', monospace;
    display: inline;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 0.9em;
    background: var(--color-accent);
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}
