:root {
    --bg: #141414;
    --bg-elevated: #1e1e1e;
    --text: #b8b8b8;
    --text-muted: #5a5a5a;
    --text-strong: #e2e2e2;
    --border: #2a2a2a;
    --accent: #8a8a8a;
    --glow: rgba(255, 255, 255, 0.03);
}

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

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Newsreader', Georgia, serif;
    line-height: 1.75;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Film grain overlay */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Ambient glow effects */
.glow {
    position: fixed;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    filter: blur(120px);
    opacity: 0.4;
    transition: transform 0.3s ease-out;
}

.glow-1 {
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(60, 60, 70, 0.4) 0%, transparent 70%);
}

.glow-2 {
    bottom: -400px;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(50, 50, 60, 0.3) 0%, transparent 70%);
}

/* Reading progress bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--text-muted), transparent);
    z-index: 1001;
    transition: width 0.1s ease-out;
}

/* Top navigation bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem;
    background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 60%, transparent 100%);
    z-index: 100;
}

.twitter-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: all 0.3s ease;
    position: relative;
}

.twitter-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--text);
    transition: width 0.3s ease;
}

.twitter-link:hover {
    color: var(--text);
}

.twitter-link:hover::after {
    width: 100%;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.55rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.04em;
}

.download-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--bg-elevated);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.03);
}

.download-icon {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.download-btn:hover .download-icon {
    transform: translateY(2px);
}

/* Main content */
main {
    max-width: 620px;
    margin: 0 auto;
    padding: 9rem 2rem 8rem;
    position: relative;
}

/* Reveal animations */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.reveal.visible p:nth-child(1) { transition-delay: 0.05s; }
.reveal.visible p:nth-child(2) { transition-delay: 0.1s; }
.reveal.visible p:nth-child(3) { transition-delay: 0.15s; }
.reveal.visible p:nth-child(4) { transition-delay: 0.2s; }
.reveal.visible p:nth-child(5) { transition-delay: 0.25s; }

/* Typography */
h1 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 2.6rem;
    font-weight: 500;
    color: var(--text-strong);
    letter-spacing: -0.03em;
    margin-bottom: 5rem;
    line-height: 1.15;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -2rem;
    left: 0;
    width: 40px;
    height: 1px;
    background: var(--border);
}

h2 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 2rem;
    opacity: 0.7;
}

p {
    margin-bottom: 1.5rem;
    text-align: left;
}

p:last-of-type {
    margin-bottom: 2.5rem;
}

strong {
    color: var(--text-strong);
    font-weight: 500;
}

.final {
    font-size: 1.5rem;
    color: var(--text-strong);
    margin-top: 1.5rem;
    letter-spacing: 0.02em;
}

/* Horizontal rules */
hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 4rem 0;
}

/* Code blocks / ASCII art */
pre.ascii-art {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    line-height: 1.45;
    color: var(--text-muted);
    margin: 2.5rem 0;
    padding: 2rem;
    overflow-x: auto;
    background: transparent;
    white-space: pre;
    transition: color 0.5s ease;
}

.reveal.visible pre.ascii-art {
    animation: fadeInAscii 1s ease 0.3s both;
}

@keyframes fadeInAscii {
    from {
        opacity: 0;
        filter: blur(4px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

pre.ascii-art.box {
    border: 1px solid var(--border);
    padding: 2.5rem 3rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.01) 0%, transparent 100%);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

pre.ascii-art.box:hover {
    border-color: var(--text-muted);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.02);
}

pre.ascii-art.circle {
    text-align: center;
    color: var(--accent);
    margin-top: 4rem;
    padding: 3rem 0;
}

pre.ascii-art.pulse {
    animation: gentlePulse 4s ease-in-out infinite;
}

@keyframes gentlePulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.01);
    }
}

/* Sections */
section {
    margin-bottom: 0;
}

/* Selection */
::selection {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-strong);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Responsive */
@media (max-width: 640px) {
    html {
        font-size: 16px;
    }

    .top-bar {
        padding: 1.25rem 1.5rem;
    }

    main {
        padding: 8rem 1.5rem 5rem;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 4rem;
    }

    h1::after {
        bottom: -1.5rem;
    }

    pre.ascii-art {
        font-size: 0.6rem;
        padding: 1.25rem;
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }

    pre.ascii-art.box {
        padding: 1.75rem 1.25rem;
    }

    hr {
        margin: 3rem 0;
    }

    .glow {
        width: 400px;
        height: 400px;
        filter: blur(80px);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    
    pre.ascii-art.pulse {
        animation: none;
    }
    
    html {
        scroll-behavior: auto;
    }
}
