:root {
  --bg: #0b1120;
  --bg-soft: #111a2e;
  --card: #16213b;
  --card-hover: #1c2a49;
  --text: #f1f5fb;
  --text-dim: #9aa8c7;
  --accent: #ffb24d;
  --accent-2: #5ec8ff;
  --border: #223257;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scrollbar-width: thin;
  scrollbar-color: rgba(94, 200, 255, 0.4) transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(94, 200, 255, 0.35); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(94, 200, 255, 0.55); }

a { color: var(--accent-2); }

/* subtle full-page grain for a tactile, premium feel */
.noise {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%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");
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- dynamic background ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg);
}

.bg-gradient {
  position: absolute;
  inset: -10%;
  background-image: linear-gradient(160deg, #0c1224 0%, #141b34 55%, #1c2b4a 100%);
  background-size: 180% 180%;
  animation: bg-pan 40s ease-in-out infinite alternate;
  transition: background-image 1.5s ease;
}

@keyframes bg-pan {
  from { background-position: 0% 0%; }
  to   { background-position: 100% 100%; }
}

.bg-stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  background-repeat: repeat;
  background-size: 400px 400px;
  background-image:
    radial-gradient(1.5px 1.5px at 15% 25%, #fff, transparent),
    radial-gradient(1px 1px at 40% 10%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 65% 35%, #fff, transparent),
    radial-gradient(1px 1px at 80% 15%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 25% 60%, #fff, transparent),
    radial-gradient(1px 1px at 90% 55%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 50% 75%, #fff, transparent);
}

.bg-sun {
  position: absolute;
  top: 6%;
  right: 10%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 201, 120, 0.9) 0%, rgba(255, 201, 120, 0.32) 42%, transparent 72%);
  opacity: 0;
  transition: opacity 1.2s ease;
  animation: sun-pulse 6s ease-in-out infinite;
}

@keyframes sun-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.07); }
}

.bg-clouds {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.cloud {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(30px);
}

.cloud.c1 { width: 280px; height: 90px;  top: 12%; left: -20%; animation: drift 55s linear infinite; }
.cloud.c2 { width: 200px; height: 70px;  top: 30%; left: -30%; opacity: .75; animation: drift 75s linear infinite -20s; }
.cloud.c3 { width: 340px; height: 110px; top: 4%;  left: -35%; opacity: .55; animation: drift 95s linear infinite -45s; }

@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(150vw); }
}

.bg-fog {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.20) 50%, rgba(255, 255, 255, 0.08) 100%);
}

.bg-rain {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  background-image: repeating-linear-gradient(
    112deg,
    rgba(180, 210, 255, 0.4) 0px,
    rgba(180, 210, 255, 0.4) 1px,
    transparent 1px,
    transparent 14px
  );
  background-size: 100% 140px;
  animation: rain-fall 0.5s linear infinite;
}

@keyframes rain-fall {
  from { background-position: 0 0; }
  to   { background-position: -34px 140px; }
}

