/* ========================================
   opensource.day — Terminal Scholar's Tide Pool
   ======================================== */

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

/* Custom Properties */
:root {
    --pale-violet: #D0C0E8;
    --muted-violet: #9088B0;
    --triadic-teal: #60B0A0;
    --triadic-amber: #D0A060;
    --terminal-void: #08060C;
    --terminal-window: #0E0C14;
    --terminal-border: #3A3848;
    --skeleton-base: #1A1828;
    --skeleton-pulse: #2A2838;
    --bubble-glow-teal: rgba(96, 176, 160, 0.05);
    --bubble-glow-amber: rgba(208, 160, 96, 0.05);
    --bubble-glow-violet: rgba(208, 192, 232, 0.05);
    --font-handwritten: 'Caveat', cursive;
    --font-mono: 'Fira Code', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--terminal-void);
    color: var(--muted-violet);
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========================================
   Bubble Container
   ======================================== */
#bubble-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: rise linear infinite;
}

.bubble--teal {
    background: var(--bubble-glow-teal);
    border: 1px solid rgba(96, 176, 160, 0.08);
}

.bubble--amber {
    background: var(--bubble-glow-amber);
    border: 1px solid rgba(208, 160, 96, 0.08);
}

.bubble--violet {
    background: var(--bubble-glow-violet);
    border: 1px solid rgba(208, 192, 232, 0.08);
}

@keyframes rise {
    0% {
        transform: translateY(100vh) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.1;
    }
    100% {
        transform: translateY(-10vh) translateX(var(--drift, 20px)) scale(0.6);
        opacity: 0;
    }
}

/* ========================================
   Terminal Void Sections
   ======================================== */
.terminal-void {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 8vw 8vw;
    z-index: 2;
}

/* ========================================
   Terminal Windows
   ======================================== */
.terminal-window {
    position: relative;
    background: var(--terminal-window);
    border: 1px solid var(--terminal-border);
    border-radius: 4px;
    max-width: 720px;
    width: 100%;
    overflow: hidden;
}

.terminal-titlebar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(26, 24, 40, 0.6);
    border-bottom: 1px solid var(--terminal-border);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red {
    background: #FF5F56;
}

.dot-yellow {
    background: #FFBD2E;
}

.dot-green {
    background: #27C93F;
}

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--terminal-border);
    margin-left: 8px;
}

.terminal-body {
    padding: clamp(1.5rem, 3vw, 2.5rem);
    position: relative;
}

/* ========================================
   Skeleton Loading
   ======================================== */
.skeleton-block {
    border-radius: 3px;
    background: linear-gradient(90deg, var(--skeleton-base), var(--skeleton-pulse), var(--skeleton-base));
    background-size: 200% 100%;
    animation: skeleton-pulse 1.6s ease-in-out infinite;
}

.skeleton-heading {
    height: 2.4rem;
    width: 60%;
    margin-bottom: 1.2rem;
}

.skeleton-line {
    height: 0.9rem;
    width: 100%;
    margin-bottom: 0.8rem;
}

.skeleton-short {
    width: 70%;
}

@keyframes skeleton-pulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Skeleton reveal state */
.skeleton-block.resolved {
    animation: none;
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, height 0.3s ease, margin 0.3s ease;
}

/* Content reveal */
.reveal-content {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease 0.2s, transform 0.6s ease 0.2s;
}

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

/* Hero-specific skeleton/content */
#hero-content {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

#hero-content.visible {
    opacity: 1;
    transform: translateY(0);
}

#skeleton-heading,
#skeleton-line-1,
#skeleton-line-2 {
    transition: opacity 0.3s ease, height 0.3s ease, margin 0.3s ease;
}

#skeleton-heading.resolved,
#skeleton-line-1.resolved,
#skeleton-line-2.resolved {
    animation: none;
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

/* ========================================
   Typography
   ======================================== */
.handwritten-heading {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    color: var(--pale-violet);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.terminal-text {
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--muted-violet);
    line-height: 1.8;
    margin-bottom: 0.8rem;
}

.terminal-text:last-child {
    margin-bottom: 0;
}

.prompt {
    color: var(--triadic-teal);
    margin-right: 0.5em;
}

.output-text {
    color: var(--pale-violet);
    padding-left: 1.5em;
}

.annotation-text {
    font-family: var(--font-handwritten);
    font-weight: 400;
    font-size: 1rem;
    color: var(--triadic-teal);
    line-height: 1.5;
}

