/**
 * CORNERSTONE Split Modal Styling
 * Privacy-First, Offline-Tolerant, CRT Terminal Aesthetic
 * Golden Ratio Layout: 19.1vh (Context) / 50vh (Story) / 30.9vh (Comments)
 * Compatible with 24+ theme system via CSS variables
 * Based on Figma AI generated design, adapted for Django
 */

/* ============================================================
   MODAL OVERLAY - Full-screen backdrop
   ============================================================ */
.article-split-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    display: none;
    /* Hidden by default, shown via JS */
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.95);
    font-family: 'Source Code Pro', 'Courier New', monospace;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Ensure modal is above all content including footer */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

.article-split-modal-overlay[data-modal-open="true"] {
    display: flex;
    opacity: 1;
}

/* ============================================================
   CRT SCANLINE EFFECT
   ============================================================ */
.crt-scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.15) 0px,
            transparent 1px,
            transparent 2px,
            rgba(0, 0, 0, 0.15) 3px);
    z-index: 10000;
}

/* ============================================================
   MODAL CONTAINER
   ============================================================ */
.article-split-modal-container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 1800px;
    max-height: 1000px;
    background: var(--crt-background);
    border: 2px solid var(--crt-border);
    box-shadow: var(--crt-glow), 0 0 40px var(--crt-shadow, rgba(0, 255, 0, 0.2));
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.article-split-modal-overlay[data-modal-open="true"] .article-split-modal-container {
    transform: scale(1);
}

/* Desktop sizing */
@media (min-width: 768px) {
    .article-split-modal-container {
        width: 95vw;
        height: 90vh;
    }
}

/* ============================================================
   HOME / CLOSE LINK (DELTA)
   ============================================================ */
.modal-home-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 50;
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.35rem;
    background: transparent;
    border: none;
    box-shadow: none;
    text-transform: none;
}

.modal-home-btn:focus-visible {
    outline: 2px solid var(--crt-primary);
    outline-offset: 2px;
}

.keyboard-shortcuts {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 50;
    color: var(--crt-text);
    text-shadow: 0 0 3px var(--crt-primary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    line-height: 1.6;
}

/* ============================================================
   SCROLL CONTAINER - Vertical desktop / Horizontal mobile
   ============================================================ */
.modal-scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--crt-primary) var(--crt-background);
}

/* Mobile: Horizontal swipe between cards */
@media (max-width: 768px) {
    .modal-scroll-container {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        /* Smooth iOS scrolling */
    }
}

/* Webkit scrollbar styling */
.modal-scroll-container::-webkit-scrollbar {
    width: 10px;
}

.modal-scroll-container::-webkit-scrollbar-track {
    background: var(--crt-background);
}

.modal-scroll-container::-webkit-scrollbar-thumb {
    background: var(--crt-primary);
    border-radius: 5px;
    box-shadow: 0 0 5px var(--crt-primary);
}

.modal-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--crt-accent, var(--crt-primary));
}

/* ============================================================
   MODAL CARDS - Base styles for all 3 cards
   ============================================================ */
.modal-card {
    scroll-snap-align: start;
    padding: 1.5rem;
    position: relative;
}

/* Mobile: Full-width horizontal cards */
@media (max-width: 768px) {
    .modal-card {
        flex: 0 0 100vw;
        /* Each card is full viewport width */
        width: 100vw;
        min-height: 100%;
        /* Fill vertical space */
        overflow-y: auto;
        /* Allow vertical scroll within card */
    }
}

/* CARD 1: Context - 19.1% of viewport height */
.modal-card-context {
    min-height: 19.1vh;
    border-bottom: 2px solid var(--crt-border);
    background: rgba(0, 0, 0, 0.3);
}

/* CARD 2: Story - 50% of viewport height */
.modal-card-story {
    min-height: 50vh;
    border-bottom: 2px solid var(--crt-border);
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
}

/* CARD 3: Comments - 30.9% of viewport height */
.modal-card-comments {
    min-height: 30.9vh;
    background: rgba(0, 0, 0, 0.3);
}

/* ============================================================
   CARD HEADERS - Corner bracket styling
   ============================================================ */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--crt-border);
    color: var(--crt-primary);
    text-shadow: 0 0 5px var(--crt-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============================================================
   CARD 1: CONTEXT STYLING
   ============================================================ */
.context-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    font-size: 12px;
}

@media (max-width: 768px) {
    .context-grid {
        grid-template-columns: 1fr;
    }
}

.context-label {
    color: var(--crt-text);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    font-size: 12px;
    opacity: 0.6;
}

/* Entity Mentions */
.entity-mentions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.entity-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: var(--crt-text);
}

.entity-item.empty {
    opacity: 0.4;
    justify-content: center;
}

.entity-name {
    color: var(--crt-text);
}

