/* Fakt počasí — landing page styles.
   Dark, high-contrast, weather-forward. No external assets (self-contained). */

:root {
  --bg-0: #080b16;
  --bg-1: #0e142a;
  --bg-2: #131b36;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2fb;
  --text-dim: #a6b0c8;
  --text-faint: #6b7690;
  --accent: #6ad2ff;      /* icy azure — data & interaction */
  --accent-soft: #3a7ea8;
  --warm: #ffb454;        /* sun / warnings */
  --cold: #8fb4ff;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --maxw: 860px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* Snappy, native-feeling touch on interactive elements. */
button, a, .search-results li, .hour {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg-0);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- Background layer stack (behind all content) --------------------
   -5 aurora (base tone) < -4 scene-css (gradient scenes) < -3 scene-haze
   (air-quality smog veil, independent of the weather scene) < -2 canvas
   (particles) < -1 scrim (keeps text readable) < 0 content. */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -5;
  background:
    radial-gradient(60% 55% at 15% 0%, rgba(106, 210, 255, 0.16), transparent 60%),
    radial-gradient(55% 50% at 90% 10%, rgba(120, 110, 255, 0.14), transparent 60%),
    radial-gradient(70% 60% at 50% 100%, rgba(40, 90, 140, 0.18), transparent 65%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 70%);
}

.scene-css {
  position: fixed;
  inset: 0;
  z-index: -4;
  pointer-events: none;
  opacity: 1;
  transition: opacity 600ms ease;
}

/* Air-quality smog veil: a warm grey-brown haze that fades in only for bad
   air (level >= 3). Sits above the gradient scene but below the particles, so
   rain/snow still read clearly through it. A veil, not a wall — opacity stays
   very low, scaling gently with severity. */
.scene-haze {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(120% 90% at 50% 60%, rgba(150, 130, 110, 0.9), transparent 70%),
    linear-gradient(180deg, rgba(150, 130, 110, 0.6), rgba(130, 110, 92, 0.4));
  transition: opacity 800ms ease;
}
.scene-haze.is-hazy { animation: haze-drift 50s ease-in-out infinite; }
.scene-haze.haze-3 { opacity: 0.06; }
.scene-haze.haze-4 { opacity: 0.09; }
.scene-haze.haze-5 { opacity: 0.12; }
@keyframes haze-drift {
  0%, 100% { transform: translateX(-3%); }
  50% { transform: translateX(3%); }
}

.scene-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  width: 100vw;
  height: 100vh;
  opacity: 0.6;
}
/* Scrim above particles so body text keeps high contrast in every scene. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 11, 22, 0.15) 0%, transparent 30%, rgba(8, 11, 22, 0.55) 100%);
}

/* Sun-drenched day: warm glow anchored top-right + slowly rotating god rays. */
.scene-sun::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(46% 42% at 82% 8%, rgba(255, 190, 110, 0.22), transparent 60%);
}
.scene-sun::after {
  content: "";
  position: absolute;
  top: -40%; right: -20%;
  width: 90vmax; height: 90vmax;
  background: repeating-conic-gradient(from 0deg at 50% 50%,
    rgba(255, 200, 120, 0.10) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 72%);
  mask-image: radial-gradient(closest-side, #000 20%, transparent 72%);
  transform-origin: center;
  animation: sun-rays 90s linear infinite;
}
.scene-sun-faint::before { opacity: 0.5; }
.scene-sun-faint::after { opacity: 0.4; }
@keyframes sun-rays { to { transform: rotate(360deg); } }

/* Fog / overcast: two blurred drifting cloud layers. */
.scene-fog::before, .scene-fog::after,
.scene-overcast::before, .scene-overcast::after {
  content: "";
  position: absolute;
  left: -15%; width: 130%; height: 60%;
  filter: blur(42px);
  background:
    radial-gradient(40% 60% at 20% 50%, rgba(190, 200, 220, 0.5), transparent 70%),
    radial-gradient(45% 55% at 65% 45%, rgba(170, 185, 210, 0.45), transparent 70%),
    radial-gradient(35% 50% at 90% 55%, rgba(200, 210, 228, 0.4), transparent 70%);
}
.scene-fog::before { top: 12%; animation: fog-drift 60s ease-in-out infinite; }
.scene-fog::after { top: 42%; animation: fog-drift 80s ease-in-out infinite reverse; }
.scene-overcast::before { top: 6%; opacity: 0.55; animation: fog-drift 70s ease-in-out infinite; }
.scene-overcast::after { top: 40%; opacity: 0.55; animation: fog-drift 90s ease-in-out infinite reverse; }
.scene-fog::before, .scene-fog::after { opacity: 0.8; }
.scene-css.is-windy::before, .scene-css.is-windy::after { animation-duration: 25s; }
@keyframes fog-drift {
  0%, 100% { transform: translateX(-6%); }
  50% { transform: translateX(6%); }
}

main { max-width: var(--maxw); margin: 0 auto; padding: 0 20px 40px; }

/* ---------- Topbar ---------- */
.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: conic-gradient(from 200deg, var(--accent), var(--warm), var(--cold), var(--accent));
  box-shadow: 0 0 20px rgba(106, 210, 255, 0.5);
}
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-badge {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 7px; border-radius: 999px; color: var(--accent);
  border: 1px solid var(--border-strong); background: var(--surface);
}

