:root {
  --bg: #f3e7cf;
  --bg2: #d7e2dd;
  --text: #112021;
  --muted: #4a5f61;
  --card: rgba(255, 255, 255, 0.84);
  --line: rgba(17, 32, 33, 0.12);
  --brand: #0f5a5f;
  --accent: #d2612b;
  --danger: #992121;
  --shadow: 0 15px 40px rgba(17, 32, 33, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 20%, rgba(210, 97, 43, 0.22), transparent 40%),
    radial-gradient(circle at 85% 5%, rgba(15, 90, 95, 0.2), transparent 35%),
    linear-gradient(160deg, var(--bg), var(--bg2));
  overflow-x: hidden;
}

.shape {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border: 2px dashed rgba(15, 90, 95, 0.23);
}

.shape-a {
  top: -8rem;
  right: -7rem;
  width: 24rem;
  height: 24rem;
  border-radius: 42% 58% 60% 40%;
  animation: drift 18s ease-in-out infinite;
}

.shape-b {
  bottom: -8rem;
  left: -6rem;
  width: 18rem;
  height: 18rem;
  border-radius: 65% 35% 45% 55%;
  border-color: rgba(210, 97, 43, 0.38);
  animation: drift 20s ease-in-out infinite reverse;
}

.app {
  position: relative;
  z-index: 1;
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.hero h1 {
  margin: 0.35rem 0 0.7rem;
  font-family: "Archivo", sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  line-height: 1.08;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--brand);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.panel,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel {
  margin-top: 1.3rem;
  padding: 1rem;
}

.search-form label {
  display: block;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.7rem;
}

input,
button {
  font: inherit;
  border-radius: 12px;
}

input {
  border: 1px solid rgba(17, 32, 33, 0.18);
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.7);
}

button {
  border: none;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), #0b4a4e);
  font-weight: 700;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}

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

.icon-btn {
  min-width: 48px;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(17, 32, 33, 0.2);
  color: var(--brand);
  background: rgba(255, 255, 255, 0.8);
  font-size: 1.25rem;
  line-height: 1;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.95);
}

.favorites-panel {
  margin-top: 0.65rem;
}

.favorites-title {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.favorites-items {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.favorites-items li {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid rgba(17, 32, 33, 0.12);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0.2rem 0.35rem 0.2rem 0.55rem;
}

.favorite-select,
.favorite-remove {
  border: none;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}

.favorite-select {
  background: transparent;
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 600;
  padding: 0.1rem 0.2rem;
}

.favorite-remove {
  background: rgba(17, 32, 33, 0.1);
  color: var(--danger);
  width: 22px;
  height: 22px;
  font-size: 0.92rem;
  padding: 0;
}

.hint,
.small-note {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.small-note {
  font-size: 0.82rem;
}

.status {
  margin: 0.8rem 0 0;
  min-height: 1.2rem;
  color: var(--brand);
  font-weight: 600;
}

.status.error {
  color: var(--danger);
}

.loader {
  margin-top: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  color: var(--brand);
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(15, 90, 95, 0.25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.cards {
  margin-top: 1.1rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.card {
  padding: 0.95rem;
  animation: reveal 0.45s ease both;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.top p {
  margin: 0;
}

.day {
  font-weight: 700;
}

.period {
  color: var(--muted);
}

.temp-range {
  margin-top: 0.5rem;
  font-family: "Archivo", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
}

.weather {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.weather img {
  width: 28px;
  height: 28px;
}

.metrics {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.metrics li {
  border: 1px solid rgba(17, 32, 33, 0.12);
  border-radius: 10px;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.6);
}

.metrics span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.metrics strong {
  font-size: 0.9rem;
}

.hourly-wrap {
  margin-top: 0.8rem;
}

.hourly-title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hourly-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid rgba(17, 32, 33, 0.12);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
}

.hourly-table th,
.hourly-table td {
  padding: 0.36rem 0.45rem;
  text-align: left;
  border-bottom: 1px solid rgba(17, 32, 33, 0.1);
  font-size: 0.82rem;
}

.hourly-table th {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hourly-table tbody tr:last-child td {
  border-bottom: none;
}

.hourly-weather {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hourly-weather img {
  width: 18px;
  height: 18px;
}

.hidden {
  display: none;
}

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

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  50% {
    transform: translate(10px, 14px) rotate(6deg);
  }
}

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

@media (max-width: 740px) {
  .app {
    padding-top: 1.2rem;
  }

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

  #submitBtn {
    grid-column: 1 / -1;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}
