﻿:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #0ea5e9;
  --shadow: 0 6px 20px rgba(2, 6, 23, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.appbar h1 {
  margin: 0;
  font-size: clamp(1.25rem, 1.5vw + 1rem, 1.75rem);
}

.container {
  width: min(960px, 100%);
  margin: 16px auto 32px;
  padding: 0 16px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 8px 0;
  flex-wrap: wrap;
}

label {
  flex: 0 0 140px;
  font-weight: 600;
  color: var(--muted);
}

input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white;
}

.btn {
  background: var(--brand);
  border: none;
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(0.95);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.controls .row:last-of-type {
  gap: 8px;
}

.controls .row:last-of-type .btn {
  flex: 1 1 140px;
}

.hint {
  color: var(--muted);
  margin: 6px 0 0;
}

.status {
  min-height: 36px;
  color: var(--brand);
  padding: 8px 12px;
  background: rgba(14, 165, 233, 0.12);
  border-radius: 12px;
  border-left: 4px solid var(--brand);
  display: flex;
  align-items: center;
  font-size: 0.95rem;
}
.current-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 100px;
  gap: 12px;
  align-items: center;
}

.big-temp {
  font-size: clamp(2.5rem, 4vw + 1rem, 3.25rem);
  font-weight: 700;
}

.meta {
  color: var(--text);
  display: grid;
  gap: 4px;
  font-size: 0.95rem;
}

.icon-wrap img {
  width: 100px;
  height: 100px;
  image-rendering: pixelated;
}

.forecast {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.forecast .tile .t {
  font-size: 1.25rem;
  font-weight: 700;
}


.footer {
  padding: 16px 24px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}


.hidden {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

#current {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#current:hover,
#current:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  outline: none;
}

.forecast .tile {
  appearance: none;
  border: none;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  display: grid;
  gap: 6px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.forecast .tile:hover,
.forecast .tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
  outline: none;
}

.detail-dialog {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.detail-content {
  width: min(520px, 100%);
  max-height: min(90vh, 560px);
  overflow: auto;
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.detail-close {
  justify-self: end;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.05);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  display: grid;
  place-items: center;
}

.detail-close:hover,
.detail-close:focus-visible {
  background: rgba(14, 165, 233, 0.18);
  color: var(--brand);
  outline: none;
}

.detail-title {
  margin: 0;
  font-size: 1.2rem;
}

.detail-body {
  display: grid;
  gap: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
}

.detail-grid dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.detail-grid dd {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

.detail-note {
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .detail-content {
    padding: 20px 18px;
    border-radius: 16px;
  }

  .detail-grid {
    gap: 6px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #current,
  .forecast .tile {
    transition: none;
  }
}

@media (min-width: 768px) {
  .container {
    grid-template-columns: minmax(260px, 320px) 1fr;
    align-items: start;
    padding: 0 24px;
  }

  .controls {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
  }

  #status {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .current {
    grid-column: 2;
    grid-row: 2;
  }

  .container > .card:last-of-type {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

@media (max-width: 640px) {
  .appbar {
    justify-content: center;
    text-align: center;
  }

  .appbar .btn {
    width: 100%;
    max-width: 220px;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }

  label {
    flex: none;
    width: 100%;
  }

  .controls .row:last-of-type {
    flex-direction: column;
  }

  .controls .row:last-of-type .btn {
    width: 100%;
  }

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

  .icon-wrap {
    justify-self: center;
  }

  .big-temp {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
    gap: 12px;
  }

  .card {
    padding: 14px;
  }

  .forecast .tile {
    padding: 10px;
  }
}

@media (min-width: 1024px) {
  .forecast {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.forecast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.forecast-modes {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.1);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--brand);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mode-btn:hover:not(:disabled) {
  background: rgba(14, 165, 233, 0.15);
}

.mode-btn.active {
  background: var(--brand);
  color: white;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
}

.mode-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.mode-btn:disabled,
.mode-btn.mode-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.forecast-summary {
  margin: 8px 0 12px;
}

.forecast .tile {
  grid-template-rows: auto auto auto auto auto;
}

.forecast .tile img {
  justify-self: center;
}

.tile-time {
  font-weight: 600;
  color: var(--text);
}

.tile-datetime {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.tile-date {
  color: var(--muted);
  font-weight: 600;
}

.tile-temp {
  font-size: 1.3rem;
  font-weight: 700;
}

.tile-extra {
  font-size: 0.9rem;
  color: var(--muted);
}

.tile-desc {
  font-size: 0.9rem;
  color: var(--text);
}
@media (max-width: 640px) {
  .forecast-header {
    flex-direction: column;
    align-items: stretch;
  }

  .forecast-modes {
    justify-content: center;
  }

  .mode-btn {
    flex: 1;
    text-align: center;
  }
}
