/* ============================================================
   CYBER CAVE — Smart Display Dashboard
   Aurora-glass theme · weather-reactive accents
   ============================================================ */

:root {
    --bg: #070a12;
    --bg-2: #0b1120;
    --panel: rgba(255, 255, 255, 0.040);
    --panel-2: rgba(255, 255, 255, 0.028);
    --brd: rgba(255, 255, 255, 0.085);
    --brd-soft: rgba(255, 255, 255, 0.05);
    --text: #eef2fb;
    --dim: #97a3bd;
    --dimmer: #5c6884;
    --accent: #6ea8ff;
    --accent-2: #9d7bff;
    --accent-rgb: 110, 168, 255;
    --good: #34d399;
    --bad: #fb7185;
    --radius: 20px;
    --gap: 16px;
}

/* Weather-reactive palettes */
body.sun-mode { --accent: #ffb454; --accent-2: #ff8a5b; --accent-rgb: 255, 180, 84; }
body.cloud-mode { --accent: #7aa2f7; --accent-2: #8bd5ff; --accent-rgb: 122, 162, 247; }
body.rain-mode { --accent: #5b8def; --accent-2: #4fd4e4; --accent-rgb: 91, 141, 239; }
body.snow-mode { --accent: #9ecbff; --accent-2: #d6ecff; --accent-rgb: 158, 203, 255; }
body.storm-mode { --accent: #b48ead; --accent-2: #7c6bff; --accent-rgb: 180, 142, 173; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.accent { color: var(--accent); }
.up { color: var(--good); }
.down { color: var(--bad); }

/* ---------------- Aurora background ---------------- */
.aurora {
    position: fixed; inset: 0; z-index: 0; overflow: hidden;
    background:
        radial-gradient(1200px 800px at 78% -10%, rgba(var(--accent-rgb), 0.10), transparent 60%),
        linear-gradient(160deg, #070a12 0%, #0a0f1d 55%, #070a12 100%);
    transition: background 1.2s ease;
}
.blob {
    position: absolute; border-radius: 50%;
    filter: blur(70px); opacity: 0.5; mix-blend-mode: screen;
    transition: background 1.2s ease;
}
.b1 { width: 44vw; height: 44vw; left: -8vw; top: -10vw;
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.55), transparent 70%);
    animation: drift1 24s ease-in-out infinite; }
.b2 { width: 38vw; height: 38vw; right: -6vw; bottom: -12vw;
    background: radial-gradient(circle, var(--accent-2), transparent 70%); opacity: 0.28;
    animation: drift2 30s ease-in-out infinite; }
.b3 { width: 26vw; height: 26vw; left: 40vw; top: 30vh;
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.4), transparent 70%); opacity: 0.22;
    animation: drift3 20s ease-in-out infinite; }
@keyframes drift1 { 50% { transform: translate(6vw, 5vh) scale(1.1); } }
@keyframes drift2 { 50% { transform: translate(-5vw, -4vh) scale(1.15); } }
@keyframes drift3 { 50% { transform: translate(-4vw, 6vh) scale(0.9); } }
.grain {
    position: absolute; inset: 0; opacity: 0.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ---------------- Layout ---------------- */
.dash {
    position: relative; z-index: 2;
    height: calc(100vh - 40px);
    padding: 22px 24px 8px;
    display: grid;
    gap: var(--gap);
    grid-template-columns: 1.25fr 1fr 1fr 1.05fr;
    grid-template-rows: auto 1fr 1fr;
    grid-template-areas:
        "top    top     top      top"
        "hero   hourly  markets  news"
        "hero   daily   schedule news";
}

.topbar { grid-area: top; }
.hero { grid-area: hero; }
.dash > .card:nth-of-type(2) { grid-area: hourly; }
.dash > .card:nth-of-type(3) { grid-area: markets; }
.dash > .card:nth-of-type(4) { grid-area: daily; }
.dash > .card:nth-of-type(5) { grid-area: schedule; }
.card-news { grid-area: news; }

/* ---------------- Top bar ---------------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 2px 6px;
}
.brand {
    font-size: 20px; font-weight: 400; letter-spacing: 5px; color: var(--dim);
    display: flex; align-items: center; gap: 12px;
}
.brand b { font-weight: 800; color: var(--text); letter-spacing: 5px; }
.brand-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 14px var(--accent);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
.top-right { display: flex; align-items: center; gap: 10px; }
.pill {
    font-size: 12px; letter-spacing: 1.5px; color: var(--dim);
    padding: 7px 14px; border-radius: 999px;
    background: var(--panel); border: 1px solid var(--brd-soft);
}
.pill.online { color: var(--good); display: flex; align-items: center; gap: 7px; }
.pill.online i {
    width: 7px; height: 7px; border-radius: 50%; background: var(--good);
    box-shadow: 0 0 10px var(--good); animation: pulse 2s infinite;
}

/* ---------------- Cards ---------------- */
.card {
    position: relative;
    background: linear-gradient(160deg, var(--panel), var(--panel-2));
    border: 1px solid var(--brd);
    border-radius: var(--radius);
    padding: 20px 22px;
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    display: flex; flex-direction: column; min-height: 0;
    animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.card:nth-of-type(2) { animation-delay: 0.05s; }
.card:nth-of-type(3) { animation-delay: 0.10s; }
.card:nth-of-type(4) { animation-delay: 0.15s; }
.card:nth-of-type(5) { animation-delay: 0.20s; }
.card-news { animation-delay: 0.25s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.card-title {
    font-size: 12px; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase;
    color: var(--dim); margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.tsub { font-weight: 400; letter-spacing: 1px; color: var(--dimmer); text-transform: none; font-size: 11px; }
.live { color: var(--accent); font-size: 10px; letter-spacing: 1.5px; margin-left: auto;
    animation: pulse 2s infinite; }
.loading { color: var(--dimmer); font-size: 13px; padding: 8px 2px; }

/* ---------------- Hero ---------------- */
.hero { justify-content: space-between; gap: 8px; padding: 26px 28px; }
.greeting { font-size: 15px; font-weight: 500; color: var(--accent); letter-spacing: 0.4px; margin-bottom: 4px; }
.clock {
    display: flex; align-items: baseline; gap: 14px;
    font-variant-numeric: tabular-nums; line-height: 0.9;
}
.clock #clock-time {
    font-size: clamp(58px, 7vw, 104px); font-weight: 700; letter-spacing: -3px;
    background: linear-gradient(180deg, #fff, #b9c6e6);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.clock-meta { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.clock-meta b { font-size: 20px; font-weight: 700; color: var(--accent); letter-spacing: 1px; }
.clock-meta i {
    font-style: normal; font-family: 'JetBrains Mono', monospace;
    font-size: 13px; color: var(--dimmer);
}
.date { font-size: 18px; font-weight: 500; color: var(--text); margin-top: 10px; }
.loc {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--dim); margin-top: 6px;
}
.loc svg { color: var(--accent); }

.daylight { padding: 4px 2px; }
.dl-times {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: var(--dim); margin-bottom: 10px;
}
.dl-times b { color: var(--text); font-weight: 600; }
.dl-dur { font-size: 11px; color: var(--dimmer); letter-spacing: 0.5px; }
.dl-track {
    position: relative; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(var(--accent-rgb), 0.45), rgba(255,255,255,0.06));
}
.dl-fill {
    position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6);
}
.dl-sun {
    position: absolute; top: 50%; transform: translate(-50%, -50%);
    font-size: 15px; filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.9));
    transition: left 1s ease;
}

.moon {
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; color: var(--dim); margin-top: 12px;
}
.moon .m-emoji { font-size: 15px; }
.moon b { color: var(--text); font-weight: 600; }

.hero-weather {
    border-top: 1px solid var(--brd-soft); padding-top: 18px; margin-top: 6px;
}

/* Air quality */
.air { margin-top: 14px; }
.air-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.air-title { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--dimmer); }
.air-head b { font-size: 13px; font-weight: 600; }
.air-meter { display: flex; gap: 5px; }
.air-meter i {
    flex: 1; height: 6px; border-radius: 3px;
    background: rgba(255, 255, 255, 0.08); transition: background 0.5s, box-shadow 0.5s;
}
.air-sub { font-size: 11px; color: var(--dimmer); margin-top: 6px; }
.now-main { display: flex; align-items: center; gap: 14px; }
.now-icon { font-size: 52px; line-height: 1; filter: drop-shadow(0 4px 14px rgba(var(--accent-rgb), 0.4)); }
.now-temp { font-size: 58px; font-weight: 700; letter-spacing: -2px; }
.now-desc { font-size: 16px; color: var(--text); text-transform: capitalize; margin-top: 2px; }
.now-hilo { font-size: 13px; color: var(--dim); margin-top: 6px; display: flex; gap: 8px; align-items: center; }
.dotsep { color: var(--dimmer); }
.now-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-top: 18px;
}
.now-grid .stat {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--brd-soft);
    border-radius: 12px; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 3px;
}
.now-grid label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--dimmer); }
.now-grid b { font-size: 15px; font-weight: 600; }

