/**
 * home_page.css
 *
 * - Defines the design-token :root variables for both light and dark themes.
 *   These tokens are the SINGLE SOURCE OF TRUTH; component CSS files
 *   read them via `var(--*)` and MUST NOT redeclare :root.
 * - Declares the @property animations used by the conic-gradient hairlines
 *   on the compose box and featured posts.
 * - Owns the page-level layout grid (3 columns -> 2 columns -> drawer).
 * - Owns the in-feed tab bar and feed-meta strip rendered by home_page.js.
 * - Owns the global notifications-toast container styles.
 *
 * Component CSS files (topnav.css, post_card.css, etc) own their own
 * BEM namespaces and never style anything outside that namespace.
 */

/* ---------- Houdini animated angle for conic-gradient hairlines ---------- */
@property --ang {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}
@property --shimmer-x {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 0%;
}

/* ---------- Theme tokens ---------- */
:root[data-theme="light"] {
    --canvas:        #fafbff;
    --surface:       #ffffff;
    --surface-2:     #f4f5fb;
    --hairline:      rgba(15, 17, 21, 0.06);
    --hairline-2:    rgba(15, 17, 21, 0.10);
    --shadow-soft:   0 1px 2px rgba(15,17,21,0.04), 0 8px 24px rgba(15,17,21,0.04);
    --shadow-pop:    0 1px 2px rgba(15,17,21,0.04), 0 16px 40px rgba(15,17,21,0.08);

    --text:          #0a0d1a;
    --text-2:        #5a5d66;
    --text-3:        #8a8e99;

    --iris:          #6366f1;
    --iris-2:        #4f52e6;
    --cyan:          #22d3ee;
    --violet:        #a855f7;
    --green:         #00b970;
    --green-2:       #009d5f;
    --red:           #ef4444;
    --amber:         #f59e0b;

    --iris-tint:     rgba(99, 102, 241, 0.10);
    --iris-tint-2:   rgba(99, 102, 241, 0.16);
    --iris-glow:     0 6px 24px rgba(99, 102, 241, 0.28);
    --green-tint:    rgba(0, 185, 112, 0.12);
    --red-tint:      rgba(239, 68, 68, 0.10);

    --aurora-1:      rgba(135, 206, 250, 0.55);
    --aurora-2:      rgba(255, 196, 175, 0.45);
    --aurora-3:      rgba(180, 240, 210, 0.45);
    --aurora-4:      rgba(210, 190, 255, 0.50);
    --aurora-5:      rgba(190, 230, 255, 0.45);
    --aurora-blur:   90px;
    --aurora-opacity: 0.85;
    --aurora-blend:  multiply;
    --aurora-blob-opacity: 0.55;
}

:root[data-theme="dark"] {
    --canvas:        #06060e;
    --surface:       #0d0d18;
    --surface-2:     #14141f;
    --hairline:      rgba(255, 255, 255, 0.06);
    --hairline-2:    rgba(255, 255, 255, 0.10);
    --shadow-soft:   0 1px 2px rgba(0,0,0,0.4), 0 12px 30px rgba(0,0,0,0.5);
    --shadow-pop:    0 1px 2px rgba(0,0,0,0.5), 0 24px 60px rgba(0,0,0,0.65);

    --text:          #f1f1f4;
    --text-2:        #a3a6b3;
    --text-3:        #6e7180;

    --iris:          #818cf8;
    --iris-2:        #6366f1;
    --cyan:          #22d3ee;
    --violet:        #c084fc;
    --green:         #10c97c;
    --green-2:       #00b970;
    --red:           #f87171;
    --amber:         #fbbf24;

    --iris-tint:     rgba(129, 140, 248, 0.16);
    --iris-tint-2:   rgba(129, 140, 248, 0.24);
    --iris-glow:     0 8px 32px rgba(129, 140, 248, 0.45);
    --green-tint:    rgba(16, 201, 124, 0.16);
    --red-tint:      rgba(248, 113, 113, 0.14);

    --aurora-1:      rgba(99, 102, 241, 0.55);
    --aurora-2:      rgba(34, 211, 238, 0.50);
    --aurora-3:      rgba(168, 85, 247, 0.55);
    --aurora-4:      rgba(45, 212, 191, 0.45);
    --aurora-5:      rgba(129, 140, 248, 0.45);
    --aurora-blur:   100px;
    --aurora-opacity: 0.65;
    --aurora-blend:  screen;
    --aurora-blob-opacity: 1;
}

/* ---------- Page reset ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--canvas);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* When the off-canvas left rail is open we lock body scroll on mobile. */
body[data-drawer-open="true"] {
    overflow: hidden;
}

