:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #697386;
  --line: rgba(31, 54, 88, 0.11);
  --blue: #2864eb;
  --blue-deep: #184bc0;
  --surface: rgba(255, 255, 255, 0.78);
  --shadow: 0 18px 50px rgba(37, 68, 120, 0.1);
  --radius-lg: 28px;
  --radius-md: 21px;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 5%, rgba(143, 192, 255, 0.26), transparent 28rem),
    linear-gradient(180deg, #f4f8ff 0%, #f8fbff 38%, #f5f8fc 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  top: 60px;
  right: -180px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(76, 137, 231, 0.12);
  box-shadow: inset 0 0 80px rgba(99, 160, 255, 0.09);
}

.ambient-two {
  top: 270px;
  left: -260px;
  width: 420px;
  height: 420px;
  background: rgba(187, 215, 255, 0.18);
  filter: blur(70px);
}

.site-header,
main,
.site-footer {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  color: #f7a928;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.brand-mark svg > path:not(.cloud-path) {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.6;
}

.brand-mark .cloud-path {
  fill: #3974ee;
  stroke: #f4f8ff;
  stroke-width: 2;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2cc57c;
  box-shadow: 0 0 0 5px rgba(44, 197, 124, 0.1);
}

.hero {
  min-height: 370px;
  padding: 73px 0 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 60px;
}

.eyebrow,
.section-label {
  margin: 0 0 18px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 68px);
  line-height: 1.16;
  letter-spacing: -0.055em;
  font-weight: 850;
}

.hero h1 span {
  color: var(--blue);
}

.hero-description {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.summary-panel {
  min-width: 382px;
  padding: 30px 34px;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 28px;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.summary-panel > div:not(.summary-divider) {
  display: flex;
  flex-direction: column;
}

.summary-panel p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-panel strong {
  font-size: 35px;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.summary-panel span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.summary-divider {
  width: 1px;
  background: var(--line);
}

.weather-section {
  padding: 42px 0 34px;
  border-top: 1px solid var(--line);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
  margin-bottom: 30px;
}

.section-label {
  margin-bottom: 10px;
}

.toolbar h2 {
  margin: 0;
  font-size: 29px;
  letter-spacing: -0.035em;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  width: 190px;
  height: 43px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.68);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-box:focus-within {
  background: #fff;
  border-color: rgba(40, 100, 235, 0.4);
  box-shadow: 0 0 0 4px rgba(40, 100, 235, 0.08);
}

.search-box svg {
  width: 17px;
  fill: none;
  stroke: #8c96a8;
  stroke-width: 1.8;
  flex: 0 0 auto;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.search-box input::placeholder {
  color: #9da5b4;
}

.unit-switch {
  height: 43px;
  display: flex;
  padding: 4px;
  background: #e9eef6;
  border-radius: 13px;
}

.unit-button {
  min-width: 39px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: #7c879a;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.unit-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 10px rgba(47, 65, 96, 0.1);
}

.refresh-button {
  height: 43px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 13px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  box-shadow: 0 9px 22px rgba(40, 100, 235, 0.22);
  transition: transform 0.18s, background 0.18s;
}

.refresh-button:hover {
  background: var(--blue-deep);
  transform: translateY(-1px);
}

.refresh-button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.refresh-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.refresh-button.loading svg {
  animation: spin 0.85s linear infinite;
}

.status-message {
  min-height: 48px;
  margin-bottom: 18px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
}

.status-message[hidden] {
  display: none;
}

.status-message.error {
  color: #a83c3c;
  background: rgba(255, 237, 237, 0.8);
  border-color: rgba(196, 57, 57, 0.15);
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid #cdd7e8;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.weather-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 15px;
}

.weather-card {
  position: relative;
  min-height: 255px;
  padding: 22px 20px 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(32, 62, 108, 0.075);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  animation: card-in 0.5s both;
}

.weather-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 38px rgba(32, 62, 108, 0.12);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.city-name {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.city-english {
  display: block;
  margin-top: 5px;
  color: #9aa3b2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.weather-icon {
  width: 53px;
  height: 53px;
  margin: -8px -6px 0 0;
  filter: drop-shadow(0 6px 8px rgba(33, 65, 111, 0.14));
}

.temperature {
  margin-top: 23px;
  font-size: 43px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.06em;
}

.weather-description {
  margin: 8px 0 19px;
  color: var(--muted);
  font-size: 12px;
}

.card-metrics {
  padding-top: 15px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  border-top: 1px solid var(--line);
}

.metric {
  min-width: 0;
}

.metric span {
  display: block;
  margin-bottom: 5px;
  color: #9aa3b2;
  font-size: 9px;
  white-space: nowrap;
}

.metric strong {
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.card-details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s, margin 0.25s;
}

.weather-card.expanded .card-details {
  max-height: 100px;
  margin-top: 14px;
  opacity: 1;
}

.details-grid {
  padding-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 10px;
}

.details-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 11px;
}

.detail-toggle {
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.detail-toggle:focus-visible {
  outline: 3px solid rgba(40, 100, 235, 0.45);
  outline-offset: -4px;
  border-radius: var(--radius-md);
}

.empty-state {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state > div {
  font-size: 42px;
  color: #aeb8c7;
}

.empty-state h3 {
  margin: 12px 0 5px;
  color: var(--ink);
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.section-footer,
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #8b95a6;
  font-size: 10px;
}

.section-footer {
  margin-top: 22px;
}

.section-footer a {
  color: inherit;
}

.site-footer {
  min-height: 92px;
  border-top: 1px solid var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1050px) {
  .weather-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { gap: 35px; }
  .summary-panel { min-width: 350px; }
}

@media (max-width: 760px) {
  .site-header,
  main,
  .site-footer { width: min(100% - 32px, 620px); }
  .site-header { height: 75px; }
  .hero { padding: 48px 0; flex-direction: column; align-items: stretch; }
  .hero h1 { font-size: clamp(38px, 12vw, 55px); }
  .summary-panel { min-width: 0; width: 100%; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .controls { flex-wrap: wrap; }
  .search-box { width: 100%; }
  .unit-switch { flex: 1; }
  .unit-button { flex: 1; }
  .weather-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .header-meta { font-size: 11px; }
  .brand { font-size: 13px; }
  .desktop-break { display: none; }
  .summary-panel { padding: 25px 22px; gap: 18px; }
  .summary-panel strong { font-size: 29px; }
  .weather-grid { grid-template-columns: 1fr; }
  .weather-card { min-height: 235px; }
  .refresh-button { padding-inline: 13px; }
  .section-footer, .site-footer { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
