@font-face {
    font-family: 'Sansdo';
    src: url('font/Sansdo-Regular.ttf') format('truetype'),
        url('font/Sansdo-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #e63946;
    /* Tomato Red */
    --secondary: #f4a261;
    /* Cheddar Orange */
    --tertiary: #8cb369;
    /* Lettuce Green */
    --bg-light: #fefae0;
    /* Bread Inner */
    --text-dark: #5c3a21;
    /* Crust Brown */
    --accent-blue: #e9c46a;
    /* Mustard Yellow */
    --accent-green: #d4a373;
    /* Toasted Bread */
    --steam: #1b2838;
    /* Steam Blue */
    --mal: #2e51a2;
    /* MAL official blue */
    --gd-green: #2ecc71;
    /* Geometry Dash Green */
    --gd-border: #2c3e50;
    /* Geometry Dash Border */
}

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

body {
    font-family: 'Sansdo', 'Nunito', sans-serif;
    font-weight: 600;
    letter-spacing: 0.05em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-light);
    color: var(--text-dark);
    min-height: 200vh;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
    opacity: 1;
    /* Body stays solid, background layer has opacity */
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--secondary) 2px, transparent 2px), radial-gradient(var(--secondary) 2px, transparent 2px);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    background-attachment: fixed;
    opacity: 0.95;
    z-index: -10;
    pointer-events: none;
}

h1,
h2,
h3 {
    font-family: 'Sansdo', 'Fredoka', sans-serif;
}

/* Background Blobs */
.blob-bg {
    position: fixed;
    top: -5%;
    left: -5%;
    width: 50vw;
    height: 50vw;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    background: linear-gradient(45deg, var(--accent-blue), var(--secondary));
    filter: blur(60px);
    z-index: -1;
    animation: wobble 15s infinite alternate ease-in-out;
    opacity: 0.6;
}

.blob-2 {
    top: auto;
    bottom: -5%;
    left: auto;
    right: -5%;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    background: linear-gradient(45deg, var(--primary), var(--tertiary));
    animation-delay: -7s;
}

@keyframes wobble {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    50% {
        transform: translate(10%, 5%) rotate(180deg) scale(1.1);
    }

    100% {
        transform: translate(-5%, 15%) rotate(360deg) scale(0.9);
    }
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    will-change: transform, opacity;
    pointer-events: none;
    /* Block clicking */
    user-select: none;
    /* Block highlighting */
}

.img-wrapper {
    animation: playfulHover 3s ease-in-out infinite alternate;
    will-change: transform;
    pointer-events: none;
    /* Block clicking completely */
}

#fadeImg {
    max-width: 600px;
    width: 80vw;
    will-change: transform, opacity, filter;
    filter: drop-shadow(0 15px 10px rgba(255, 71, 126, 0.3));
    transition: filter 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.img-wrapper:hover #fadeImg {
    filter: drop-shadow(0 25px 15px rgba(255, 71, 126, 0.5));
    transform: scale(1.05) rotate(3deg);
}

@keyframes playfulHover {
    0% {
        transform: translateY(0px) rotate(-2deg);
    }

    100% {
        transform: translateY(-20px) rotate(2deg);
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    font-size: 3rem;
    color: var(--primary);
    animation: playfulBounce 1.5s infinite;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    text-shadow: 2px 2px 0px white;
}

@keyframes playfulBounce {

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

    50% {
        transform: translateY(-25px) scale(1.1);
    }
}

/* Interactive Sandwich Section */
.content {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
    min-height: 80vh;
}

.sandwich-container {
    text-align: center;
    width: 100%;
}

.sandwich-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 8rem;
    color: var(--primary);
    text-shadow: 2px 2px 0px white, 4px 4px 0px rgba(0, 0, 0, 0.1);
    animation: playfulHover 3s ease-in-out infinite alternate;
}

