/* =============================================
   weather.monk – © Boris Reinhard
   Design: Dark Atmospheric / Brutalist-Clean
   ============================================= */

:root {
    --bg:        #080c14;
    --bg2:       #0d1320;
    --surface:   rgba(255,255,255,0.04);
    --surface2:  rgba(255,255,255,0.07);
    --border:    rgba(255,255,255,0.08);
    --border2:   rgba(255,255,255,0.14);
    --accent:    #5ce8ff;
    --accent2:   #ff6b6b;
    --accent3:   #ffd166;
    --text:      #e8eef5;
    --text-muted:#8899aa;
    --text-dim:  #445566;
    --font-head: 'Syne', sans-serif;
    --font-mono: 'Space Mono', monospace;
    --font-body: 'DM Sans', sans-serif;
    --r:         12px;
    --r-lg:      20px;
    --shadow:    0 8px 40px rgba(0,0,0,0.5);
    --glow:      0 0 40px rgba(92,232,255,0.15);
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* GRAIN OVERLAY */
.grain-overlay {
    position: fixed; inset: 0; z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 200px;
    opacity: 0.6;
}

/* BACKGROUND ORBS */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    animation: drift 20s ease-in-out infinite alternate;
}
.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #1a6fff, transparent);
    top: -100px; left: -100px;
    animation-duration: 25s;
}
.orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #5ce8ff, transparent);
    top: 50%; right: -80px;
    animation-duration: 18s;
    animation-direction: alternate-reverse;
}
.orb-3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #764fff, transparent);
    bottom: 100px; left: 30%;
    animation-duration: 22s;
}
@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, 20px) scale(1.08); }
}

/* HEADER */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(8, 12, 20, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* LOGO */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: var(--text);
    white-space: nowrap;
}
.logo-mark {
    color: var(--accent);
    font-size: 1.4rem;
    animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.logo em { color: var(--accent); font-style: normal; }

/* TAB NAV */
.tab-nav {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 4px;
}
.tab-btn {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 100px;
    transition: all 0.2s ease;
}
.tab-btn.active {
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
}
.tab-btn:hover:not(.active) {
    color: var(--text);
    background: var(--surface2);
}

/* MAIN */
.main-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 60px;
    position: relative;
    z-index: 1;
}

/* HERO SEARCH */
.hero-section {
    padding: 40px 0 20px;
}

.search-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    padding: 16px 56px 16px 20px;
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input::placeholder { color: var(--text-dim); font-weight: 400; }
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(92,232,255,0.12);
}

.gps-btn {
    position: absolute;
    right: 14px;
    width: 34px; height: 34px;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}
.gps-btn svg { width: 20px; height: 20px; }
.gps-btn:hover { color: var(--accent); background: var(--surface2); }

/* AUTOCOMPLETE */
.autocomplete-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 200;
}
.autocomplete-list.hidden { display: none; }
.autocomplete-item {
    padding: 12px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--surface2); }
.autocomplete-item .item-flag { font-size: 1.1rem; }
.autocomplete-item .item-info { display: flex; flex-direction: column; }
.autocomplete-item .item-name { font-weight: 500; }
.autocomplete-item .item-region { font-size: 0.75rem; color: var(--text-muted); }
.search-container { position: relative; }

/* CURRENT WEATHER */
.current-weather {
    margin-top: 28px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--r-lg);
    padding: 28px 24px 20px;
    position: relative;
    overflow: hidden;
}
.current-weather::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(92,232,255,0.06) 0%, transparent 60%);
    pointer-events: none;
}
.current-weather.hidden { display: none; }

