@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap');

@font-face {
    font-family: 'Aeonik';
    src: url('Aeonik/Aeonik-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Aeonik';
    src: url('Aeonik/Aeonik-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Aeonik';
    src: url('Aeonik/Aeonik-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Aeonik';
    src: url('Aeonik/Aeonik-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

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

body {
    font-family: 'Aeonik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0b0b0b;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Main page specific - no scroll for carousel */
body.no-scroll {
    overflow: hidden;
    height: 100vh;
}

/* Admin page - always allow scroll */
body.admin-page {
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto !important;
}

/* Grid view - ALWAYS allow scroll with maximum priority */
body.grid-view {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: 100vh !important;
    position: relative !important;
}

/* Override ALL container restrictions in grid view */
body.grid-view .container,
body.grid-view .container.carousel-container {
    overflow: visible !important;
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
}

/* Ensure main content doesn't block scrolling */
body.grid-view .main-content {
    overflow: visible !important;
    height: auto !important;
}

/* Ensure cards grid doesn't block scrolling */
body.grid-view .cards-grid {
    overflow: visible !important;
    height: auto !important;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Carousel container specific */
.container.carousel-container {
    height: 100vh;
    overflow: hidden;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    background: linear-gradient(to bottom, rgba(11, 11, 11, 1) 0%, rgba(11, 11, 11, 0.9) 70%, transparent 100%);
    z-index: 100;
}

.view-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(255,255,255,0.05);
    padding: 4px;
    border-radius: 12px;
}

.view-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: rgba(255,255,255,0.1);
    color: #00ff88;
}

.view-btn:hover:not(.active) {
    color: rgba(255,255,255,0.9);
}

.logo {
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo-img {
    height: 64px;
    width: auto;
}

.logo-text {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.08em;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.menu-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: opacity 0.3s ease;
}

.menu-btn:hover {
    opacity: 0.7;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    min-height: calc(100vh - 8rem);
}

/* Carousel view - no scroll */
.carousel-view .main-content {
    height: 100vh;
    overflow: hidden;
}

/* Grid view - allow scroll */
.grid-view .main-content {
    overflow: visible;
    justify-content: flex-start;
    padding-bottom: 8rem;
}

.stories-carousel {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    transform-style: preserve-3d;
}

.time-indicator {
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: #00ff88;
    color: #0b0b0b;
    padding: 8px 20px;
    border-radius: 24px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    z-index: 100;
    transition: all 0.3s ease;
}

.story-card {
    position: absolute;
    width: 100%;
    padding: 3rem;
    background: linear-gradient(135deg, rgba(20,20,20,0.995) 0%, rgba(15,15,15,0.995) 100%);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37),
                inset 0 1px 0 0 rgba(255,255,255,0.1);
    opacity: 0;
    transform: translateY(100px) rotateX(-15deg) scale(0.9);
    transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.4s cubic-bezier(0.4, 0.0, 0.2, 1),
                filter 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none;
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    
    /* Optimize text rendering during animations */
    -webkit-font-smoothing: subpixel-antialiased;
    transform: translateZ(0);
}

.story-card.active {
    opacity: 1;
    transform: translateY(0) rotateX(0) scale(1);
    pointer-events: auto;
    filter: blur(0);
    z-index: 20;
    -webkit-transform: translateY(0) rotateX(0) scale(1);
}

.story-card.active.coming-forward {
    animation: comeForward 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 25;
}

.story-card.prev.falling-away {
    animation: fallAway 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 22;
}

/* Rapid navigation mode - faster animations */
.rapid-nav .story-card {
    transition: transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.rapid-nav .story-card.active.coming-forward {
    animation: comeForward 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.rapid-nav .story-card.prev.falling-away {
    animation: fallAway 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Disable conflicting animations on mobile */
@media (max-width: 768px) {
    .story-card.active.coming-forward {
        animation: none;
    }
    
    .story-card.prev.falling-away {
        animation: none;
    }
    
    /* Simplify transforms on mobile to prevent text rendering issues */
    .story-card {
        transform: translateY(100px) scale(0.95);
        -webkit-transform: translateY(100px) scale(0.95);
    }
    
    .story-card.active {
        transform: translateY(0) scale(1);
        -webkit-transform: translateY(0) scale(1);
    }
    
    .story-card.prev {
        transform: translateY(200px) scale(0.9);
        -webkit-transform: translateY(200px) scale(0.9);
        filter: none; /* Remove blur on mobile */
    }
    
    .story-card.next {
        transform: translateY(-120px) scale(0.9);
        -webkit-transform: translateY(-120px) scale(0.9);
        filter: none; /* Remove blur on mobile */
    }
    
    /* Disable 3D transforms on mobile */
    .stories-carousel {
        perspective: none;
        transform-style: flat;
    }
}

.story-card.prev {
    opacity: 0;
    transform: translateY(200px) translateZ(-100px) rotateX(-75deg) scale(1.1);
    filter: blur(4px);
    z-index: 15;
}

.story-card.next {
    opacity: 0.9;
    transform: translateY(-150px) translateZ(-50px) rotateX(15deg) scale(0.85);
    filter: blur(1px);
    z-index: 10;
}

.story-card.far-prev {
    opacity: 0;
    transform: translateY(-150px) rotateX(15deg) scale(0.85);
    z-index: 1;
    pointer-events: none;
}

.story-card.far-next {
    opacity: 0;
    transform: translateY(-150px) rotateX(15deg) scale(0.85);
    z-index: 1;
    pointer-events: none;
}

.story-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.9);
}

.story-category {
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #00ff88;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.story-category:hover {
    opacity: 0.9;
    transform: scale(1.05);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.story-date {
    color: rgba(255,255,255,0.5);
}

.story-title {
    font-size: 2.5rem;
    font-weight: 400;
    line-height: 1.3;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    color: rgba(255,255,255,1);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.story-excerpt {
    font-size: 1.125rem;
    line-height: 1.6;
    color: rgba(255,255,255,1);
    margin-bottom: 2rem;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.story-tags {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tag-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-right: 0.25rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tag-person {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.tag-person:hover {
    background: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

.tag-company {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.tag-company:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.tag-topic {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.tag-topic:hover {
    background: rgba(0, 255, 136, 0.25);
    transform: translateY(-1px);
}

.story-source {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.85);
    flex-wrap: wrap;
    gap: 2px;
}

.source-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    text-underline-offset: 2px;
    transition: color 0.2s, text-decoration-color 0.2s;
}
.source-link:hover {
    text-decoration-color: #00ff88;
    color: #00ff88;
}
.source-separator {
    opacity: 0.4;
    margin: 0 2px;
}

.navigation-controls {
    position: fixed;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 2rem;
    z-index: 100;
}

.nav-arrow {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.nav-arrow:active {
    transform: scale(0.95);
}

.story-indicators {
    display: flex;
    gap: 0.5rem;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.indicator.active {
    background: #00ff88;
    width: 24px;
    border-radius: 4px;
}

/* Link Buttons */
.story-link-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.story-link-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    transform: scale(1.1);
    border-color: #00ff88;
}

.grid-link {
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.grid-card:hover .grid-link {
    opacity: 1;
    transform: scale(1.1);
}

.expanded-link-btn {
    background: transparent;
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    transition: all 0.3s ease;
}

.expanded-link-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    transform: translateY(-1px);
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 3rem;
    background: linear-gradient(to top, rgba(11, 11, 11, 1) 0%, rgba(11, 11, 11, 0.9) 70%, transparent 100%);
    z-index: 50;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.05em;
}

@media (max-width: 768px) {
    .header {
        padding: 1rem 1rem;
        gap: 8px;
    }

    .logo-img {
        height: 36px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .logo a {
        gap: 6px;
    }

    .view-switcher {
        padding: 2px;
    }

    .view-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .story-card {
        padding: 2rem;
    }
    
    .story-title {
        font-size: 1.75rem;
    }
    
    .story-excerpt {
        font-size: 1rem;
    }
    
    .navigation-controls {
        bottom: 2rem;
    }
    
    .footer {
        padding: 1rem 1.5rem;
    }
}

/* Grid View */
.cards-grid {
    position: relative;
    padding: 120px 60px 100px;
    min-height: 100vh;
    width: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow-y: visible !important;
    overflow-x: hidden;
}

.cards-grid::-webkit-scrollbar {
    width: 10px;
}

.cards-grid::-webkit-scrollbar-track {
    background: transparent;
}

.cards-grid::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 5px;
}

.cards-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}

.cards-grid > div {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    width: 100%;
    padding-bottom: 40px;
}

.load-more-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

.load-more-btn {
    background: transparent;
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
}

.load-more-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.2);
}

.grid-card {
    background: linear-gradient(135deg, rgba(25,25,25,0.98) 0%, rgba(18,18,18,0.95) 100%);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 24px;
    backdrop-filter: blur(30px);
    box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.3),
                inset 0 1px 0 0 rgba(255,255,255,0.08);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s ease;
    cursor: pointer;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.grid-card:hover {
    transform: translateY(-8px) translateZ(0);
    box-shadow: 0 16px 48px 0 rgba(0, 0, 0, 0.4),
                inset 0 1px 0 0 rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
}

.grid-card.wide {
    grid-column: span 2;
}

.grid-card-inner {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.grid-card .story-title {
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.35;
    margin-bottom: 1.25rem;
    letter-spacing: -0.01em;
    color: rgba(255,255,255,1);
    flex: 0;
}

.grid-card.wide .story-title {
    font-size: 2rem;
    line-height: 1.3;
}

.grid-card .story-excerpt {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.75);
    margin-bottom: auto;
    font-weight: 300;
    flex: 1;
}

.grid-card.wide .story-excerpt {
    font-size: 1.05rem;
    line-height: 1.65;
}

.grid-card .story-meta {
    margin-bottom: 1.25rem;
}

.grid-card .story-source {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

@media (max-width: 768px) {
    .cards-grid {
        padding: 20px 20px 40px;
    }
    
    .cards-grid > div {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .grid-card.wide {
        grid-column: span 1;
    }
    
    .grid-card {
        min-height: 240px;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes comeForward {
    from {
        transform: translateY(-150px) translateZ(-50px) rotateX(15deg) scale(0.85);
        -webkit-transform: translateY(-150px) translateZ(-50px) rotateX(15deg) scale(0.85);
        opacity: 0.9;
    }
    to {
        transform: translateY(0) translateZ(0) rotateX(0) scale(1);
        -webkit-transform: translateY(0) translateZ(0) rotateX(0) scale(1);
        opacity: 1;
    }
}

@-webkit-keyframes comeForward {
    from {
        -webkit-transform: translateY(-150px) translateZ(-50px) rotateX(15deg) scale(0.85);
        opacity: 0.9;
    }
    to {
        -webkit-transform: translateY(0) translateZ(0) rotateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes fallAway {
    from {
        transform: translateY(0) translateZ(0) rotateX(0) scale(1);
        -webkit-transform: translateY(0) translateZ(0) rotateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(200px) translateZ(-100px) rotateX(-75deg) scale(1.1);
        -webkit-transform: translateY(200px) translateZ(-100px) rotateX(-75deg) scale(1.1);
        opacity: 0;
    }
}

@-webkit-keyframes fallAway {
    from {
        -webkit-transform: translateY(0) translateZ(0) rotateX(0) scale(1);
        opacity: 1;
    }
    to {
        -webkit-transform: translateY(200px) translateZ(-100px) rotateX(-75deg) scale(1.1);
        opacity: 0;
    }
}

/* Simplified animations for mobile */
@media (max-width: 768px) {
    @keyframes comeForward {
        from {
            transform: translateY(-120px) scale(0.9);
            opacity: 0.9;
        }
        to {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
    }
    
    @keyframes fallAway {
        from {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
        to {
            transform: translateY(150px) scale(0.95);
            opacity: 0;
        }
    }
}

/* Expanded View */
.expanded-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.expanded-view.active {
    display: block;
}

.expanded-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    animation: fadeIn 0.1s forwards;
}

.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        transparent 50%,
        rgba(0, 255, 136, 0.03) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    opacity: 1;
}

.glitch-overlay {
    display: none; /* Removed glitch effect */
}

.expanded-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    max-height: 85vh;
    background: linear-gradient(135deg, rgba(20,20,20,0.995) 0%, rgba(15,15,15,0.995) 100%);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 24px;
    backdrop-filter: blur(60px);
    -webkit-backdrop-filter: blur(60px);
    box-shadow: 0 0 100px rgba(0, 255, 136, 0.2),
                0 20px 60px rgba(0, 0, 0, 0.8),
                inset 0 0 50px rgba(0, 255, 136, 0.05);
    display: flex;
    flex-direction: row;
    opacity: 0;
    animation: expandContentFast 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.expanded-content-inner {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 3rem;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 136, 0.3) rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.expanded-content-inner::-webkit-scrollbar {
    width: 8px;
}

.expanded-content-inner::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.expanded-content-inner::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 4px;
}

.expanded-content-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}

.close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00ff88;
    transform: rotate(90deg);
}

.close-btn span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 2px;
    background: #00ff88;
    transform-origin: center;
}

.close-btn span:first-child {
    transform: translate(-50%, -50%) rotate(45deg);
}

.close-btn span:last-child {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.expanded-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: typeIn 0.15s forwards 0.1s;
}

.expanded-category {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #00ff88;
    padding: 6px 12px;
    border: 1px solid #00ff88;
    border-radius: 20px;
}

.expanded-date {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
}

.expanded-title {
    font-size: 3rem;
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 1);
    opacity: 0;
    animation: typeIn 0.15s forwards 0.15s;
}

.expanded-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    animation: typeIn 0.15s forwards 0.2s;
}

.expanded-read-time {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.expanded-body {
    margin-bottom: 3rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.expanded-excerpt {
    font-size: 1.25rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    font-weight: 300;
    opacity: 0;
    animation: typeIn 0.15s forwards 0.25s;
}

.expanded-article {
    position: relative;
    min-height: 200px;
    flex: 1;
}

.loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    opacity: 1;
}

.loading-text::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 255, 136, 0.1);
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.article-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
}

.article-content p {
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: none;
}

.article-content p.typed {
    opacity: 1;
    animation: typeLine 0.3s ease-out;
}

@keyframes typeLine {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-content .typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #00ff88;
    animation: blink 1s infinite;
    margin-left: 2px;
    vertical-align: text-bottom;
}

.related-stories {
    opacity: 0;
    animation: typeIn 0.2s forwards 0.35s;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 255, 136, 0.1);
}

.related-stories h3 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: #00ff88;
    margin-bottom: 1.5rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.related-story-card {
    background: rgba(0, 255, 136, 0.02);
    border: 1px solid rgba(0, 255, 136, 0.1);
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.related-story-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}

.related-story-card:hover {
    background: rgba(0, 255, 136, 0.05);
    border-color: rgba(0, 255, 136, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.1);
}

.related-story-card:hover::before {
    transform: translateX(100%);
}

.related-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
}

.related-category {
    color: #00ff88;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.related-source {
    color: rgba(255, 255, 255, 0.5);
}

.related-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-excerpt {
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading-related, .no-related, .error-related {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

.error-related {
    color: rgba(255, 100, 100, 0.7);
}

/* Sidebar Styles */
.expanded-sidebar {
    width: 320px;
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(15, 15, 15, 0.5);
    border-left: 1px solid rgba(0, 255, 136, 0.1);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 136, 0.2) transparent;
    max-height: 85vh;
    position: relative;
}

.expanded-sidebar::-webkit-scrollbar {
    width: 6px;
}

.expanded-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.expanded-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.2);
    border-radius: 3px;
}

.sidebar-section {
    margin-bottom: 2.5rem;
    opacity: 0;
    animation: slideInRight 0.3s forwards;
    animation-delay: 0.4s;
}

.sidebar-section:nth-child(2) { animation-delay: 0.5s; }
.sidebar-section:nth-child(3) { animation-delay: 0.6s; }
.sidebar-section:nth-child(4) { animation-delay: 0.7s; }
.sidebar-section:nth-child(5) { animation-delay: 0.8s; }

.sidebar-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #00ff88;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
}

.tag-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tag-item:hover {
    background: rgba(0, 255, 136, 0.05);
    border-color: rgba(0, 255, 136, 0.3);
    transform: translateX(4px);
}

.tag-image {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.tag-image.circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.tag-image.rectangle {
    width: 40px;
    height: 28px;
    border-radius: 4px;
}

.tag-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tag-text {
    flex: 1;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.3;
}

.simple-tag {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.simple-tag:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
    color: #00ff88;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animations */
@keyframes fadeIn {
    to { opacity: 1; }
}



@keyframes expandContent {
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes expandContentFast {
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes typeIn {
    to { opacity: 1; }
}

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

/* Mobile adjustments */
@media (max-width: 768px) {
    .expanded-content {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        flex-direction: column;
    }

    .expanded-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 120px;
        border-left: none;
        border-top: 1px solid rgba(0, 255, 136, 0.2);
        background: linear-gradient(to top, rgba(15, 15, 15, 0.98) 0%, rgba(15, 15, 15, 0.95) 100%);
        padding: 1rem 1.5rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
        align-items: flex-start;
        gap: 2rem;
        z-index: 1002;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    }

    .expanded-content-inner {
        border-right: none;
        padding: 2rem 1.5rem;
        padding-top: calc(2rem + env(safe-area-inset-top, 0px));
        padding-bottom: 140px;
        flex: 1;
        min-height: 0;
    }

    .close-btn {
        top: calc(1rem + env(safe-area-inset-top, 0px));
        right: 1rem;
    }

    .sidebar-section {
        margin-bottom: 0;
        margin-right: 2rem;
        flex-shrink: 0;
        animation: slideUp 0.3s forwards;
    }

    .sidebar-section:last-child {
        margin-right: 0;
    }

    .sidebar-section h4 {
        font-size: 0.65rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.25rem;
    }

    .tag-list {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        max-width: none;
    }

    .tag-item {
        padding: 0.375rem;
        min-width: fit-content;
    }

    .tag-image.circle {
        width: 28px;
        height: 28px;
    }

    .tag-image.rectangle {
        width: 32px;
        height: 22px;
    }

    .tag-text {
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .simple-tag {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        white-space: nowrap;
    }

    /* Horizontal scrollbar styling for mobile */
    .expanded-sidebar::-webkit-scrollbar {
        height: 4px;
        width: 4px;
    }

    .expanded-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .expanded-sidebar::-webkit-scrollbar-thumb {
        background: rgba(0, 255, 136, 0.2);
        border-radius: 2px;
    }

    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .expanded-title {
        font-size: 2rem;
    }

    .expanded-excerpt {
        font-size: 1.125rem;
    }
}

@media (min-width: 769px) {
    /* Removed animation that was causing double-flip in Safari */
    .story-card.active {
        /* animation: slideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); */
    }
}

/* Safari gets the same experience as other browsers now */

/* ==================== SWIPE FUNCTIONALITY STYLES ==================== */

/* Swipe Preview States */
.story-card.swipe-right-preview {
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.6) !important;
    border: 2px solid #4ade80;
}

.story-card.swipe-left-preview {
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.6) !important;
    border: 2px solid #ef4444;
}

/* Desktop drag cursor */
.story-card {
    cursor: grab;
    user-select: none;
}

.story-card:active {
    cursor: grabbing;
}

/* Like/Dislike Animations - Smooth Tinder-style */
@keyframes likedAnimation {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    15% {
        transform: translateX(20px) translateY(-5px) rotate(2deg) scale(1.02);
        box-shadow: 0 10px 40px rgba(74, 222, 128, 0.3);
    }
    100% {
        transform: translateX(500px) translateY(-50px) rotate(20deg) scale(0.9);
        opacity: 0;
        box-shadow: 0 20px 80px rgba(74, 222, 128, 0);
    }
}

@keyframes dislikedAnimation {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    15% {
        transform: translateX(-20px) translateY(-5px) rotate(-2deg) scale(1.02);
        box-shadow: 0 10px 40px rgba(239, 68, 68, 0.3);
    }
    100% {
        transform: translateX(-500px) translateY(-50px) rotate(-20deg) scale(0.9);
        opacity: 0;
        box-shadow: 0 20px 80px rgba(239, 68, 68, 0);
    }
}

.story-card.liked-animation {
    animation: likedAnimation 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    z-index: 1000;
}

.story-card.disliked-animation {
    animation: dislikedAnimation 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    z-index: 1000;
}

/* Swipe Indicator Overlays */
.swipe-indicator {
    position: absolute;
    top: 30px;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.swipe-indicator.like {
    right: 30px;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.4);
}

.swipe-indicator.dislike {
    left: 30px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.story-card.swipe-right-preview .swipe-indicator.like {
    opacity: 1;
}

.story-card.swipe-left-preview .swipe-indicator.dislike {
    opacity: 1;
}

/* Touch feedback for mobile */
@media (max-width: 768px) {
    .swipe-indicator {
        top: 20px;
        font-size: 16px;
        padding: 8px 16px;
    }
    
    .swipe-indicator.like {
        right: 20px;
    }
    
    .swipe-indicator.dislike {
        left: 20px;
    }
}

/* Keyboard Shortcuts Guide - Corner position with keyboard layout */
.keyboard-guide {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.keyboard-guide:hover {
    opacity: 1;
    transform: scale(1.05);
}

.keyboard-layout {
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.arrow-keys {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.key-row {
    display: flex;
    gap: 2px;
}

.key-row.top {
    margin-left: 36px; /* Center the up arrow */
}

.key-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.arrow-key {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 16px;
    color: white;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: all 0.2s ease;
}

.arrow-key:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    transform: translateY(-1px);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 3px 6px rgba(0, 0, 0, 0.4);
}

.key-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: lowercase;
    margin-top: 2px;
}

/* Highlight like/dislike keys */
.key-item:has(.arrow-key:contains("→")) .arrow-key {
    border-color: rgba(74, 222, 128, 0.3);
}

.key-item:has(.arrow-key:contains("←")) .arrow-key {
    border-color: rgba(239, 68, 68, 0.3);
}

.drag-hint {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    font-style: italic;
}

/* Hide keyboard guide on mobile */
@media (max-width: 768px) {
    .keyboard-guide {
        display: none;
    }
}

/* Hide keyboard guide in grid view */
body:has(.view-btn[data-view="grid"].active) .keyboard-guide {
    display: none;
}

/* Hamburger Menu Styles */
.menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    pointer-events: none;
    transition: all 0.3s ease;
}

.menu-drawer.open {
    pointer-events: all;
}

.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.menu-drawer.open .menu-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.menu-content {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 300px;
    background: rgba(11, 11, 11, 0.98);
    border-left: 1px solid rgba(0, 255, 136, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 3rem 2rem;
}

.menu-drawer.open .menu-content {
    transform: translateX(0);
}

.menu-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.menu-close span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 24px;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
    transform-origin: center;
    transition: all 0.3s ease;
}

.menu-close span:first-child {
    transform: translate(-50%, -50%) rotate(45deg);
}

.menu-close span:last-child {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.menu-close:hover span {
    background: #00ff88;
}

.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 4rem;
}

.menu-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    border-bottom: 1px solid transparent;
}

.menu-link:hover {
    color: #00ff88;
    border-bottom-color: rgba(0, 255, 136, 0.3);
    transform: translateX(-5px);
}

.menu-link-highlight {
    color: #00ff88;
    position: relative;
}

.menu-link-highlight::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.5; transform: translateY(-50%) scale(0.8); }
}