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

:root {
    --color-bg-dark: #1a1714;
    --color-bg-mid: #2d2821;
    --color-bg-panel: #3d3529;
    --color-amber: #e8a832;
    --color-gold: #f5d45e;
    --color-cream: #f0e6d2;
    --color-red: #c4572a;
    --color-muted: #b8a88a;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg-dark);
    color: var(--color-cream);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
}

.section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
}

/* Opening Cipher */
#opening-cipher {
    background-color: var(--color-bg-dark);
    flex-direction: column;
}

.cipher-container {
    text-align: center;
}

.glyph-display {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.glyph {
    font-family: 'VT323', monospace;
    font-size: clamp(4rem, 12vw, 8rem);
    color: var(--color-gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    image-rendering: pixelated;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

.decode-display {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.decode-display.visible {
    opacity: 1;
}

.decode-val {
    font-family: 'VT323', monospace;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--color-amber);
    letter-spacing: 0.08em;
}

.result-display {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    opacity: 0;
    transition: opacity 0.8s ease 1.2s;
}

.result-display.visible {
    opacity: 1;
}

.result-char {
    font-family: 'VT323', monospace;
    font-size: clamp(3rem, 8vw, 5.5rem);
    color: var(--color-cream);
    letter-spacing: 0.08em;
}

.cipher-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    color: var(--color-muted);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.8s ease 1.8s;
}

.cipher-subtitle.visible {
    opacity: 1;
}

/* Slide Sections */
.slide-section .section-content {
    max-width: 720px;
    width: 100%;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

.slide-section.revealed .section-content {
    transform: translateX(0);
    opacity: 1;
}

.section-heading {
    font-family: 'VT323', monospace;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    color: var(--color-gold);
    letter-spacing: 0.08em;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

.section-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    color: var(--color-cream);
    line-height: 1.7;
    margin-top: 1.5rem;
}

/* Pixel Grid Decoration */
.pixel-grid-decoration {
    width: 128px;
    height: 8px;
    background: repeating-linear-gradient(
        90deg,
        var(--color-amber) 0px,
        var(--color-amber) 8px,
        transparent 8px,
        transparent 16px
    );
    margin-bottom: 1.5rem;
    image-rendering: pixelated;
}

/* Hex Table */
.hex-table {
    margin-top: 2rem;
    border: 2px solid var(--color-bg-panel);
    padding: 1.5rem;
    background: var(--color-bg-mid);
}

.hex-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-bg-panel);
}

.hex-row:last-child {
    border-bottom: none;
}

.hex-key {
    font-family: 'VT323', monospace;
    font-size: 2rem;
    color: var(--color-gold);
    width: 3rem;
    text-align: center;
}

.hex-arrow {
    color: var(--color-muted);
    font-size: 1.25rem;
}

.hex-value {
    font-family: 'VT323', monospace;
    font-size: 2rem;
    color: var(--color-amber);
}

/* Glyph Specimens */
.glyph-specimens {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.specimen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pixel-canvas {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    border: 2px solid var(--color-bg-panel);
    background: var(--color-bg-mid);
}

.specimen-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* Base-16 Grid */
.base16-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    max-width: 280px;
    margin-bottom: 1.5rem;
}

.b16-cell {
    font-family: 'VT323', monospace;
    font-size: 1.75rem;
    color: var(--color-cream);
    background: var(--color-bg-mid);
    border: 2px solid var(--color-bg-panel);
    padding: 0.75rem;
    text-align: center;
    transition: background 0.3s ease, color 0.3s ease;
}

.b16-cell.active {
    background: var(--color-amber);
    color: var(--color-bg-dark);
    border-color: var(--color-gold);
}

/* Building Blocks */
.blocks-animation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.block {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'VT323', monospace;
    font-size: 1.75rem;
    color: var(--color-bg-dark);
    background: var(--color-gold);
    border: 2px solid var(--color-amber);
    animation: blockPulse 2s ease-in-out infinite;
    animation-delay: calc(var(--delay) * 0.2s);
}

@keyframes blockPulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.final-glyph {
    font-family: 'VT323', monospace;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--color-red);
    letter-spacing: 0.12em;
    margin-top: 2rem;
    text-transform: uppercase;
}

/* Scroll Progress */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--color-amber);
    width: 0%;
    z-index: 100;
    transition: width 0.1s linear;
}

/* Section alternating backgrounds */
#what-is-a6c {
    background-color: var(--color-bg-mid);
}

#codes-alphabets {
    background-color: var(--color-bg-dark);
}

#base-sixteen {
    background-color: var(--color-bg-mid);
}

#building-blocks {
    background-color: var(--color-bg-dark);
}
