/* ══════════════════════════════════════════════════════════════
   MLP - HIGH CONTRAST RIBBON THEME
   ★ BLACK & WHITE ★ 
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    /* High Contrast Palette */
    --bg-color: #000000;
    --text-color: #ffffff;
    --card-bg: #111111;
    --card-border: #ffffff;

    /* Typography */
    --font-main: 'Courier Prime', 'Courier New', monospace;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ════ MOVING RIBBON FRAME ════ */
.ribbon-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.ribbon-strip {
    position: absolute;
    background: #ffffff;
    color: #000000;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid #000;
}

.ribbon-top,
.ribbon-bottom {
    width: 100%;
    height: 24px;
    left: 0;
}

.ribbon-top {
    top: 10px;
    transform: rotate(-0.5deg);
}

.ribbon-bottom {
    bottom: 10px;
    transform: rotate(0.5deg);
}

.ribbon-left,
.ribbon-right {
    width: 24px;
    height: 100%;
    top: 0;
    flex-direction: column;
}

.ribbon-left {
    left: 10px;
    transform: rotate(0.5deg);
}

.ribbon-right {
    right: 10px;
    transform: rotate(-0.5deg);
}

/* Moving Text Animation */
.ribbon-text-track {
    white-space: nowrap;
    animation: scroll-ribbon 10s linear infinite;
    padding-left: 100%;
}

.ribbon-vertical .ribbon-text-track {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding-top: 100%;
    padding-left: 0;
}