/* ---------- Visually-hidden helper (for label-for that we don't display) ---------- */
.home-page__visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Layout grid ---------- */
.home-page__main-grid {
    max-width: 1480px;
    margin: 24px auto 80px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 260px minmax(0, 700px) 340px;
    justify-content: center;
    gap: 32px;
}

.home-page__left-rail,
.home-page__right-rail {
    position: sticky;
    top: 90px;
    align-self: start;
    height: calc(100vh - 110px);
    overflow-y: auto;
    scrollbar-width: thin;
}
.home-page__left-rail::-webkit-scrollbar,
.home-page__right-rail::-webkit-scrollbar { width: 6px; }
.home-page__left-rail::-webkit-scrollbar-thumb,
.home-page__right-rail::-webkit-scrollbar-thumb {
    background: var(--hairline-2);
    border-radius: 3px;
}

.home-page__feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* ---------- Feed header (tab bar + meta strip) ---------- */
.home-page__feed-header {
    position: sticky;
    top: 90px;
    z-index: 5;
    padding: 6px 6px 10px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
}

.home-page__tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}
.home-page__tabs::-webkit-scrollbar { display: none; }

.home-page__tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-2);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.home-page__tab:hover {
    color: var(--text);
    background: var(--surface-2);
}
.home-page__tab--active {
    background: var(--iris-tint);
    color: var(--iris);
    border-color: color-mix(in srgb, var(--iris) 20%, transparent);
}
.home-page__tab-x {
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    opacity: 0.6;
}
.home-page__tab-x:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}

.home-page__feed-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 0;
    border-top: 1px solid var(--hairline);
    margin: 0 -6px -6px;
}

.home-page__market-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--green-tint);
    color: var(--green-2);
    font-size: 12px;
    font-weight: 500;
}
.home-page__market-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent);
}

.home-page__live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
}
.home-page__live-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--iris);
    animation: homePagePulse 1.6s ease-in-out infinite;
}
@keyframes homePagePulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--iris) 50%, transparent); }
    50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--iris) 0%, transparent); }
}

.home-page__feed-meta-spacer { flex: 1; }

.home-page__feed-meta-filter {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid var(--hairline);
    background: var(--surface-2);
    border-radius: 8px;
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.home-page__feed-meta-filter:hover {
    background: var(--surface);
    color: var(--text);
}

/* ---------- Feed posts list ---------- */
.home-page__feed-posts {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- Right rail wrapping container (becomes 2-col grid <1100px) ---------- */
.home-page__right-rail-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- Notifications toast container ---------- */
.home-page__notifications {
    position: fixed;
    top: 90px;
    right: 24px;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 360px;
}

.home-page__toast {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-pop);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.home-page__toast--visible {
    opacity: 1;
    transform: translateY(0);
}
.home-page__toast--success { border-color: color-mix(in srgb, var(--green) 24%, transparent); }
.home-page__toast--error   { border-color: color-mix(in srgb, var(--red) 24%, transparent); }
.home-page__toast--warning { border-color: color-mix(in srgb, var(--amber) 24%, transparent); }
.home-page__toast--info    { border-color: color-mix(in srgb, var(--iris) 24%, transparent); }

.home-page__toast-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.home-page__toast--success .home-page__toast-dot { background: var(--green); }
.home-page__toast--error   .home-page__toast-dot { background: var(--red); }
.home-page__toast--warning .home-page__toast-dot { background: var(--amber); }
.home-page__toast--info    .home-page__toast-dot { background: var(--iris); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .home-page__main-grid {
        grid-template-columns: 240px minmax(0, 660px) 320px;
        gap: 24px;
    }
}

@media (max-width: 1100px) {
    .home-page__main-grid {
        grid-template-columns: 240px minmax(0, 1fr);
    }
    .home-page__right-rail {
        grid-column: 1 / -1;
        position: static;
        height: auto;
        overflow: visible;
    }
    .home-page__right-rail-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .home-page__main-grid {
        grid-template-columns: 1fr;
        padding: 0 16px;
    }
    .home-page__left-rail {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        background: var(--surface);
        z-index: 80;
        padding: 80px 16px 16px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid var(--hairline);
        box-shadow: var(--shadow-pop);
        overflow-y: auto;
    }
    body[data-drawer-open="true"] .home-page__left-rail {
        transform: translateX(0);
    }
    .home-page__right-rail-grid {
        grid-template-columns: 1fr;
    }
    .home-page__feed-header { top: 80px; }
    .home-page__notifications {
        top: auto;
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .home-page__live-pill-dot { animation: none !important; }
}