.cw-location {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cw-country {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.65rem;
}

.cw-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.cw-temp-block {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 1;
}
.cw-temp {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 5rem;
    color: var(--text);
    letter-spacing: -0.04em;
    line-height: 1;
}
.cw-unit {
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 10px;
}
.cw-icon { font-size: 4rem; line-height: 1; }

.cw-desc-row {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-bottom: 20px;
    font-style: italic;
}

.cw-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.cw-detail {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.detail-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.detail-val {
    font-family: var(--font-head);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
}

/* LOADING */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}
.loading-spinner.hidden { display: none; }
.spinner-ring {
    width: 28px; height: 28px;
    border: 2px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ERROR */
.error-msg {
    background: rgba(255,107,107,0.1);
    border: 1px solid rgba(255,107,107,0.3);
    border-radius: var(--r);
    padding: 14px 20px;
    color: var(--accent2);
    font-size: 0.9rem;
    margin-top: 16px;
}
.error-msg.hidden { display: none; }

/* TAB PANELS */
.tab-content-wrap { margin-top: 8px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.panel-section {
    margin-top: 24px;
    animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.panel-section.hidden { display: none; }

.section-title {
    font-family: var(--font-head);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.section-sub {
    font-weight: 400;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

/* HOURLY SCROLL */
.hourly-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.hourly-scroll::-webkit-scrollbar { height: 3px; }
.hourly-scroll::-webkit-scrollbar-track { background: var(--surface); border-radius: 2px; }
.hourly-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.hourly-card {
    flex: 0 0 72px;
    scroll-snap-align: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
}
.hourly-card:hover { border-color: var(--accent); background: var(--surface2); }
.hourly-card.now { border-color: var(--accent); background: rgba(92,232,255,0.06); }
.h-time {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.hourly-card.now .h-time { color: var(--accent); }
.h-icon { font-size: 1.4rem; line-height: 1; }
.h-temp {
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}
.h-rain {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: #6ab4ff;
}

/* DAILY LIST */
.daily-list { display: flex; flex-direction: column; gap: 8px; }
.daily-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 90px 1fr auto auto;
    align-items: center;
    gap: 16px;
    transition: border-color 0.2s, background 0.2s;
}
.daily-card:hover { border-color: var(--border2); background: var(--surface2); }
.daily-card.today { border-color: var(--accent); }
.d-day {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.d-desc {
    font-size: 0.85rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.d-desc .d-icon { font-size: 1.1rem; }
.d-rain {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: #6ab4ff;
    text-align: right;
}
.d-temps {
    font-family: var(--font-head);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}
.d-max { color: var(--text); }
.d-min { color: var(--text-muted); font-weight: 400; }

/* AIR QUALITY */
.air-quality-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px;
}
.aqi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.aqi-value {
    font-family: var(--font-head);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}
.aqi-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 4px;
}
.aqi-bar-wrap {
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}
.aqi-bar {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #00e400, #ffff00, #ff7e00, #ff0000, #8f3f97, #7e0023);
    width: 100%;
}
.aqi-indicator {
    height: 100%;
    background: rgba(0,0,0,0.5);
    margin-left: auto;
    transition: width 0.5s ease;
}
.aqi-pollutants {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.aqi-pollutant {
    background: var(--surface2);
    border-radius: 8px;
    padding: 10px;
}
.p-name {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}
.p-val {
    font-family: var(--font-head);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

/* POLLEN */
.pollen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.pollen-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pollen-name {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.pollen-icon { font-size: 1.6rem; }
.pollen-level {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
}
.pollen-bar-wrap {
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden;
}
.pollen-bar { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

.level-none   { color: var(--text-dim); }
.level-low    { color: #5ce8a0; }
.level-medium { color: var(--accent3); }
.level-high   { color: #ff9a3c; }
.level-vhigh  { color: var(--accent2); }
.bar-none   { background: var(--text-dim); width: 5%; }
.bar-low    { background: #5ce8a0; width: 25%; }
.bar-medium { background: var(--accent3); width: 50%; }
.bar-high   { background: #ff9a3c; width: 75%; }
.bar-vhigh  { background: var(--accent2); width: 95%; }

.pollen-placeholder {
    grid-column: 1/-1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-style: italic;
}
.pollen-info-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px 18px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* RADAR */
.radar-container { display: flex; flex-direction: column; gap: 14px; }
.radar-map {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.radar-iframe { width: 100%; height: 100%; border: none; }
.radar-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-style: italic;
}
.radar-icon { font-size: 3rem; }
.radar-placeholder.hidden { display: none; }
.radar-links { display: flex; }
.radar-ext-btn {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: var(--accent);
    border: 1px solid rgba(92,232,255,0.3);
    border-radius: 100px;
    padding: 8px 16px;
    transition: background 0.2s, color 0.2s;
}
.radar-ext-btn:hover {
    background: rgba(92,232,255,0.1);
    text-decoration: none;
}
.radar-credit {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-dim);
    letter-spacing: 0.06em;
}

/* DONATION */
.donation-banner {
    margin: 40px 0 0;
    background: linear-gradient(135deg, rgba(92,232,255,0.06), rgba(118,79,255,0.06));
    border: 1px solid rgba(92,232,255,0.2);
    border-radius: var(--r-lg);
    padding: 20px 24px;
}
.donation-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.donation-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
}
.donation-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0070BA;
    color: #fff;
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 100px;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}
.donation-btn:hover { background: #005ea6; text-decoration: none; transform: translateY(-1px); }
.donation-btn:active { transform: translateY(0); }

/* FOOTER */
.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(8,12,20,0.8);
    margin-top: 60px;
    position: relative;
    z-index: 1;
}
.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.footer-copy {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.footer-sources {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.footer-sources a { color: var(--text-muted); font-size: 0.75rem; }
.footer-sources a:hover { color: var(--accent); }
.footer-legal {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .header-inner { gap: 10px; }
    .logo-text { font-size: 0.95rem; }
    .tab-btn { font-size: 0.58rem; padding: 5px 8px; }
    .cw-temp { font-size: 3.8rem; }
    .cw-details { grid-template-columns: repeat(2, 1fr); }
    .daily-card { grid-template-columns: 70px 1fr auto; }
    .d-rain { display: none; }
    .aqi-pollutants { grid-template-columns: repeat(2, 1fr); }
    .donation-inner { flex-direction: column; align-items: flex-start; }
    .pollen-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
    .cw-temp { font-size: 3rem; }
    .cw-details { grid-template-columns: repeat(2, 1fr); }
}
