/* Meteorologyly: dark glass dashboard whose ambient glow follows the weather */

:root {
  --bg: #050507;
  --ink: #f4f6fb;
  --muted: rgba(244, 246, 251, 0.58);
  --faint: rgba(244, 246, 251, 0.36);
  --hair: rgba(255, 255, 255, 0.08);
  --hair-strong: rgba(255, 255, 255, 0.14);
  --shell: rgba(255, 255, 255, 0.025);
  --core: rgba(13, 14, 19, 0.74);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --drift: cubic-bezier(0.37, 0, 0.63, 1);
  --r-outer: 2rem;
  --pad-shell: 0.375rem;
  --r-inner: calc(var(--r-outer) - var(--pad-shell));
  --font: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* sky palette (overridden per condition) */
  --orb-a: #3b5b7a;
  --orb-b: #64748b;
  --orb-c: #1e293b;
  --accent: #a9c4e4;
  --cool: #7f9cc4;
}

body[data-sky="clear-day"]   { --orb-a: #f59e0b; --orb-b: #f0607a; --orb-c: #2f5fe8; --accent: #ffcf7a; --cool: #8fb3ff; }
body[data-sky="clear-night"] { --orb-a: #3730a3; --orb-b: #6d28d9; --orb-c: #0f766e; --accent: #c4b5fd; --cool: #7dd3fc; }
body[data-sky="clouds"]      { --orb-a: #3b5b7a; --orb-b: #64748b; --orb-c: #1e293b; --accent: #a9c4e4; --cool: #7f9cc4; }
body[data-sky="rain"]        { --orb-a: #1d4ed8; --orb-b: #0e7490; --orb-c: #1e293b; --accent: #7cc4ff; --cool: #5eead4; }
body[data-sky="snow"]        { --orb-a: #94a3b8; --orb-b: #93c5fd; --orb-c: #c7d2fe; --accent: #e0f2fe; --cool: #93c5fd; }
body[data-sky="thunder"]     { --orb-a: #7c3aed; --orb-b: #4338ca; --orb-c: #be185d; --accent: #d8b4fe; --cool: #818cf8; }
body[data-sky="fog"]         { --orb-a: #6b7280; --orb-b: #9ca3af; --orb-c: #44403c; --accent: #d6d3d1; --cool: #a8a29e; }

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 6rem; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* film grain, fixed and non-interactive */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }

/* ---------- Ambient sky ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% 120%, var(--bg) 30%, transparent 75%);
}
.orb {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(circle, currentColor 0%, transparent 62%);
  opacity: 0.38;
  filter: blur(40px);
  transition: color 1.6s var(--ease);
  animation: drift 38s var(--drift) infinite alternate;
}
.orb-a { color: var(--orb-a); top: -28vmax; left: -14vmax; }
.orb-b { color: var(--orb-b); top: -18vmax; right: -24vmax; animation-duration: 46s; animation-delay: -12s; }
.orb-c { color: var(--orb-c); bottom: -36vmax; left: 20vw; opacity: 0.28; animation-duration: 54s; animation-delay: -24s; }
body[data-sky="snow"] .orb { opacity: 0.22; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
}

/* ---------- Floating island nav ---------- */
.nav-wrap {
  position: fixed;
  top: 1.25rem;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.nav-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(12, 13, 18, 0.55);
  border: 1px solid var(--hair);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 20px 50px -30px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.brand img { border-radius: 50%; }
.nav-links { display: flex; gap: 0.15rem; margin: 0; padding: 0; list-style: none; }
.nav-links a {
  display: block;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
.nav-links a:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }

.burger {
  display: none;
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}
.burger span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1rem;
  height: 1.5px;
  margin: -0.75px 0 0 -0.5rem;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.6s var(--ease);
}
.burger span:first-child { transform: translateY(-3.5px); }
.burger span:last-child { transform: translateY(3.5px); }
body.menu-open .burger span:first-child { transform: rotate(45deg); }
body.menu-open .burger span:last-child { transform: rotate(-45deg); }

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  padding: 2rem;
  background: rgba(5, 5, 7, 0.82);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease), visibility 0s linear 0.6s;
}
body.menu-open .menu-overlay { opacity: 1; visibility: visible; transition: opacity 0.6s var(--ease); }
.menu-overlay ul { list-style: none; margin: 0; padding: 0; }
.menu-overlay li {
  overflow: hidden;
}
.menu-overlay a {
  display: block;
  padding: 0.35rem 0;
  font-size: clamp(2.5rem, 12vw, 4rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  text-decoration: none;
  opacity: 0;
  transform: translateY(3rem);
  transition: transform 0.8s var(--ease), opacity 0.8s var(--ease);
}
body.menu-open .menu-overlay a {
  opacity: 1;
  transform: translateY(0);
  transition-delay: calc(120ms + var(--i) * 60ms);
}

/* ---------- Layout ---------- */
.page {
  width: min(1240px, 100% - 3rem);
  margin: 0 auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transition: background-color 1.6s var(--ease), box-shadow 1.6s var(--ease);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: end;
  gap: 2rem;
  padding: 10rem 0 4rem;
}
.display {
  margin: 1.25rem 0 0;
  font-size: clamp(3rem, 7.5vw, 6.25rem);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: -0.05em;
}
.intro-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.9rem; }

/* search: double-bezel pill with nested island button */
.search {
  width: 100%;
  max-width: 30rem;
  padding: var(--pad-shell);
  border-radius: 999px;
  background: var(--shell);
  border: 1px solid var(--hair);
}
.search-core {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.35rem 0.35rem 1.1rem;
  border-radius: 999px;
  background: var(--core);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: box-shadow 0.6s var(--ease);
}
.search-core:focus-within { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 0 0 1px var(--hair-strong); }
.search-core > i { font-size: 1.15rem; color: var(--faint); }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }

.btn-island {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.35rem 0.35rem 1.15rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.5s var(--ease);
}
.btn-island:active { transform: scale(0.98); }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(5, 5, 7, 0.08);
  transition: transform 0.6s var(--ease);
}
.btn-island:hover .btn-icon,
.city-card:hover .btn-icon { transform: translate(2px, -1px) scale(1.05); }

.ghost-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.5s var(--ease), background-color 0.5s var(--ease), transform 0.5s var(--ease);
}
.ghost-pill:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.ghost-pill:active { transform: scale(0.98); }

/* bento */
.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.row-2 { grid-row: span 2; }

/* double-bezel cards */
.shell {
  padding: var(--pad-shell);
  border-radius: var(--r-outer);
  background: var(--shell);
  border: 1px solid var(--hair);
}
.core {
  height: 100%;
  padding: clamp(1.25rem, 2.4vw, 2.1rem);
  border-radius: var(--r-inner);
  background: var(--core);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 40px 80px -50px rgba(0, 0, 0, 0.55);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}
.card-title { margin: 0; font-size: 1rem; font-weight: 400; color: var(--muted); }

/* hero */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 31rem;
}
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.875rem; }
.city {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.place { display: flex; flex-wrap: wrap; gap: 0 0.9rem; margin: 0.45rem 0 0; font-size: 0.875rem; }
.place span:empty { display: none; }
.hero-temp { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.temp-xl {
  font-size: clamp(5.5rem, 15vw, 11rem);
  font-weight: 200;
  line-height: 0.82;
  letter-spacing: -0.07em;
  font-variant-numeric: tabular-nums;
}
.hero-icon {
  font-size: clamp(4rem, 9vw, 7.5rem);
  color: var(--accent);
  transition: color 1.6s var(--ease);
}
.hero-foot { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.hero-foot p { margin: 0; }
.condition { font-size: 1.15rem; }

/* stats */
.stats { display: flex; flex-direction: column; justify-content: space-between; gap: 1.1rem; }
.stat { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0.6rem; }
.stat-label { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--muted); }
.stat-label i { font-size: 1.1rem; }
.stat-value { font-size: 1.5rem; font-weight: 300; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat + .stat { padding-top: 1.1rem; border-top: 1px solid var(--hair); }
.meter {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1.1s var(--ease), background-color 1.6s var(--ease);
}

/* daylight arc */
.sun { display: flex; flex-direction: column; gap: 1rem; }
.sun-arc { width: 100%; height: auto; overflow: visible; }
.arc-track { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 1.2; stroke-dasharray: 2 5; }
.arc-progress { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; transition: stroke 1.6s var(--ease); }
.horizon { stroke: var(--hair); stroke-width: 1; }
.sun-dot { fill: var(--accent); filter: drop-shadow(0 0 6px var(--accent)); transition: opacity 0.6s var(--ease); }
.sun-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.sun-times span { display: flex; flex-direction: column; }
.sun-times .center { align-items: center; }
.sun-times .end { align-items: flex-end; }
.sun-times small { font-size: 0.75rem; }
.sun-times b { font-weight: 400; font-variant-numeric: tabular-nums; }

/* forecast */
.forecast { list-style: none; margin: 0; padding: 0; }
.day {
  display: grid;
  grid-template-columns: 3.75rem 1.75rem 2.4rem 1fr 2.4rem;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0;
  font-variant-numeric: tabular-nums;
}
.day + .day { border-top: 1px solid var(--hair); }
.day-name { font-size: 0.95rem; }
.day i { font-size: 1.35rem; color: var(--accent); transition: color 1.6s var(--ease); }
.t-lo { color: var(--faint); text-align: right; }
.t-hi { text-align: right; }
.range { position: relative; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }
.range-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--from);
  right: calc(100% - var(--to));
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cool), var(--accent));
}

