/* ============================================================
   CityScope — reset, typography, weather-responsive atmosphere
   ============================================================ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Visually hides content while keeping it in the accessibility tree —
   used for the screen-reader-only data tables behind each canvas chart. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--text);
  background: var(--background);
  overflow-x: hidden;
  min-height: 100vh;
  transition: color 0.4s ease;
}

button, input, select, textarea { font-family: inherit; }

h1, h2, h3, h4, p { margin: 0; }

a { color: var(--accent-text); text-underline-offset: 0.18em; }

/* Numbers that update or sit in columns shouldn't jitter. */
.metric-value, .hero-temp, .hero-time-value, .hourly-temp, .daily-temps, .aqi-value,
.range-value, .compare-table td, #currency-target-line, .fact-row dd { font-variant-numeric: tabular-nums; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--btn-primary-bg);
  color: var(--primary-contrast);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.75rem; }
main:focus { outline: none; }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

/* Set by js/motion.js only when motion is allowed; GSAP then reveals these.
   motion.js removes the class if GSAP is missing, so content never stays
   hidden. */
.motion-pending [data-reveal] { opacity: 0; }

img { max-width: 100%; }

::selection { background: var(--primary); color: var(--primary-contrast); }

/* ============================================================
   Scrollbars — slim, translucent, rounded, everywhere (page scroll,
   the hourly-forecast strip, dropdown lists, ...) instead of the
   browser's flat default bar, which breaks the glass look.
   ============================================================ */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}
*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: rgba(127, 127, 127, 0.35);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(127, 127, 127, 0.55);
  background-clip: padding-box;
}

/* ============================================================
   Atmosphere — a very subtle, weather-driven gradient behind the
   whole app. Intentionally understated: a mood, not a scene.
   ============================================================ */

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  --atmo-top: #7ec8f2;
  --atmo-mid: #bfe0fb;
  --atmo-bottom: #eef3f8;
  --atmo-glow: rgba(255, 244, 200, 0.55);
  background: linear-gradient(180deg, var(--atmo-top) 0%, var(--atmo-mid) 55%, var(--atmo-bottom) 100%);
  transition: background 1.1s ease;
}

