/* WhiteMesh public site. Mobile first, light and dark, high contrast, no external fonts. */
:root {
  --bg: #f2f6fb;
  --surface: #ffffff;
  --surface-2: #eaf1fa;
  --text: #0d1a2c;
  --muted: #4d5e74;
  --border: #d6e0ec;
  --primary: #1a64d6;
  --primary-soft: #d9e8ff;
  --good: #17803b;
  --warn: #8a5a00;
  --warn-bg: #fff3d4;
  --danger: #b42318;
  --danger-bg: #ffe4e1;
  --info-bg: #e2efff;
  --radius: 20px;
  --shadow: 0 8px 28px rgba(16, 38, 74, 0.09);
  --mesh: 26, 100, 214;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060d19;
    --surface: #0d1829;
    --surface-2: #132238;
    --text: #edf3fa;
    --muted: #a3b4c8;
    --border: #1e3250;
    --primary: #6cb2ff;
    --primary-soft: #16325a;
    --good: #4ac26b;
    --warn: #f0b429;
    --warn-bg: #2e2410;
    --danger: #ff7b72;
    --danger-bg: #3a1614;
    --info-bg: #10284a;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    --mesh: 108, 178, 255;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
#mesh { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.topbar, main, .footer { position: relative; z-index: 1; }
h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.6rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

/* Top bar ----------------------------------------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto; padding: 0.9rem 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); }
.brand img { border-radius: 10px; }
.brand-name { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-name b { color: var(--primary); }
.chip {
  font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--primary); background: var(--primary-soft);
  border: 0; border-radius: 999px; padding: 0.55rem 1rem; min-height: 44px; cursor: pointer;
}

main { max-width: 1120px; margin: 0 auto; padding: 0 1rem 2rem; }

/* Banners and alerts ------------------------------------------------------------------------------------- */
.banner { margin: 0 0 1rem; padding: 0.85rem 1rem; border-radius: 14px; font-size: 0.98rem; }
.banner-test { background: var(--warn-bg); color: var(--text); border-left: 6px solid var(--warn); }
.banner-offline { background: var(--info-bg); border-left: 6px solid var(--primary); }
.alerts { display: grid; gap: 0.6rem; margin: 1rem 0; }
.alerts:empty { display: none; }
.alert { padding: 0.85rem 1rem; border-radius: 14px; border-left: 6px solid var(--primary); background: var(--info-bg); }
.alert strong { display: block; font-size: 1.05rem; }
.alert[data-level="warn"] { background: var(--warn-bg); border-color: var(--warn); }
.alert[data-level="danger"] { background: var(--danger-bg); border-color: var(--danger); }

/* Hero: the sky right now -------------------------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; color: #fff; min-height: 300px;
  box-shadow: var(--shadow); isolation: isolate;
}
.sky { position: absolute; inset: 0; z-index: -1; transition: background 1.2s ease; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(3, 10, 24, 0.05) 30%, rgba(3, 10, 24, 0.45) 100%);
}
.hero[data-sky="day"] .sky { background: linear-gradient(180deg, #2a72c9 0%, #4f97e3 45%, #8cc4f7 100%); }
.hero[data-sky="golden"] .sky { background: linear-gradient(180deg, #3d6fb6 0%, #e8956b 70%, #ffc98b 100%); }
.hero[data-sky="twilight"] .sky { background: linear-gradient(180deg, #17224a 0%, #5a3f7d 55%, #d9776a 100%); }
.hero[data-sky="night"] .sky { background: linear-gradient(180deg, #030814 0%, #0a1834 55%, #13294f 100%); }
.hero[data-weather="rain"][data-sky="day"] .sky,
.hero[data-weather="rain"][data-sky="golden"] .sky { background: linear-gradient(180deg, #3a4a5e 0%, #5d6f86 60%, #8193a8 100%); }
.hero[data-weather="rain"][data-sky="twilight"] .sky,
.hero[data-weather="rain"][data-sky="night"] .sky { background: linear-gradient(180deg, #0c121c 0%, #1b2636 60%, #2c3b50 100%); }
.stars { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s ease; }
.hero[data-sky="night"][data-weather="clear"] .stars { opacity: 1; }
.star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.hero-inner { padding: 1.4rem 1.3rem 1.3rem; }
.place { margin: 0; font-weight: 700; font-size: 1.05rem; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.place .sep { opacity: 0.7; }
.status { margin: 0.2rem 0 0; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa7b8; flex: none; }
.dot.on { background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); animation: pulse 2.4s infinite; }
.dot.off { background: #fbbf24; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); } 70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }

.hero-main { display: flex; align-items: center; gap: 1rem; margin-top: 0.8rem; }
.illustration { width: 120px; height: 120px; flex: none; }
.illustration svg { width: 100%; height: 100%; overflow: visible; }
.temp {
  margin: 0; font-size: clamp(4rem, 18vw, 6.2rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25); font-variant-numeric: tabular-nums;
}
.temp .unit { font-size: 0.38em; font-weight: 600; vertical-align: 0.95em; margin-left: 0.15em; letter-spacing: 0; }
.summary { margin: 0.4rem 0 0; font-size: 1.25rem; font-weight: 650; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.feels { margin: 0.1rem 0 0; font-size: 1rem; opacity: 0.95; }
.feels:empty, .summary:empty, .minmax:empty { display: none; }
.minmax {
  display: inline-flex; gap: 1rem; margin: 1rem 0 0; padding: 0.45rem 0.9rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(6px); font-weight: 600; font-size: 0.98rem;
}

/* Illustration animations */
.sun-rays { transform-origin: 60px 60px; animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sun-core { filter: drop-shadow(0 0 14px rgba(255, 214, 102, 0.85)); }
.moon { filter: drop-shadow(0 0 12px rgba(220, 230, 255, 0.6)); }
.cloud { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.18)); animation: drift 7s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
.drop { animation: fall 1.1s linear infinite; }
@keyframes fall { 0% { transform: translateY(-6px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(26px); opacity: 0; } }

/* Next hours ---------------------------------------------------------------------------------------------- */
.tag { font-size: 0.8rem; font-weight: 700; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.6rem; }
.commute { display: grid; gap: 0.6rem; margin: 0.4rem 0 0.9rem; }
.trip { display: flex; gap: 0.8rem; align-items: center; padding: 0.8rem 0.9rem; border-radius: 16px; background: var(--surface-2); }
.trip-icon { width: 46px; height: 46px; flex: none; }
.trip-title { margin: 0; font-weight: 700; }
.trip-main { margin: 0.1rem 0 0; font-size: 1.05rem; }
.trip-advice { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.trip-advice span { font-size: 0.88rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.hours { list-style: none; margin: 0; padding: 0 0 0.5rem; display: flex; gap: 0.5rem; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.hour { flex: 0 0 68px; scroll-snap-align: start; text-align: center; padding: 0.55rem 0.25rem; border-radius: 14px; background: var(--surface-2); }
.hour.now { outline: 2px solid var(--primary); outline-offset: -2px; }
.hour-time { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.hour svg { width: 36px; height: 36px; display: block; margin: 0.25rem auto; }
.hour-temp { margin: 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hour-rain { margin: 0.1rem 0 0; font-size: 0.8rem; font-weight: 700; color: var(--primary); min-height: 1.2em; }
.source-note { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--muted); }
@media (min-width: 760px) { .commute { grid-template-columns: 1fr 1fr; } }

/* Cards ------------------------------------------------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin: 1rem 0; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem;
  box-shadow: var(--shadow); transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-2px); }
.card-title { display: flex; align-items: center; gap: 0.45rem; font-size: 0.95rem; color: var(--muted); margin: 0; font-weight: 650; }
.card-value { margin: 0.35rem 0 0; font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.card-value .unit { font-size: 0.5em; font-weight: 600; color: var(--muted); margin-left: 0.15em; }
.card-value-text { font-size: 1.45rem; }
.card-note { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }
.trend { display: inline-block; margin-left: 0.35rem; font-size: 0.7em; color: var(--primary); }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 0.55rem; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #f0b429, #38bdf8 40%, #1a64d6); transition: width 1s ease; }

.ico { width: 20px; height: 20px; display: inline-block; background: var(--primary); flex: none;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.ico-drop { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 3s6 6.6 6 11a6 6 0 0 1-12 0c0-4.4 6-11 6-11z'/%3E%3C/svg%3E"); }
.ico-rain { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 15a4 4 0 0 1-.6-8A6 6 0 0 1 18 8a3.5 3.5 0 0 1-.5 7H7z'/%3E%3Cpath d='M8 18l-1 3M12 18l-1 3M16 18l-1 3'/%3E%3C/svg%3E"); }
.ico-gauge { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 17a8 8 0 1 1 16 0'/%3E%3Cpath d='M12 17l4-5'/%3E%3C/svg%3E"); }
.ico-sun { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }

/* Panels ------------------------------------------------------------------------------------------------ */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.2rem; margin: 1rem 0; box-shadow: var(--shadow);
}
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.5rem; }
.panel-head h2 { margin: 0; }
.tabs { display: flex; gap: 0.35rem; background: var(--surface-2); padding: 0.25rem; border-radius: 999px; }
.tab {
  font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--muted); background: transparent; border: 0;
  border-radius: 999px; padding: 0.45rem 0.85rem; min-height: 40px; cursor: pointer;
}
.tab[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }

.chart { position: relative; margin: 0; }
#chart-svg { width: 100%; height: 230px; display: block; touch-action: pan-y; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.4s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.grad-top { stop-color: var(--primary); stop-opacity: 0.28; }
.grad-bottom { stop-color: var(--primary); stop-opacity: 0; }
.chart-label { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart-rain { fill: rgba(56, 189, 248, 0.16); }
.chart-now { fill: var(--primary); }
.chart-now-ring { fill: none; stroke: var(--primary); stroke-width: 2; opacity: 0.5; transform-box: fill-box; transform-origin: center; animation: ring 2.4s ease-out infinite; }
@keyframes ring { from { transform: scale(0.6); opacity: 0.7; } to { transform: scale(2.2); opacity: 0; } }
.chart-cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; top: 4px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  background: var(--text); color: var(--bg); font-size: 0.9rem; font-weight: 600; padding: 0.35rem 0.65rem; border-radius: 10px;
}
.chart-summary { color: var(--muted); font-size: 0.95rem; margin-top: 0.35rem; }

.date-pick { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; font-weight: 600; color: var(--muted); }
.date-pick input { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 0.35rem 0.5rem; min-height: 40px; }
.history-days { list-style: none; margin: 0 0 0.8rem; padding: 0 0 0.3rem; display: flex; gap: 0.5rem; overflow-x: auto; }
.day-chip {
  font: inherit; display: grid; gap: 0.1rem; min-width: 92px; padding: 0.55rem 0.7rem; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-align: left;
}
.day-chip[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.day-name { font-weight: 700; font-size: 0.92rem; white-space: nowrap; }
.day-temps { font-variant-numeric: tabular-nums; font-weight: 600; }
.day-rain { font-size: 0.8rem; color: var(--muted); }
.history-detail h3 { margin: 0.2rem 0 0.3rem; }
.history-test { margin: 0 0 0.4rem; font-size: 0.9rem; font-weight: 600; color: var(--warn); }
.history-summary { margin: 0 0 0.4rem; color: var(--muted); }
#history-svg { width: 100%; height: 200px; display: block; touch-action: pan-y; }

.rain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.rain-list li { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.8rem; border-radius: 12px; background: var(--surface-2); }
.rain-list .badge { font-size: 0.85rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }
.rain-list .none { background: transparent; padding: 0; color: var(--muted); }

.two-col { display: grid; gap: 0 1rem; }
.forecast-stage { margin: 0; font-weight: 700; font-size: 1.1rem; }
.forecast-text { margin: 0.3rem 0 0.8rem; color: var(--muted); }
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #38bdf8, var(--primary)); border-radius: inherit; transition: width 1.2s ease; }

.map { height: 260px; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.map-note { color: var(--muted); font-size: 0.92rem; margin: 0.5rem 0 0; }

.soon-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0; }
.soon-list li { padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px dashed var(--border); color: var(--muted); font-weight: 600; }

.share { display: grid; gap: 0.8rem; align-items: center; }
.share p { margin: 0.2rem 0 0; color: var(--muted); }
.share-button {
  font: inherit; font-weight: 700; font-size: 1.05rem; color: #fff; border: 0; cursor: pointer; min-height: 52px;
  border-radius: 999px; padding: 0.8rem 1.4rem; background: linear-gradient(90deg, #1a64d6, #38bdf8);
  box-shadow: 0 6px 18px rgba(26, 100, 214, 0.35); transition: transform 0.2s ease;
}
.share-button:hover { transform: translateY(-1px); }
.share-status { font-weight: 600; color: var(--good) !important; }
.share-status:empty { display: none; }
@media (min-width: 760px) { .share { grid-template-columns: 1fr auto; } .share-status { grid-column: 1 / -1; } }

.about p { margin: 0 0 0.8rem; }
.how { list-style: none; padding: 0; margin: 0.8rem 0; display: grid; gap: 0.6rem; }
.how li { display: flex; gap: 0.7rem; align-items: flex-start; }
.how-step { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
details { border-top: 1px solid var(--border); padding: 0.7rem 0; }
details:last-of-type { border-bottom: 1px solid var(--border); }
summary { cursor: pointer; font-weight: 650; min-height: 32px; }
details p { margin: 0.5rem 0 0; color: var(--muted); }

.footer { max-width: 1120px; margin: 0 auto; padding: 1rem 1rem 2.5rem; color: var(--muted); font-size: 0.95rem; }
.footer p { margin: 0.25rem 0; }
.footer-small { font-size: 0.85rem; }

/* Larger screens ---------------------------------------------------------------------------------------- */
@media (min-width: 760px) {
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr 1fr; }
  .hero-inner { padding: 2rem 2.2rem 1.8rem; }
  .illustration { width: 150px; height: 150px; }
  #chart-svg { height: 280px; }
}

@media (max-width: 420px) {
  .hero-inner { padding: 1.2rem 1.1rem 1.1rem; }
  .illustration { width: 80px; height: 80px; }
  .hero-main { gap: 0.6rem; }
  .summary { font-size: 1.12rem; }
  .card-value-text { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