/* chart */
.chart-card { display: flex; flex-direction: column; }
.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.segmented {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hair);
}
.segmented button {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease), transform 0.5s var(--ease);
}
.segmented button i { font-size: 1rem; }
.segmented button:hover { color: var(--ink); }
.segmented button:active { transform: scale(0.97); }
.segmented button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
.chart-box { position: relative; flex: 1; min-height: 22rem; }

/* map */
.map-frame {
  height: 26rem;
  border-radius: calc(var(--r-inner) - 0.75rem);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}
.map-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  filter: invert(92%) hue-rotate(180deg) saturate(0.6) contrast(0.92);
}

/* featured cities */
.block { padding: 6rem 0 0; }
.block-head { margin-bottom: 2rem; }
.section-title {
  margin: 1rem 0 0;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.045em;
  line-height: 1;
}
.city-strip {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--hair-strong) transparent;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.city-card {
  flex: 0 0 15rem;
  scroll-snap-align: start;
  padding: var(--pad-shell);
  border-radius: 1.75rem;
  border: 1px solid var(--hair);
  background: var(--shell);
  text-align: left;
  cursor: pointer;
  transition: transform 0.6s var(--ease);
}
.city-card:active { transform: scale(0.98); }
.city-media {
  display: block;
  height: 11rem;
  overflow: hidden;
  border-radius: calc(1.75rem - var(--pad-shell));
  background: var(--core);
}
.city-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85);
  transition: transform 1.2s var(--ease);
}
.city-card:hover .city-media img { transform: scale(1.05); }
.city-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.35rem 0.35rem 0.8rem;
  font-size: 0.95rem;
}
.city-meta .btn-icon { background: rgba(255, 255, 255, 0.07); }