.interactive-sandwich {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 220px;
    /* Base contracted state height */
    margin: 0 auto;
    perspective: 1000px;
    transform-style: preserve-3d;
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), margin-top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), margin-bottom 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.interactive-sandwich.expanded {
    height: var(--expanded-height, 630px);
    /* Dynamically calculated based on number of layers */
}

/* Base styles for the box image */
.hopxop {
    position: absolute;
    width: 100%;
    max-width: 500px;
    height: auto;
    left: 0;
    right: 0;
    margin: 0 auto;
    top: -20px;
    z-index: 20;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center bottom;
    pointer-events: auto;
    filter: drop-shadow(0 15px 10px rgba(0, 0, 0, 0.1));
}

.interactive-sandwich:not(.expanded) .hopxop:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 25px 15px rgba(0, 0, 0, 0.15));
    cursor: pointer;
}

/* Open lid smoothly and hide box image */
.interactive-sandwich.expanded .hopxop {
    transform: translateY(40px) scale(0.8) rotateX(-20deg);
    opacity: 0;
    visibility: hidden;
}

.layer {
    position: absolute;
    width: 100%;
    height: 50px;
    border-radius: 25px;
    left: 0;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Sansdo', 'Fredoka', sans-serif;
    font-size: 1.8rem;
    color: var(--text-dark);
    box-shadow: 0 10px 0px rgba(0, 0, 0, 0.1);
    transform-origin: center center;
    text-decoration: none;
    cursor: default;
    z-index: var(--layer-z, 1);
}

/* Contracted layer state (hidden inside box) */
.layer {
    top: 75px;
    transform: scale(0.4);
    opacity: 0;
    visibility: hidden;
}

/* Expanded layers fan out */
.interactive-sandwich.expanded .layer {
    opacity: 1;
    visibility: visible;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
    transform: scale(1);
    cursor: pointer;
    top: var(--expand-top);
}

.interactive-sandwich.expanded .bun-top,
.interactive-sandwich.expanded .bun-bottom {
    transform: scale(1.02);
}


/* Individual Layer Styles */
.bun-top {
    height: 90px;
    background: var(--bg-light) !important;
    border: 5px solid var(--text-dark);
    border-radius: 90px 90px 20px 20px;
}

.bun-bottom {
    height: 80px;
    background: var(--bg-light) !important;
    border: 5px solid var(--text-dark);
    border-radius: 20px 20px 60px 60px;
}

.link-layer {
    border: 4px solid var(--text-dark);
    cursor: pointer;
}

.link-layer.active:not(.bun-top):not(.bun-bottom) {
    transform: scale(1.05) !important;
    z-index: 15 !important;
    height: 200px !important;
    margin-top: 25px !important;
    /* Perfect spacing without moving the layers above */
    border-radius: 20px !important;
    box-shadow: 0 25px 30px rgba(0, 0, 0, 0.4) !important;

    /* Preparation for user images */
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Add a slight hover effect still so users know they can click it */
.link-layer:hover:not(.active) {
    transform: scale(1.05) !important;
    box-shadow: 0 15px 20px rgba(0, 0, 0, 0.2) !important;
}

/* Push layers below the active filling DOWN */
.link-layer.active:not(.bun-top):not(.bun-bottom)~.link-layer {
    margin-top: 200px !important;
}

/* Increase container size so bottom layers aren't cut off when pushed down */
.interactive-sandwich:has(.link-layer.active:not(.bun-top):not(.bun-bottom)) {
    height: var(--expanded-active-height, 850px);
}

/* 📸 ADD YOUR BACKGROUND IMAGES HERE 📸
   You can either add 'data-img' to the HTML tag, or define it below!
*/

.link-layer.active[data-img] {
    background-image: var(--active-bg) !important;
}

.bun-top.active {
    background-image: url('image-top-bun.jpg') !important;
}

.bun-bottom.active {
    background-image: url('image-bottom-bun.jpg') !important;
}

/* Base custom layer styles (auto-handled via HTML data-bg/color props now) */

/* Branching link text visual */
.layer-text {
    opacity: 0;
    transition: opacity 0.3s ease 0.2s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    pointer-events: none;
}

.interactive-sandwich.expanded .layer-text {
    opacity: 1;
    transform: translateX(0);
}

/* Base styles for alternating text */
.link-layer .layer-text {
    position: absolute;
    background: white;
    border: 4px dashed var(--text-dark);
    padding: 15px 30px;
    border-radius: 30px;
    color: var(--text-dark);
    pointer-events: auto;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
}

.link-layer .layer-text:hover {
    background: var(--bg-light);
}

/* Right-sided text (odd layers) */
.link-layer:nth-of-type(odd) .layer-text {
    left: 105%;
    transform: translateX(-30px);
}

/* Left-sided text (even layers) */
.link-layer:nth-of-type(even) .layer-text {
    right: 105%;
    transform: translateX(30px);
}

/* The actual layer itself (colored bar) */
.layer-visual {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    position: absolute;
    top: 0;
    left: 0;
}

/* Falling Sandwiches */
.sandwich {
    position: fixed;
    top: -10vh;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    will-change: transform;
}

@keyframes fallRight {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(120vh) rotate(360deg);
    }
}

