/* fhua.xyz portal — minimal white, generous whitespace */

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #121316;
  --ink-soft: #3d4147;
  --muted: #6b7076;
  --faint: #9aa0a6;
  --line: #ecedef;
  --line-strong: #dcdfe3;
  --hover: #f6f7f9;
  --accent: #2f6bf6;
  --accent-soft: #eef3ff;
  --temp-high: #e06c3a;
  --temp-low: #4f7fd6;
  --shadow: 0 10px 30px -12px rgba(18, 19, 22, .16), 0 2px 8px -4px rgba(18, 19, 22, .08);
  --radius: 16px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e10;
    --card: #121316;
    --ink: #f2f3f5;
    --ink-soft: #d3d6da;
    --muted: #9aa0a6;
    --faint: #6f747b;
    --line: #212429;
    --line-strong: #2e3238;
    --hover: #191b1f;
    --accent: #7aa2ff;
    --accent-soft: #172033;
    --temp-high: #e98a5c;
    --temp-low: #7ba3e8;
    --shadow: 0 14px 34px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 340px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(47, 107, 246, .055), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

@media (prefers-color-scheme: dark) {
  body::before { background: radial-gradient(120% 100% at 50% 0%, rgba(122, 162, 255, .08), transparent 70%); }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 28px 72px;
  animation: rise .55s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 30px 0 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}

.brand-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-sep { color: var(--line-strong); }

.brand-sub { color: var(--muted); font-size: 13px; }

.clock {
  color: var(--faint);
  font-size: 12.5px;
  letter-spacing: .01em;
}

/* ---------- hero ---------- */

.hero {
  padding: 84px 0 44px;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}

.hero h1 {
  margin: 0;
  font-size: clamp(26px, 4.2vw, 34px);
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.mark { color: var(--ink); }

.lede {
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
  max-width: 46ch;
}

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.weather {
  padding: 22px 24px 18px;
}

/* ---------- weather head ---------- */

.wx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.city-wrap { position: relative; }

.city-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: -8px;
  padding: 4px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .16s var(--ease);
}

.city-btn:hover { background: var(--hover); }

.city-btn .pin { width: 15px; height: 15px; color: var(--faint); }
.city-btn .chev { width: 13px; height: 13px; color: var(--faint); margin-left: -1px; }

.city-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wx-actions {
  display: flex;
  gap: 2px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color .16s var(--ease), background .16s var(--ease);
}

.icon-btn:hover { color: var(--ink); background: var(--hover); }
.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn.spin svg { animation: spin .8s linear infinite; }

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

/* ---------- weather main ---------- */

.wx-main {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "icon temp text"
    "icon temp meta";
  align-items: center;
  column-gap: 18px;
  margin: 18px 0 4px;
}

.wx-icon {
  grid-area: icon;
  align-self: center;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.wx-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .92;
}

.wx-temp {
  grid-area: temp;
  align-self: center;
  display: flex;
  align-items: flex-start;
  font-size: clamp(52px, 8vw, 72px);
  font-weight: 300;
  line-height: .95;
  letter-spacing: -0.045em;
  color: var(--ink);
}

.wx-temp .deg {
  font-size: .5em;
  font-weight: 300;
  margin-top: .12em;
  color: var(--faint);
  letter-spacing: 0;
}

.wx-text {
  grid-area: text;
  align-self: end;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.wx-meta {
  grid-area: meta;
  align-self: start;
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.rule {
  height: 1px;
  margin: 20px 0 6px;
  border: 0;
  background: var(--line);
}

/* ---------- hourly ---------- */

.wx-hours {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(44px, 1fr);
  gap: 2px;
  overflow-x: auto;
  padding: 6px 0 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.wx-hours::-webkit-scrollbar { display: none; }

.hour {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 8px 0 9px;
  border-radius: 10px;
  color: var(--muted);
}

.hour.now { background: var(--accent-soft); color: var(--accent); }

.hour .h-time {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .01em;
}

.hour.now .h-time { color: var(--accent); }

.hour svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .85;
}

.hour .h-temp { font-size: 12.5px; color: var(--ink-soft); }
.hour.now .h-temp { color: var(--accent); font-weight: 500; }

/* ---------- 7-day + chart ---------- */

.wx-week {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.week-chart {
  width: 100%;
  height: auto;
  min-height: 60px;
}

.week-chart svg { display: block; overflow: visible; }

.chart-col {
  fill: transparent;
  transition: fill .15s var(--ease);
}

.chart-col:hover { fill: var(--hover); }

.chart-area { opacity: .9; }

.week-chart .line {
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.week-chart .line.high { stroke: var(--temp-high); }
.week-chart .line.low { stroke: var(--temp-low); }

.week-chart .dot {
  stroke-width: 1.7;
  pointer-events: none;
}

.week-chart .dot.high { fill: var(--card); stroke: var(--temp-high); }
.week-chart .dot.low { fill: var(--card); stroke: var(--temp-low); }

.week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-top: 2px;
}

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 0 2px;
}

.day .d-name { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.day svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--ink);
  opacity: .8;
}

.day .d-temp {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12.5px;
  line-height: 1.2;
}

.day .d-temp b { font-weight: 500; color: var(--ink-soft); }
.day .d-temp i { font-style: normal; color: var(--faint); }

/* ---------- card footer / source ---------- */

.wx-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .01em;
}

