@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/raleway-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

@font-face {
  font-family: 'Raleway';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/raleway-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

:root {
  --cream: #ebe8e6;
  --card: #f7f5f3;
  --teal: #2e5967;
  --teal-deep: #234650;
  --ink: #1d1f25;
  --ink-soft: #4a4f57;
  --paper: #fdfdfd;
  --accent: #c26148;
  --accent-hover: #a94f39;
  --line: rgba(29, 31, 37, 0.1);
  --header-bg: rgba(255, 255, 255, 0.55);
  --shadow: 0 16px 34px -16px rgba(29, 31, 37, 0.35);
  --cool: #3f7f9c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cream: #1a1d22;
    --card: #21252b;
    --teal: #2e5967;
    --teal-deep: #234650;
    --ink: #f1efec;
    --ink-soft: #c4c0b9;
    --paper: #fdfdfd;
    --accent: #d97555;
    --accent-hover: #e8896a;
    --line: rgba(241, 239, 236, 0.12);
    --header-bg: rgba(26, 29, 34, 0.65);
    --shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.6);
    --cool: #5fa2c2;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
}

h1, h2 {
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}

.app {
  width: 100%;
  max-width: 640px;
  padding: 24px 18px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  padding: 16px 0 14px;
  margin: 0 -18px 20px;
  padding-left: 18px;
  padding-right: 18px;
}

.brand-link {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}

.brand-link:hover {
  color: var(--accent-hover);
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--teal);
}

.search {
  display: flex;
  gap: 8px;
}

.search input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
}

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

.search button {
  border: none;
  border-radius: 100px;
  background: var(--accent);
  color: var(--paper);
  font-size: 1.1rem;
  padding: 0 20px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.search button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.status {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 10px;
  font-size: 1rem;
}

.hidden {
  display: none !important;
}

.current {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--teal);
  color: var(--paper);
  border-radius: 10px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.current-icon {
  font-size: 4rem;
  line-height: 1;
}

.current-temp {
  font-size: 3rem;
  font-weight: 700;
}

.current-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.current-place {
  font-size: 1.2rem;
  font-weight: 700;
}

.current-desc {
  opacity: 0.85;
}

.current-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.85rem;
  opacity: 0.85;
}

.hourly h2,
.daily h2,
.ensemble h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--ink);
}

.hourly-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.hour-card {
  flex: 0 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
  min-width: 68px;
}

.geosphere-source .hour-card {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.h-wind,
.h-precip {
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

.source-note {
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-top: 8px;
}

.hour-card .h-time {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.hour-card .h-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.hour-card .h-temp {
  font-weight: 700;
  color: var(--ink);
}

.daily-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
}

.day-row .d-name {
  font-weight: 700;
  color: var(--ink);
}

.day-row .d-icon {
  font-size: 1.4rem;
  text-align: center;
}

.day-row .d-range {
  display: flex;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  justify-self: end;
}

.day-row .d-max {
  font-weight: 700;
  color: var(--ink);
}

.day-row .d-min {
  color: var(--ink-soft);
}

.ens-help {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.ens-help summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}

.ens-help summary::-webkit-details-marker {
  display: none;
}

.ens-help p {
  margin: 8px 0;
}

.ens-help ul {
  margin: 8px 0;
  padding-left: 20px;
}

.ens-help li {
  margin: 4px 0;
}

.ens-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.ens-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 8px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
}

.ens-legend-median {
  background: var(--ink);
  width: 3px;
  height: 12px;
}

.ens-chart-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 4px 4px;
}

#ensembleChart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.ensemble-note {
  margin: 10px 2px 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.ensemble-note a {
  color: var(--accent);
}

.footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 30px;
}

.footer p {
  margin: 4px 0;
}

.footer-legal {
  opacity: 0.85;
}

.footer a {
  color: var(--accent);
}

@media (max-width: 420px) {
  .current {
    flex-direction: column;
    text-align: center;
  }

  .current-meta {
    justify-content: center;
  }
}
