/* ==========================================================================
   WICK NEWS - RESPONSIVE TIMELINE STYLES
   Mobile-first approach with breakpoints:
   - sm: 640px
   - md: 768px  (tablet portrait)
   - lg: 1024px (tablet landscape / small desktop)
   - xl: 1280px (desktop)
   ========================================================================== */

/* ==========================================================================
   1. BASE / MOBILE FIRST (< 640px)
   ========================================================================== */

/* Container Overrides */
.container {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Hide the decorative spine on very small screens */
@media (max-width: 639px) {
    .timeline-spine-vertical {
        display: none;
    }
}

/* Mobile Header Adjustments */
.header-filters-wrap {
    flex-direction: column;
    gap: 0.75rem;
}

.header-filter-item {
    width: 100%;
}

.header-filter-item button {
    width: 100%;
}

/* Mobile Timeline Grid - Simplified */
.timeline-grid {
    grid-template-columns: 24px 1fr;
    gap: 0;
}

/* Mobile Spine Node */
.spine-node {
    width: 10px;
    height: 10px;
    margin-left: -5px;
}

.spine-connector {
    width: 20px;
}

/* Mobile Card Styles */
.timeline-card {
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.timeline-card-title {
    font-size: 1.25rem;
    line-height: 1.1;
}

/* Mobile Progress Bar */
.progress-bar-container {
    max-width: 100%;
}

/* Mobile Expand Button */
.expand-button {
    width: 100%;
    justify-content: center;
}

/* Mobile Bundle Inner Cards */
.bundle-inner-article {
    padding: 1rem;
    margin-left: 0;
}

/* Mobile CTA Buttons */
.cta-button-group {
    flex-direction: column;
    gap: 0.75rem;
}

.cta-button-group button,
.cta-button-group a {
    width: 100%;
    justify-content: center;
}

/* Mobile Sources Grid */
.sources-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Mobile People/Avatars */
.people-grid {
    gap: 1rem;
}

.person-avatar {
    width: 3rem;
    height: 3rem;
}

/* Mobile Footer */
.site-footer-content {
    padding: 2rem 1rem;
}

/* ==========================================================================
   2. SMALL TABLETS (sm: 640px+)
   ========================================================================== */

@media (min-width: 640px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .timeline-grid {
        grid-template-columns: 32px 1fr;
    }
    
    .timeline-card {
        padding: 1.25rem;
        margin-bottom: 2rem;
    }
    
    .timeline-card-title {
        font-size: 1.5rem;
    }
    
    .header-filters-wrap {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .header-filter-item {
        width: auto;
        min-width: 140px;
    }
    
    .cta-button-group {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .cta-button-group button,
    .cta-button-group a {
        width: auto;
        flex: 1;
        min-width: 180px;
    }
    
    .sources-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   3. TABLETS PORTRAIT (md: 768px+)
   ========================================================================== */

@media (min-width: 768px) {
    .container {
        max-width: 720px;
        margin: 0 auto;
    }
    
    .timeline-grid {
        grid-template-columns: 60px 1fr;
    }
    
    .spine-node {
        width: 12px;
        height: 12px;
        margin-left: -6px;
    }
    
    .spine-connector {
        width: 50px;
    }
    
    .timeline-card {
        padding: 1.5rem;
    }
    
    .timeline-card-title {
        font-size: 1.75rem;
    }
    
    .bundle-inner-article {
        padding: 1.25rem;
    }
    
    .person-avatar {
        width: 3.5rem;
        height: 3.5rem;
    }
    
    /* Show sidebar on tablets in single column below content */
    .content-sidebar-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .sidebar-column {
        display: block;
    }
}

/* ==========================================================================
   4. TABLETS LANDSCAPE / SMALL DESKTOP (lg: 1024px+)
   ========================================================================== */

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
    
    .timeline-grid {
        grid-template-columns: 120px 1fr;
    }
    
    .spine-node {
        width: 14px;
        height: 14px;
        margin-left: -7px;
    }
    
    .spine-connector {
        width: 96px;
    }
    
    .timeline-card {
        padding: 0;
        margin-bottom: 3rem;
    }
    
    .timeline-card-title {
        font-size: 2.5rem;
    }
    
    .content-sidebar-grid {
        grid-template-columns: 1fr 280px;
        gap: 2rem;
    }
    
    .person-avatar {
        width: 3.5rem;
        height: 3.5rem;
    }
}

/* ==========================================================================
   5. DESKTOP (xl: 1280px+)
   ========================================================================== */

@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
    
    .timeline-card-title {
        font-size: 3rem;
    }
    
    .content-sidebar-grid {
        grid-template-columns: 1fr 320px;
        gap: 4rem;
    }
}

/* ==========================================================================
   6. UTILITY CLASSES FOR RESPONSIVE BEHAVIOR
   ========================================================================== */

/* Hide on mobile, show on tablet+ */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
}

/* Show on mobile, hide on tablet+ */
.show-mobile {
    display: block;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none;
    }
}

/* Mobile-friendly scrollable containers */
.scroll-x-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scroll-x-mobile::-webkit-scrollbar {
    display: none;
}

/* Touch-friendly tap targets */
@media (max-width: 1023px) {
    button,
    a,
    .tap-target {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ==========================================================================
   7. HEADER RESPONSIVE FIXES
   ========================================================================== */

/* Header base styles */
.site-header {
    position: relative;
    z-index: 100;
}

.site-header.is-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

/* Mobile hamburger menu */
.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

@media (min-width: 1024px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Header height transitions */
.header-primary {
    transition: height 0.3s ease, padding 0.3s ease;
}

/* Mobile header sizing */
@media (max-width: 639px) {
    .header-primary {
        height: 56px;
    }
    
    .header-primary.scrolled {
        height: 48px;
    }
    
    .header-logo {
        font-size: 1.25rem !important;
    }
    
    .header-logo.scrolled {
        font-size: 1.125rem !important;
    }
}

/* Tablet header sizing */
@media (min-width: 640px) and (max-width: 1023px) {
    .header-primary {
        height: 64px;
    }
    
    .header-primary.scrolled {
        height: 56px;
    }
    
    .header-logo {
        font-size: 1.5rem !important;
    }
}

/* Desktop header sizing */
@media (min-width: 1024px) {
    .header-primary {
        height: 96px;
    }
    
    .header-primary.scrolled {
        height: 72px;
    }
}

/* Slide-out menu styles */
.slide-out-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 384px;
    background: #111827;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
}

.slide-out-menu.is-open {
    transform: translateX(0);
}

/* Menu backdrop */
.menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9999;
}

.menu-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Secondary nav improvements */
.secondary-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.secondary-nav::-webkit-scrollbar {
    display: none;
}

/* Mobile: Make secondary nav full-width bleed */
@media (max-width: 639px) {
    .secondary-nav-container {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Filter tags/chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: rgba(55, 65, 81, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.6);
    border-radius: 4px;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #d1d5db;
    white-space: nowrap;
    transition: all 0.2s ease;
    cursor: pointer;
}

.filter-chip:hover {
    background: rgba(75, 85, 99, 0.8);
    border-color: rgba(107, 114, 128, 0.8);
}

.filter-chip .remove-icon {
    font-size: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.filter-chip:hover .remove-icon {
    opacity: 1;
}

/* Mobile menu nav items */
.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    color: white;
    border-radius: 0.5rem;
    transition: background 0.2s ease;
}

.mobile-nav-item:hover {
    background: rgba(55, 65, 81, 0.5);
}

.mobile-nav-item:active {
    background: rgba(55, 65, 81, 0.8);
}

.mobile-nav-item i {
    width: 1.25rem;
    text-align: center;
    color: #9ca3af;
}

/* Mobile menu form elements */
.mobile-menu select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.mobile-menu select:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Apply/Clear buttons */
.mobile-menu-apply-btn {
    display: block;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: #3B82F6;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 0.375rem;
    transition: background 0.2s ease;
}

.mobile-menu-apply-btn:hover {
    background: #2563eb;
}

.mobile-menu-apply-btn:active {
    background: #1d4ed8;
}

/* Safe area padding for mobile menu */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-menu-footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* ==========================================================================
   8. TIMELINE SPECIFIC RESPONSIVE ADJUSTMENTS
   ========================================================================== */

/* Mobile: Simplify the spine visual */
@media (max-width: 767px) {
    /* Thinner spine line */
    .spine-line {
        width: 2px;
        left: 11px;
    }
    
    /* Smaller connection dots */
    .spine-dot {
        width: 8px;
        height: 8px;
    }
    
    /* Reduce timeline card left padding */
    .timeline-content {
        padding-left: 1.5rem;
    }
    
    /* Stack metrics vertically on very small screens */
    .metrics-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Full width progress bar */
    .progress-bar-wrap {
        max-width: 100%;
        width: 100%;
    }
    
    /* Move icons below progress bar */
    .metric-icons {
        margin-top: 0.5rem;
        justify-content: flex-end;
        width: 100%;
    }
}

/* Tablet: Balanced spine */
@media (min-width: 768px) and (max-width: 1023px) {
    .spine-line {
        width: 2px;
        left: 29px;
    }
    
    .timeline-content {
        padding-left: 3rem;
    }
}

/* ==========================================================================
   9. BUNDLE CARD RESPONSIVE
   ========================================================================== */

/* Mobile bundle cards */
@media (max-width: 767px) {
    .bundle-card {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    
    .bundle-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .bundle-event-title {
        font-size: 1.5rem;
    }
    
    .bundle-expand-btn {
        width: 100%;
        margin-top: 1rem;
    }
    
    .bundle-inner-list {
        margin-top: 1rem;
    }
    
    .bundle-inner-article {
        margin-left: 0;
        border-left-width: 3px;
        padding: 0.75rem;
    }
    
    .bundle-inner-title {
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   10. SINGLE ARTICLE PAGE RESPONSIVE
   ========================================================================== */

/* Mobile: Stack everything vertically */
@media (max-width: 767px) {
    .article-layout {
        grid-template-columns: 1fr;
    }
    
    /* Hide the decorative left rail on mobile */
    .article-left-rail {
        display: none;
    }
    
    .article-content {
        padding-left: 0;
    }
    
    .article-title {
        font-size: 1.75rem;
    }
    
    .article-sidebar {
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    
    /* Analysis view buttons */
    .analysis-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .analysis-btn {
        width: 100%;
    }
    
    /* Video embed responsive */
    .video-embed {
        border-radius: 0.5rem;
    }
}

/* Tablet: Two-column with narrower sidebar */
@media (min-width: 768px) and (max-width: 1023px) {
    .article-layout {
        grid-template-columns: 40px 1fr;
    }
    
    .article-left-rail {
        display: block;
    }
    
    .article-content-grid {
        grid-template-columns: 1fr;
    }
    
    .article-sidebar {
        margin-top: 2rem;
    }
    
    .article-title {
        font-size: 2rem;
    }
}

/* Desktop: Full layout */
@media (min-width: 1024px) {
    .article-layout {
        grid-template-columns: 120px 1fr;
    }
    
    .article-content-grid {
        grid-template-columns: 1fr 300px;
        gap: 2rem;
    }
    
    .article-title {
        font-size: 2.25rem;
    }
}

/* ==========================================================================
   11. ANALYSIS VIEW (Contradictions/Reiterations) RESPONSIVE
   ========================================================================== */

/* Mobile: Hide timeline nodes, show simple list */
@media (max-width: 767px) {
    .analysis-timeline-nodes {
        display: none;
    }
    
    .analysis-content {
        padding-left: 0;
    }
    
    /* Mobile navigation for analysis items */
    .analysis-nav-mobile {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding: 1rem 0;
        margin-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .analysis-nav-item {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 9999px;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .analysis-nav-item.active {
        background: #1e293b;
        color: white;
        border-color: #1e293b;
    }
}

/* Tablet: Show simplified nodes */
@media (min-width: 768px) and (max-width: 1023px) {
    .analysis-timeline-nodes {
        display: block;
    }
    
    .analysis-node-label {
        display: none;
    }
    
    .analysis-connector {
        width: 60px;
    }
}

/* ==========================================================================
   12. TYPOGRAPHY RESPONSIVE SCALING
   ========================================================================== */

/* Fluid typography for headings */
.heading-xl {
    font-size: clamp(1.5rem, 5vw, 3rem);
    line-height: 1;
}

.heading-lg {
    font-size: clamp(1.25rem, 4vw, 2.5rem);
    line-height: 1;
}

.heading-md {
    font-size: clamp(1rem, 3vw, 1.75rem);
    line-height: 1.1;
}

/* Body text scaling */
.body-text {
    font-size: clamp(0.875rem, 2vw, 1rem);
    line-height: 1.7;
}

/* Caption/meta text */
.caption-text {
    font-size: clamp(0.625rem, 1.5vw, 0.75rem);
}

/* ==========================================================================
   13. SPACING RESPONSIVE UTILITIES
   ========================================================================== */

/* Responsive section padding */
.section-padding {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

@media (min-width: 768px) {
    .section-padding {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
}

@media (min-width: 1024px) {
    .section-padding {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }
}

/* Responsive gaps */
.responsive-gap {
    gap: 1rem;
}

@media (min-width: 768px) {
    .responsive-gap {
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .responsive-gap {
        gap: 2rem;
    }
}

/* ==========================================================================
   14. TOUCH & INTERACTION IMPROVEMENTS
   ========================================================================== */

/* Larger touch targets on mobile */
@media (max-width: 1023px) {
    .touch-target {
        position: relative;
    }
    
    .touch-target::after {
        content: '';
        position: absolute;
        top: -8px;
        right: -8px;
        bottom: -8px;
        left: -8px;
    }
}

/* Remove hover effects on touch devices */
@media (hover: none) {
    .hover-effect:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Active state for touch */
@media (hover: none) {
    .touch-active:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* ==========================================================================
   15. SAFE AREA INSETS (for notched devices)
   ========================================================================== */

@supports (padding: max(0px)) {
    .safe-area-inset {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .safe-area-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ==========================================================================
   16. PRINT STYLES (for completeness)
   ========================================================================== */

@media print {
    .no-print,
    .site-header,
    .site-footer,
    .advertisement,
    .expand-button,
    .cta-button-group {
        display: none !important;
    }
    
    .timeline-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
        background: white;
    }
}
