:root {
  --bg_main: #0a1f44;
  --bg_main_deep: #061530;
  --text_light: #fdfbf7;
  --text_med: #5b6a86;
  --text_dark: #1b2233;
  --accent: #ff5a5f;
  --accent_deep: #d13f44;
  --amber: #ffb020;
  --card_radius: 18px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-weight: normal;
}

button {
  cursor: pointer;
}

input {
  -webkit-appearance: none;
}

button,
input {
  border: none;
  background: none;
  outline: none;
  color: inherit;
  font-family: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

ul {
  list-style: none;
}

body {
  font: 1rem/1.5 "Inter", sans-serif;
  background: var(--bg_main);
  color: var(--text_dark);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Top banner */

.top-banner {
  color: var(--text_light);
  padding: 90px 0 70px;
  background: linear-gradient(180deg, var(--bg_main_deep) 0%, var(--bg_main) 100%);
}

.heading {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 3.4rem;
  letter-spacing: -0.01em;
}

.heading-accent {
  color: var(--accent);
}

.subheading {
  margin-top: 12px;
  color: rgba(253, 251, 247, 0.6);
  font-size: 1.05rem;
  max-width: 420px;
}

.top-banner form {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 40px;
  border-bottom: 1px solid rgba(253, 251, 247, 0.3);
  padding-bottom: 14px;
  max-width: 560px;
  transition: border-color 0.25s ease;
}

.top-banner form:focus-within {
  border-color: var(--text_light);
}

.city-input {
  flex: 1;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.6rem;
  color: var(--text_light);
}

.city-input::placeholder {
  color: rgba(253, 251, 247, 0.4);
}

.top-banner form button {
  position: relative;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 13px 24px;
  margin-left: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--text_light);
  transition: background 0.25s ease, transform 0.15s ease;
}

.top-banner form button:hover {
  background: var(--accent_deep);
}

.top-banner form button:active {
  transform: scale(0.97);
}

.top-banner form button:disabled {
  cursor: default;
  opacity: 0.75;
}

.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(253, 251, 247, 0.5);
  border-top-color: var(--text_light);
  border-radius: 50%;
  vertical-align: middle;
  animation: spin 0.7s linear infinite;
}

button.is-loading .btn-spinner {
  display: inline-block;
}

button.is-loading .btn-label {
  opacity: 0.7;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.top-banner form .msg {
  position: absolute;
  bottom: -34px;
  left: 0;
  max-width: 480px;
  min-height: 20px;
  font-size: 0.9rem;
  color: var(--amber);
}

@media screen and (max-width: 700px) {
  .top-banner {
    padding: 60px 0 90px;
  }

  .heading {
    font-size: 2.4rem;
  }

  .top-banner form {
    flex-direction: column;
    align-items: stretch;
    border-bottom: none;
  }

  .city-input {
    border-bottom: 1px solid rgba(253, 251, 247, 0.3);
    padding-bottom: 14px;
  }

  .top-banner form button {
    margin: 20px 0 0 0;
    justify-content: center;
    display: flex;
  }

  .top-banner form .msg {
    position: static;
    max-width: none;
    margin-top: 14px;
  }
}

/* City cards */

.ajax-section {
  margin: -40px 0 60px;
}

.ajax-section .cities {
  display: grid;
  grid-gap: 28px 20px;
  grid-template-columns: repeat(4, 1fr);
}

@media screen and (max-width: 1000px) {
  .ajax-section .cities {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media screen and (max-width: 700px) {
  .ajax-section .cities {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 500px) {
  .ajax-section .cities {
    grid-template-columns: repeat(1, 1fr);
  }
}

.ajax-section .city {
  position: relative;
  padding: 32px 10% 36px;
  border-radius: var(--card_radius);
  background: var(--text_light);
  color: var(--text_med);
  opacity: 0;
}

.ajax-section .city::after {
  content: "";
  width: 90%;
  height: 40px;
  position: absolute;
  bottom: -10px;
  left: 5%;
  z-index: -1;
  opacity: 0.15;
  border-radius: var(--card_radius);
  background: var(--text_light);
}

.city-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  color: var(--text_dark);
}

.city-name sup {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.25em 0.6em;
  border-radius: 30px;
  color: var(--text_light);
  background: var(--amber);
}

.city-temp {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 3.4rem;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text_dark);
}

.city-temp sup {
  font-size: 0.4em;
  font-weight: 500;
}

.ajax-section figure {
  margin-top: 12px;
}

.city-icon {
  width: 72px;
  height: 72px;
}

.ajax-section figcaption {
  margin-top: 4px;
  font-size: 0.85rem;
  text-transform: capitalize;
  letter-spacing: 0.01em;
}