.footer { padding: 5rem 0 3rem; font-size: 0.85rem; }
.footer a { color: var(--ink); text-underline-offset: 3px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 40;
  max-width: calc(100% - 2rem);
  padding: 0.75rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--hair-strong);
  background: rgba(12, 13, 18, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 0.9rem;
  opacity: 0;
  transform: translate(-50%, 1.5rem);
  pointer-events: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* loading */
body.is-loading #now .core { opacity: 0.55; }
#now .core { transition: opacity 0.6s var(--ease); }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(2.5rem); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.bento > * { min-width: 0; }
.bento > .reveal:nth-child(2) { transition-delay: 80ms; }
.bento > .reveal:nth-child(3) { transition-delay: 160ms; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .span-8, .span-5, .span-7 { grid-column: span 12; }
  .span-4 { grid-column: span 6; }
  .row-2 { grid-row: auto; }
  .hero { min-height: 26rem; }
}

@media (max-width: 860px) {
  .nav-links { display: none; }
  .burger { display: block; }
  .nav-pill { width: calc(100% - 2rem); justify-content: space-between; }
}

@media (max-width: 767px) {
  .page { width: 100%; padding: 0 1rem; }
  .intro { grid-template-columns: minmax(0, 1fr); padding: 7.5rem 0 2.5rem; }
  .intro-actions { align-items: stretch; }
  .search { max-width: none; }
  .ghost-pill { align-self: flex-start; }
  .bento { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .controls { width: 100%; }
  .controls .segmented:first-child { flex: 1 1 100%; }
  .controls .segmented:first-child button { flex: 1; justify-content: center; padding-inline: 0.5rem; }
  .bento > * { grid-column: 1 / -1; min-width: 0; }
  .hero { min-height: 22rem; }
  .chart-box { min-height: 18rem; }
  .map-frame { height: 20rem; }
  .block { padding-top: 4rem; }
  .city-card { flex-basis: 12.5rem; }
  .city-media { height: 9rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .orb { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}
