:root {
    --bg0: #080c14;
    --bg1: #0d1320;
    --bg2: #111929;
    --bg3: #172035;
    --bg4: #1e2a42;
    --border: rgba(100, 160, 255, 0.10);
    --border2: rgba(100, 160, 255, 0.20);
    --text: #d8e8ff;
    --text2: #7a9cbf;
    --text3: #6390c1;
    --accent: #4a9eff;
    --accent2: #2d6cb5;
    --warm: #ff8c42;
    --cold: #42c8ff;
    --rain: #5b9cf6;
    --wind: #a78bfa;
    --green: #4ade80;
    --red: #f87171;
    --amber: #fbbf24;
}

@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  src: url('../fonts/noto-sans-v42-latin-regular.woff2') format('woff2');
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg0);
    color: var(--text);
    font-family: 'Noto Sans', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

.mono {
    font-family: 'Noto Sans', monospace;
}

a:link{color:var(--text3); text-decoration: none;}
a:active{color:var(--text3); text-decoration: none;}
a:visited{color:var(--text3); text-decoration: none;}
a:hover{color: var(--text);}

/* Stars background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(1px 1px at 15% 20%, rgba(200, 220, 255, 0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 10%, rgba(200, 220, 255, 0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 60%, rgba(200, 220, 255, 0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 45%, rgba(200, 220, 255, 0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 80%, rgba(200, 220, 255, 0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 30%, rgba(200, 220, 255, 0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 70%, rgba(200, 220, 255, 0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 5% 50%, rgba(200, 220, 255, 0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 90%, rgba(200, 220, 255, 0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 33% 40%, rgba(200, 220, 255, 0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 77% 85%, rgba(200, 220, 255, 0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 12% 92%, rgba(200, 220, 255, 0.3) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* Layout */
.wrap {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    background: rgba(8, 12, 20, 0.85);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg3);
    font-size: 18px;
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--text);
}

.logo-sub {
    font-size: 11px;
    color: var(--text3);
    font-family: 'Noto Sans', monospace;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1
    }
    50% {
        opacity: 0.5
    }
}

.api-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: 'Noto Sans', monospace;
    color: var(--text3);
}

/* Nav tabs */
nav {
    display: flex;
    gap: 4px;
    margin: 24px 0 0;
    flex-wrap: wrap;
}

.tab {
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    background: transparent;
    transition: all 0.2s;
    font-family: 'Noto Sans', sans-serif;
    letter-spacing: 0.02em;
}

.tab:hover {
    color: var(--text);
    background: var(--bg3);
    border-color: var(--border);
}

.tab.active {
    color: var(--accent);
    background: rgba(74, 158, 255, 0.08);
    border-color: rgba(74, 158, 255, 0.3);
}

/* Sections */
.section {
    display: none;
    padding: 28px 0 60px;
}

.section.active {
    display: block;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.section-sub {
    font-size: 13px;
    color: var(--text3);
    font-family: 'Noto Sans', monospace;
    margin-bottom: 24px;
}

/* Cards */
.card {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
}

.card-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 10px;
    font-family: 'Noto Sans', monospace;
}

/* Metric cards grid */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.metric {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}

.metric-label {
    font-size: 11px;
    color: var(--text3);
    font-family: 'Noto Sans', monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    font-family: 'Noto Sans', monospace;
}

.metric-unit {
    font-size: 13px;
    color: var(--text3);
    font-weight: 400;
    margin-left: 2px;
}

.metric-sub {
    font-size: 11px;
    color: var(--text3);
    margin-top: 4px;
    font-family: 'Noto Sans', monospace;
}

.metric.warm .metric-value {
    color: var(--warm);
}

.metric.cold .metric-value {
    color: var(--cold);
}

.metric.rain .metric-value {
    color: var(--rain);
}

.metric.wind .metric-value {
    color: var(--wind);
}

.metric.neutral .metric-value {
    color: var(--text);
}

/* Grid 2 cols */
.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    .grid2, .grid3 {
        grid-template-columns: 1fr;
    }
}

/* Chart wrapper */
.chart-wrap {
    position: relative;
    width: 100%;
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.ctrl-label {
    font-size: 12px;
    color: var(--text3);
    font-family: 'Noto Sans', monospace;
    letter-spacing: 0.06em;
}

.ctrl-input {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    padding: 7px 12px;
    font-family: 'Noto Sans', monospace;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ctrl-input:hover, .ctrl-input:focus {
    border-color: var(--border2);
}

input[type=date].ctrl-input {
    color-scheme: dark;
}

.btn {
    background: rgba(74, 158, 255, 0.12);
    border: 1px solid rgba(74, 158, 255, 0.3);
    color: var(--accent);
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 13px;
    font-family: 'Noto Sans', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: rgba(74, 158, 255, 0.20);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text2);
}

.btn-ghost:hover {
    background: var(--bg3);
    color: var(--text);
}

select.ctrl-input {
    appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%233d5a7a'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: 'Noto Sans', monospace;
}

.data-table th {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text3);
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-weight: 400;
}

.data-table th:first-child {
    text-align: left;
}

.data-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid rgba(100, 160, 255, 0.05);
    color: var(--text2);
    transition: background 0.15s;
}

.data-table td:first-child {
    text-align: left;
    color: var(--text);
}

.data-table tr:hover td {
    background: var(--bg3);
}

.data-table .hot {
    color: var(--warm);
}

.data-table .cold2 {
    color: var(--cold);
}

.data-table .wet {
    color: var(--rain);
}

/* Records */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.record-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
}

.record-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.record-card.r-hot::before {
    background: linear-gradient(90deg, var(--warm), transparent);
}

.record-card.r-cold::before {
    background: linear-gradient(90deg, var(--cold), transparent);
}