/* ---------------- Hourly ---------------- */
.hourly {
    flex: 1; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden;
    padding-bottom: 4px; scrollbar-width: none;
}
.hourly::-webkit-scrollbar { display: none; }
.hour {
    flex: 1 0 auto; min-width: 62px;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    gap: 8px; padding: 12px 6px;
    background: rgba(255, 255, 255, 0.028); border: 1px solid var(--brd-soft);
    border-radius: 14px;
}
.hour.now { border-color: rgba(var(--accent-rgb), 0.5); background: rgba(var(--accent-rgb), 0.08); }
.hour .h-time { font-size: 12px; color: var(--dim); font-weight: 500; }
.hour.now .h-time { color: var(--accent); }
.hour .h-icon { font-size: 24px; line-height: 1; }
.hour .h-temp { font-size: 17px; font-weight: 700; }
.hour .h-pop { font-size: 10px; color: var(--accent); font-weight: 600; min-height: 12px; }

/* ---------------- Daily ---------------- */
.daily { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 2px; }
.day {
    display: grid; grid-template-columns: 46px 30px 1fr 90px;
    align-items: center; gap: 12px; padding: 7px 2px;
}
.day + .day { border-top: 1px solid var(--brd-soft); }
.day .d-name { font-size: 14px; font-weight: 500; color: var(--text); }
.day .d-icon { font-size: 20px; text-align: center; }
.day .d-bar { position: relative; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); }
.day .d-bar span {
    position: absolute; top: 0; bottom: 0; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.day .d-range { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.day .d-range .lo { color: var(--dimmer); }
.day .d-range .hi { color: var(--text); font-weight: 600; }

/* ---------------- Markets ---------------- */
.markets { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 6px; }
.coin {
    display: grid; grid-template-columns: 1fr 96px auto;
    align-items: center; gap: 12px; padding: 10px 4px;
}
.coin + .coin { border-top: 1px solid var(--brd-soft); }
.coin-id b { display: block; font-size: 15px; font-weight: 700; letter-spacing: 0.5px; }
.coin-id span { display: block; font-size: 11px; color: var(--dimmer); margin-top: 1px; }
.coin-spark { height: 34px; }
.coin-right { text-align: right; }
.coin-price { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.coin-chg { font-size: 12px; font-weight: 600; margin-top: 2px; }

/* ---------------- Schedule ---------------- */
.nextup {
    background: rgba(var(--accent-rgb), 0.09); border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; flex-shrink: 0;
}
.nextup .nu-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); }
.nextup .nu-title { font-size: 15px; font-weight: 600; margin-top: 2px; }
.nextup .nu-count { font-size: 12px; color: var(--dim); margin-top: 1px; }
.events { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.event {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255, 255, 255, 0.028); border: 1px solid var(--brd-soft);
    border-radius: 12px; padding: 9px 12px;
}
.event .e-date {
    flex-shrink: 0; width: 42px; text-align: center;
    border-right: 1px solid var(--brd-soft); padding-right: 10px;
}
.event .e-date .d { display: block; font-size: 19px; font-weight: 700; line-height: 1; color: var(--accent); }
.event .e-date .m { display: block; font-size: 10px; letter-spacing: 1px; color: var(--dimmer); margin-top: 2px; }
.event .e-body { min-width: 0; }
.event .e-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event .e-time { font-size: 12px; color: var(--dim); margin-top: 1px; }

/* ---------------- News ---------------- */
.news { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.news-item {
    display: flex; gap: 14px; padding: 11px 2px;
}
.news-item + .news-item { border-top: 1px solid var(--brd-soft); }
.news-rank {
    font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700;
    color: var(--accent); opacity: 0.7; flex-shrink: 0; width: 22px;
}
.news-body { min-width: 0; }
.news-src { font-size: 11px; color: var(--dimmer); margin-bottom: 3px; letter-spacing: 0.3px; }
.news-src .score { color: var(--accent); }
.news-headline {
    font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------------- Ticker ---------------- */
.ticker {
    position: relative; z-index: 2; height: 40px;
    display: flex; align-items: center; overflow: hidden;
    border-top: 1px solid var(--brd-soft);
    background: rgba(7, 10, 18, 0.6); backdrop-filter: blur(10px);
}
.ticker-track {
    display: inline-flex; white-space: nowrap; padding-left: 100%;
    font-size: 13px; color: var(--dim); letter-spacing: 0.4px;
    animation: marquee 48s linear infinite;
}
.ticker-track b { color: var(--text); font-weight: 700; }
.ticker-sep { color: var(--accent); margin: 0 6px; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------------- Weather particles ---------------- */
.weather-layer { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.rain-drop { position: absolute; top: -12vh; width: 1.5px; height: 60px;
    background: linear-gradient(transparent, rgba(var(--accent-rgb), 0.6)); }
.snowflake { position: absolute; top: -6vh; border-radius: 50%; background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1200px), (max-aspect-ratio: 1/1) {
    .dash {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto auto;
        grid-template-areas:
            "top     top"
            "hero    hero"
            "hourly  markets"
            "daily   schedule"
            "news    news";
        height: auto; min-height: calc(100vh - 40px);
    }
    body, html { overflow-y: auto; }
    .hero { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 24px; }
    .hero-time, .hero-weather { flex: 1 1 300px; }
    .hero-weather { border-top: none; border-left: 1px solid var(--brd-soft); padding-top: 0; padding-left: 24px; margin-top: 0; }
    .hero-time { display: flex; flex-direction: column; justify-content: center; }
    .daylight { margin-top: 18px; }
    .dl-dur { display: none; }
}
@media (max-width: 640px) {
    .dash {
        grid-template-columns: 1fr;
        grid-template-areas: "top" "hero" "hourly" "markets" "daily" "schedule" "news";
        padding: 16px;
    }
    .hero { flex-direction: column; }
    .hero-weather { border-left: none; border-top: 1px solid var(--brd-soft); padding-left: 0; padding-top: 18px; margin-top: 6px; }
    .clock #clock-time { font-size: clamp(52px, 16vw, 84px); }
    .now-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .blob, .brand-dot, .pill.online i, .live, .ticker-track, .card { animation: none !important; }
    .rain-drop, .snowflake { display: none; }
}
