/* ================================================
   haskell.quest - styles.css
   Mid-century modern, minimal-navigation, frost aesthetic
   ================================================ */

/* Palette:
   Frost base:   #F0F4F8
   Frost overlay: #E8EEF4
   Slate:        #5A6A80
   Warm amber:   #D0A070
   Light slate:  #A0B0C0
   Dark slate:   #2A3A4A
   City glow:    #E8C090
*/

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 17px);
    line-height: 1.85;
    color: #5A6A80;
    background-color: #F0F4F8;
    overflow-x: hidden;
}

/* ================================================
   Progress Bar (fixed bottom)
   ================================================ */

#progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #E8EEF4;
    z-index: 1000;
    opacity: 0;
    transition: opacity 400ms ease;
}

#progress-bar.visible {
    opacity: 1;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: #D0A070;
    transition: width 100ms linear;
}

/* ================================================
   Section 1: Hero / Opening Viewport
   ================================================ */

#hero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #F0F4F8;
    /* Frosted layered gradient overlay */
    background:
        linear-gradient(135deg, rgba(232, 238, 244, 0.6) 0%, rgba(240, 244, 248, 0.3) 50%, rgba(232, 238, 244, 0.5) 100%),
        linear-gradient(45deg, rgba(240, 244, 248, 0.8) 0%, rgba(232, 238, 244, 0.4) 100%),
        #F0F4F8;
}

#hero-content {
    text-align: center;
}

/* QUEST title with kinetic letters */
#quest-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(48px, 8vw, 100px);
    color: #2A3A4A;
    letter-spacing: 0.15em;
    line-height: 1;
    margin-bottom: 0.1em;
}

.quest-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(-30px);
}

.quest-letter.dropped {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Individual oscillation animations for each letter */
.quest-letter.oscillating[data-index="0"] {
    animation: oscillate0 3.2s ease-in-out infinite;
}
.quest-letter.oscillating[data-index="1"] {
    animation: oscillate1 3.8s ease-in-out infinite;
}
.quest-letter.oscillating[data-index="2"] {
    animation: oscillate2 4.2s ease-in-out infinite;
}
.quest-letter.oscillating[data-index="3"] {
    animation: oscillate3 3.5s ease-in-out infinite;
}
.quest-letter.oscillating[data-index="4"] {
    animation: oscillate4 4.8s ease-in-out infinite;
}

@keyframes oscillate0 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes oscillate1 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(2px); }
}
@keyframes oscillate2 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
@keyframes oscillate3 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}
@keyframes oscillate4 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* "haskell" subtitle */
#haskell-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(18px, 2.5vw, 32px);
    color: #A0B0C0;
    letter-spacing: 0.4em;
    text-transform: lowercase;
    opacity: 0;
    transition: opacity 400ms ease;
    margin-bottom: 2em;
}

#haskell-subtitle.visible {
    opacity: 1;
}

/* Typewriter line */
#typewriter-line {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: #5A6A80;
    min-height: 1.5em;
    margin-top: 1em;
}

#typewriter-text {
    /* text rendered by JS */
}

#typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #D0A070;
    vertical-align: text-bottom;
    margin-left: 1px;
    animation: cursorBlink 600ms step-end infinite;
    opacity: 0;
}

#typewriter-cursor.active {
    opacity: 1;
}

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

/* ================================================
   Section 2: Abstract Shapes / Type Hierarchy
   ================================================ */

#type-hierarchy {
    width: 100%;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F0F4F8;
    padding: 4rem 2rem;
}

#shapes-container {
    width: 100%;
    max-width: 1200px;
    text-align: center;
}

#shapes-svg {
    width: 100%;
    height: auto;
    max-height: 600px;
}

.connector {
    stroke: #A0B0C0;
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    opacity: 0.5;
}

.shape {
    transition: transform 200ms ease;
}

.shape-circle {
    fill: none;
    stroke: #5A6A80;
    stroke-width: 2.5;
}

.shape-triangle {
    fill: none;
    stroke: #D0A070;
    stroke-width: 2.5;
}