.bg-snow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  background-repeat: repeat;
  background-size: 320px 320px;
  background-image:
    radial-gradient(2.5px 2.5px at 10% 20%, #fff, transparent 60%),
    radial-gradient(2px 2px at 30% 60%, #fff, transparent 60%),
    radial-gradient(3px 3px at 55% 15%, #fff, transparent 60%),
    radial-gradient(2px 2px at 70% 80%, #fff, transparent 60%),
    radial-gradient(2.5px 2.5px at 85% 40%, #fff, transparent 60%),
    radial-gradient(2px 2px at 95% 70%, #fff, transparent 60%);
  animation: snow-fall 12s linear infinite;
}

@keyframes snow-fall {
  from { background-position: 0 0; }
  to   { background-position: 120px 320px; }
}

/* sky state -> gradient */
body[data-sky="clear-day"]           .bg-gradient { background-image: linear-gradient(160deg, #123a63 0%, #1c5f8a 45%, #2f7fae 100%); }
body[data-sky="clear-night"]         .bg-gradient { background-image: linear-gradient(160deg, #05070f 0%, #0c1224 55%, #141b34 100%); }
body[data-sky="partly-cloudy-day"]   .bg-gradient { background-image: linear-gradient(160deg, #16233f 0%, #274469 50%, #3a5b85 100%); }
body[data-sky="partly-cloudy-night"] .bg-gradient { background-image: linear-gradient(160deg, #060911 0%, #0f1626 55%, #182238 100%); }
body[data-sky="cloudy-day"]          .bg-gradient { background-image: linear-gradient(160deg, #22262f 0%, #333944 55%, #454c58 100%); }
body[data-sky="cloudy-night"]        .bg-gradient { background-image: linear-gradient(160deg, #0a0b0f 0%, #14161d 55%, #1d2028 100%); }
body[data-sky="fog-day"]             .bg-gradient { background-image: linear-gradient(160deg, #2b3138 0%, #454c53 55%, #5c636b 100%); }
body[data-sky="fog-night"]           .bg-gradient { background-image: linear-gradient(160deg, #0d0f12 0%, #1a1d22 55%, #262a30 100%); }
body[data-sky="drizzle-day"]         .bg-gradient { background-image: linear-gradient(160deg, #1a2733 0%, #253849 55%, #33495d 100%); }
body[data-sky="drizzle-night"]       .bg-gradient { background-image: linear-gradient(160deg, #060a0e 0%, #0e161d 55%, #16212a 100%); }
body[data-sky="rain-day"]            .bg-gradient { background-image: linear-gradient(160deg, #131c26 0%, #1b2c3a 55%, #24384a 100%); }
body[data-sky="rain-night"]          .bg-gradient { background-image: linear-gradient(160deg, #04070a 0%, #0a1119 55%, #101a22 100%); }
body[data-sky="snow-day"]            .bg-gradient { background-image: linear-gradient(160deg, #1c2c3d 0%, #2e4763 50%, #4a6a8c 100%); }
body[data-sky="snow-night"]          .bg-gradient { background-image: linear-gradient(160deg, #060a12 0%, #101b2c 55%, #182740 100%); }
body[data-sky="storm-day"]           .bg-gradient { background-image: linear-gradient(160deg, #14131c 0%, #23202f 55%, #302b41 100%); }
body[data-sky="storm-night"]         .bg-gradient { background-image: linear-gradient(160deg, #06050a 0%, #100e18 55%, #1a1624 100%); }

/* sky state -> layer visibility */
body[data-sky$="-night"] .bg-stars { opacity: 1; animation: twinkle 4s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .65; } to { opacity: 1; } }

body[data-sky="clear-day"] .bg-sun,
body[data-sky="partly-cloudy-day"] .bg-sun { opacity: .95; }

body[data-sky^="partly-cloudy"] .bg-clouds { opacity: .35; }
body[data-sky^="cloudy"]        .bg-clouds { opacity: .55; }
body[data-sky^="drizzle"]       .bg-clouds { opacity: .5; }
body[data-sky^="rain"]          .bg-clouds { opacity: .5; }
body[data-sky^="snow"]          .bg-clouds { opacity: .4; }
body[data-sky^="storm"]         .bg-clouds { opacity: .6; }
body[data-sky^="fog"]           .bg-clouds { opacity: .25; }

body[data-sky^="fog"] .bg-fog { opacity: 1; }

body[data-sky^="drizzle"] .bg-rain { opacity: .28; }
body[data-sky^="rain"]    .bg-rain { opacity: .5; }
body[data-sky^="storm"]   .bg-rain { opacity: .6; }

body[data-sky^="snow"] .bg-snow { opacity: .9; }

@media (prefers-reduced-motion: reduce) {
  .bg-gradient, .bg-stars, .bg-sun, .cloud, .bg-rain, .bg-snow,
  .hero-icon, .hero-eyebrow, .hero-main, .hero-desc, .hero-feels, .hero-panel {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

/* ---------- layout ---------- */

.hero {
  position: relative;
  padding: 20px 6vw 60px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.hero-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(480px circle at var(--mx, 50%) var(--my, 15%), rgba(255, 255, 255, 0.10), transparent 62%);
}

.nav {
  position: relative;
  max-width: 1000px;
  margin: 0 auto 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--text-dim);
}

.brand {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

.hero-content {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--text-dim);
  animation: fade-up 0.7s ease both;
  animation-delay: 0.05s;
}

.hero-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  animation: fade-up 0.7s ease both;
  animation-delay: 0.12s;
}

.hero-icon {
  font-size: 4.6rem;
  line-height: 1;
  filter: drop-shadow(0 8px 24px rgba(255, 178, 77, 0.3));
  animation: bob 4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.hero-temp {
  font-size: 5.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff, #c7d4ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-icon, .hero-temp, .hero-desc {
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.hero-desc {
  margin: 4px 0 2px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  animation: fade-up 0.7s ease both;
  animation-delay: 0.2s;
}

.hero-feels {
  margin: 0 0 28px;
  color: var(--text-dim);
  font-size: 0.95rem;
  animation: fade-up 0.7s ease both;
  animation-delay: 0.27s;
}

.hero-panel {
  display: grid;
  gap: 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  padding: 22px 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 24px 50px -24px rgba(0, 0, 0, 0.55);
  animation: fade-up 0.7s ease both;
  animation-delay: 0.35s;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- sunrise / sunset arc ---------- */

.sun-arc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sun-arc-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
  overflow: visible;
}

.sun-arc-path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 3 7;
}

.sun-dot {
  fill: var(--accent);
  filter: drop-shadow(0 0 6px rgba(255, 178, 77, 0.9));
  transition: cx 1s ease, cy 1s ease, opacity 0.4s ease;
}

.sun-arc-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 320px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.sun-arc-value {
  color: var(--text);
  font-weight: 700;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 44px 6vw 20px;
}

.section {
  margin-bottom: 44px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--text);
}

.section-title::before {
  content: "";
  width: 4px;
  height: 1.1em;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  flex: 0 0 auto;
}

/* full-bleed carousel: breaks out of the centered .content column
   to span the full viewport width; cards center as a group when they
   fit, page by exactly one viewport-width per button click, and blur
   out (not just fade) under the edge overlays. */
.carousel-breakout {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.carousel-scroll {
  display: flex;
  justify-content: safe center;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  padding: 4px 76px 16px;
  scrollbar-width: none;
}

.carousel-scroll::-webkit-scrollbar { display: none; }

.carousel-fade {
  position: absolute;
  top: 0;
  bottom: 16px;
  width: 90px;
  z-index: 2;
  pointer-events: none;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.carousel-fade.left {
  left: 0;
  -webkit-mask-image: linear-gradient(to right, #000, transparent);
  mask-image: linear-gradient(to right, #000, transparent);
}

.carousel-fade.right {
  right: 0;
  -webkit-mask-image: linear-gradient(to left, #000, transparent);
  mask-image: linear-gradient(to left, #000, transparent);
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 20, 35, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.15s ease;
}

.carousel-btn:hover { background: rgba(255, 255, 255, 0.16); }
.carousel-btn:active { transform: translateY(-50%) scale(0.94); }
.carousel-btn:disabled { opacity: 0; pointer-events: none; }
.carousel-btn[hidden] { display: none; }

.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }

@media (max-width: 640px) {
  .carousel-scroll { padding-left: 56px; padding-right: 56px; }
  .carousel-fade { width: 60px; }
  .carousel-btn { width: 34px; height: 34px; }
}

.hour-card, .day-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 24px -16px rgba(0, 0, 0, 0.6);
  transition: background 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.hour-card:hover, .day-card:hover {
  background: rgba(255, 255, 255, 0.13);
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 16px 32px -16px rgba(94, 200, 255, 0.35);
}

.hour-card {
  width: 84px;
  padding: 14px 8px;
}

.hour-time { font-size: 0.78rem; color: var(--text-dim); margin-bottom: 8px; }
.hour-icon { font-size: 1.6rem; margin-bottom: 6px; }
.hour-temp { font-weight: 600; font-size: 1rem; }
.hour-pop { font-size: 0.72rem; color: var(--accent-2); margin-top: 4px; }

.day-card {
  width: 132px;
  padding: 16px 10px;
}

.day-name { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 8px; text-transform: capitalize; }
.day-icon { font-size: 1.8rem; margin-bottom: 8px; }
.day-temps { font-size: 0.95rem; }
.day-temps .max { font-weight: 700; }
.day-temps .min { color: var(--text-dim); margin-left: 6px; }
.day-pop { font-size: 0.75rem; color: var(--accent-2); margin-top: 6px; }

.about {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 26px 28px;
}

.about p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 640px;
}

.skeleton-row {
  color: var(--text-dim);
  padding: 20px 0;
}

.error-box {
  color: #ff8a8a;
  background: rgba(255, 90, 90, 0.08);
  border: 1px solid rgba(255, 90, 90, 0.3);
  border-radius: 12px;
  padding: 14px 16px;
}

.footer {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 6vw 48px;
  color: var(--text-dim);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

.footer p { margin: 4px 0; }

@media (max-width: 520px) {
  .hero-temp { font-size: 3.6rem; }
  .hero-icon { font-size: 3.2rem; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}
