/* ============================================
   Long Island Today - Enhancement Styles
   Dark Mode, Print, Microinteractions
   ============================================ */

/* ============================================
   MICROINTERACTIONS & ANIMATIONS
   ============================================ */

/* Button Scale Effect */
.btn {
    transform: translateY(0);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-2px) scale(1.02);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

/* Card Lift Effect */
.event-card,
.news-card,
.voting-card,
.feature-card,
.membership-card,
.restaurant-card,
.related-card,
.similar-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease;
}

.event-card:hover,
.news-card:hover,
.feature-card:hover,
.related-card:hover,
.similar-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(232, 106, 51, 0.1);
}

/* Link Underline Animation */
.nav-link,
.footer-links a,
.see-all,
.see-all-link {
    position: relative;
}

.nav-link::after,
.see-all::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after,
.see-all:hover::after {
    width: 100%;
}

/* Image Zoom on Hover */
.event-image img,
.news-image img,
.restaurant-image img,
.gallery-item img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.event-card:hover .event-image img,
.news-card:hover .news-image img,
.restaurant-card:hover .restaurant-image img,
.gallery-item:hover img {
    transform: scale(1.08);
}

/* Input Focus Animation */
input[type="text"],
input[type="email"],
input[type="search"],
textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
textarea:focus {
    transform: scale(1.01);
}

/* Social Link Bounce */
.social-links a {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.social-links a:hover {
    transform: translateY(-4px) scale(1.1);
}

/* Badge Pulse */
.event-badge,
.news-category,
.restaurant-badge {
    transition: transform 0.2s ease;
}

.event-card:hover .event-badge,
.news-card:hover .news-category {
    transform: scale(1.05);
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-200) 0%,
        var(--gray-100) 50%,
        var(--gray-200) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Loading Button State */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Smooth Page Transitions */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* ============================================
   MOBILE MENU ENHANCEMENTS
   ============================================ */

/* Hamburger Animation */
.mobile-menu-btn {
    position: relative;
    z-index: 101;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--gray-700);
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Nav Slide-in */
.mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 320px;
    background: var(--white);
    padding: 100px 32px 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 99;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
}

.mobile-nav.active {
    transform: translateX(0);
}

/* Mobile Nav Links Animation */
.mobile-nav .nav-link {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s ease;
}

.mobile-nav.active .nav-link {
    opacity: 1;
    transform: translateX(0);
}

.mobile-nav.active .nav-link:nth-child(1) { transition-delay: 0.1s; }
.mobile-nav.active .nav-link:nth-child(2) { transition-delay: 0.15s; }
.mobile-nav.active .nav-link:nth-child(3) { transition-delay: 0.2s; }
.mobile-nav.active .nav-link:nth-child(4) { transition-delay: 0.25s; }
.mobile-nav.active .nav-link:nth-child(5) { transition-delay: 0.3s; }

.mobile-nav .btn {
    margin-top: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease 0.35s, transform 0.3s ease 0.35s;
}