.shape-rect {
    fill: none;
    stroke: #5A6A80;
    stroke-width: 2;
}

.shape-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    fill: #5A6A80;
    text-anchor: middle;
    pointer-events: none;
}

#shapes-caption {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px;
    color: #A0B0C0;
    margin-top: 2rem;
    letter-spacing: 0.02em;
}

/* ================================================
   Section 3: Learning Content
   ================================================ */

#learning {
    width: 100%;
    background: #F0F4F8;
    padding: 6rem 2rem;
    position: relative;
}

#learning-column {
    max-width: 55ch;
    margin: 0 auto;
    position: relative;
}

.learning-block {
    margin-bottom: 6rem;
}

.learning-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 36px);
    color: #2A3A4A;
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.learning-block p {
    color: #5A6A80;
    margin-bottom: 1.2rem;
}

/* Code blocks with typewriter effect */
.code-block {
    background: #E8EEF4;
    border-left: 3px solid #D0A070;
    padding: 1.5rem;
    margin: 2rem 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    line-height: 1.7;
    color: #2A3A4A;
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
    overflow: hidden;
}

.code-text {
    /* Characters injected by JS */
}

.code-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #D0A070;
    vertical-align: text-bottom;
    margin-left: 1px;
    opacity: 0;
}

.code-cursor.active {
    animation: cursorBlink 600ms step-end infinite;
}

.code-block .run-indicator {
    display: inline-block;
    position: absolute;
    bottom: 0.8rem;
    right: 0.8rem;
    width: 0;
    height: 0;
    border-left: 10px solid #D0A070;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    opacity: 0;
    cursor: pointer;
    transition: opacity 300ms ease, transform 200ms ease;
}

.code-block .run-indicator.visible {
    opacity: 0.7;
}

.code-block .run-indicator:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* Margin decorative shapes */
.margin-shape {
    position: relative;
    width: 20px;
    height: 20px;
    margin: 2rem auto;
    opacity: 0.3;
}

.margin-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #5A6A80;
}

.margin-triangle {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 18px solid #D0A070;
    background: none;
    border-radius: 0;
}

.margin-rect {
    width: 22px;
    height: 16px;
    border: 2px solid #5A6A80;
    border-radius: 1px;
}

/* ================================================
   Section 4: Cityscape
   ================================================ */

#cityscape {
    width: 100%;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2A3A4A;
    padding: 4rem 2rem;
    position: relative;
}

#city-container {
    width: 100%;
    max-width: 1200px;
    text-align: center;
}

#city-svg {
    width: 100%;
    height: auto;
}

.building {
    fill: #5A6A80;
}

.building-window {
    fill: #A0B0C0;
    transition: fill 500ms ease;
}

.building-window.lit {
    fill: #E8C090;
}

#city-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px;
    color: #A0B0C0;
    margin-top: 2rem;
    letter-spacing: 0.05em;
}

/* ================================================
   Footer
   ================================================ */

#footer {
    width: 100%;
    padding: 3rem 2rem 4rem;
    text-align: center;
    background: #F0F4F8;
}

#footer-rule {
    border: none;
    height: 1px;
    background: #E8EEF4;
    max-width: 200px;
    margin: 0 auto 2rem;
}

#end-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 4vw, 48px);
    color: #A0B0C0;
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
}

.end-letter {
    display: inline-block;
}

.end-letter[data-index="0"] {
    animation: oscillate0 4.5s ease-in-out infinite;
}
.end-letter[data-index="1"] {
    animation: oscillate1 5.2s ease-in-out infinite;
}
.end-letter[data-index="2"] {
    animation: oscillate2 3.8s ease-in-out infinite;
}

#restart-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #A0B0C0;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 300ms ease;
}

#restart-link:hover {
    color: #D0A070;
}

/* ================================================
   Responsive
   ================================================ */

@media (max-width: 768px) {
    #learning-column {
        max-width: 100%;
    }

    #type-hierarchy {
        padding: 2rem 1rem;
    }

    .code-block {
        padding: 1rem;
        font-size: 12px;
    }

    #cityscape {
        padding: 2rem 1rem;
    }
}
