* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #1d3b5c;
  color: #fff;
  overflow: hidden;
}

/* Background photos, switched by the script (sunrise / day / sunset / night) */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: no-repeat center / cover;
}

.bg--top {
  opacity: 0;
  transition: opacity 1.2s ease;
}

.bg--top.is-visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .bg--top {
    transition: none;
  }
}

.container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 64px 16px 16px;
}

.header {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* Search box + suggestion list */
.search {
  position: relative;
}

.search svg {
  position: absolute;
  left: 0.65em;
  top: 50%;
  width: 1.05em;
  height: 1.05em;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

#city-search {
  font: inherit;
  font-size: 1.05rem;
  width: 12em;
  padding: 0.4em 0.6em 0.4em 2.1em;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

#city-search::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

#city-search:focus-visible {
  outline: 2px solid #ffb547;
  outline-offset: 2px;
}

#city-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  border-radius: 10px;
  background: rgba(16, 24, 38, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  max-height: 60vh;
  overflow-y: auto;
}

#city-suggestions li {
  padding: 0.45em 0.7em;
  border-radius: 7px;
  cursor: pointer;
}

#city-suggestions li[aria-selected="true"],
#city-suggestions li[role="option"]:hover {
  background: rgba(255, 181, 71, 0.22);
}

#city-suggestions li.no-match {
  color: rgba(255, 255, 255, 0.65);
  cursor: default;
}

#city-dropdown {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.4em 0.6em;
  min-width: 10em;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

#city-dropdown option {
  color: #111;
  background: #fff;
}

#city-dropdown:focus-visible {
  outline: 2px solid #ffb547;
  outline-offset: 2px;
}

.time-display {
  text-align: center;
  font-size: clamp(1.4rem, 5vw, 2rem);
  background-color: rgba(0, 0, 0, 0.5);
  padding: 10px 24px;
  border-radius: 15px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.time-display p {
  margin: 0;
}

#city-time {
  font-size: 1.6em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}

.label {
  font-size: 0.7em;
  opacity: 0.9;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.vertical-line {
  width: 4px;
  height: 20px;
  background-color: red;
  border-radius: 2px;
  margin: 8px 0 5px;
}

.card img {
  width: min(56vmin, 400px);
  height: auto;
  opacity: 0;
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
}

.card img.is-ready {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .card img {
    transition: none;
  }
}

@media (max-width: 600px) {
  .header {
    left: 12px;
  }

  .search {
    flex: 1 1 auto;
    min-width: 0;
  }

  #city-search {
    width: 100%;
  }

  #city-search,
  #city-dropdown {
    font-size: 1rem;
  }

  #city-dropdown {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 45%;
  }
}
