:root{
  --bg-0:#0b0e14;
  --bg-1:#12161f;
  --panel:#161b26;
  --panel-2:#1c2230;
  --border:#262d3d;
  --text:#e8ebf2;
  --text-dim:#8891a5;
  --accent:#5eb8ff;
  --accent-2:#8f7bff;
  --warm:#ffb454;
  --rain:#4fd1e8;
  --radius:18px;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  min-height:100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(95,140,255,0.14), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(143,123,255,0.12), transparent 55%),
    var(--bg-0);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Helvetica,Arial,sans-serif;
  padding:32px 20px 60px;
}
.wrap{max-width:1000px;margin:0 auto;}

/* Top row: icon + name on the left (icon's left edge on the content edge), search fills the rest. */
.topbar{display:flex;align-items:center;gap:24px;margin-bottom:28px;}
.brand-h1{margin:0;font:inherit;flex-shrink:0;}   /* the page's main heading, styled exactly as before */
.brand{display:flex;align-items:center;gap:12px;flex-shrink:0;color:var(--text);text-decoration:none;}
.brand img{display:block;height:48px;width:auto;}
.brand-name{font-size:13px;font-weight:300;letter-spacing:0.2em;white-space:nowrap;}

.search{position:relative;flex:1;min-width:0;}
.search-box{
  display:flex;
  align-items:center;
  gap:10px;
  height:48px;
  padding:0 14px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  transition:border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box:focus-within{border-color:rgba(95,184,255,0.55);box-shadow:0 0 0 3px rgba(95,184,255,0.12);}
.search-box svg{width:18px;height:18px;color:var(--text-dim);flex-shrink:0;}
.search-box input{
  flex:1;
  min-width:0;
  height:100%;
  background:transparent;
  border:0;
  outline:0;
  color:var(--text);
  font:inherit;
  font-size:15px;
}
.search-box input::placeholder{color:var(--text-dim);}
.search-list{
  position:absolute;
  left:0;right:0;
  top:calc(100% + 6px);
  z-index:10;
  margin:0;
  padding:6px;
  list-style:none;
  max-height:320px;
  overflow-y:auto;
  background:var(--panel-2);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:0 18px 40px -12px rgba(0,0,0,0.6);
}
.search-list li{padding:10px 12px;border-radius:10px;cursor:pointer;font-size:14px;}
.search-list li .pl-sub{color:var(--text-dim);font-size:12.5px;margin-left:6px;}
.search-list li.active{background:rgba(95,184,255,0.14);}
.search-list li.empty{color:var(--text-dim);cursor:default;}
.search-msg{position:absolute;top:calc(100% + 8px);left:4px;color:#ff8080;font-size:13px;}
.wrap.loading header, .wrap.loading main{opacity:0.45;pointer-events:none;transition:opacity 0.2s ease;}

header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:12px;
  margin-bottom:28px;
}
.loc{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.loc .place{
  font-size:26px;
  font-weight:600;
  letter-spacing:-0.02em;
}
.loc .place .country{color:var(--text-dim);font-weight:400;font-size:16px;margin-left:6px;}
.loc .updated{color:var(--text-dim);font-size:13px;}
.now{
  display:flex;
  align-items:center;
  gap:10px;
}
.now img{width:56px;height:56px;filter:drop-shadow(0 4px 10px rgba(0,0,0,0.4));}
.now .now-row{display:flex;align-items:baseline;gap:10px;}
.now .now-temp{font-size:40px;font-weight:300;letter-spacing:-0.03em;}
.now .feels{font-size:13px;color:var(--text-dim);white-space:nowrap;}
.air{white-space:nowrap;}
.air i{display:inline-block;width:7px;height:7px;border-radius:50%;margin:0 5px 1px 0;vertical-align:middle;}

/* Weather warnings: only shown when there are any. Click one for the details. */
.alerts{display:flex;flex-direction:column;gap:10px;margin-bottom:24px;}
.alerts[hidden]{display:none;}
.alert{background:rgba(255,180,84,0.08);border:1px solid rgba(255,180,84,0.35);border-radius:14px;padding:12px 16px;}
.alert.severe{background:rgba(255,110,110,0.08);border-color:rgba(255,110,110,0.45);}
.alert summary{display:flex;align-items:center;gap:10px;cursor:pointer;list-style:none;font-size:14px;font-weight:600;}
.alert summary::-webkit-details-marker{display:none;}
.alert summary svg{width:18px;height:18px;color:var(--warm);flex-shrink:0;}
.alert.severe summary svg{color:#ff8080;}
.alert .alert-when{margin-left:auto;padding-left:12px;color:var(--text-dim);font-weight:400;font-size:12.5px;white-space:nowrap;}
.alert p{margin:10px 0 0 28px;color:var(--text-dim);font-size:13px;line-height:1.5;white-space:pre-line;}
.now .now-cond{color:var(--text-dim);font-size:14px;max-width:120px;}

#status{
  text-align:center;
  color:var(--text-dim);
  padding:60px 20px;
  font-size:15px;
}
#status.error{color:#ff8080;}
.spinner{
  width:28px;height:28px;
  margin:0 auto 16px;
  border-radius:50%;
  border:3px solid var(--border);
  border-top-color:var(--accent);
  animation:spin 0.8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg);}}

