/* ==========================================================================
   HORIZON CSS - v8.6.2 Solaris Expanse
   Temporal Bar, Layout, Cards, Destined Highlight + Safe Area Support
   ========================================================================== */

/* ==========================================================================
   1. PAGE LAYOUT
   ========================================================================== */
.horizon-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

#page-horizon .timeline-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--bg-main);
    display: block;
    box-sizing: border-box;
    width: 100%;
}

#horizon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    align-items: start;
    width: 100%;
}

/* ==========================================================================
   2. TEMPORAL BAR
   ========================================================================== */
.temporal-bar {
    display: none;
    width: 80px;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    overflow-y: auto;
    scrollbar-width: none;
    background: rgba(250, 252, 234, 0.9) !important;
    border-right: 1px solid var(--border);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}
.temporal-bar::-webkit-scrollbar { display: none; }

@media (prefers-color-scheme: dark) {
    .temporal-bar { background: rgba(13, 17, 23, 0.85) !important; }
}

/* ==========================================================================
   3. TIME MARKERS
   ========================================================================== */
.time-marker {
    font-size: 10px;
    color: var(--text-muted);
    padding: 8px 4px;
    cursor: pointer;
    text-align: center;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}
.time-marker:hover {
    color: var(--accent);
    background: rgba(184, 134, 11, 0.05);
    border-right: 3px solid var(--accent);
}
.time-marker.active {
    color: var(--accent) !important;
    font-weight: bold;
    background: rgba(184, 134, 11, 0.15);
    border-right: 3px solid var(--accent);
}
.time-marker[data-label="Today"] {
    color: #ef4444;
    font-weight: bold;
    border-left: 2px solid transparent;
}
.time-marker[data-label="Today"]::before {
    content: "●";
    margin-right: 5px;
    font-size: 8px;
    vertical-align: middle;
}
.time-marker[data-label="Today"].active {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.15);
    border-right: 3px solid #ef4444;
}

/* ==========================================================================
   4. HORIZON CARDS
   ========================================================================== */
#page-horizon .timeline-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 250px;
    height: auto;
    width: 100%;
    margin: 0;
    padding: 15px;
    box-sizing: border-box;
}

#page-horizon .prediction-header-grid {
    display: block;
    margin-bottom: 10px;
}

#page-horizon .timeline-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

#page-horizon .prediction-text {
    flex: 1 1 auto;
    line-height: 1.6;
    margin-bottom: 12px;
}

#page-horizon .author-tag {
    margin-top: auto;
    padding-top: 12px;
    opacity: 0.9;
}

/* ==========================================================================
   5. DESTINED RIBBON CARD
   ========================================================================== */
.destined-ribbon-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 250px;
    height: auto;
    box-sizing: border-box;
    background: var(--card-bg);
    border: 3px solid #d97706;
    border-radius: 16px;
    padding: 52px 24px 24px;
    margin-bottom: 28px;
    box-shadow: 0 12px 35px -10px rgba(217, 119, 6, 0.45) !important;
    animation: destinedGentleGlow 6s ease-in-out infinite;
}

.destined-ribbon-card::before {
    content: "✧ This one was written for you today… ✧";
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    background: #d97706;
    color: #fffdf0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 4px 24px 6px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
    white-space: nowrap;
    z-index: 2;
    animation: ribbonPulse 4s ease-in-out infinite;
}

.destined-ribbon-card .urgency-indicator {
    background: linear-gradient(90deg, #d97706, #fcd34d) !important;
    height: 6px;
    width: 100%;
    border-radius: 99px;
    margin-bottom: 12px;
}

.destined-ribbon-card .prediction-title-link {
    font-size: 17px;
    font-weight: 400;
    color: #d97706;
}

@keyframes destinedGentleGlow {
    0%, 100% { box-shadow: 0 12px 35px -10px rgba(217, 119, 6, 0.45); }
    50% { box-shadow: 0 12px 45px -5px rgba(217, 119, 6, 0.65); }
}

@keyframes ribbonPulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

/* Golden Hour theme overrides */
[data-theme="golden"] .destined-ribbon-card {
    border-color: #b45309;
    box-shadow: 0 15px 35px -12px rgba(180, 83, 9, 0.5) !important;
}
[data-theme="golden"] .destined-ribbon-card::before {
    background: #b45309;
}
[data-theme="golden"] .destined-ribbon-card .urgency-indicator {
    background: linear-gradient(90deg, #b45309, #fcd34d) !important;
}

/* ==========================================================================
   6. BADGES & PULSE ANIMATION
   ========================================================================== */
.horizon-age-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}
.horizon-age-badge.red    { background: #fee2e2; color: #000; border: 1px solid #fecaca; }
.horizon-age-badge.orange { background: #ffedd5; color: #000; border: 1px solid #fed7aa; }
.horizon-age-badge.yellow { background: #fef9c3; color: #000; border: 1px solid #fef08a; }
.horizon-age-badge.default{ background: #f1f5f9; color: #000; border: 1px solid var(--border); }

.horizon-today-stamp {
    display: inline-block;
    font-family: "Georgia", serif;
    font-size: 16px;
    font-weight: 400;
    font-style: italic;
    color: #f00808;
    text-transform: uppercase;
    letter-spacing: 1px;
    transform: rotate(-3deg);
    opacity: 0.85;
}

.horizon-new-pulse {
    animation: horizonPulseRed 2s infinite;
    border: 1px solid #ef4444 !important;
}
@keyframes horizonPulseRed {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   7. MOBILE OVERRIDES (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {

    /* 1. FORCE THE VIEWPORT */
    body, .horizon-layout {
        overflow-x: hidden !important;
        width: 100vw !important;
        position: relative;
    }

    /* 2. THE CONTAINER (The most important part) */
    #page-horizon .timeline-container {
        position: absolute !important;
        top: 0;
        right: 0;
        height: 100dvh !important;
        
        /* BASE STATE: When bar is visible, width MUST be 100% minus bar width */
        width: calc(100% - 60px) !important; 
        
        /* Stop Flexbox from trying to 'help' */
        flex: none !important;
        display: block !important;
        
        padding: 15px !important;
        padding-top: calc(15px + var(--safe-top)) !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        transition: width 0.3s ease, transform 0.3s ease;
    }

    /* 3. THE EXPANDED STATE (When bar is hidden) */
    /* When the bar is hidden, we set width to 100% */
    #page-horizon .temporal-bar.hidden-mobile ~ .timeline-container {
        width: 100% !important;
    }

    /* 4. THE BAR */
    .temporal-bar {
        position: absolute !important;
        left: 0;
        top: 0;
        width: 60px !important;
        height: 100% !important;
        z-index: 10;
        transition: transform 0.3s ease;
    }

    .temporal-bar.hidden-mobile {
        transform: translateX(-60px) !important;
    }

    /* 5. FORCE THE CARDS TO COMPLY */
    #horizon-grid {
        display: block !important; /* Switch from Grid to Block to ensure 100% width works */
        width: 100% !important;
    }

    /* horizon.css - Mobile Media Query section */

    #page-horizon .timeline-card {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        
        /* ADD THIS LINE FOR THE GAP */
        margin-bottom: 20px !important; 
        
        box-sizing: border-box !important;
        display: flex;
        flex-direction: column;
    }

    /* Ensure text wraps instead of pushing the card width */
    .prediction-title-link, .prediction-text {
        white-space: normal !important;
        word-wrap: break-word !important;
    }
}