.weather-page {
  color: #f7f1e8;
  background: #101820;
}

.weather-shell {
  min-height: 100dvh;
  padding: clamp(1rem, 4vw, 3rem);
}

.weather-header {
  width: min(100%, 1120px);
  margin: 0 auto clamp(1.5rem, 4vw, 2.75rem);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  margin-bottom: clamp(1rem, 3vw, 1.75rem);
  color: rgba(247, 241, 232, 0.72);
  text-decoration: none;
}

.back-link:hover {
  color: #f7f1e8;
}

.weather-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 8vw, 4.6rem);
  font-weight: 600;
  line-height: 1.16;
  text-wrap: balance;
}

.weather-lede {
  max-width: 34rem;
  margin: 0.9rem 0 0;
  color: rgba(247, 241, 232, 0.68);
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.25rem);
  text-wrap: pretty;
}

.api-panel {
  width: min(100%, 1120px);
  margin: 0 auto 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(247, 241, 232, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.api-panel h2,
.api-panel p {
  margin: 0;
}

.api-panel h2 {
  font-size: 1rem;
}

.api-panel p {
  color: rgba(247, 241, 232, 0.62);
  font-size: 0.92rem;
  text-wrap: pretty;
}

.api-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
}

.api-form input,
.api-form button {
  min-height: 2.75rem;
  border-radius: 8px;
}

.api-form input {
  width: 100%;
  border: 1px solid rgba(247, 241, 232, 0.18);
  padding: 0.65rem 0.8rem;
  color: #f7f1e8;
  background: rgba(16, 24, 32, 0.78);
}

.api-form button {
  border: 1px solid rgba(204, 168, 91, 0.74);
  padding: 0 1rem;
  color: #14130f;
  background: #d9b66f;
  cursor: pointer;
  transition:
    opacity 160ms ease-out,
    transform 160ms ease-out;
}

.api-form button:hover {
  transform: translateY(-1px);
}

.api-form button:active {
  transform: translateY(0) scale(0.98);
}

.weather-status {
  width: min(100%, 1120px);
  min-height: 1.7rem;
  margin: 0 auto 1rem;
  color: rgba(247, 241, 232, 0.62);
  font-size: 0.9rem;
}

.weather-grid {
  width: min(100%, 1120px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.city-panel,
.entanglement {
  border: 1px solid rgba(247, 241, 232, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.city-panel {
  position: relative;
  min-height: 26rem;
  overflow: hidden;
  padding: clamp(1rem, 4vw, 1.35rem);
}

.city-panel__top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.city-label {
  margin: 0 0 0.35rem;
  color: rgba(247, 241, 232, 0.56);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.city-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 5vw, 2.2rem);
  font-weight: 600;
  line-height: 1.22;
  text-wrap: balance;
}

.weather-icon {
  width: 4.5rem;
  height: 4.5rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 2.75rem;
  line-height: 1;
}

.temperature {
  position: relative;
  z-index: 1;
  margin: clamp(2.5rem, 8vw, 4rem) 0 0;
  font-family: var(--font-mono);
  font-size: clamp(3.6rem, 18vw, 6.5rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.description {
  position: relative;
  z-index: 1;
  margin: 0.65rem 0 0;
  color: rgba(247, 241, 232, 0.72);
  font-size: 1.1rem;
}

.weather-meta {
  position: relative;
  z-index: 1;
  margin: clamp(2rem, 7vw, 3rem) 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.weather-meta div {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid rgba(247, 241, 232, 0.1);
  border-radius: 8px;
  background: rgba(16, 24, 32, 0.45);
}

.weather-meta dt {
  color: rgba(247, 241, 232, 0.55);
  font-size: 0.76rem;
}

.weather-meta dd {
  margin: 0.22rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.entanglement {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 18rem;
  padding: 1.2rem;
  text-align: center;
}

.particle-icon {
  position: relative;
  width: 5rem;
  height: 5rem;
  margin-bottom: 1rem;
}

.particle-icon::before {
  content: "";
  position: absolute;
  inset: 1.3rem;
  border: 1px solid rgba(217, 182, 111, 0.48);
  border-radius: 50%;
}

.particle-icon span {
  position: absolute;
  top: 2.15rem;
  left: 2.15rem;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: #d9b66f;
  box-shadow: 0 0 14px rgba(217, 182, 111, 0.76);
}

.particle-icon span:first-child {
  animation: orbitOne 3.2s linear infinite;
}

.particle-icon span:last-child {
  animation: orbitTwo 3.2s linear infinite;
}

.particle-icon.is-disentangled span:first-child {
  animation: driftLeft 2.6s ease-in-out infinite alternate;
}

.particle-icon.is-disentangled span:last-child {
  animation: driftRight 2.6s ease-in-out infinite alternate;
}

.entanglement h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
}

.entanglement p {
  margin: 0.55rem 0 0;
  color: rgba(247, 241, 232, 0.68);
  text-wrap: pretty;
}

.distance {
  position: relative;
  min-height: 1.7rem;
  min-width: 9rem;
  margin-top: 1.3rem !important;
  color: #d9b66f !important;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.distance span {
  position: absolute;
  inset: 0;
  transition:
    opacity 160ms ease-out,
    transform 160ms ease-out;
}

.distance__heart {
  opacity: 0;
  transform: translateY(0.35rem);
}

.distance:hover .distance__real,
.distance:focus-visible .distance__real {
  opacity: 0;
  transform: translateY(-0.35rem);
}

.distance:hover .distance__heart,
.distance:focus-visible .distance__heart {
  opacity: 1;
  transform: translateY(0);
}

.updated-at {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.romance-metric {
  width: 100%;
  margin: 1.2rem 0 0;
  text-align: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(247, 241, 232, 0.1);
  border-radius: 8px;
  color: rgba(247, 241, 232, 0.72);
  background: rgba(16, 24, 32, 0.36);
  font-size: 0.86rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.weather-effect {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.city-panel.is-rainy .weather-effect {
  opacity: 0.38;
  background-image:
    linear-gradient(105deg, transparent 0 48%, rgba(186, 220, 230, 0.85) 50%, transparent 52%),
    linear-gradient(105deg, transparent 0 46%, rgba(186, 220, 230, 0.52) 48%, transparent 50%);
  background-size: 1.4rem 6rem, 2.1rem 7rem;
  animation: rainFall 900ms linear infinite;
}

.city-panel.is-clear .weather-effect {
  opacity: 0.32;
  background-image:
    radial-gradient(circle at 24% 32%, rgba(244, 214, 133, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 24%, rgba(244, 214, 133, 0.72) 0 1px, transparent 2px),
    radial-gradient(circle at 64% 72%, rgba(244, 214, 133, 0.66) 0 1px, transparent 2px);
  animation: sunFloat 4s ease-in-out infinite alternate;
}

.sky-line {
  width: min(100%, 1120px);
  margin: clamp(1.5rem, 5vw, 2.5rem) auto 0;
  color: rgba(247, 241, 232, 0.7);
  font-family: var(--font-display);
  text-align: center;
  text-wrap: balance;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@keyframes orbitOne {
  from {
    transform: rotate(0deg) translateX(1.5rem) rotate(0deg);
  }

  to {
    transform: rotate(360deg) translateX(1.5rem) rotate(-360deg);
  }
}

@keyframes orbitTwo {
  from {
    transform: rotate(180deg) translateX(1.5rem) rotate(-180deg);
  }

  to {
    transform: rotate(540deg) translateX(1.5rem) rotate(-540deg);
  }
}

@keyframes driftLeft {
  from {
    transform: translateX(-0.4rem);
  }

  to {
    transform: translateX(-1.6rem);
  }
}

@keyframes driftRight {
  from {
    transform: translateX(0.4rem);
  }

  to {
    transform: translateX(1.6rem);
  }
}

@keyframes rainFall {
  from {
    background-position: 0 0, 0 0;
  }

  to {
    background-position: -1.4rem 6rem, -2.1rem 7rem;
  }
}

@keyframes sunFloat {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-0.8rem);
  }
}

@media (min-width: 740px) {
  .api-panel {
    grid-template-columns: minmax(0, 1fr) minmax(22rem, 0.7fr);
    align-items: end;
  }

  .api-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (min-width: 960px) {
  .weather-grid {
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.58fr) minmax(0, 1fr);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .particle-icon span,
  .city-panel.is-rainy .weather-effect,
  .city-panel.is-clear .weather-effect {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