main{display:none;}
main.ready{display:block;animation:fadein 0.4s ease;}
@keyframes fadein{from{opacity:0;transform:translateY(6px);}to{opacity:1;transform:translateY(0);}}

.days{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:16px;
  margin-bottom:32px;
}
.day-card{
  background:linear-gradient(160deg,var(--panel),var(--panel-2));
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px 18px;
  cursor:pointer;
  transition:transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  position:relative;
  overflow:hidden;
}
.day-card::before{
  content:"";
  position:absolute;inset:0;
  background:linear-gradient(135deg, rgba(95,184,255,0.10), rgba(143,123,255,0.06));
  opacity:0;
  transition:opacity 0.18s ease;
}
.day-card:hover, .day-card.hovered{
  transform:translateY(-4px);
  border-color:rgba(95,184,255,0.55);
  box-shadow:0 14px 30px -12px rgba(95,184,255,0.35);
}
.day-card:hover::before, .day-card.hovered::before{opacity:1;}
.day-card.pinned{
  border-color:var(--accent);
  box-shadow:0 0 0 1px rgba(95,184,255,0.4) inset, 0 14px 30px -14px rgba(95,184,255,0.4);
}
.day-card .top-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  position:relative;
}
.day-card .dname{font-weight:600;font-size:15px;}
.day-card .ddate{color:var(--text-dim);font-size:12px;margin-top:2px;}
.day-card .badge{
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:0.06em;
  background:rgba(95,184,255,0.15);
  color:var(--accent);
  padding:3px 8px;
  border-radius:20px;
  font-weight:600;
}
.day-card .icon-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin:14px 0 10px;
  position:relative;
}
.day-card .icon-row img{width:48px;height:48px;}
.day-card .cond{font-size:13px;color:var(--text-dim);line-height:1.3;}
.day-card .sun{margin-left:auto;display:flex;flex-direction:column;gap:5px;font-size:12px;color:var(--text-dim);white-space:nowrap;}
.day-card .sun span{display:flex;align-items:center;gap:6px;}
.day-card .sun svg{width:15px;height:15px;color:var(--warm);flex-shrink:0;}
.day-card .temps{
  display:flex;
  align-items:baseline;
  gap:8px;
  margin-bottom:14px;
  position:relative;
}
.day-card .tmax{font-size:26px;font-weight:600;letter-spacing:-0.02em;}
.day-card .tmin{font-size:16px;color:var(--text-dim);}
.day-card .stats{
  display:flex;
  gap:16px;
  position:relative;
}
.stat{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--text-dim);}
.stat svg{width:15px;height:15px;flex-shrink:0;opacity:0.85;}
.stat b{color:var(--text);font-weight:600;}

.hourly-section h2{
  font-size:14px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:var(--text-dim);
  margin:0 0 14px 4px;
  display:flex;
  align-items:center;
  gap:8px;
}
.hourly-section h2 span.hday{color:var(--text);}
.hourly-scroll{
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding:6px 4px 14px;
  scroll-snap-type:x proximity;
}
.hourly-scroll::-webkit-scrollbar{height:8px;}
.hourly-scroll::-webkit-scrollbar-track{background:transparent;}
.hourly-scroll::-webkit-scrollbar-thumb{background:var(--border);border-radius:8px;}
/* Drag the hours sideways with the mouse (touch screens already swipe). */
@media (pointer:fine){ .hourly-scroll{cursor:grab;} }
.hourly-scroll.dragging{cursor:grabbing;scroll-snap-type:none;user-select:none;}
.hourly-scroll.dragging .hour-card{pointer-events:none;}
.hour-card img{-webkit-user-drag:none;user-select:none;}

