/* ================================================================
   WEATHERWHISPER — GLOBAL STYLESHEET
   Fluid color-shifting glassmorphism aesthetic.
================================================================ */

:root {
  /* These variables will be dynamically modified by app.js based on temperature */
  --bg-hue: 220; /* 220 for cold blue, 0 for hot red */
  --bg-sat: 60%;
  --bg-lit: 12%;
  
  --bg-base:        hsl(var(--bg-hue), var(--bg-sat), var(--bg-lit));
  --bg-card:        rgba(15, 15, 20, 0.5);
  --bg-card-hover:  rgba(25, 25, 30, 0.7);

  --accent-primary: hsl(var(--bg-hue), 80%, 60%);
  --accent-white:   #ffffff;

  --text-primary:   #f4f4f8;
  --text-secondary: hsl(var(--bg-hue), 20%, 75%);
  --text-muted:     #5a6080;

  --border:         rgba(255, 255, 255, 0.08);

  --sp-xs:  0.25rem; --sp-sm:  0.5rem; --sp-md:  1rem; --sp-lg:  1.5rem; --sp-xl:  2rem; --sp-2xl: 3rem;
  --font-sans: 'InterVariable', 'Inter', system-ui, sans-serif;
  --font-mono: 'InterVariable', 'Inter', system-ui, sans-serif;

  --r-sm:   6px; --r-md:   12px; --r-lg:   20px; --r-full: 9999px;
  --shadow-card: 0 8px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.4);
  --t-fast: 0.15s ease; --t-med: 0.5s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  background-image: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
  background-attachment: fixed;
  display: flex; flex-direction: column;
  transition: background-color var(--t-med);
}

h1, h2, h3 { color: var(--text-primary); font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }

.site-header { padding: var(--sp-xl) var(--sp-md); text-align: center; }
.header-inner { max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: var(--sp-md); }
.logo-icon { width: 64px; height: 64px; filter: drop-shadow(0 0 12px var(--accent-primary)); transition: filter var(--t-med); }

.header-text h1 {
  font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 700; letter-spacing: -0.02em;
  color: var(--accent-white); line-height: 1.1;
}
.tagline { color: var(--text-secondary); font-size: 0.95rem; text-transform: uppercase; margin-top: var(--sp-xs); letter-spacing: 0.06em; transition: color var(--t-med); }

.main-content { flex: 1; padding: 0 var(--sp-md) var(--sp-2xl); display: flex; flex-direction: column; align-items: center; gap: var(--sp-xl); }

.card {
  background: var(--bg-card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-xl);
  box-shadow: var(--shadow-card); position: relative; overflow: hidden; width: 100%; max-width: 600px;
}

/* Input Labels */
.input-label { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--sp-xs); text-align: left; width: 100%; }

/* City Select */
.city-select-wrapper { margin-bottom: var(--sp-lg); }
.city-select {
  width: 100%; padding: 1rem; border-radius: var(--r-md); background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 1rem; font-family: var(--font-sans); cursor: text; transition: border-color var(--t-fast);
}
.city-select:focus { outline: none; border-color: var(--accent-primary); }
.city-contact { text-align: center; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.6rem; }
.city-contact a { color: var(--text-secondary); text-decoration: underline; transition: color var(--t-fast); }
.city-contact a:hover { color: var(--accent-white); }

/* Date Range */
.date-range-wrapper { display: flex; align-items: center; gap: var(--sp-md); margin-bottom: var(--sp-xl); width: 100%; }
.date-input { flex: 1; width: 100%; padding: 1rem; border-radius: var(--r-md); background: rgba(0,0,0,0.3); border: 1px solid var(--border); color: var(--text-primary); font-family: var(--font-sans); font-size: 1rem; color-scheme: dark; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.date-input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(255,255,255,0.1); }
.date-input::-webkit-calendar-picker-indicator { cursor: pointer; filter: invert(0.8) sepia(0) saturate(0) hue-rotate(0deg); opacity: 0.7; transition: opacity var(--t-fast); }
.date-input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.date-separator { color: var(--text-muted); font-weight: 600; padding: 0 0.5rem; }

/* Range View */
.range-title { font-size: 1rem; margin-bottom: var(--sp-sm); color: var(--text-secondary); text-align: center; }
.range-list { max-height: 250px; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-xs); padding-right: 0.5rem; }
.range-item { display: flex; justify-content: space-between; background: rgba(0,0,0,0.2); padding: 0.75rem 1rem; border-radius: var(--r-sm); border: 1px solid rgba(255,255,255,0.03); }
.range-date { color: var(--accent-white); font-weight: 600; font-variant-numeric: tabular-nums; }
.range-temps { color: var(--text-secondary); display: flex; gap: 1rem; }
.range-min { color: #88ccff; }
.range-max { color: #ff8855; font-weight: 600; }

/* Result Display */
.result-box { text-align: center; padding-top: var(--sp-xs); margin-bottom: var(--sp-lg); }
.result-label { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: var(--sp-xs); transition: color var(--t-med); text-transform: uppercase; letter-spacing: 0.05em; }
.result-temp { font-size: clamp(3rem, 10vw, 5rem); font-weight: 800; color: var(--accent-white); font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 0 20px var(--accent-primary); transition: text-shadow var(--t-med); }

/* Range Slider */
.slider-container { margin-bottom: var(--sp-xl); display: flex; flex-direction: column; gap: var(--sp-sm); }
.slider-label { display: flex; justify-content: space-between; font-weight: 600; font-size: 0.9rem; color: var(--text-secondary); }
.slider-val { color: var(--accent-white); font-variant-numeric: tabular-nums; }

input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; margin: 10px 0; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 8px; cursor: pointer; background: rgba(255,255,255,0.1); border-radius: 4px; }
input[type=range]::-webkit-slider-thumb { height: 24px; width: 24px; border-radius: 50%; background: var(--accent-white); cursor: pointer; -webkit-appearance: none; margin-top: -8px; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }

/* ---- App switcher carousel ---------------------------------------- */
/* Stormberry chrome, the MetadataScrubber design (2026-10). The track
   holds 10 identical sets of cards and slides by exactly one set
   (-10%), so the loop is seamless. Change the number of sets and the
   shift together. The page's own app is the last card of each set. */
.app-switcher-container {
  padding: 3rem 0;
  margin-top: 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  line-height: 1.6;
  color-scheme: dark;
}

.switcher-title {
  margin: 0 0 1.5rem;
  padding: 0 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: var(--text-secondary);
}

.app-switcher-marquee {
  display: flex;
  width: 100%;
  overflow: hidden;
  padding: 0.5rem 1rem 1.5rem;
}

.app-switcher-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
}