/* ========================================
   Cursor Blink
   ======================================== */
.cursor-blink {
    display: inline-block;
    width: 8px;
    height: 1.2em;
    background: var(--triadic-teal);
    animation: blink 1s step-end infinite;
    vertical-align: middle;
    margin-left: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cursor-blink.active {
    opacity: 1;
}

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

/* ========================================
   Margin Notes (Scholarly Annotations)
   ======================================== */
.margin-note {
    position: absolute;
    max-width: 160px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    z-index: 3;
}

.margin-note.visible {
    opacity: 1;
    transform: translateY(0);
}

.margin-note-right {
    right: 2vw;
    top: 30%;
}

.margin-note-left {
    left: 2vw;
    top: 35%;
}

.margin-note::before {
    content: '~';
    display: block;
    font-family: var(--font-handwritten);
    font-size: 1.4rem;
    color: var(--triadic-amber);
    margin-bottom: 0.3rem;
}

/* ========================================
   Hero Section
   ======================================== */
#hero {
    min-height: 100vh;
}

.hero-terminal {
    max-width: 640px;
}

.hero-content h1 {
    letter-spacing: 0.02em;
}

.typing-text {
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    border-right: none;
    color: var(--triadic-teal);
    font-size: clamp(0.85rem, 1vw, 0.95rem);
}

.typing-text.typed {
    width: 100%;
    transition: width 0s;
}

/* ========================================
   About Section
   ======================================== */
#about .terminal-window {
    max-width: 680px;
}

/* ========================================
   Principles Section
   ======================================== */
.principles-terminal {
    max-width: 720px;
}

.principle-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.8rem;
    align-items: flex-start;
}

.principle-item:last-child {
    margin-bottom: 0;
}

.principle-number {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--triadic-amber);
    flex-shrink: 0;
    padding-top: 0.15em;
}

.principle-title {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--pale-violet);
    margin-bottom: 0.3rem;
}

/* ========================================
   Ecosystem Section
   ======================================== */
.ecosystem-terminal {
    max-width: 760px;
}

.ecosystem-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

.eco-organism {
    padding: 1rem;
    border: 1px solid var(--terminal-border);
    border-radius: 4px;
    background: rgba(14, 12, 20, 0.5);
}

.eco-icon {
    font-size: 1.6rem;
    display: block;
    margin-bottom: 0.4rem;
}

.eco-icon.teal-glow {
    color: var(--triadic-teal);
    text-shadow: 0 0 12px rgba(96, 176, 160, 0.3);
}

.eco-icon.amber-glow {
    color: var(--triadic-amber);
    text-shadow: 0 0 12px rgba(208, 160, 96, 0.3);
}

.eco-icon.violet-glow {
    color: var(--pale-violet);
    text-shadow: 0 0 12px rgba(208, 192, 232, 0.3);
}

.eco-name {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--pale-violet);
    margin-bottom: 0.3rem;
}

/* ========================================
   Reflections Section
   ======================================== */
.reflections-terminal {
    max-width: 660px;
}

.reflection-quote {
    margin-bottom: 1.8rem;
    padding-left: 1.2rem;
    border-left: 2px solid var(--triadic-amber);
}

.reflection-quote:last-child {
    margin-bottom: 0;
}

.reflection-quote cite {
    display: block;
    margin-top: 0.4rem;
    font-style: normal;
}

/* ========================================
   Footer Section
   ======================================== */
.footer-void {
    min-height: 60vh;
}

.footer-terminal {
    max-width: 480px;
}

.footer-sign {
    font-size: 1.8rem;
    margin-top: 1.5rem;
    text-align: center;
    color: var(--triadic-amber);
}

.footer-year {
    text-align: center;
    color: var(--terminal-border);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

/* ========================================
   Terminal Window Entrance Animations
   ======================================== */
.terminal-window {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.terminal-window.entered {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 900px) {
    .margin-note {
        position: relative;
        max-width: 100%;
        right: auto;
        left: auto;
        top: auto;
        margin-top: 1.5rem;
        padding: 0 8vw;
    }

    .terminal-void {
        flex-direction: column;
        padding: 6vw 5vw;
    }

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

@media (max-width: 600px) {
    .terminal-void {
        padding: 10vw 4vw;
    }

    .terminal-body {
        padding: 1.2rem;
    }

    .principle-item {
        flex-direction: column;
        gap: 0.3rem;
    }
}