.entity-count {
    color: var(--crt-accent, var(--crt-primary));
}

/* Threat/Buzz Indicators */
.indicators {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.indicator {
    padding: 0.5rem 0.75rem;
    border: 1px solid;
    font-size: 12px;
}

.indicator-buzz {
    border-color: var(--alert-threat, #ff4500);
    background: rgba(255, 69, 0, 0.1);
}

.indicator-threat {
    border-color: var(--sentiment-bearish, red);
    background: rgba(255, 0, 0, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

.indicator-pinned {
    border-color: var(--alert-pinned, yellow);
    background: rgba(255, 255, 0, 0.1);
}

.indicator-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.indicator-buzz .indicator-content {
    color: var(--alert-threat, #ff4500);
}

.indicator-threat .indicator-content {
    color: var(--sentiment-bearish, red);
}

.indicator-pinned .indicator-content {
    color: var(--alert-pinned, yellow);
}

.indicator-svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Theme Clusters */
.theme-clusters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.theme-tag {
    padding: 0.25rem 0.5rem;
    font-size: 11px;
    text-transform: uppercase;
    border: 1px solid var(--crt-accent, var(--crt-primary));
    color: var(--crt-accent, var(--crt-primary));
    background: rgba(0, 0, 0, 0.3);
}

/* Phase 4: Trend Pulse Indicators */
.indicator-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border: 1px solid var(--crt-border-color, rgba(255, 255, 255, 0.1));
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
}

.indicator-label {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--crt-text-secondary, #888);
    text-transform: uppercase;
}

.indicator-value {
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Source Code Pro', monospace;
}

.indicator-value.threat-high,
.indicator-value.buzz-high,
.indicator-value.impact-high {
    color: var(--crt-accent-danger, #f5365c);
}

.indicator-value.threat-medium,
.indicator-value.buzz-medium,
.indicator-value.impact-medium {
    color: var(--crt-accent-warning, #fb6340);
}

.indicator-value.threat-low,
.indicator-value.buzz-low,
.indicator-value.impact-low {
    color: var(--crt-accent-success, #2dce89);
}

/* Phase 4: BERT Similarity Badges */
.bert-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: 'Source Code Pro', monospace;
}

.bert-badge.bert-high {
    background: rgba(45, 206, 137, 0.2);
    color: var(--crt-accent-success, #2dce89);
    border: 1px solid var(--crt-accent-success, #2dce89);
}

.bert-badge.bert-medium {
    background: rgba(251, 99, 64, 0.2);
    color: var(--crt-accent-warning, #fb6340);
    border: 1px solid var(--crt-accent-warning, #fb6340);
}

.bert-badge.bert-low {
    background: rgba(128, 128, 128, 0.2);
    color: var(--crt-text-secondary, #888);
    border: 1px solid var(--crt-text-secondary, #888);
}

.comment-item.comment-bert-high {
    border-left: 3px solid var(--crt-accent-success, #2dce89);
}

.comment-item.comment-bert-medium {
    border-left: 3px solid var(--crt-accent-warning, #fb6340);
}

.comment-item.comment-bert-low {
    border-left: 3px solid var(--crt-text-secondary, #888);
    opacity: 0.7;
}

.theme-tag.empty {
    opacity: 0.4;
}

/* ============================================================
   CARD 2: STORY STYLING
   ============================================================ */
.spotlight-effect {
    /* Frame the entire modal container instead of just the story card */
    position: fixed;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 80px var(--crt-shadow, rgba(0, 255, 0, 0.15));
    border: 3px solid var(--crt-primary);
    border-radius: 4px;
    z-index: 10001;
    /* Above modal content but below close button */
    opacity: 0.6;
    /* Only show when modal is open */
    display: none;
}

/* Show spotlight effect when modal is open */
.article-split-modal-overlay[data-modal-open="true"] .spotlight-effect {
    display: block;
}

.story-content {
    max-width: 56rem;
    /* ~4xl */
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.story-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--crt-border);
    gap: 1rem;
}

.story-meta {
    display: flex;
    align-items: flex-start;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 55%;
}

.story-source {
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--crt-border);
    color: var(--crt-primary);
    text-shadow: 0 0 5px var(--crt-primary);
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
    max-width: 100%;
}

.story-header-right {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 0 0 auto;
    justify-content: flex-end;
    min-width: 0;
    flex-shrink: 0;
}

.story-delta {
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.35rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.story-status-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.story-datetime {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: 'Source Code Pro', monospace;
}

.story-datetime .date-line {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--crt-text);
    line-height: 1.2;
}

.story-datetime .time-line {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--crt-text);
    line-height: 1.2;
}

.reading-progress-line {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: flex-end;
}

.reading-progress {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--crt-text);
    opacity: 0.7;
    letter-spacing: 0.05em;
    min-width: 3ch;
    text-align: right;
}

/* ============================================================
   FONT SIZE TOGGLE CONTROLS - Compact Buttons
   ============================================================ */
.font-size-controls {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    justify-content: flex-end;
}

.font-size-btn {
    background: transparent;
    border: 1px solid var(--crt-border);
    color: var(--crt-text);
    padding: 0.15rem 0.4rem;
    cursor: pointer;
    font-size: 0.65rem;
    font-family: 'Source Code Pro', monospace;
    min-width: auto;
    transition: all 0.2s ease;
    opacity: 0.7;
    line-height: 1.2;
}

.font-size-btn:hover {
    background: var(--crt-primary);
    color: var(--crt-background);
    opacity: 1;
    border-color: var(--crt-primary);
}

.font-size-btn.active {
    background: var(--crt-primary);
    color: var(--crt-background);
    opacity: 1;
    border-color: var(--crt-primary);
}

/* Font size classes for story card */
.modal-card-story[data-font-size="small"] .article-body {
    font-size: 0.875rem;  /* 14px */
    line-height: 1.6;
}

.modal-card-story[data-font-size="medium"] .article-body {
    font-size: 1rem;  /* 16px - default */
    line-height: 1.65;
}

.modal-card-story[data-font-size="large"] .article-body {
    font-size: 1.125rem;  /* 18px */
    line-height: 1.7;
}

/* ============================================================
   ENTITY HIGHLIGHTING
   ============================================================ */
.entity-mention {
    text-decoration: underline;
    text-decoration-color: var(--crt-primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    cursor: help;
    transition: all 0.2s ease;
}

.entity-mention:hover {
    background: rgba(var(--crt-primary-rgb, 0, 255, 0), 0.15);
    text-decoration-thickness: 2px;
}

.entity-tooltip {
    position: absolute;
    background: var(--crt-background);
    border: 1px solid var(--crt-primary);
    padding: 0.5rem;
    font-size: 0.75rem;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    max-width: 200px;
}

.entity-tooltip.visible {
    opacity: 1;
}

/* ============================================================
   QUICK ACTIONS BAR
   ============================================================ */
.quick-actions-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--crt-background);
    border-top: 1px solid var(--crt-border);
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(var(--crt-background-rgb, 0, 0, 0), 0.95);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    background: transparent;
    border: 1px solid var(--crt-border);
    color: var(--crt-text);
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    opacity: 0.7;
    min-width: 70px;
}

.action-btn:hover {
    background: var(--crt-primary);
    color: var(--crt-background);
    opacity: 1;
    border-color: var(--crt-primary);
}

.action-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.action-label {
    font-size: 0.7rem;
}

/* ============================================================
   MOBILE RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 768px) {
    .story-header {
        gap: 0.5rem;
    }
    
    .story-meta {
        max-width: 45%;
    }
    
    .story-source {
        font-size: 16px;
        padding: 0.2rem 0.5rem;
        line-height: 1.3;
    }
    
    .story-header-right {
        gap: 0.5rem;
    }
    
    .story-delta {
        font-size: 1rem;
        padding: 0.05rem 0.25rem;
    }
    
    .story-datetime .date-line,
    .story-datetime .time-line {
        font-size: 10px;
    }
    
    /* Slightly smaller font buttons on mobile */
    .font-size-btn {
        padding: 0.1rem 0.3rem;
        font-size: 0.6rem;
    }
    
    .font-size-controls {
        gap: 0.2rem;
    }
    
    .reading-progress {
        font-size: 10px;
    }
    
    /* Quick Actions Bar */
    .quick-actions-bar {
        flex-direction: row;
        justify-content: space-around;
        padding: 0.0rem 0rem;
        gap: 0.25rem;
    }
    
    .action-btn {
        flex: 1;
        min-width: auto;
        padding: 0.35rem 0.15rem;
    }
    
    .action-label {
        font-size: 0.65rem;
    }
    
    .action-icon {
        font-size: 1rem;
    }
}

/* ============================================================
   RELATED ARTICLES SECTION
   ============================================================ */
.modal-card-related {
    padding: 1.5rem;
    border-top: 1px solid var(--crt-border);
}

.related-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.related-articles-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.related-article-item {
    padding: 1rem;
    border: 1px solid var(--crt-border);
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.related-article-item:hover {
    border-color: var(--crt-primary);
    background: rgba(var(--crt-primary-rgb, 0, 255, 0), 0.05);
}

.related-article-title {
    font-size: 0.875rem;
    color: var(--crt-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.related-article-meta {
    font-size: 0.75rem;
    color: var(--crt-text);
    opacity: 0.6;
    display: flex;
    gap: 0.5rem;
}

.related-empty {
    text-align: center;
    padding: 2rem;
    color: var(--crt-text);
    opacity: 0.5;
    font-style: italic;
}

.article-title {
    color: var(--crt-primary);
    text-shadow: 0 0 10px var(--crt-primary);
    font-size: 24px;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.article-body {
    color: var(--crt-text);
    text-shadow: 0 0 1px var(--crt-primary);
    font-size: 16px;
    overflow-y: auto;
    max-height: 100%;
    height: 100%;
}

/* Cleaned article content styling */
.cleaned-article-content {
    color: var(--crt-text-color, var(--crt-text, #e6eef8));
    background: var(--crt-background, #000);
    font-family: 'Source Code Pro', 'Courier New', monospace;
    line-height: 1.65;
    padding: 20px;
    max-width: 100%;
    font-size: 16px;
    overflow-y: auto;
    height: 100%;
}

.cleaned-article-content h1,
.cleaned-article-content h2,
.cleaned-article-content h3,
.cleaned-article-content h4,
.cleaned-article-content h5,
.cleaned-article-content h6 {
    color: var(--crt-primary, #00ffd5);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.cleaned-article-content a {
    color: var(--crt-accent, #ffaa00);
    text-decoration: underline dotted;
}

.cleaned-article-content a:hover {
    color: var(--crt-primary, #00ffd5);
}

.cleaned-article-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
}

line-height: 1.6;
white-space: pre-wrap;
}

.story-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--crt-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    text-transform: uppercase;
}

.original-source-link {
    color: var(--crt-accent, var(--crt-primary));
    text-shadow: 0 0 5px var(--crt-accent, var(--crt-primary));
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.original-source-link:hover,
.original-source-link:focus {
    opacity: 1;
}

.tracker-free-badge {
    color: var(--crt-text);
    opacity: 0.4;
}

/* ============================================================
   CARD 3: COMMENTS STYLING
   ============================================================ */
.comments-container {
    max-width: 100%;
}

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

.comment-item {
    border-left: 2px solid;
    padding-left: 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
}

/* Sentiment-based border colors */
.comment-sentiment-bullish {
    border-left-color: var(--sentiment-bullish, #0f0);
}

.comment-sentiment-bearish {
    border-left-color: var(--sentiment-bearish, red);
}

.comment-sentiment-neutral {
    border-left-color: var(--sentiment-neutral, #888);
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comment-author {
    color: var(--crt-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sentiment-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border: 1px solid;
    font-size: 11px;
    text-transform: uppercase;
}

.sentiment-bullish {
    color: var(--sentiment-bullish, #0f0);
    border-color: var(--sentiment-bullish, #0f0);
}

.sentiment-bearish {
    color: var(--sentiment-bearish, red);
    border-color: var(--sentiment-bearish, red);
}

.sentiment-neutral {
    color: var(--sentiment-neutral, #888);
    border-color: var(--sentiment-neutral, #888);
}

.sentiment-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.comment-timestamp {
    font-size: 12px;
    color: var(--crt-text);
    opacity: 0.5;
}

.comment-content {
    color: var(--crt-text);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.comment-votes {
    margin-top: 0.5rem;
    font-size: 12px;
    color: var(--crt-accent, var(--crt-primary));
}

.comments-empty {
    text-align: center;
    padding: 3rem 0;
    color: var(--crt-text);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.4;
}

/* ============================================================
   MOBILE HORIZONTAL SWIPE INDICATORS
   ============================================================ */
@media (max-width: 768px) {

    /* Swipe indicator dots at bottom */
    .article-split-modal-container::after {
        content: '';
        position: absolute;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
        z-index: 100;
        pointer-events: none;
    }
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 768px) {
    .article-split-modal-container {
        max-width: 100vw;
        max-height: 100vh;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        /* No rounded corners on mobile */
    }

    .modal-card {
        padding: 1rem;
    }

    .modal-card-story {
        padding: 1.5rem;
    }

    .article-title {
        font-size: 20px;
    }

    .article-body {
        font-size: 14px;
    }

    .modal-home-btn {
        padding: 0.3rem;
        font-size: 1rem;
    }

    .keyboard-shortcuts {
        display: none;
        /* Hide on mobile, swipe is intuitive */
    }
}

/* ============================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================ */
.article-split-modal-overlay[aria-hidden="true"] {
    display: none !important;
}

/* Ensure modal shows when data-modal-open="true" even if aria-hidden is set */
.article-split-modal-overlay[data-modal-open="true"][aria-hidden="true"] {
    display: flex !important;
    opacity: 1 !important;
}

.article-split-modal-overlay:focus-within {
    outline: 2px solid var(--crt-primary);
    outline-offset: -4px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    .article-split-modal-container,
    .modal-scroll-container,
    .indicator-threat,
    .reading-indicator {
        animation: none;
        transition: none;
    }

    .modal-scroll-container {
        scroll-behavior: auto;
    }
}