/* HEADER */

header {
    display: block;
    background-image: url(../images/tessellation.webp);
    background-size: 300px 300px;
    background-repeat: repeat;
    padding: 20px;
    text-align: center;
    border-bottom: 15px solid #116e93;
    margin: 0;
    height: 5vh;
}

/* TITLE SECTION */

#title-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 65vh;
    padding: 5rem 2rem;

    background: radial-gradient(circle at top,
            #ffffff 0%,
            #e2e8f0 45%,
            #c3cfe2 100%);

    position: relative;
    overflow: hidden;
    border-radius: 10vh;
}

/* Image overlay at low opacity */
#title-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url(../images/home/tree_3.png);
    background-size: cover;
    background-position: center;
    opacity: 0.1;
    pointer-events: none;
}

/* Decorative circle on top */

#title-section::after {
    content: "";
    position: absolute;
    width: 350px;
    height: 350px;
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: 50%;
    top: -120px;
    right: -120px;
    pointer-events: none;
    z-index: 1;
    animation: circle-pulse 8s ease-in-out infinite;
}

@keyframes circle-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.3;
    }
}

/* Ensure content sits above overlay */

#main-title,
#title-section h2,
#title-section button,
.scroll-cue {
    position: relative;
    z-index: 1;
}

/* MAIN TITLE (typewriter-ish entrance) */

#main-title {
    font-family: "Aleo", serif;
    font-size: clamp(3.5rem, 10vw, 6rem);
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.03em;
    line-height: 1;
    color: rgb(9, 83, 157);
    background-clip: text;
    position: relative;
    z-index: 1;
    display: inline-block;
    white-space: normal;
}

#main-title .word {
    display: inline-block;
    margin-right: 0.25em;
}

/* Per-character animation */

#main-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    animation: type-write 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

/* Stagger animation for each character */

#main-title .char:nth-child(1) {
    animation-delay: 0s;
}

#main-title .char:nth-child(2) {
    animation-delay: 0.05s;
}

#main-title .char:nth-child(3) {
    animation-delay: 0.1s;
}

#main-title .char:nth-child(4) {
    animation-delay: 0.15s;
}

#main-title .char:nth-child(5) {
    animation-delay: 0.2s;
}

#main-title .char:nth-child(6) {
    animation-delay: 0.25s;
}

#main-title .char:nth-child(7) {
    animation-delay: 0.3s;
}

#main-title .char:nth-child(8) {
    animation-delay: 0.35s;
}

#main-title .char:nth-child(9) {
    animation-delay: 0.4s;
}

#main-title .char:nth-child(10) {
    animation-delay: 0.45s;
}

#main-title .char:nth-child(11) {
    animation-delay: 0.5s;
}

#main-title .char:nth-child(12) {
    animation-delay: 0.55s;
}

#main-title .char:nth-child(13) {
    animation-delay: 0.6s;
}

#main-title .char:nth-child(14) {
    animation-delay: 0.65s;
}

#main-title .char:nth-child(15) {
    animation-delay: 0.7s;
}

#main-title .char:nth-child(16) {
    animation-delay: 0.75s;
}

#main-title .char:nth-child(17) {
    animation-delay: 0.8s;
}

#main-title .char:nth-child(18) {
    animation-delay: 0.85s;
}

#main-title .char:nth-child(19) {
    animation-delay: 0.9s;
}

#main-title .char:nth-child(20) {
    animation-delay: 0.95s;
}

#main-title .char:nth-child(21) {
    animation-delay: 1s;
}

#main-title .char:nth-child(22) {
    animation-delay: 1.05s;
}

#main-title .char:nth-child(23) {
    animation-delay: 1.1s;
}

#main-title .char:nth-child(24) {
    animation-delay: 1.15s;
}

#main-title .char:nth-child(25) {
    animation-delay: 1.2s;
}

@keyframes type-write {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* SUBTITLE */

#title-section h2 {
    font-family: "Aleo", serif;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 400;
    margin: 0 0 2.5rem 0;
    color: #718096;
    position: relative;
    z-index: 1;
    opacity: 0;
    animation: subtitle-fade 1s ease-out 1.5s forwards;
}

@keyframes subtitle-fade {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Underline accent */

#title-section h2::after {
    content: "";
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    animation: underline-expand 1.2s cubic-bezier(0.215, 0.61, 0.355, 1) 1.8s forwards;
}

@keyframes underline-expand {
    0% {
        width: 0;
    }

    100% {
        width: 80px;
    }
}

/* BUTTON */

#title-section button {
    font-family: "Aleo", serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1.1rem 3rem;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    color: white;
    cursor: pointer;
    transition:
        transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    z-index: 1;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: subtitle-fade 1s ease-out 2.2s forwards;
}

#title-section button:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

#title-section button:active {
    transform: translateY(-2px) scale(0.99);
}

