* {
  box-sizing: border-box;
}

:root {
  --bg-start: #f3faf8;
  --bg-end: #eaf5f0;
  --surface: #ffffff;
  --text-primary: #10231f;
  --text-secondary: #5c7a72;
  --accent: #0ea37a;
  --accent-aqua: #14b8a6;
  --hairline: #d8ece5;
  --hairline-strong: #bfe0d6;
  --accent-contrast: #ffffff;
  --danger: #d1495b;
}

[data-theme="dark"] {
  --bg-start: #081512;
  --bg-end: #0b1f1a;
  --surface: #0f221d;
  --text-primary: #e7f5ef;
  --text-secondary: #8fb3a8;
  --accent: #34d399;
  --accent-aqua: #2dd4bf;
  --hairline: #1c3a32;
  --hairline-strong: #26483e;
  --accent-contrast: #06140f;
  --danger: #ff8098;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-start) 0%, var(--bg-end) 100%);
  color: var(--text-primary);
  font-family: "Roboto", Arial, sans-serif;
  display: grid;
  place-items: center;
  padding: 40px 18px;
  transition: background 250ms ease, color 250ms ease;
}

.weather-app {
  width: min(640px, 100%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 30px 32px 26px;
  transition: background 250ms ease, border-color 250ms ease;
}

header {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--hairline);
}

.field-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.search-form {
  flex: 1;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-input {
  flex: 1;
  border: 0;
  border-bottom: 1px solid var(--hairline-strong);
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  padding: 6px 2px;
  outline: none;
  transition: border-color 150ms ease;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-input:focus {
  border-color: var(--accent);
}

.search-button {
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 0 18px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.search-button:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, transform 300ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(-18deg);
}

.current-weather {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 0 26px;
}

.reading-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 10px;
}

.current-city {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 42px;
  line-height: 1.05;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.current-description {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
}

.status-message {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0 0;
  min-height: 16px;
}

.reading-temperature {
  flex-shrink: 0;
  text-align: right;
}

.temp-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.current-temperature-icon {
  font-size: 30px;
  line-height: 1;
}

.temp-value-row {
  display: flex;
  align-items: flex-start;
}

.current-temperature-value {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 56px;
  line-height: 1;
}

.current-temperature-unit {
  font-family: "IBM Plex Mono", monospace;
  font-size: 16px;
  font-weight: 500;
  margin-top: 6px;
  color: var(--text-secondary);
}

.reading-gauge {
  height: 3px;
  margin-top: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-aqua), var(--accent));
}

.stat-row {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--hairline);
  padding-top: 18px;
}

.stat-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 17px;
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  align-self: stretch;
  background: var(--hairline);
  margin: 0 20px;
}

footer {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  padding-top: 22px;
  margin-top: 22px;
  border-top: 1px solid var(--hairline);
  text-align: center;
}

footer p {
  margin: 0;
}

a {
  color: var(--accent);
  font-weight: 500;
}

@media (max-width: 560px) {
  body {
    padding: 20px 14px;
  }
  .weather-app {
    padding: 22px 20px 20px;
  }
  header {
    flex-wrap: wrap;
    align-items: center;
  }
  .search-form {
    order: 1;
    width: 100%;
  }
  .theme-toggle {
    order: 2;
    margin-left: auto;
  }
  .current-weather {
    flex-direction: column;
  }
  .reading-temperature {
    text-align: left;
    width: 100%;
  }
  .temp-top {
    justify-content: flex-start;
  }
  .current-city {
    font-size: 32px;
  }
  .current-temperature-value {
    font-size: 44px;
  }
}
