/* そらいろ天気 — Apple Weather 风格：动态天空背景 + 磨砂玻璃卡片 */

:root {
  --glass: rgba(255, 255, 255, 0.14);
  --glass-strong: rgba(255, 255, 255, 0.22);
  --glass-border: rgba(255, 255, 255, 0.28);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.75);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Yu Gothic UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #4a7fc1;
  transition: background 1.2s ease;
  overflow-x: hidden;
}

/* ===== 动态天空背景 ===== */
.bg-sunny       { background: linear-gradient(180deg, #2f8fdc 0%, #6fb1ea 55%, #b7dcf7 100%); }
.bg-day.bg-partly   { background: linear-gradient(180deg, #4a7fc1 0%, #7ea9d9 55%, #c2d9ee 100%); }
.bg-night       { background: linear-gradient(180deg, #0b1533 0%, #16264f 55%, #2a3c68 100%); }
.bg-night.bg-partly { background: linear-gradient(180deg, #101c3d 0%, #24365c 55%, #3a4d74 100%); }
.bg-cloudy      { background: linear-gradient(180deg, #5a7691 0%, #86a0b8 55%, #b9c9d8 100%); }
.bg-rain        { background: linear-gradient(180deg, #2e4157 0%, #48607a 55%, #6c83a0 100%); }
.bg-snow        { background: linear-gradient(180deg, #6d84a0 0%, #93a9c2 55%, #d3e0ec 100%); }
.bg-fog         { background: linear-gradient(180deg, #75828f 0%, #9aa5b1 55%, #c8ced6 100%); }

.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

.sky-glow {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  top: -18vmax; right: -12vmax; filter: blur(10px);
  background: radial-gradient(circle, rgba(255, 214, 102, 0.55) 0%, rgba(255, 214, 102, 0) 65%);
  opacity: 0; transition: opacity 1.2s ease;
}
.bg-sunny .sky-glow { opacity: 1; animation: glowPulse 6s ease-in-out infinite; }
.bg-night .sky-glow { background: radial-gradient(circle, rgba(214, 226, 255, 0.4) 0%, rgba(214, 226, 255, 0) 62%); opacity: 0.8; }
@keyframes glowPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.sky-stars {
  position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s ease;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, #fff 99%, transparent),
    radial-gradient(1.2px 1.2px at 28% 9%, #fff 99%, transparent),
    radial-gradient(1.6px 1.6px at 45% 22%, #dfe8ff 99%, transparent),
    radial-gradient(1.1px 1.1px at 63% 12%, #fff 99%, transparent),
    radial-gradient(1.5px 1.5px at 78% 27%, #fff 99%, transparent),
    radial-gradient(1.2px 1.2px at 88% 8%, #dfe8ff 99%, transparent),
    radial-gradient(1.3px 1.3px at 8% 34%, #fff 99%, transparent),
    radial-gradient(1.1px 1.1px at 35% 40%, #dfe8ff 99%, transparent),
    radial-gradient(1.4px 1.4px at 55% 35%, #fff 99%, transparent),
    radial-gradient(1.2px 1.2px at 71% 44%, #fff 99%, transparent),
    radial-gradient(1px 1px at 92% 38%, #fff 99%, transparent),
    radial-gradient(1.2px 1.2px at 20% 6%, #dfe8ff 99%, transparent);
  animation: twinkle 4.5s ease-in-out infinite alternate;
}
.bg-night .sky-stars, .bg-night.bg-partly .sky-stars { opacity: 0.85; }
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }

.sky-cloud {
  position: absolute; border-radius: 999px; filter: blur(26px);
  background: rgba(255, 255, 255, 0.6); opacity: 0; transition: opacity 1.2s ease;
  width: 34vmax; height: 9vmax; top: 18%;
  animation: drift 70s linear infinite;
}
.sky-cloud.c2 { width: 26vmax; height: 7vmax; top: 38%; opacity: 0; animation-duration: 95s; animation-delay: -30s; }
.sky-cloud.c3 { width: 42vmax; height: 11vmax; top: 60%; opacity: 0; animation-duration: 120s; animation-delay: -60s; }
.bg-partly .sky-cloud, .bg-cloudy .sky-cloud, .bg-rain .sky-cloud { opacity: 0.55; }
.bg-rain .sky-cloud { background: rgba(226, 233, 240, 0.5); }
@keyframes drift { from { left: -45%; } to { left: 115%; } }

.sky-rain {
  position: absolute; inset: -10% 0 0 0; opacity: 0; transition: opacity 1s ease;
  background-image: repeating-linear-gradient(100deg,
    transparent 0 26px, rgba(255, 255, 255, 0.16) 26px 27px, transparent 27px 54px);
  background-size: 220px 220px;
  animation: rainfall 0.9s linear infinite;
}
.bg-rain .sky-rain { opacity: 1; }
@keyframes rainfall { from { background-position: 0 0; } to { background-position: -62px 220px; } }

.sky-snow {
  position: absolute; inset: -10% 0 0 0; opacity: 0; transition: opacity 1s ease;
  background-image:
    radial-gradient(2.5px 2.5px at 20% 0%, #fff 99%, transparent),
    radial-gradient(2px 2px at 55% 0%, #fff 99%, transparent),
    radial-gradient(3px 3px at 80% 0%, #eef4ff 99%, transparent),
    radial-gradient(2px 2px at 35% 0%, #fff 99%, transparent);
  background-size: 260px 260px;
  animation: snowfall 9s linear infinite;
}
.bg-snow .sky-snow { opacity: 0.9; }
@keyframes snowfall { from { background-position: 0 -260px; } to { background-position: 40px 260px; } }

/* ===== 布局 ===== */
.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; width: 100%; position: relative; }
.wrap.narrow { max-width: 780px; }

.site-header { padding: 16px 0; position: relative; z-index: 2; }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.12rem; font-weight: 700; text-shadow: 0 1px 8px rgba(0,0,0,0.18); }
.brand small { display: block; font-size: 0.62rem; font-weight: 400; opacity: 0.8; letter-spacing: 0.18em; }
.brand-icon { width: 34px; height: 34px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
.site-header nav { display: flex; gap: 6px; }
.site-header nav a {
  color: var(--muted); text-decoration: none; padding: 6px 14px;
  border-radius: 10px; font-size: 0.93rem; transition: all 0.2s;
}
.site-header nav a:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.site-header nav a.active { background: rgba(255, 255, 255, 0.18); color: var(--text); }

main { flex: 1; padding-bottom: 34px; position: relative; z-index: 1; }

/* ===== 玻璃卡片 ===== */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  padding: 22px 24px;
  margin-top: 18px;
  animation: fadeUp 0.7s ease both;
}
.glass:nth-of-type(2) { animation-delay: 0.08s; }
.glass:nth-of-type(3) { animation-delay: 0.16s; }
.glass:nth-of-type(4) { animation-delay: 0.24s; }
.glass:nth-of-type(5) { animation-delay: 0.32s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.glass h2 { font-size: 0.95rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 14px; }

/* about ページの本文 */
.prose h1 { font-size: 1.45rem; margin-bottom: 14px; }
.prose h2 { font-size: 1.05rem; font-weight: 600; color: var(--text); opacity: 0.95; margin: 20px 0 8px; letter-spacing: 0; }
.prose p { margin-bottom: 10px; }
.prose ul { margin: 0 0 10px 1.3em; }

.hero { padding: 30px 0 4px; animation: fadeUp 0.6s ease both; }
.hero h1 { font-size: 1.5rem; text-shadow: 0 1px 10px rgba(0,0,0,0.15); }
.hero .sub { color: var(--muted); margin: 4px 0 16px; font-size: 0.95rem; }
.city-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.city-chips button {
  border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.12);
  color: var(--text); padding: 7px 17px; border-radius: 999px;
  cursor: pointer; font-size: 0.92rem; transition: all 0.25s; backdrop-filter: blur(8px);
}
.city-chips button:hover { background: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
.city-chips button.active { background: rgba(255, 255, 255, 0.85); color: #274b7a; border-color: transparent; font-weight: 600; }

/* ===== 当前天气 ===== */
.current-left { display: flex; align-items: center; gap: 26px; margin-bottom: 20px; }
.current-city { font-size: 1.15rem; font-weight: 600; }
.current-temp { font-size: 4.4rem; font-weight: 200; line-height: 1.1; letter-spacing: -0.02em; }
.current-temp .deg { font-size: 1.8rem; vertical-align: 0.9em; opacity: 0.85; }
.current-desc { font-size: 1.05rem; color: var(--muted); }
.current-hl { font-size: 0.92rem; color: var(--muted); margin-top: 2px; }

.current-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; border-top: 1px solid rgba(255, 255, 255, 0.22); padding-top: 16px;
}
.meta-item { display: flex; flex-direction: column; }
.meta-label { font-size: 0.74rem; color: var(--muted); margin-bottom: 2px; letter-spacing: 0.03em; }

/* ===== CSS 动画天气图标 ===== */
.wx { width: 118px; height: 118px; position: relative; flex-shrink: 0; }
.wx-art { position: absolute; inset: 0; }

.wx-art .sun-core {
  position: absolute; width: 52px; height: 52px; border-radius: 50%;
  left: 33px; top: 33px;
  background: radial-gradient(circle at 35% 35%, #ffe38a, #ffb02e);
  box-shadow: 0 0 34px rgba(255, 190, 60, 0.75);
  animation: sunSpin 26s linear infinite;
}
.wx-art .sun-ray {
  position: absolute; width: 3.5px; height: 15px; border-radius: 3px;
  background: linear-gradient(#ffd97a, rgba(255, 217, 122, 0));
  left: 57px; top: 6px; transform-origin: 57px 56px;
}
.wx-art .sun-ray:nth-child(2) { transform: rotate(45deg); }
.wx-art .sun-ray:nth-child(3) { transform: rotate(90deg); }
.wx-art .sun-ray:nth-child(4) { transform: rotate(135deg); }
.wx-art .sun-ray:nth-child(5) { transform: rotate(180deg); }
.wx-art .sun-ray:nth-child(6) { transform: rotate(225deg); }
.wx-art .sun-ray:nth-child(7) { transform: rotate(270deg); }
.wx-art .sun-ray:nth-child(8) { transform: rotate(315deg); }
@keyframes sunSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.wx-art .moon {
  position: absolute; width: 54px; height: 54px; border-radius: 50%;
  left: 32px; top: 30px;
  background: radial-gradient(circle at 38% 38%, #f4f7ff, #b9c8ee);
  box-shadow: 0 0 30px rgba(214, 226, 255, 0.6), inset -12px -8px 0 rgba(120, 140, 190, 0.35);
  animation: moonFloat 7s ease-in-out infinite;
}
@keyframes moonFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.wx-art .cloud-main {
  position: absolute; left: 18px; top: 44px; width: 82px; height: 30px;
  border-radius: 999px; background: linear-gradient(#fdfeff, #d9e6f5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  animation: cloudBob 6s ease-in-out infinite;
}
.wx-art .cloud-main::before {
  content: ""; position: absolute; width: 38px; height: 38px; border-radius: 50%;
  background: inherit; left: 12px; top: -19px;
}
.wx-art .cloud-main::after {
  content: ""; position: absolute; width: 28px; height: 28px; border-radius: 50%;
  background: inherit; left: 42px; top: -13px;
}
@keyframes cloudBob { 0%,100% { transform: translateX(-4px); } 50% { transform: translateX(6px); } }

.wx-art .drop {
  position: absolute; width: 3.5px; height: 13px; border-radius: 3px;
  background: linear-gradient(rgba(160, 200, 255, 0.1), #9cc4f5);
  top: 74px; animation: dropFall 1.15s ease-in infinite;
}
.wx-art .drop:nth-of-type(2) { left: 30px; animation-delay: 0.25s; }
.wx-art .drop:nth-of-type(3) { left: 48px; animation-delay: 0.55s; }
.wx-art .drop:nth-of-type(4) { left: 66px; animation-delay: 0.8s; }
.wx-art .drop:nth-of-type(5) { left: 84px; animation-delay: 0.4s; }
@keyframes dropFall { 0% { transform: translateY(0); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(26px); opacity: 0; } }

.wx-art .flake {
  position: absolute; font-size: 11px; top: 72px; color: #eef4ff;
  animation: flakeFall 2.4s linear infinite;
}
.wx-art .flake:nth-of-type(2) { left: 34px; animation-delay: 0.8s; }
.wx-art .flake:nth-of-type(3) { left: 52px; animation-delay: 1.5s; }
.wx-art .flake:nth-of-type(4) { left: 70px; animation-delay: 0.3s; }
@keyframes flakeFall { 0% { transform: translateY(-4px) rotate(0deg); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(26px) rotate(200deg); opacity: 0; } }

.wx-art .bolt {
  position: absolute; left: 46px; top: 66px; width: 0; height: 0;
  border-left: 9px solid transparent; border-right: 7px solid transparent;
  border-top: 22px solid #ffd166; filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.8));
  animation: boltFlash 2.1s ease-in infinite;
}
@keyframes boltFlash { 0%, 55%, 61%, 100% { opacity: 0; } 57%, 59% { opacity: 1; } }

.wx-sunny .sun-core, .wx-sunny .sun-ray { display: block; }
.wx-night .moon { display: block; }
.wx-cloudy .cloud-main { display: block; }
.wx-rain .cloud-main, .wx-rain .drop { display: block; }
.wx-snow .cloud-main, .wx-art .flake { display: block; }
.wx-thunder .cloud-main, .wx-thunder .bolt { display: block; }
.wx-art > * { display: none; }

/* ===== 小时条 ===== */
.hourly-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.hour {
  flex: 0 0 64px; text-align: center; padding: 12px 4px;
  border-radius: 12px; background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.hour.now { background: rgba(255, 255, 255, 0.22); }
.hour .h-time { font-size: 0.78rem; color: var(--muted); }
.hour .h-icon { font-size: 1.35rem; margin: 4px 0; }
.hour .h-temp { font-weight: 600; }
.hour .h-pop { font-size: 0.72rem; color: #a8d3ff; min-height: 1em; }

/* ===== 图表 ===== */
.chart svg { width: 100%; height: 190px; display: block; }
.chart text { fill: rgba(255, 255, 255, 0.7); font-size: 11px; }
.chart .grid-line { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; }
.chart .temp-line { fill: none; stroke: #ffd166; stroke-width: 2.5; stroke-linejoin: round;
  stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 1.6s ease forwards 0.2s; }
.chart .temp-area { fill: rgba(255, 255, 255, 0.12); }
.chart .temp-dot { fill: #ffd166; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ===== 7天 ===== */
.daily-list { display: grid; gap: 4px; }
.daily-row {
  display: grid; grid-template-columns: 4.6em 2.1em 1fr 5.6em;
  align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px;
  transition: background 0.2s;
}
.daily-row:hover { background: rgba(255, 255, 255, 0.08); }
.daily-row .d-name { font-weight: 600; }
.daily-row .d-icon { text-align: center; font-size: 1.2rem; }
.daily-row .d-temp { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.daily-row .d-temp .lo { opacity: 0.65; margin-right: 8px; }
.range-wrap { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); position: relative; }
.range-fill { position: absolute; top: 0; bottom: 0; border-radius: 3px;
  background: linear-gradient(90deg, #7fd4ff, #ffd166, #ff9a5c); }

/* ===== 详情网格 ===== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.detail-grid .glass { margin-top: 0; }
.detail h3 { font-size: 0.82rem; color: var(--muted); font-weight: 600; letter-spacing: 0.05em; margin-bottom: 10px; }
.detail-big { font-size: 2.3rem; font-weight: 300; line-height: 1.2; }
.detail-big small { font-size: 0.95rem; opacity: 0.7; margin-left: 4px; }
.detail-note { color: var(--muted); font-size: 0.84rem; margin-top: 8px; }
.bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); margin-top: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #8ec9f5, #ffd166); width: 0; transition: width 0.9s ease; }
.bar-fill.uv { background: linear-gradient(90deg, #9be59b, #ffd166, #ff8a5c); }

.compass { position: relative; width: 150px; margin: 4px auto; }
.compass svg { width: 100%; display: block; }
.cmp-ring { fill: none; stroke: rgba(255, 255, 255, 0.25); stroke-width: 2; }
.cmp-txt { fill: rgba(255, 255, 255, 0.65); font-size: 11px; text-anchor: middle; }
#wind-needle { transition: transform 1s cubic-bezier(0.34, 1.4, 0.64, 1); transform-origin: 60px 60px; }
.cmp-needle { fill: #ffd166; }
.compass-val { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding-top: 26px; text-align: center; }
.compass-val span { font-size: 1.5rem; font-weight: 300; }
.compass-val small { color: var(--muted); font-size: 0.78rem; }

.sun-arc { fill: none; stroke: rgba(255, 255, 255, 0.3); stroke-width: 2.5; stroke-dasharray: 4 6; }
.sun-horizon { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.5; }
.sun-dot { fill: #ffd166; filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.9)); transition: cx 1s ease; }
.sun-times { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.9rem; color: var(--muted); }
.sun-times b { color: var(--text); font-weight: 600; }

/* ===== 其他 ===== */
.btn { background: rgba(255, 255, 255, 0.85); color: #274b7a; border: none;
  padding: 9px 24px; border-radius: 10px; cursor: pointer; font-size: 0.95rem; font-weight: 600; }
.btn:hover { background: #fff; }
.error-card h2 { color: #ffd2d2; }
.loading { opacity: 0.5; pointer-events: none; transition: opacity 0.3s; }
main .wrap > section[hidden] { display: none; }

.detail { animation: fadeUp 0.7s ease both; }
.detail:nth-child(2) { animation-delay: 0.06s; } .detail:nth-child(3) { animation-delay: 0.12s; }
.detail:nth-child(4) { animation-delay: 0.18s; } .detail:nth-child(5) { animation-delay: 0.24s; }
.detail:nth-child(6) { animation-delay: 0.3s; }

.site-footer {
  padding: 24px 0 28px; font-size: 0.84rem; color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.18); backdrop-filter: blur(10px); position: relative; z-index: 1;
}
.site-footer a { color: #b8d6ff; }
.site-footer .wrap p + p { margin-top: 4px; }

/* ===== about 页面内容在玻璃上的排版 ===== */
.about-body .card-list { display: grid; gap: 14px; }
.card h1 { font-size: 1.4rem; margin-bottom: 14px; }
.card h2 { font-size: 1rem; color: #fff; opacity: 0.92; margin: 18px 0 8px; }
.card p { margin-bottom: 10px; }
.card a { color: #b8d6ff; }
.city-table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 0.9rem; }
.city-table th, .city-table td { border: 1px solid rgba(255, 255, 255, 0.2); padding: 7px 12px; text-align: left; }
.city-table th { background: rgba(255, 255, 255, 0.12); }

@media (max-width: 680px) {
  .current-left { gap: 16px; }
  .wx { width: 92px; height: 92px; }
  .wx-art .sun-core { width: 40px; height: 40px; left: 26px; top: 26px; }
  .wx-art .sun-ray { left: 44px; top: 6px; transform-origin: 44px 44px; }
  .current-temp { font-size: 3.4rem; }
  .glass { padding: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .daily-row { grid-template-columns: 3.8em 1.8em 1fr 5em; }
}