@keyframes scroll-ribbon {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Corner Bows */
.corner-bow {
    position: fixed;
    font-size: 40px;
    z-index: 10000;
    filter: drop-shadow(2px 2px 0 #fff);
}

.bow-tl {
    top: -5px;
    left: -5px;
    transform: rotate(-15deg);
}

.bow-tr {
    top: -5px;
    right: -5px;
    transform: rotate(15deg);
}

.bow-bl {
    bottom: -5px;
    left: -5px;
    transform: rotate(-105deg);
}

.bow-br {
    bottom: -5px;
    right: -5px;
    transform: rotate(105deg);
}

/* ════ HEADER ════ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 60px 40px 20px;
    border-bottom: 2px solid #fff;
    margin: 0 40px;
}

.logo-img {
    height: 40px;
    filter: grayscale(100%) invert(1);
}

.nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
}

.nav-link:hover,
.nav-link.active {
    text-decoration: underline;
}

.header-stats {
    font-size: 12px;
}

/* ════ B&W GALLERY GRID ════ */
.gallery-section {
    padding: 60px 40px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

body {
    text-align: center;
    /* Global Centering */
}

.nft-card {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    padding: 0;
    /* Remove padding for full bleed */
    position: relative;
    aspect-ratio: 4 / 5;
    /* 0.8 Aspect Ratio (2000x2500) */
    overflow: hidden;
    transition: transform 0.2s;
}

.nft-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 4px 4px 0 #ffffff;
}

.nft-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    /* restoring overlay */
    top: 0;
    left: 0;
    /* image-rendering: pixelated; Removed to improve high-res ASCII quality */
}

/* Layering for Reveal */
.ascii-image {
    z-index: 1;
    /* Bottom layer - always visible */
    filter: grayscale(100%) contrast(1.2);
}

.original-image {
    z-index: 2;
    /* Top layer - hidden by default, revealed by clip-path */
    clip-path: circle(0% at 50% 50%);
    /* Start hidden */
    transition: clip-path 0.1s ease;
    /* Smooth movement */
    opacity: 1 !important;
    /* Ensure visibility for clip-path */
}

/* Hover Reveal Logic - JS handles clip-path on .original-image */
/* .nft-card:hover .ascii-image { opacity: 0; } REMOVED to prevent full reveal */

/* Info Text */
.nft-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px;
    font-size: 10px;
    text-transform: uppercase;
    z-index: 10;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.nft-card:hover .nft-card-info {
    transform: translateY(0);
}

.card-ribbon-wrapper {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 20px;
    z-index: 10;
}

/* ════ LOAD MORE ════ */
.load-more-container {
    text-align: center;
    margin-top: 40px;
}

.load-more-btn {
    background: #000;
    color: #fff;
    border: 2px solid #fff;
    padding: 10px 20px;
    font-family: var(--font-main);
    cursor: pointer;
    font-size: 16px;
}

.load-more-btn:hover {
    background: #fff;
    color: #000;
}

/* ════ FOOTER ════ */
.footer {
    padding: 40px;
    text-align: center;
    border-top: none;
    /* Removed Divider */
    margin: 0 40px 40px;
}

.footer-ascii {
    font-family: monospace;
    white-space: pre;
    overflow: hidden;
    /* Hide overflow on small screens */
    width: 100%;
    margin-bottom: 20px;
    color: #fff;
    text-align: center;
    /* Ensure centered */
    display: flex;
    justify-content: center;
}

.footer-links {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-link {
    color: #fff;
    text-decoration: none;
}

/* ════ MLPIFY B&W STYLES ════ */
.mlpify-section {
    padding: 60px 20px;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.upload-area {
    border: 2px dashed #ffffff;
    padding: 60px;
    margin: 40px 0;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover,
.upload-area.drag-over {
    background: #ffffff;
    color: #000000;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.upload-text {
    font-weight: bold;
    font-size: 18px;
}

.rate-limit-info {
    margin: 20px 0;
    font-size: 14px;
    border: 1px solid #333;
    padding: 10px;
    display: inline-block;
}

/* Color Selection */
.color-selection {
    margin: 40px 0;
    border: 1px solid #333;
    padding: 20px;
}

.color-presets {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.preset-btn {
    background: #000;
    color: #fff;
    border: 1px solid #fff;
    padding: 8px 16px;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover,
.preset-btn.active {
    background: #fff;
    color: #000;
}

.custom-colors {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
}

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Preview Area */
.preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.preview-box img,
.converted-preview img {
    max-width: 100%;
    max-height: 400px;
    border: 2px solid #ffffff;
    display: block;
}

.arrow {
    font-size: 40px;
}

/* Actions */
.mlpify-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.action-btn {
    background: #000;
    color: #fff;
    border: 2px solid #fff;
    padding: 15px 30px;
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
}

.action-btn:hover:not(:disabled) {
    background: #fff;
    color: #000;
}

.action-btn:disabled {
    border-color: #555;
    color: #555;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        padding: 20px;
        margin: 0;
        gap: 10px;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .gallery-section {
        padding: 40px 20px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    /* Keep ribbons visible but maybe scale down or safer inset */
    .ribbon-top {
        top: 0;
        width: 100%;
        transform: none;
    }

    .ribbon-bottom {
        bottom: 0;
        width: 100%;
        transform: none;
    }

    /* Force side ribbons on mobile */
    .ribbon-left,
    .ribbon-right {
        display: flex !important;
        height: 100%;
        width: 20px;
    }

    .ribbon-left {
        left: 0;
        transform: none;
    }

    .ribbon-right {
        right: 0;
        transform: none;
    }

    /* Hide sides on mobile to prevent overflow/touch issues - DISABLED, showing all sides */

    .corner-bow {
        font-size: 24px;
    }

    /* Smaller bows */
}

/* ════ HEADER & MEME TOOLS ════ */
.header {
    display: flex;
    flex-direction: column;
    /* Stack logo and tools */
    align-items: center;
    padding: 20px;
    border-bottom: none;
    /* Removed white border */
    margin: 0;
    gap: 0;
    /* Reset */
}

.logo-img {
    height: 60px;
    filter: invert(1);
    /* Ensure visibility on black */
    margin-bottom: 30px;
}

.meme-tools-section {
    border: 2px solid #ffffff;
    /* White Border */
    background: #000;
    padding: 20px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    /* Center the box */
}

.meme-tools-title {
    color: #ffffff;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    /* Center buttons */
}

.nav-link {
    display: block;
    width: 100%;
    /* Default width */
    box-sizing: border-box;
    /* Prevent padding form increasing width */
    border: 2px solid #fff;
    color: #fff;
    text-align: center;
    padding: 15px;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #fff;
    color: #000;
    text-decoration: none;
}

/* ════ ABOUT SECTION CENTER FIX ════ */
.about-section {
    padding: 60px 20px;
    text-align: center;
    /* Center content */
    max-width: 800px;
    margin: 0 auto;
}

.about-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
    flex-wrap: wrap;
    /* Fix mobile */
}

/* ════ FOOTER MOBILE FIX ════ */
.footer-links {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    /* Allow wrapping on mobile */
}

/* Ensure footer text doesn't overflow */
.footer-text {
    word-wrap: break-word;
}

/* Mobile Adjustments for MLPIFY TOOLS */
@media (max-width: 480px) {
    .meme-tools-section {
        max-width: 250px;
        /* Reduce width on mobile to shorten buttons */
    }

    /* MLPIFY Page Mobile Optimizations */
    .preview-container {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .preview-box {
        flex: 1;
        width: 48%;
        /* Ensure they share width */
    }

    .preview-title {
        font-size: 12px;
        /* Smaller title */
        margin-bottom: 5px;
    }

    .preview-box img,
    .converted-preview img {
        max-height: 150px;
        /* Reduce height further to fit side-by-side */
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    .arrow {
        display: none;
        /* Hide arrow to save space */
    }

    .mlpify-actions {
        flex-direction: column;
        /* Stack buttons */
        gap: 10px;
        align-items: stretch;
        /* Full width */
        padding: 0 20px;
    }

    .action-btn,
    .preset-btn {
        padding: 12px;
        font-size: 14px;
        width: 100%;
        /* Full width buttons */
    }

    .upload-area {
        padding: 30px 20px;
    }

    .upload-icon {
        font-size: 32px;
    }
}

/* ════ CHAOS MODE EASTER EGG ════ */
#dontClickMeBtn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    padding: 0;
    margin-left: 10px;
}

#dontClickMeBtn:hover {
    color: #ff0000;
    text-shadow: 2px 2px 0px #fff;
    transform: scale(1.1);
}

.chaos-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
    display: none;
}

.chaos-container.active {
    display: block;
}

.ribbon-chaos {
    position: absolute;
    background: #000;
    color: #fff;
    white-space: nowrap;
    font-family: var(--font-header);
    font-size: 20px;
    padding: 5px;
    border: 1px solid #fff;
    opacity: 0.8;
}

.running-character {
    position: absolute;
    z-index: 10000;
    height: 150px;
    width: auto;
    mix-blend-mode: lighten;
    /* Switch to lighten for sharper cut */
    filter: contrast(1.5) brightness(0.8);
    /* Crush darks to black */
}

.blink-chaos {
    animation: blink-chaos 0.1s infinite;
}

@keyframes blink-chaos {
    0% {
        opacity: 1;
        filter: invert(0);
    }

    50% {
        opacity: 0;
        filter: invert(1);
    }

    100% {
        opacity: 1;
        filter: invert(0);
    }
}

@keyframes runAcross {
    from {
        transform: translateX(110vw);
    }

    to {
        transform: translateX(-50vw);
    }
}

@keyframes runAcrossReverse {
    from {
        transform: translateX(-50vw) scaleX(-1);
    }

    to {
        transform: translateX(110vw) scaleX(-1);
    }
}