/* ---------- Search ---------- */
.search { position: relative; margin-left: auto; flex: 1 1 280px; max-width: 420px; }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: var(--text-faint); pointer-events: none;
}
#search-input {
  width: 100%;
  padding: 12px 40px 12px 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s, background 0.2s;
}
#search-input::placeholder { color: var(--text-faint); }
#search-input:focus {
  outline: none;
  border-color: var(--accent-soft);
  background: var(--surface-strong);
}
.search-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border: none; border-radius: 50%;
  background: var(--surface-strong); color: var(--text-dim);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  list-style: none; background: #131a30; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); overflow: hidden; z-index: 20;
  box-shadow: var(--shadow);
}
.search-results li {
  padding: 11px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 1px;
}
.search-results li:last-child { border-bottom: none; }
.search-results li:hover, .search-results li[aria-selected="true"] { background: var(--surface-strong); }
.search-results .r-name { font-weight: 600; }
.search-results .r-detail { font-size: 0.8rem; color: var(--text-dim); }
.search-results .r-empty { color: var(--text-dim); cursor: default; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 26px 0 10px; min-height: 340px; display: flex; flex-direction: column; justify-content: center; }
.hero-loading { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--text-dim); padding: 60px 0; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-place { display: inline-flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }
.hero-place .pin { width: 20px; height: 20px; fill: var(--accent); }
.hero-place h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
/* SEO keyword kept in the H1 but visually subordinate — the place name is the
   focal point, "Počasí" just leads into it (a giant temperature sits right
   below, so the word "weather" shouldn't compete for attention). */
.h1-kicker { font-weight: 400; color: var(--text-faint); }
.place-sub { color: var(--text-dim); font-size: 1rem; }