@keyframes fallLeft {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(120vh) rotate(-360deg);
    }
}

/* --- Loading Screen --- */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Highest z-index to cover everything */
    z-index: 99999;
    transition: opacity 0.6s ease-in-out, visibility 0.6s ease-in-out;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-icon {
    font-size: 5rem;
    animation: spinSandwich 2s infinite cubic-bezier(0.68, -0.55, 0.265, 1.55);
    filter: drop-shadow(0 15px 10px rgba(0, 0, 0, 0.15));
}

@keyframes spinSandwich {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.3);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes pulseText {
    0% {
        opacity: 0.6;
        transform: scale(0.95);
    }

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

/* --- Medium Desktop/Tablet Responsiveness (Scaling) --- */
@media (max-width: 1130px) and (min-width: 769px) {
    .interactive-sandwich {
        transform: scale(0.75);
        transform-origin: top center;
    }

    .interactive-sandwich.expanded {
        margin-bottom: -100px;
    }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .content {
        padding: 4rem 1rem;
        min-height: 60vh;
    }

    .sandwich-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .interactive-sandwich {
        transform: scale(0.9);
        transform-origin: top center;
        margin-bottom: -10px;
    }

    .interactive-sandwich.expanded {
        margin-bottom: -100px;
    }

    .sandwich-title {
        font-size: 2.5rem;
        margin-bottom: 5rem;
    }


    /* Change link layer text tags to center labels on mobile */
    .link-layer .layer-text {
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto;
        /* Increase original font size to counter the scale */
        font-size: 1.5rem;
        padding: 5px 15px;
        white-space: normal;
        text-align: center;
        width: max-content;
        max-width: 90%;
        box-sizing: border-box;
        box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .gd-btn-container {
        transform: scale(0.9);
        transform-origin: top right;
    }

    /* Important: Disable the translating motion since labels are central now! */
    .interactive-sandwich:hover .layer-text,
    .interactive-sandwich.expanded .layer-text {
        transform: none !important;
    }

    /* Alternate labels odd/even transforms in original CSS need to be overridden */
    .link-layer:nth-of-type(odd) .layer-text,
    .link-layer:nth-of-type(even) .layer-text {
        transform: none !important;
    }

    .loader-sandwich {
        font-size: 4rem;
    }
}

@media (max-width: 480px) {
    .gd-btn-container {
        transform: scale(0.8);
        transform-origin: top right;
    }

    .interactive-sandwich {
        transform: scale(0.85);
        margin-bottom: -20px;
    }

    .interactive-sandwich.expanded {
        margin-bottom: -200px;
    }

    .link-layer .layer-text {
        font-size: 1.35rem;
        border: 2px dashed var(--text-dark);
        padding: 4px 10px;
    }

    #fadeImg {
        max-width: 90vw;
    }
}

/* --- Settings & Low Detail Mode (LDM) --- */
.gd-btn-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100000;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
}