body[data-weather="clear"] .atmosphere { --atmo-top:#7ec8f2; --atmo-mid:#bfe4fb; --atmo-bottom:#f3f9ff; --atmo-glow: rgba(255,238,180,0.6); }
body[data-theme="dark"][data-weather="clear"] .atmosphere { --atmo-top:#040f22; --atmo-mid:#0c2748; --atmo-bottom:#15304f; --atmo-glow: rgba(255,222,150,0.22); }

body[data-weather="partly-cloudy"] .atmosphere,
body[data-weather="unknown"] .atmosphere { --atmo-top:#84b6e8; --atmo-mid:#cfe3f7; --atmo-bottom:#f4f8fd; --atmo-glow: rgba(255,255,255,0.5); }
body[data-theme="dark"][data-weather="partly-cloudy"] .atmosphere,
body[data-theme="dark"][data-weather="unknown"] .atmosphere { --atmo-top:#0a1830; --atmo-mid:#16304f; --atmo-bottom:#1f3c5c; --atmo-glow: rgba(255,255,255,0.12); }

body[data-weather="cloudy"] .atmosphere { --atmo-top:#9aabbd; --atmo-mid:#c4d0dc; --atmo-bottom:#eef1f5; --atmo-glow: rgba(255,255,255,0.3); }
body[data-theme="dark"][data-weather="cloudy"] .atmosphere { --atmo-top:#141a24; --atmo-mid:#20293a; --atmo-bottom:#2c3648; --atmo-glow: rgba(255,255,255,0.07); }

body[data-weather="fog"] .atmosphere { --atmo-top:#b7c1cb; --atmo-mid:#d4dade; --atmo-bottom:#eff1f3; --atmo-glow: rgba(255,255,255,0.35); }
body[data-theme="dark"][data-weather="fog"] .atmosphere { --atmo-top:#1a1f26; --atmo-mid:#282e37; --atmo-bottom:#383f48; --atmo-glow: rgba(255,255,255,0.06); }

body[data-weather="rain"] .atmosphere { --atmo-top:#4a6fa5; --atmo-mid:#6f8fb8; --atmo-bottom:#b7c8db; --atmo-glow: rgba(255,255,255,0.15); }
body[data-theme="dark"][data-weather="rain"] .atmosphere { --atmo-top:#050b16; --atmo-mid:#101d33; --atmo-bottom:#1a2c47; --atmo-glow: rgba(255,255,255,0.05); }

body[data-weather="thunderstorm"] .atmosphere { --atmo-top:#2c3648; --atmo-mid:#47536b; --atmo-bottom:#6a7690; --atmo-glow: rgba(255,255,255,0.2); }
body[data-theme="dark"][data-weather="thunderstorm"] .atmosphere { --atmo-top:#03040a; --atmo-mid:#0f1320; --atmo-bottom:#181f31; --atmo-glow: rgba(255,255,255,0.08); }

body[data-weather="snow"] .atmosphere { --atmo-top:#cfe0ea; --atmo-mid:#e6eff5; --atmo-bottom:#fbfdff; --atmo-glow: rgba(255,255,255,0.6); }
body[data-theme="dark"][data-weather="snow"] .atmosphere { --atmo-top:#111a24; --atmo-mid:#223244; --atmo-bottom:#33465a; --atmo-glow: rgba(255,255,255,0.1); }

.fx-glow, .fx-clouds, .fx-fog, .fx-rain, .fx-snow, .fx-lightning {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.fx-glow { background: radial-gradient(circle at 50% 18%, var(--atmo-glow), transparent 55%); }
body[data-weather="clear"] .fx-glow,
body[data-weather="partly-cloudy"] .fx-glow,
body[data-weather="unknown"] .fx-glow { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  body[data-weather="clear"] .fx-glow { animation: glow-pulse 7s ease-in-out infinite; }
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

.cloud {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.85), rgba(255,255,255,0) 70%);
}
body[data-theme="dark"] .cloud { background: radial-gradient(ellipse at center, rgba(255,255,255,0.16), rgba(255,255,255,0) 70%); }
.cloud-a { width: 46vw; height: 18vw; top: 10%; left: -10%; }
.cloud-b { width: 34vw; height: 14vw; top: 22%; right: -8%; }

body[data-weather="partly-cloudy"] .fx-clouds,
body[data-weather="unknown"] .fx-clouds,
body[data-weather="cloudy"] .fx-clouds,
body[data-weather="fog"] .fx-clouds,
body[data-weather="rain"] .fx-clouds,
body[data-weather="thunderstorm"] .fx-clouds,
body[data-weather="snow"] .fx-clouds { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .cloud-a { animation: drift-a 90s linear infinite alternate; }
  .cloud-b { animation: drift-b 110s linear infinite alternate; }
}
@keyframes drift-a { from { transform: translateX(0); } to { transform: translateX(12vw); } }
@keyframes drift-b { from { transform: translateX(0); } to { transform: translateX(-14vw); } }

.fx-fog {
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.35) 0px, rgba(255,255,255,0.35) 2px, transparent 2px, transparent 60px);
  background-size: 100% 220px;
}
body[data-weather="fog"] .fx-fog { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  body[data-weather="fog"] .fx-fog { animation: fog-drift 50s linear infinite; }
}
@keyframes fog-drift { from { background-position-x: 0; } to { background-position-x: 400px; } }

.fx-rain { display: block; width: 100%; height: 100%; }
body[data-weather="rain"] .fx-rain,
body[data-weather="thunderstorm"] .fx-rain { opacity: 0.6; }

.fx-snow {
  background-image: radial-gradient(circle, rgba(255,255,255,0.9) 1.5px, transparent 1.6px);
  background-size: 42px 42px;
}
body[data-weather="snow"] .fx-snow { opacity: 0.55; }
@media (prefers-reduced-motion: no-preference) {
  body[data-weather="snow"] .fx-snow { animation: snow-fall 9s linear infinite; }
}
@keyframes snow-fall { from { background-position: 0 0; } to { background-position: 42px 210px; } }

.fx-lightning { background: rgba(255, 255, 255, 0.9); opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  body[data-weather="thunderstorm"] .fx-lightning { animation: lightning-flash 9s ease-in-out infinite; }
}
@keyframes lightning-flash {
  0%, 92%, 100% { opacity: 0; }
  93% { opacity: 0.5; }
  94% { opacity: 0.05; }
  95% { opacity: 0.35; }
  96% { opacity: 0; }
}

@keyframes fade-slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
