:root {
  --bg: #0b1117;
  --bg-deep: #0f1722;
  --ink: #eef2f7;
  --muted: #8b98ab;
  --card: rgba(16, 24, 36, 0.78);
  --border: rgba(148, 163, 184, 0.18);
  --shadow: 0 22px 60px rgba(3, 6, 12, 0.45);
  --owm: #ff6b4a;
  --aladin: #36c5a3;
  --meteo: #4b8bff;
  --rain: #6fb4ff;
  --panel-glow: rgba(79, 140, 255, 0.18);
}

body[data-theme="light"] {
  --bg: #f5f3ef;
  --bg-deep: #e7e1d8;
  --ink: #17151a;
  --muted: #6d6470;
  --card: rgba(255, 255, 255, 0.92);
  --border: rgba(24, 24, 29, 0.12);
  --shadow: 0 18px 40px rgba(27, 25, 31, 0.12);
  --owm: #ff7a4f;
  --aladin: #2ea887;
  --meteo: #3d78f2;
  --rain: #2f6fc7;
  --panel-glow: rgba(255, 167, 93, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(79, 140, 255, 0.25) 0%, transparent 55%),
    radial-gradient(circle at 85% 15%, rgba(54, 197, 163, 0.2) 0%, transparent 60%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body[data-theme="light"] {
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 200, 150, 0.55) 0%, transparent 55%),
    radial-gradient(circle at 85% 20%, rgba(100, 170, 255, 0.25) 0%, transparent 60%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.sunband {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.08) 0%, transparent 55%),
    linear-gradient(120deg, rgba(79, 140, 255, 0.2), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body[data-theme="light"] .sunband {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.45) 0%, transparent 55%),
    linear-gradient(120deg, rgba(255, 148, 84, 0.22), transparent 60%);
}

.grain {
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px);
  mix-blend-mode: screen;
  opacity: 0.2;
  pointer-events: none;
  z-index: 1;
}

body[data-theme="light"] .grain {
  mix-blend-mode: multiply;
  opacity: 0.18;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  padding: 36px clamp(20px, 5vw, 80px) 18px;
  animation: slideDown 0.8s ease both;
}

.location .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 11px;
  color: var(--muted);
}

.location h1 {
  margin: 8px 0 0;
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: clamp(32px, 4vw, 46px);
}

.sync {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-radius: 20px;
  background: rgba(14, 22, 34, 0.75);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

body[data-theme="light"] .sync {
  background: rgba(255, 255, 255, 0.85);
}

.sync-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.sync .label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.sync .value {
  font-weight: 600;
}

.columns {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding: 16px clamp(20px, 5vw, 80px) 40px;
}

.model {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: relative;
  overflow: hidden;
  animation: floatIn 0.8s ease both;
  backdrop-filter: blur(14px);
}

.model:nth-child(2) {
  animation-delay: 0.08s;
}

.model:nth-child(3) {
  animation-delay: 0.16s;
}

.model::after {
  content: "";
  position: absolute;
  inset: -40% 40% auto auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, var(--panel-glow) 0%, transparent 70%);
  opacity: 0.6;
}

.model-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(15, 23, 34, 0.7);
}

body[data-theme="light"] .tag {
  background: rgba(22, 24, 32, 0.06);
  color: #17151a;
}

.tag.nowcast {
  background: rgba(255, 107, 74, 0.18);
  color: #ffb5a4;
}

.tag.regional {
  background: rgba(54, 197, 163, 0.2);
  color: #b3f0df;
}

.tag.global {
  background: rgba(75, 139, 255, 0.2);
  color: #bfd6ff;
}

body[data-theme="light"] .tag.nowcast {
  background: rgba(255, 122, 79, 0.28);
  color: #7a2a14;
}

body[data-theme="light"] .tag.regional {
  background: rgba(46, 168, 135, 0.28);
  color: #0f3d33;
}

body[data-theme="light"] .tag.global {
  background: rgba(61, 120, 242, 0.28);
  color: #123070;
}

.model h2 {
  margin: 10px 0 4px;
  font-size: 22px;
}

.meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.accent {
  width: 14px;
  height: 70px;
  border-radius: 999px;
}

.accent.owm {
  background: var(--owm);
}

.accent.aladin {
  background: var(--aladin);
}

.accent.meteo {
  background: var(--meteo);
}

.current {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(10, 16, 24, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

body[data-theme="light"] .current {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(24, 24, 29, 0.1);
}

.current-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-img {
  width: 115px;
  height: 115px;
  object-fit: contain;
}

.status {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.temp {
  font-size: 50px;
  font-weight: 700;
}

.current-sub {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.current-sub div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.current-sub .label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.current-sub .value {
  font-weight: 600;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.section-title .hint {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.06em;
}

.hourly {
  display: grid;
  gap: 12px;
}

.hourly-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(88px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.hourly-track::-webkit-scrollbar {
  height: 0;
}

.hourly-track::-webkit-scrollbar-thumb {
  background: transparent;
}

.hour {
  scroll-snap-align: start;
  background: rgba(12, 20, 32, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  position: relative;
}

body[data-theme="light"] .hour {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(24, 24, 29, 0.1);
}

.hour-time {
  font-size: 12px;
  font-weight: 600;
}

.hour-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

/* OWM hourly icons use orange assets; no filter needed. */

.hour-temp {
  font-size: 16px;
  font-weight: 600;
}

.hour-precip {
  font-size: 12px;
  color: var(--muted);
}

.hour-bar {
  width: 70%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  position: relative;
  overflow: hidden;
}

body[data-theme="light"] .hour-bar {
  background: rgba(24, 24, 29, 0.08);
}

.hour-bar::after {
  content: "";
  position: absolute;
  inset: 0 0 0 0;
  transform: scaleX(var(--bar));
  transform-origin: left;
  background: linear-gradient(90deg, var(--rain), rgba(43, 91, 138, 0.7));
}

.daily {
  display: grid;
  gap: 12px;
}

.daily-list {
  display: grid;
  gap: 10px;
}

.day {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(11, 18, 28, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

body[data-theme="light"] .day {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(24, 24, 29, 0.08);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.switch-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 3px;
  transition: background 0.25s ease, border 0.25s ease;
}

.switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateX(0);
  transition: transform 0.25s ease, background 0.25s ease;
}

body[data-theme="light"] .switch-thumb {
  transform: translateX(20px);
}

.switch-text {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.weekday {
  font-weight: 600;
}

.day-status {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}

.day-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.day-precip {
  font-size: 12px;
  color: var(--muted);
}

.day-temp {
  font-weight: 600;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .columns {
    grid-template-columns: 1fr;
  }

  .current-sub {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .sync {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .current-sub {
    grid-template-columns: 1fr;
  }

  .day {
    grid-template-columns: 1fr auto auto;
  }
}