.hero-main { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 6px 0 0; }
.hero-icon { width: clamp(110px, 30vw, 160px); height: clamp(110px, 30vw, 160px); }
.hero-temp { display: flex; align-items: flex-start; }
.temp-value {
  font-size: clamp(5.5rem, 20vw, 9.5rem);
  font-weight: 200; letter-spacing: -0.04em; line-height: 0.9;
  background: linear-gradient(180deg, #ffffff, #b9c6e6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.temp-unit { font-size: clamp(1.6rem, 5vw, 2.6rem); font-weight: 300; color: var(--text-dim); margin-top: 0.6em; }

.hero-condition { font-size: 1.35rem; font-weight: 500; margin-top: 4px; }
.hero-feels { color: var(--text-dim); margin-top: 2px; }
.hero-feels strong { color: var(--text); font-weight: 600; }

.hero-stats {
  display: flex; justify-content: center; gap: 12px; margin: 22px auto 0; flex-wrap: wrap; max-width: 560px;
}
.stat {
  flex: 1 1 140px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.stat-value { font-size: 1.1rem; font-weight: 600; }

/* Air-quality tile: a left colour bar in the EEA band palette (slightly
   lightened for legibility on the dark surface, band still recognisable). */
.stat-aqi { position: relative; padding-left: 18px; }
.stat-aqi::before {
  content: "";
  position: absolute; left: 7px; top: 12px; bottom: 12px;
  width: 4px; border-radius: 2px;
  background: var(--aqi-color, var(--text-faint));
}
.aqi-reason { font-size: 0.72rem; color: var(--text-dim); }
.stat-aqi.aqi-0 { --aqi-color: #50f0e6; }
.stat-aqi.aqi-1 { --aqi-color: #7ad7b0; }
.stat-aqi.aqi-2 { --aqi-color: #f0e641; }
.stat-aqi.aqi-3 { --aqi-color: #ff6b6b; }
.stat-aqi.aqi-4 { --aqi-color: #d64d78; }
.stat-aqi.aqi-5 { --aqi-color: #a95bc0; }
.hero-source { margin-top: 16px; font-size: 0.76rem; color: var(--text-faint); }

/* ---------- Panels ---------- */
.panel { margin-top: 34px; }
.panel-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-dim); margin-bottom: 12px; padding-left: 4px; }

/* Hourly */
.hourly-scroll {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 12px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.hourly-scroll::-webkit-scrollbar { height: 6px; }
.hourly-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.hour {
  scroll-snap-align: start; flex: 0 0 auto; width: 72px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 6px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.hour.is-now { border-color: var(--accent-soft); background: var(--surface-strong); }
.hour-time { font-size: 0.8rem; color: var(--text-dim); }
.hour-icon { width: 34px; height: 34px; }
.hour-temp { font-weight: 600; font-size: 1.02rem; }
.hour-pop { font-size: 0.72rem; color: var(--accent); min-height: 1em; }

/* Daily */
.daily-list { display: flex; flex-direction: column; gap: 8px; }
.day {
  display: grid; grid-template-columns: 92px 40px 1fr auto; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
}
.day-name { font-weight: 600; }
.day-name small { display: block; font-weight: 400; font-size: 0.76rem; color: var(--text-faint); }
.day-icon { width: 34px; height: 34px; }
.day-pop { font-size: 0.78rem; color: var(--accent); grid-column: 3; }
.day-range { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.day-min { color: var(--text-dim); width: 34px; text-align: right; }
.day-max { color: var(--text); font-weight: 600; width: 34px; }
.day-bar { width: 84px; height: 5px; border-radius: 3px; background: var(--border-strong); position: relative; overflow: hidden; }
.day-bar span { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, var(--cold), var(--warm)); }

/* ---------- About ---------- */
.about { margin-top: 60px; text-align: center; }
.about-title { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; }
.about-lead { color: var(--text-dim); max-width: 540px; margin: 12px auto 0; font-size: 1.05rem; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 28px; text-align: left; }
.about-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.about-icon { font-size: 1.6rem; margin-bottom: 8px; }
.about-card h3 { font-size: 1.12rem; margin-bottom: 6px; }
.about-card p { color: var(--text-dim); font-size: 0.94rem; }

/* ---------- Apps ---------- */
.apps { margin-top: 56px; text-align: center; padding: 34px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.apps-title { font-size: 1.5rem; font-weight: 700; }
.apps-lead { color: var(--text-dim); margin: 10px auto 0; max-width: 460px; }
.apps-badges { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.store-badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px; border: 1px solid var(--border-strong); border-radius: 12px;
  background: rgba(0,0,0,0.25); color: var(--text);
}
.store-badge svg { width: 24px; height: 24px; fill: currentColor; }
.store-badge span { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.store-badge small { font-size: 0.64rem; color: var(--text-dim); }
.store-badge b { font-size: 1rem; }

/* ---------- Footer ---------- */
.site-footer { max-width: var(--maxw); margin: 60px auto 0; padding: 30px 20px 50px; border-top: 1px solid var(--border); text-align: center; }
.footer-brand { font-weight: 700; margin-bottom: 8px; }
.footer-note { color: var(--text-dim); font-size: 0.86rem; max-width: 560px; margin: 4px auto; }
.footer-attrib { color: var(--text-faint); font-size: 0.8rem; margin: 14px auto 0; max-width: 560px; }
.footer-attrib a, .footer-contact a { color: var(--accent); text-decoration: none; }
.footer-attrib a:hover, .footer-contact a:hover { text-decoration: underline; }
.footer-contact { margin-top: 12px; font-size: 0.9rem; }

/* ---------- Weather icon animations ---------- */
.wx { width: 100%; height: 100%; overflow: visible; }
.wx .sun-core { transform-origin: center; }
.wx .sun-rays { transform-origin: center; animation: rays-spin 30s linear infinite; }
@keyframes rays-spin { to { transform: rotate(360deg); } }
.wx .cloud { animation: cloud-drift 6s ease-in-out infinite; }
@keyframes cloud-drift { 0%,100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
.wx .drop { animation: drop-fall 1.4s linear infinite; }
.wx .drop:nth-child(2) { animation-delay: 0.4s; }
.wx .drop:nth-child(3) { animation-delay: 0.8s; }
@keyframes drop-fall { 0% { opacity: 0; transform: translateY(-3px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(8px); } }
.wx .flake { animation: flake-fall 3s linear infinite; transform-origin: center; }
.wx .flake:nth-child(2) { animation-delay: 1s; }
.wx .flake:nth-child(3) { animation-delay: 2s; }
@keyframes flake-fall { 0% { opacity: 0; transform: translateY(-3px) rotate(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(9px) rotate(180deg); } }
.wx .bolt { animation: bolt-flash 2.5s steps(1) infinite; }
@keyframes bolt-flash { 0%, 92%, 100% { opacity: 0.25; } 94%, 98% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  /* Motion stops, but the beautiful gradient scenes stay — never blank. */
  .wx *, .spinner, .scene-haze,
  .scene-sun::after, .scene-fog::before, .scene-fog::after,
  .scene-overcast::before, .scene-overcast::after { animation: none !important; }
}

@media (max-width: 560px) {
  .topbar { gap: 12px; padding: 14px 16px; }
  main { padding: 0 16px 40px; }
  .search { order: 3; margin-left: 0; max-width: none; }

  /* 16px min — anything smaller makes iOS Safari zoom the page on focus. */
  #search-input { font-size: 1rem; }
  .search-results { max-height: 50vh; overflow-y: auto; }
  .search-results li { padding: 14px 16px; min-height: 48px; }
  /* Keep the ✕ visually 24px but give it a 40px touch target. */
  .search-clear { width: 40px; height: 40px; padding: 8px; background-clip: content-box; }

  /* Scrollbar is noise on touch; add edge fades to hint horizontal scroll. */
  .hourly-scroll {
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  }
  .hourly-scroll::-webkit-scrollbar { display: none; }

  .day { grid-template-columns: 76px 34px 1fr auto; gap: 8px; padding: 11px 12px; }
  .day-bar { width: 54px; }
}

@media (max-width: 400px) {
  .temp-value { font-size: 4.6rem; }
  .hero-icon { width: 84px; height: 84px; }
  .hero-main { gap: 2px; }

  /* Three stats as full-width rows instead of cramped columns. */
  .hero-stats .stat {
    flex-basis: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 14px;
  }

  .day { grid-template-columns: 64px 30px 1fr auto; gap: 6px; padding: 10px; }
  .day-icon { width: 30px; height: 30px; }
  .day-bar { width: 44px; }
  .day-min, .day-max { width: 28px; font-size: 0.92rem; }

  .about-grid { gap: 10px; }
  .apps { padding: 26px 16px; }
}