.record-card.r-rain::before {
    background: linear-gradient(90deg, var(--rain), transparent);
}

.record-card.r-wind::before {
    background: linear-gradient(90deg, var(--wind), transparent);
}

.record-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.record-val {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Noto Sans', monospace;
    line-height: 1;
}

.record-val.r-hot {
    color: var(--warm);
}

.record-val.r-cold {
    color: var(--cold);
}

.record-val.r-rain {
    color: var(--rain);
}

.record-val.r-wind {
    color: var(--wind);
}

.record-desc {
    font-size: 12px;
    color: var(--text3);
    margin-top: 4px;
    font-family: 'Noto Sans', monospace;
}

.record-date {
    font-size: 11px;
    color: var(--text3);
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    font-family: 'Noto Sans', monospace;
}

/* Events */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-item {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.event-heavy_rain .event-dot {
    background: var(--rain);
    box-shadow: 0 0 6px var(--rain);
}

.event-storm .event-dot {
    background: var(--amber);
    box-shadow: 0 0 6px var(--amber);
}

.event-heat_wave .event-dot {
    background: var(--warm);
    box-shadow: 0 0 6px var(--warm);
}

.event-frost .event-dot {
    background: var(--cold);
    box-shadow: 0 0 6px var(--cold);
}

.event-body {
    flex: 1;
}

.event-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.event-time {
    font-size: 11px;
    color: var(--text3);
    font-family: 'Noto Sans', monospace;
    margin-top: 2px;
}

.event-intensity {
    font-family: 'Noto Sans', monospace;
    font-size: 14px;
    color: var(--text2);
}

/* Loading */
.loading {
    text-align: center;
    padding: 48px 0;
    color: var(--text3);
    font-family: 'Noto Sans', monospace;
    font-size: 13px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 8px;
    padding: 14px 18px;
    color: #f87171;
    font-size: 13px;
    font-family: 'Noto Sans', monospace;
}

/* Separator */
.sep {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* Year comparison */
.year-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.year-pill {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 12px;
    font-family: 'Noto Sans', monospace;
    cursor: pointer;
    background: var(--bg3);
    color: var(--text2);
    transition: all 0.15s;
}

.year-pill.active {
    background: rgba(74, 158, 255, 0.12);
    border-color: rgba(74, 158, 255, 0.35);
    color: var(--accent);
}

.year-pill:hover:not(.active) {
    border-color: var(--border2);
    color: var(--text);
}

/* Normals band info */
.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text2);
    font-family: 'Noto Sans', monospace;
    align-items: center;
}

.legend-swatch {
    width: 12px;
    height: 4px;
    border-radius: 2px;
    display: inline-block;
    margin-right: 4px;
}

/* Yearly table */
.yearly-badge {
    display: inline-block;
    font-size: 10px;
    font-family: 'Noto Sans', monospace;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.yearly-badge.above {
    background: rgba(255, 140, 66, 0.15);
    color: var(--warm);
}

.yearly-badge.below {
    background: rgba(66, 200, 255, 0.15);
    color: var(--cold);
}

/* Heatmap */
.heatmap-wrap {
    overflow-x: auto;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: 60px repeat(12, 1fr);
    gap: 3px;
    min-width: 560px;
}

.hm-cell {
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-family: 'Noto Sans', monospace;
    color: rgba(216, 232, 255, 0.7);
    transition: opacity 0.15s;
}

.hm-cell:hover {
    opacity: 0.8;
    cursor: default;
}

.hm-label {
    font-size: 10px;
    font-family: 'Noto Sans', monospace;
    color: var(--text3);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    height: 32px;
}

.hm-header {
    font-size: 10px;
    font-family: 'Noto Sans', monospace;
    color: var(--text3);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    letter-spacing: 0.05em;
}

.hm-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 11px;
    font-family: 'Noto Sans', monospace;
    color: var(--text3);
}

.hm-legend-bar {
    height: 8px;
    width: 140px;
    border-radius: 4px;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    background: rgba(8, 12, 20, 0.9);
    padding: 32px 0 24px;
    margin-top: 60px;
    position: relative;
    z-index: 1;
}

.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
}

@media (max-width: 700px) {
    .footer-inner {
        grid-template-columns: 1fr;
    }
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-logo {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-desc {
    font-size: 12px;
    color: var(--text3);
    font-family: 'Noto Sans', monospace;
    line-height: 1.7;
    max-width: 280px;
}

.footer-col-title {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text);
    font-family: 'Noto Sans', monospace;
    margin-bottom: 12px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-links li {
    font-size: 12px;
    font-family: 'Noto Sans', monospace;
    color: var(--text2);
    cursor: pointer;
    transition: color 0.15s;
}

.footer-links li:hover {
    color: var(--text);
}

.footer-api {
    font-size: 11px;
    font-family: 'Noto Sans', monospace;
}

.footer-api-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}

.footer-api-method {
    background: rgba(74, 158, 255, 0.1);
    color: var(--accent);
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.05em;
}

.footer-api-path {
    color: var(--text3);
}

.footer-siti {
    font-size: 11px;
    font-family: 'Noto Sans', monospace;
}

.footer-siti-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    border-bottom: 1px solid var(--border);
}

.footer-siti-method {
    background: rgba(74, 158, 255, 0.1);
    color: var(--accent);
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.05em;
}

.footer-siti-path {
    color: var(--text3);
}


.footer-bottom {
    border-top: 1px solid var(--border);
    margin-top: 24px;
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-copy {
    font-size: 11px;
    font-family: 'Noto Sans', monospace;
    color: var(--text3);
}

.footer-pill {
    font-size: 10px;
    font-family: 'Noto Sans', monospace;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text3);
}