.mobile-nav.active .btn {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile Nav Backdrop */
.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

.mobile-nav-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --white: #0a0a0a;
        --gray-50: #171717;
        --gray-100: #1f1f1f;
        --gray-200: #2a2a2a;
        --gray-300: #404040;
        --gray-400: #737373;
        --gray-500: #a3a3a3;
        --gray-600: #d4d4d4;
        --gray-700: #e5e5e5;
        --gray-800: #f5f5f5;
        --gray-900: #fafafa;
        --black: #ffffff;
        
        --primary-light: #1a0f0a;
        --primary-lighter: #140b07;
    }
    
    body {
        background: #0a0a0a;
        color: #f5f5f5;
    }
    
    /* Header Dark Mode */
    .header {
        background: #0a0a0a;
        border-color: #2a2a2a;
    }
    
    /* Cards Dark Mode */
    .event-card,
    .news-card,
    .sidebar-card,
    .feature-card,
    .membership-card {
        background: #171717;
        border-color: #2a2a2a;
    }
    
    /* Hero Dark Mode */
    .hero {
        background: linear-gradient(135deg, #171717 0%, #1a0f0a 100%);
    }
    
    /* Footer Dark Mode */
    .footer {
        background: #0a0a0a;
        border-top: 1px solid #2a2a2a;
    }
    
    /* Newsletter Dark Mode */
    .newsletter-section {
        background: linear-gradient(135deg, #d35a24 0%, #b45309 100%);
    }
    
    .newsletter-input {
        background: #171717;
        color: #f5f5f5;
        border-color: #404040;
    }
    
    .newsletter-input::placeholder {
        color: #737373;
    }
    
    /* Voting Section Dark Mode */
    .voting-section {
        background: linear-gradient(135deg, #0a0a0a 0%, #171717 100%);
    }
    
    /* Input Dark Mode */
    input[type="text"],
    input[type="email"],
    input[type="search"],
    textarea {
        background: #171717;
        color: #f5f5f5;
        border-color: #404040;
    }
    
    input:focus,
    textarea:focus {
        border-color: var(--primary);
    }
    
    /* Scrollbar Dark Mode */
    ::-webkit-scrollbar {
        width: 10px;
    }
    
    ::-webkit-scrollbar-track {
        background: #171717;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #404040;
        border-radius: 5px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #525252;
    }
    
    /* Logo Inversion */
    .header .logo img,
    .footer-logo img {
        filter: brightness(0) invert(1);
    }
    
    /* Image Overlays */
    .event-image::after,
    .news-image::after,
    .article-hero::before,
    .event-hero::before,
    .restaurant-hero::before {
        background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 100%);
    }
    
    /* Stats Bar */
    .stats-bar {
        background: #171717;
    }
    
    .stats-bar::before {
        opacity: 0.3;
    }
    
    /* Mobile Nav Dark Mode */
    .mobile-nav {
        background: #0a0a0a;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    }
    
    .mobile-nav .nav-link {
        border-color: #2a2a2a;
    }
    
    /* Skeleton Dark Mode */
    .skeleton {
        background: linear-gradient(
            90deg,
            #2a2a2a 0%,
            #404040 50%,
            #2a2a2a 100%
        );
        background-size: 200% 100%;
    }
    
    /* Selection */
    ::selection {
        background: rgba(232, 106, 51, 0.3);
        color: #f5f5f5;
    }
}

/* Dark Mode Toggle Button (Manual Override) */
.dark-mode-toggle {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gray-800);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 90;
    transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}

/* Smooth Color Transitions for Dark Mode */
body,
.header,
.footer,
.event-card,
.news-card,
.sidebar-card,
.mobile-nav,
input,
textarea {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ============================================
   PRINT STYLESHEET
   ============================================ */

@media print {
    /* Hide non-essential elements */
    .header,
    .mobile-nav,
    .mobile-nav-backdrop,
    .scroll-top,
    .newsletter-section,
    .voting-section,
    .tiktok-section,
    .footer,
    .btn,
    .share-bar,
    .share-buttons,
    .related-events,
    .related-articles,
    .similar-restaurants,
    .sidebar-card:has(.vote-card),
    .dark-mode-toggle,
    .page-loading,
    video,
    audio,
    iframe {
        display: none !important;
    }
    
    /* Reset backgrounds and colors */
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    /* Links */
    a {
        text-decoration: underline;
        color: #000 !important;
    }
    
    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666 !important;
    }
    
    /* Images */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
    
    /* Headings */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }
    
    h1 { font-size: 24pt; }
    h2 { font-size: 18pt; }
    h3 { font-size: 14pt; }
    
    /* Paragraphs */
    p {
        orphans: 3;
        widows: 3;
    }
    
    /* Page breaks */
    .event-card,
    .news-card,
    article,
    section {
        page-break-inside: avoid;
    }
    
    /* Article specific */
    .article-body {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .article-body p {
        font-size: 12pt !important;
        line-height: 1.6 !important;
    }
    
    .article-hero,
    .event-hero,
    .restaurant-hero {
        height: auto !important;
        position: relative !important;
        padding: 20px 0 !important;
    }
    
    .article-hero::before,
    .event-hero::before,
    .restaurant-hero::before {
        display: none !important;
    }
    
    .article-hero-content,
    .event-hero-content,
    .restaurant-hero-content {
        position: relative !important;
        padding: 0 !important;
        color: black !important;
    }
    
    /* Container */
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    /* Sidebar */
    .event-detail-grid,
    .restaurant-detail-grid {
        display: block !important;
    }
    
    .event-sidebar,
    .restaurant-sidebar {
        margin-top: 20px !important;
        page-break-before: always;
    }
    
    /* Print header */
    @page {
        margin: 2cm;
        @top-center {
            content: "Long Island Today";
            font-size: 10pt;
            color: #666;
        }
        @bottom-center {
            content: counter(page);
            font-size: 10pt;
        }
    }
    
    /* First page */
    @page :first {
        @top-center {
            content: none;
        }
    }
    
    /* Breadcrumb */
    .breadcrumb {
        border: none !important;
        padding: 10px 0 !important;
    }
    
    /* Gallery */
    .gallery-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .gallery-item {
        break-inside: avoid;
    }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus indicators */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 1000;
    padding: 16px 24px;
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 16px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .mobile-nav {
        transition: none !important;
    }
    
    .mobile-nav .nav-link {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary: #c44500;
    }
    
    .btn-primary {
        border: 2px solid currentColor;
    }
    
    .event-card,
    .news-card {
        border: 2px solid var(--gray-800);
    }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   Focus states, keyboard navigation, ARIA
   ============================================ */

/* Global Focus Visible Styles */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Enhanced Button Focus */
.btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(232, 106, 51, 0.2);
}

.btn-primary:focus-visible {
    outline-color: var(--white);
    box-shadow: 0 0 0 3px var(--primary), 0 0 0 6px rgba(232, 106, 51, 0.3);
}

/* Card Focus Styles */
.event-card:focus-within,
.news-card:focus-within,
.restaurant-card:focus-within,
.voting-card:focus-within,
.guide-card:focus-within,
.article-card:focus-within {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    transform: translateY(-4px);
}

/* Link Focus in Cards */
.event-card a:focus-visible,
.news-card a:focus-visible,
.article-card a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Navigation Focus */
.nav-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 4px;
}