.hour-card{
  scroll-snap-align:start;
  flex:0 0 auto;
  width:96px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px 10px 16px;
  text-align:center;
  transition:border-color 0.15s ease, transform 0.15s ease;
}
.hour-card.now-hour{border-color:var(--accent);background:linear-gradient(160deg, rgba(95,184,255,0.12), var(--panel));}
.hour-card:hover{transform:translateY(-2px);border-color:rgba(95,184,255,0.5);}
.hour-card .htime{font-size:12px;color:var(--text-dim);margin-bottom:6px;font-weight:600;}
.hour-card img{width:38px;height:38px;margin:2px auto 4px;display:block;}
.hour-card .htemp{font-size:18px;font-weight:600;margin-bottom:10px;}
.hour-card .hrain{display:flex;align-items:center;justify-content:center;gap:4px;margin:-4px 0 10px;font-size:11.5px;color:var(--text-dim);}
.hour-card .hrain svg{width:13px;height:13px;color:var(--rain);}
.hour-card .hrain b{color:var(--text);font-weight:600;}
.hour-card .wind{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  padding-top:10px;
  border-top:1px solid var(--border);
}
.hour-card .wind-arrow{
  width:20px;height:20px;
  color:var(--rain);
  transition:transform 0.3s ease;
}
.hour-card .wind-speed{font-size:11.5px;color:var(--text-dim);}
.hour-card .wind-speed b{color:var(--text);font-weight:600;}
.hour-card .wind-dir{font-size:10px;color:var(--text-dim);letter-spacing:0.05em;}

footer{
  text-align:center;
  color:var(--text-dim);
  font-size:11.5px;
  margin-top:36px;
  opacity:0.7;
}

footer a{color:inherit;}
footer a:hover{color:var(--text);}

/* Town pages (climate.observer/whitby): the town's name is the page heading. */
h1.place{margin:0;}

/* Below the forecast on town pages: the forecast in words, and the nearest towns. */
.about{margin-top:40px;padding-top:26px;border-top:1px solid var(--border);}
.about h2, .towns-page h2{
  font-size:14px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:var(--text-dim);
  margin:0 0 12px 4px;
}
.about .summary{margin:0 0 30px;}
.about p{margin:0 0 8px 4px;color:var(--text-dim);font-size:13.5px;line-height:1.6;}
.about p b{color:var(--text);font-weight:600;}
.nearby{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-wrap:wrap;gap:8px;}
.nearby a{
  display:inline-block;
  padding:7px 14px;
  border-radius:20px;
  background:var(--panel);
  border:1px solid var(--border);
  color:var(--text);
  text-decoration:none;
  font-size:13px;
  transition:border-color 0.15s ease;
}
.nearby a:hover{border-color:rgba(95,184,255,0.55);}
.nearby a.all{background:transparent;color:var(--text-dim);}

/* The list of all towns (climate.observer/towns), and the "page not found" page. */
.page-title{font-size:26px;font-weight:600;letter-spacing:-0.02em;margin:0 0 8px;}
.page-intro{color:var(--text-dim);font-size:14px;margin:0 0 30px;line-height:1.6;}
.page-intro a{color:var(--accent);}
.towns-page section{margin-bottom:30px;}
.town-list{list-style:none;margin:0;padding:0 0 0 4px;columns:4 170px;column-gap:24px;}
.town-list li{font-size:13.5px;line-height:1.9;break-inside:avoid;}
.town-list a{color:var(--text);text-decoration:none;}
.town-list a:hover{color:var(--accent);}
.credit{color:var(--text-dim);font-size:12px;opacity:0.8;}
.credit a{color:inherit;}

@media(max-width:640px){
  .topbar{flex-wrap:wrap;gap:16px;}
  .search{flex-basis:100%;}
  .days{grid-template-columns:1fr;}
  header{align-items:flex-start;}
}