.gd-btn-outer {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 9999px;
    background-color: white;
    padding: 3px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gd-btn-container:hover .gd-btn-outer {
    transform: scale(1.05);
    /* group-hover:scale-105 */
}

.gd-btn-container:active .gd-btn-outer {
    transform: scale(0.95);
    /* active:scale-95 */
}

.gd-btn-inner {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    background-color: black;
    padding: 3px;
}

.gd-btn-bg {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
}

.gd-cog-svg {
    width: 85%;
    height: 85%;
    position: relative;
    z-index: 10;
}

.settings-menu {
    position: absolute;
    top: 100px;
    right: 20px;
    z-index: 100000;
    background-color: #334499;
    /* Custom GD Blue - solid and opaque */
    border: 3px solid black;
    box-shadow: 0 0 0 3px white;
    border-radius: 15px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.2s;
    min-width: 300px;
    overflow: visible;
    isolation: isolate;
}

.settings-menu.hidden {
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-20px) scale(0);
    transition: transform 0.1s ease-in, visibility 0.1s;
}

.gd-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    z-index: 10;
}

.gd-close-btn:hover .gd-btn-outer {
    transform: scale(1.1);
}

.gd-close-btn:active .gd-btn-outer {
    transform: scale(0.9);
}

.gd-close-btn .gd-btn-outer {
    width: 40px;
    height: 40px;
    padding: 2px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.gd-close-btn .gd-btn-inner {
    padding: 2px;
}

.gd-close-btn .gd-btn-bg {
    font-family: 'Sansdo', 'Fredoka', sans-serif;
    font-size: 1.8rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.gd-menu-content {
    padding: 30px 20px;
}

.gd-checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.checkbox-label {
    font-family: 'Sansdo', 'Fredoka', sans-serif;
    font-size: 1.4rem;
    color: white;
    margin-right: 15px;
}

.gd-checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.gd-checkbox {
    height: 40px;
    width: 40px;
    background-color: #9a9a9a;
    border: 2px solid black;
    border-radius: 8px;
    box-shadow: 0 0 0 2px white;
    position: relative;
    transition: transform 0.1s;
    margin: 3px;
    /* Space for the white shadow */
}

.gd-checkbox-wrapper:hover .gd-checkbox {
    transform: scale(1.05);
}

.gd-checkbox-wrapper input:checked~.gd-checkbox {
    background-color: #9a9a9a;
    /* Keep background gray as requested */
}

/* Geometry Dash checkmark (X or Check) - GD LDM uses a big white check */
.gd-checkbox:after {
    content: "";
    position: absolute;
    display: none;
}

.gd-checkbox-wrapper input:checked~.gd-checkbox:after {
    display: block;
}

.gd-checkbox:after {
    left: 50%;
    top: 45%;
    width: 12px;
    height: 24px;
    border: solid #6bcc23;
    border-width: 0 7px 7px 0;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* --- LDM Body Effects --- */
body.ldm .blob-bg {
    display: none !important;
}

body.ldm .sandwich {
    display: none !important;
}

body.ldm .interactive-sandwich {
    transition: none !important;
}

body.ldm .layer {
    transition: top 0.2s linear !important;
    /* Flat, instant movement */
}

/* LDM UI Optimizations */
body.ldm .gd-btn-outer,
body.ldm .settings-menu {
    transition: none !important;
    transform: none !important;
}

body.ldm .gd-btn-container:hover .gd-btn-outer,
body.ldm .gd-btn-container:active .gd-btn-outer,
body.ldm .gd-close-btn:hover .gd-btn-outer,
body.ldm .gd-close-btn:active .gd-btn-outer {
    transform: none !important;
    scale: 1 !important;
}

body.ldm .settings-menu.hidden {
    opacity: 0 !important;
    display: none !important;
    /* Instant hide */
}

body.ldm #fadeImg {
    filter: none !important;
    /* Disable expensive blur on scroll */
    transition: opacity 0.3s linear !important;
}