.app-switcher-marquee:hover .app-switcher-track,
.app-switcher-marquee:focus-within .app-switcher-track { animation-play-state: paused; }

@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-10%); }
}

.switcher-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-right: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.switcher-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
}

.switcher-card img {
  width: 32px;
  height: 32px;
  opacity: 0.9;
}

/* A visible focus ring on the dark chrome, whatever the page does elsewhere */
.app-switcher-container a:focus-visible,
.site-footer a:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* ---- Carousel and footer access (2026-10-10) ---------------------- */
/* The page's own app, the last card of every set, is marked for screen
   readers (aria-current) and for the eye (an accent border). */
.switcher-card[aria-current="page"] { border-color: var(--text-primary); }

/* Rounded focus ring, whatever corner radius the page's own ring uses */
.switcher-card:focus-visible { border-radius: 12px; }

/* Keyboard focus stops the slide and the row scrolls to the focused card,
   so it is never off-screen. :focus-visible and not :focus-within, so a
   mouse click does not move the card from under the pointer. */
.app-switcher-marquee:has(.switcher-card:focus-visible) { overflow-x: auto; }
.app-switcher-marquee:has(.switcher-card:focus-visible) .app-switcher-track { animation: none; }

/* The pause tick box (WCAG 2.2.2): ticked, the slide stops and the row
   scrolls by hand. Plain CSS, no script. `all: revert` keeps the page's
   own form styles off it. */
.app-switcher-container input.switcher-pause {
  all: revert;
  margin: 0 0.5rem 0.75rem 0;
  vertical-align: middle;
  accent-color: var(--text-primary);
  cursor: pointer;
}

.app-switcher-container label.switcher-pause-label {
  all: revert;
  display: inline-block;
  margin-bottom: 0.75rem;
  vertical-align: middle;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
}

.app-switcher-container input.switcher-pause:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.switcher-pause:checked ~ .app-switcher-marquee { overflow-x: auto; }
.switcher-pause:checked ~ .app-switcher-marquee .app-switcher-track { animation: none; }

/* A footer link never breaks inside itself (the org.nr. did at 320 px) */
.footer-bottom p a { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  /* Nothing slides, so there is nothing to pause. */
  .app-switcher-container input.switcher-pause,
  .app-switcher-container label.switcher-pause-label { display: none; }
}

/* ---- Footer -------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  padding: 4rem 1.5rem 2rem;
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

.site-footer p { margin: 0; }

.footer-inner {
  max-width: 680px;
  margin: 0 auto 3rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.footer-brand { max-width: 320px; }

.footer-logo {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.footer-logo:hover { color: var(--text-primary); }
.footer-dot { color: var(--accent-primary); transition: color var(--t-med); }

.footer-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.footer-powered p {
  max-width: 250px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* Credit links read as links, as the legal links do */
.footer-powered a,
.footer-bottom p a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 150ms ease;
}

.footer-powered a:hover,
.footer-bottom p a:hover { color: var(--accent-primary); }

.footer-bottom {
  max-width: 680px;
  margin: 0 auto;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.footer-social { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; }
.footer-social a { color: var(--text-secondary); transition: color 150ms ease, transform 150ms ease; }
.footer-social a:hover { color: var(--text-primary); transform: translateY(-2px); }
.footer-social svg { display: block; }

.footer-bottom p { color: var(--text-secondary); font-size: 0.85rem; }

/* The public test of an app's privacy claim, where it makes one */
.footer-bottom .footer-offline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

.footer-privacy, .footer-ai { opacity: 0.85; }

@media (min-width: 720px) {
  .switcher-title { padding: 0 2rem; }
  .app-switcher-marquee { padding: 0.5rem 2rem 1.5rem; }
  .footer-powered p { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  /* No sliding: the carousel becomes a row the reader scrolls. */
  .app-switcher-track { animation: none; }
  .app-switcher-marquee { overflow-x: auto; }
  .switcher-card,
  .footer-social a { transition: none; }
  .switcher-card:hover,
  .footer-social a:hover { transform: none; }
}

/* Kept from before: this footer follows the hue that app.js sets */
.site-footer { transition: background-color var(--t-med); }
.footer-tagline, .footer-powered p, .footer-bottom p { transition: color var(--t-med); }
