/* ============================================
   lunatic.dev -- Styles
   Sepia Nostalgic Terminal Aesthetic
   ============================================ */

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

:root {
    --old-paper: #F0E8D8;
    --terminal-dark: #1A1812;
    --phosphor-amber: #D4A84B;
    --faded-ink: #5A4A35;
    --warm-gray: #A0927A;
    --bubble-blue: #7AB0C8;
    --cream-light: #FAF4E8;
    --titlebar-bg: #2A2418;
    --dot-warm: #8B7355;
    --skeleton-base: #E8DCC8;
    --skeleton-shine: #F0E8D8;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Recursive", sans-serif;
    font-variation-settings: "MONO" 0, "CASL" 0, "wght" 400;
    background: var(--old-paper);
    color: var(--faded-ink);
    line-height: 1.7;
    font-size: clamp(15px, 1.1vw, 18px);
    overflow-x: hidden;
    position: relative;
}

/* --- Skeleton Loading Animation --- */
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-bar {
    height: 14px;
    margin-bottom: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-group {
    padding: 8px 0;
}

.skeleton-group.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity 0.4s ease;
}

/* --- Cursor Blink --- */
@keyframes cursorBlink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* --- Bubble Rise --- */
@keyframes bubbleRise {
    0% {
        transform: translateY(100vh) translateX(0px);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-60px) translateX(var(--drift, 5px));
        opacity: 0;
    }
}

/* --- Water Bubbles --- */
.bubbles-container {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 60px;
    z-index: 10;
    pointer-events: none;
    overflow: hidden;
}

.bubbles-left {
    left: 10px;
}

.bubbles-right {
    right: 10px;
}

.bubble {
    position: absolute;
    bottom: -40px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5), rgba(122, 176, 200, 0.2) 60%, transparent);
    border: 1px solid rgba(122, 176, 200, 0.15);
    animation: bubbleRise var(--duration, 10s) var(--delay, 0s) linear infinite;
    opacity: 0;
}

/* --- Hero Section --- */
.hero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--old-paper);
    position: relative;
}

/* --- Terminal Window --- */
.terminal {
    width: 80%;
    height: 70%;
    max-width: 1100px;
    background: var(--terminal-dark);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    position: relative;
}

.terminal-titlebar {
    background: var(--titlebar-bg);
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot-amber {
    background: var(--phosphor-amber);
}

.dot-warm {
    background: var(--dot-warm);
}

.dot-dark {
    background: var(--faded-ink);
}

.terminal-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400;
    font-size: 12px;
    color: var(--warm-gray);
    letter-spacing: 0.5px;
}

.terminal-content {
    flex: 1;
    padding: 24px;
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400;
    color: var(--phosphor-amber);
    position: relative;
    overflow-y: auto;
    /* Scan-line effect */
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(0, 0, 0, 0.05) 1px,
            rgba(0, 0, 0, 0.05) 2px
        ),
        var(--terminal-dark);
}

.terminal-content .skeleton-group {
    transition: opacity 0.4s ease;
}