.wx-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-note.warn { color: #b4531c; }

@media (prefers-color-scheme: dark) {
  .wx-note.warn { color: #e2a06a; }
}

.src-wrap { position: relative; flex: 0 0 auto; }

.src-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px 3px 6px;
  margin-right: -7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.src-btn:hover { background: var(--hover); color: var(--ink); }

.src-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .75;
}

.src-btn .chev {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .7;
}

.src-menu {
  position: absolute;
  right: -6px;
  bottom: calc(100% + 8px);
  width: 236px;
  padding: 5px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 40;
  animation: pop .16s var(--ease) both;
}

.src-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.src-item:hover { background: var(--hover); color: var(--ink); }

.src-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.src-item-label { font-size: 12.5px; }
.src-item-org { font-size: 10px; color: var(--faint); line-height: 1.4; }

.src-item .tick {
  margin-left: auto;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.src-item.on .tick { opacity: 1; }
.src-item.on .src-item-label { color: var(--ink); font-weight: 500; }

.src-hint {
  margin: 4px 4px 2px;
  padding: 6px 5px 2px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--faint);
  line-height: 1.5;
}

/* ---------- links ---------- */

.links {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  text-decoration: none;
  color: inherit;
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}

.link:hover { border-color: var(--line-strong); }

.link:active { transform: scale(.995); }

.link-badge {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--hover);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.link-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.link-name {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: .01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-desc {
  font-size: 11.5px;
  color: var(--faint);
}

.link-arrow {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--faint);
  transition: transform .18s var(--ease), color .18s var(--ease);
}

.link-arrow svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link:hover .link-arrow { transform: translateX(3px); color: var(--accent); }

/* ---------- footer ---------- */

.foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 88px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--faint);
}

.foot .dot { color: var(--line-strong); }

.foot a {
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .16s, border-color .16s;
}

.foot a:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- city search ---------- */

.search {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 300px;
  max-width: calc(100vw - 56px);
  padding: 7px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  box-shadow: var(--shadow);
  z-index: 30;
  animation: pop .16s var(--ease) both;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(-4px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.search input {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}

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

.search-list { max-height: 216px; overflow-y: auto; margin-top: 4px; }

.result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--ink-soft);
}

.result:hover, .result.active { background: var(--hover); color: var(--ink); }

.result .r-sub {
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.search-hint {
  padding: 10px;
  font-size: 12px;
  color: var(--faint);
}

.search-hint:empty { display: none; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 8px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px;
  letter-spacing: .01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  z-index: 60;
}

.toast.show { opacity: .95; transform: translate(-50%, 0); }

/* ---------- focus / a11y ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: rgba(47, 107, 246, .16); }

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .page { padding: 0 20px 56px; }
  .top { padding-top: 22px; }
  .hero { padding: 56px 0 34px; }
  .weather { padding: 18px 18px 15px; }
  .wx-main {
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-areas:
      "icon temp"
      "text text"
      "meta meta";
    column-gap: 14px;
    row-gap: 0;
    margin: 14px 0 2px;
  }
  .wx-icon { width: 52px; height: 52px; }
  .wx-text { margin-top: 12px; }
  .wx-meta { margin-top: 2px; }
  .wx-temp { font-size: 52px; }
  .wx-text { font-size: 15px; }
  .wx-meta { font-size: 12px; }
  .wx-hours { grid-auto-columns: minmax(42px, 1fr); }
  .week-days { margin-top: 4px; }
  .day { gap: 4px; }
  .day svg { width: 21px; height: 21px; }
  .day .d-temp { flex-direction: column; align-items: center; gap: 0; font-size: 11.5px; }
  .day .d-name { font-size: 11px; }
  .day .d-name { font-size: 11px; }
  .day .d-temp { font-size: 12px; }
  .foot { margin-top: 64px; }
  .search { width: 268px; }
}

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

/* icon occlusion: cloud filled with card background so suns/moons sit behind it */
.cfill { fill: var(--card); }