/* MOBILE */

@media (max-width: 768px) {
    #title-section {
        min-height: 60vh;
        padding: 3rem 1.5rem;
    }

    #title-section::after {
        width: 250px;
        height: 250px;
        top: -80px;
        right: -80px;
    }
}

/* Scroll cue */

.scroll-cue {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.85rem;
    color: #718096;
    opacity: 0;
    animation: scroll-cue-in 1.2s ease-out 2.6s forwards;
}

.scroll-cue__line {
    width: 2px;
    height: 26px;
    background: linear-gradient(to bottom, #a0aec0, #4c51bf);
    border-radius: 999px;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.scroll-cue__line::after {
    content: "";
    position: absolute;
    top: -40%;
    left: 0;
    right: 0;
    height: 40%;
    background: #e2e8f0;
    border-radius: inherit;
    animation: scroll-cue-slide 1.6s ease-in-out 0.6s infinite;
}

@keyframes scroll-cue-in {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scroll-cue-slide {
    0% {
        transform: translateY(0);
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    70% {
        transform: translateY(140%);
        opacity: 1;
    }

    100% {
        transform: translateY(160%);
        opacity: 0;
    }
}

/* SHARED SECTION LAYOUT FOR MAIN CONTENT BLOCKS */

.poly-block,
.game-of-life {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
}

/* Text width constraint for first two sections */

.poly-text,
#reset-opacity-wrapper,
.pages-section-inner {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* POLY BLOCK */

.poly-block {
    position: relative;
    min-height: 420px;
    /* give more vertical space */
    padding: 3rem 2rem 4rem;
    /* extra bottom padding */
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    /* pull content lower */
    justify-content: center;
}

/* 3D canvas wrapper */

.poly-canvas-wrapper {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* canvas anchored toward bottom */
}

/* Make canvas larger and lower */

#poly-canvas {
    width: 120%;
    /* slightly overflow horizontally */
    max-width: none;
    /* remove previous cap */
    aspect-ratio: 16 / 9;
    height: auto;
    display: block;
    background-color: transparent;
    /* push shape down visually */
}

/* Text block on top */

.poly-text {
    position: relative;
    z-index: 1;
    border-radius: 24px;
    backdrop-filter: blur(1px);
    background-color: transparent;
}

/* GAME OF LIFE BLOCK */

.game-of-life {
    position: relative;
    overflow: hidden;
}

/* Rounded gif background layer */

.game-of-life::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url(../images/home/color_replaced_color_replaced_game-of-life-loop-cropped-ezgif.com-speed.gif);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.2;
    pointer-events: none;
    mix-blend-mode: multiply;
    border-radius: 10%;
    overflow: hidden;
}

/* Content layer */

#reset-opacity-wrapper {
    position: relative;
    z-index: 1;
    opacity: 1;
}

/* PAGE LIST */

.pages-section {
    margin-top: -40px;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
}

.pages-section h1 {
    margin-bottom: 1rem;
}

.pages-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    /* anchor for the vertical line */
}

/* Vertical git-like backbone: softer, dashed, subtle */
.pages-section ul::before {
    content: "";
    position: absolute;
    left: 0;
    transform: translateX(-35px);
    /* keep this where it worked for you */
    top: 8px;
    /* start slightly below top card */
    bottom: 8px;
    /* end slightly above bottom card */
    width: 2px;
    background: linear-gradient(to bottom,
            #d3dce6 0,
            #d3dce6 6px,
            transparent 6px,
            transparent 12px);
    background-size: 100% 12px;
    /* repeating dashed effect */
}

li.page-entry {
    display: flex;
    justify-content: center;
    margin: 8px 0;
    position: relative;
    /* anchor for node + connector */
}


/* Connector */
li.page-entry::before {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    margin-left: -34px;
    width: 36px;
    height: 1.5px;
    background: #cbd5e0;
    border-radius: 999px;
}


/* Node */
li.page-entry::after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #0e74b9;
    border: 2px solid #cbd5e0;
}

/* Cards */

.page-link {
    display: block;
    width: 80%;
    margin: 10px 0;
    padding: 20px 40px;
    text-decoration: none;
    background: #ffffff;
    color: #111;
    border: 2px solid #d9e2ec;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.coming-soon {
    background: #f0f0f0;
}

.page-link:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    background: #f7fbff;
}

.coming-soon:hover {
    transform: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    background: #f0f0f0;
}

/* Optional: hollow grey nodes for coming soon entries */
li.page-entry.page-entry--coming-soon::after {
    background: transparent;
}

h3 {
    margin: 10px 0;
    padding: 0;
}

h3 .highlight {
    color: royalblue;
}

/* FOOTER */

.footer-content {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.footer-section {
    flex: 0 1 auto;
    min-width: 0;
}

.footer-section ul {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-section--references {
    display: none;
}