.terminal-content .skeleton-group .skeleton-bar {
    background: linear-gradient(90deg, rgba(212, 168, 75, 0.15) 25%, rgba(212, 168, 75, 0.25) 50%, rgba(212, 168, 75, 0.15) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    height: 12px;
}

/* --- Typed Content --- */
.typed-content {
    display: none;
}

.typed-content.visible {
    display: block;
}

.ascii-art {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 700;
    color: var(--phosphor-amber);
    font-size: clamp(8px, 1.2vw, 16px);
    line-height: 1.2;
    white-space: pre;
    margin-bottom: 16px;
}

.welcome-text {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400;
    color: var(--phosphor-amber);
    font-size: clamp(13px, 1vw, 16px);
    line-height: 1.6;
    white-space: pre-wrap;
}

.welcome-text .prompt {
    color: var(--warm-gray);
}

.cursor {
    display: inline-block;
    width: 9px;
    height: 18px;
    background: var(--phosphor-amber);
    animation: cursorBlink 1.06s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}

/* --- Hero Transition --- */
.hero-transition {
    height: 120px;
    background: linear-gradient(to bottom, var(--old-paper), var(--terminal-dark) 40%, var(--old-paper) 100%);
}

/* --- Content Sections --- */
.content-section {
    padding: 80px 20px;
    position: relative;
}

.section-inner {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.section-content {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.section-content.visible {
    opacity: 1;
}

.section-skeleton {
    transition: opacity 0.4s ease;
}

.section-skeleton.hidden {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

/* --- ASCII Dividers --- */
.ascii-divider {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 700;
    color: var(--phosphor-amber);
    font-size: clamp(10px, 0.9vw, 14px);
    line-height: 1.3;
    margin-bottom: 32px;
    white-space: pre;
}

/* --- Cards --- */
.card {
    background: var(--cream-light);
    border-radius: 6px;
    padding: 32px;
    border: 1px solid rgba(160, 146, 122, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.card h2 {
    font-family: "Recursive", sans-serif;
    font-variation-settings: "MONO" 0, "CASL" 0.3, "wght" 600;
    color: var(--faded-ink);
    font-size: clamp(20px, 2vw, 28px);
    margin-bottom: 16px;
}

.card h3 {
    font-family: "Recursive", sans-serif;
    font-variation-settings: "MONO" 0, "CASL" 0.2, "wght" 500;
    color: var(--faded-ink);
    font-size: clamp(16px, 1.4vw, 20px);
    margin-bottom: 8px;
}

.card p {
    color: var(--faded-ink);
    margin-bottom: 12px;
    line-height: 1.7;
}

.card p:last-child {
    margin-bottom: 0;
}

/* --- Card Grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.prompt-symbol {
    color: var(--phosphor-amber);
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 700;
    margin-right: 6px;
}

/* --- Principles --- */
.principle {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid rgba(160, 146, 122, 0.15);
}

.principle:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.principle-number {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 700;
    color: var(--phosphor-amber);
    font-size: 28px;
    flex-shrink: 0;
    width: 50px;
    line-height: 1.2;
}

.principle h3 {
    margin-bottom: 6px;
}

/* --- Contact Card --- */
.contact-card {
    background: var(--terminal-dark);
    padding: 32px;
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 400;
    /* Scan-line effect */
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(0, 0, 0, 0.05) 1px,
            rgba(0, 0, 0, 0.05) 2px
        ),
        var(--terminal-dark);
}

.contact-card .terminal-line {
    color: var(--phosphor-amber);
    margin-bottom: 4px;
    font-size: clamp(13px, 1vw, 15px);
}

.contact-card .terminal-output {
    color: var(--warm-gray);
    margin-bottom: 16px;
    padding-left: 20px;
    font-size: clamp(13px, 1vw, 15px);
}

.contact-card .terminal-output:last-child {
    margin-bottom: 0;
}

/* --- Footer --- */
.site-footer {
    padding: 60px 20px 40px;
    text-align: center;
    background: var(--terminal-dark);
}

.ascii-footer {
    font-family: "Recursive", monospace;
    font-variation-settings: "MONO" 1, "CASL" 0, "wght" 700;
    color: var(--phosphor-amber);
    font-size: clamp(6px, 0.9vw, 12px);
    line-height: 1.2;
    white-space: pre;
    display: inline-block;
    margin-bottom: 20px;
    opacity: 0.7;
}

.footer-text {
    font-family: "Recursive", sans-serif;
    font-variation-settings: "MONO" 0, "CASL" 0.3, "wght" 400;
    color: var(--warm-gray);
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .terminal {
        width: 94%;
        height: 75%;
    }

    .terminal-content {
        padding: 16px;
    }

    .ascii-art {
        font-size: clamp(5px, 2.5vw, 10px);
    }

    .content-section {
        padding: 50px 16px;
    }

    .card {
        padding: 24px;
    }

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

    .principle {
        flex-direction: column;
        gap: 8px;
    }

    .principle-number {
        width: auto;
    }

    .bubbles-container {
        width: 30px;
    }

    .ascii-divider {
        font-size: clamp(7px, 2vw, 10px);
    }
}

@media (max-width: 480px) {
    .terminal {
        width: 98%;
        height: 80%;
        border-radius: 6px;
    }

    .terminal-titlebar {
        height: 30px;
        padding: 0 10px;
        gap: 6px;
    }

    .terminal-dot {
        width: 9px;
        height: 9px;
    }

    .terminal-title {
        font-size: 10px;
    }

    .hero-transition {
        height: 80px;
    }
}