.mobile-nav .nav-link:focus-visible {
    outline-color: var(--primary);
    background: var(--primary-lighter);
}

/* Form Input Focus */
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible,
.search-input:focus-visible,
.newsletter-input:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(232, 106, 51, 0.15);
}

/* FAQ Accordion Focus */
.faq-question:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: var(--primary-lighter);
}

/* Filter/Tag Button Focus */
.filter-tag:focus-visible,
.filter-btn:focus-visible,
.month-btn:focus-visible,
.faq-nav-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Pagination Focus */
.page-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    background: var(--primary-lighter);
}

/* Social Link Focus */
.social-links a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    transform: translateY(-2px);
}

/* Logo Focus */
.logo:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 8px;
}

/* Mobile Menu Button Focus */
.mobile-menu-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Scroll to Top Focus */
.scroll-top:focus-visible {
    outline: 3px solid var(--white);
    outline-offset: 3px;
}

/* Image/Media Focus (for keyboard users) */
.event-image a:focus-visible,
.news-image a:focus-visible,
.article-image a:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
}

/* Keyboard Skip Navigation Enhancement */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: 16px 24px;
    background: var(--primary);
    color: var(--white);
    font-weight: 700;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: none;
}

/* Tab Focus Order Indicator */
[tabindex]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Interactive Element Minimum Size */
.btn,
.nav-link,
.social-links a,
.filter-tag,
.page-btn,
.mobile-menu-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Ensure visible text labels */
[aria-label]:focus-visible::after {
    content: attr(aria-label);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
}

/* Screen Reader Only Text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Visible on Focus (for skip links) */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Loading State Accessibility */
[aria-busy="true"] {
    cursor: wait;
}

[aria-busy="true"]::after {
    content: " Loading...";
    position: absolute;
    clip: rect(0, 0, 0, 0);
}
