/* ============================================================
 * SeoUHI · Demo presentation enhancements
 * Layered on top of the original css/style.css.
 * Does not modify the original stylesheet rules, only augments them.
 * ============================================================ */

:root {
    --brand: #0ea5e9;
    --brand-2: #6366f1;
    --accent: #f59e0b;
    --accent-hot: #ef4444;
    --ink-900: #0f172a;
    --ink-700: #1e293b;
    --ink-500: #475569;
    --ink-300: #94a3b8;
    --paper: #f8fafc;
    --paper-2: #ffffff;
    --border: rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.18);
    --radius: 10px;
    --radius-lg: 14px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial,
                 "Noto Sans", "Noto Sans CJK KR", sans-serif;
}

html, body {
    font-family: var(--font-sans);
    color: var(--ink-700);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.01em;
}

body { margin: 0; }

/* -------- Navbar polish -------- */
.navbar {
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    background: rgba(255, 255, 255, 0.82) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm) !important;
}
.nav-left h1 {
    background: linear-gradient(135deg, var(--brand), var(--brand-2) 60%, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.nav-left h2 {
    color: var(--ink-500) !important;
    font-size: 14px !important;
}
.logo {
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.15));
}
.current-time {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    background: linear-gradient(135deg, #eef2ff, #ecfeff) !important;
    color: var(--ink-700);
    border: 1px solid var(--border);
}

/* -------- Buttons -------- */
.menu-btn,
.toggle-heatmap-btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: var(--shadow-sm);
    font-weight: 500 !important;
    letter-spacing: 0.02em;
}
.menu-btn {
    background: #fff !important;
    border: 1px solid var(--border) !important;
    color: var(--ink-700) !important;
}
.menu-btn:hover {
    background: #f1f5f9 !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.toggle-heatmap-btn {
    background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
    color: #fff !important;
    border: none !important;
}
.toggle-heatmap-btn:hover {
    background: linear-gradient(135deg, #0284c7, #4f46e5) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* -------- Notification bar -------- */
.notification-bar {
    background: linear-gradient(90deg,
        rgba(254, 242, 232, 0.92),
        rgba(254, 232, 232, 0.92) 50%,
        rgba(238, 242, 255, 0.92)) !important;
    color: var(--ink-700);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.notification-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 100%);
    transform: translateX(-100%);
    animation: uhi-shimmer 9s ease-in-out infinite;
}
@keyframes uhi-shimmer {
    0%   { transform: translateX(-100%); }
    60%  { transform: translateX(100%); }
    100% { transform: translateX(100%); }
}
.notification-bar #notification-text { position: relative; z-index: 1; }

/* -------- Loading overlay -------- */
.uhi-loading {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background:
        radial-gradient(circle at 30% 20%, rgba(14, 165, 233, 0.25), transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(239, 68, 68, 0.25), transparent 55%),
        linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
.uhi-loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.uhi-loading .orb {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 38%, #fde68a, #f97316 45%, #7f1d1d 100%);
    box-shadow:
        0 0 0 6px rgba(253, 230, 138, 0.18),
        0 0 0 18px rgba(249, 115, 22, 0.12),
        0 0 0 34px rgba(127, 29, 29, 0.08);
    animation: uhi-pulse 2.4s ease-in-out infinite;
}
@keyframes uhi-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50%      { transform: scale(1.08); filter: brightness(1.15); }
}
.uhi-loading .title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: linear-gradient(90deg, #93c5fd, #fcd34d, #fca5a5);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.uhi-loading .sub {
    font-size: 13px;
    color: #cbd5e1;
    opacity: 0.85;
    max-width: 320px;
    text-align: center;
}
.uhi-loading .dots {
    display: inline-flex;
    gap: 6px;
    margin-top: 6px;
}
.uhi-loading .dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f8fafc;
    opacity: 0.35;
    animation: uhi-dots 1.2s ease-in-out infinite;
}
.uhi-loading .dots span:nth-child(2) { animation-delay: 0.15s; }
.uhi-loading .dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes uhi-dots {
    0%, 100% { opacity: 0.35; transform: translateY(0); }
    50%      { opacity: 1;    transform: translateY(-3px); }
}

/* -------- Floating legend (bottom right) -------- */
.uhi-legend {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 900;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px 14px;
    font-size: 12px;
    color: var(--ink-700);
    min-width: 200px;
}
.uhi-legend h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-500);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.uhi-legend .bar {
    height: 10px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        #e8f6e3 0%,
        #74c476 28%,
        #fdbe85 45%,
        #fd8d3c 55%,
        #e31a1c 75%,
        #800026 100%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.uhi-legend .ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-500);
    font-size: 11px;
}

/* -------- Floating timeline control (bottom left) -------- */
.uhi-timeline {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 900;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
}
.uhi-timeline .uhi-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.uhi-timeline .label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--ink-500);
    text-transform: uppercase;
}
.uhi-timeline .value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--ink-700);
    font-size: 13px;
}
.uhi-timeline button.playBtn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink-700);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s ease, transform 0.15s ease;
}
.uhi-timeline button.playBtn:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}
.uhi-timeline .slider {
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--brand), var(--accent-hot));
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.uhi-timeline .slider .fill {
    position: absolute;
    inset: 0;
    right: auto;
    background: rgba(15, 23, 42, 0.06);
    border-left: 2px solid #fff;
    width: 0%;
    transition: width 0.3s linear;
}

/* -------- Footer credit -------- */
.uhi-credit {
    position: fixed;
    right: 14px;
    top: 72px;
    z-index: 900;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    color: var(--ink-500);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}
.uhi-credit strong { color: var(--ink-700); }
.uhi-credit a {
    color: var(--brand-2);
    text-decoration: none;
    margin-left: 6px;
}
.uhi-credit a:hover { text-decoration: underline; }

/* -------- Mapbox overrides -------- */
.mapboxgl-ctrl-attrib.mapboxgl-compact { border-radius: 999px !important; }
.mapboxgl-popup-content {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    border: 1px solid var(--border) !important;
}

/* -------- Responsive tweaks -------- */
@media (max-width: 900px) {
    .nav-left h2 { display: none; }
    .uhi-credit { display: none; }
    .uhi-legend { min-width: 160px; right: 12px; bottom: 88px; font-size: 11px; }
    .uhi-timeline { left: 12px; right: 12px; bottom: 12px; min-width: 0; }
}
@media (max-width: 640px) {
    .navbar { padding: 0 12px !important; }
    .nav-left h1 { font-size: 18px !important; }
    .current-time { display: none; }
    .notification-bar { font-size: 12px; padding: 8px 12px !important; }
    .toggle-heatmap-btn { padding: 6px 10px !important; font-size: 13px !important; }
    .menu-btn { padding: 6px 12px !important; font-size: 13px !important; }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .uhi-loading .orb,
    .uhi-loading .dots span,
    .notification-bar::before { animation: none !important; }
    .menu-btn,
    .toggle-heatmap-btn,
    .uhi-timeline button.playBtn { transition: none !important; }
}
