:root {
  color-scheme: light;
  --bg: #f3f7fa;
  --surface: #ffffff;
  --surface-soft: #eef5f9;
  --surface-blue: #eaf4fb;
  --text: #183049;
  --text-strong: #0e253a;
  --muted: #65788a;
  --line: #d7e2ea;
  --accent: #2f7dbc;
  --accent-strong: #1e659c;
  --rain: #2b8fc5;
  --sun: #efb63f;
  --good: #2e8a67;
  --warn: #bd8420;
  --bad: #bd4a47;
  --shadow: 0 8px 24px rgba(25, 55, 75, .07);
  --radius: 22px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(79, 157, 208, .10), transparent 34%),
    linear-gradient(180deg, #f8fbfd 0%, var(--bg) 100%);
  color: var(--text);
}

button, input, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px max(18px, env(safe-area-inset-right)) 16px max(18px, env(safe-area-inset-left));
  background: rgba(250, 253, 255, .94);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(203, 218, 228, .9);
}

.topbar h1 {
  margin: 2px 0 3px;
  color: var(--text-strong);
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: .73rem;
  font-weight: 850;
  letter-spacing: .105em;
}

.credit {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
}

.refresh-button {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.page-shell {
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

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

.hidden { display: none !important; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 4px 12px;
}

.section-heading h2 {
  margin: 4px 0 0;
  color: var(--text-strong);
  font-size: 1.23rem;
}

.loading-card,
.error-card {
  padding: 28px;
  text-align: center;
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  border: 4px solid #dce8ef;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

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

.primary-button {
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
}

.live-badge,
.agreement-badge {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--surface-blue);
  border: 1px solid #cce1ef;
  color: var(--accent-strong);
  font-size: .78rem;
  font-weight: 800;
}

.current-card {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) 1.5fr;
  gap: 24px;
  padding: 26px;
  background:
    radial-gradient(circle at 92% 10%, rgba(244, 185, 66, .14), transparent 28%),
    var(--surface);
}

.current-main {
  display: flex;
  align-items: center;
  gap: 18px;
}

.current-icon {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  border-radius: 28px;
  background: #f5f9fc;
  border: 1px solid var(--line);
  font-size: 4.2rem;
}

.current-condition {
  margin: 0 0 4px;
  color: var(--text-strong);
  font-size: 1.05rem;
  font-weight: 850;
}

.current-temperature {
  display: flex;
  align-items: flex-start;
  line-height: .9;
}

.current-temperature strong {
  color: var(--text-strong);
  font-size: clamp(3.7rem, 10vw, 5.7rem);
  letter-spacing: -.06em;
}

.current-temperature span {
  margin: 7px 0 0 6px;
  font-size: 1.45rem;
  color: var(--muted);
}

.current-feels {
  margin: 10px 0 0;
  color: var(--muted);
}

.current-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.current-metrics article {
  display: grid;
  gap: 5px;
  min-height: 82px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid #dde9f0;
}

.current-metrics span {
  color: var(--muted);
  font-size: .76rem;
}

.current-metrics strong {
  align-self: end;
  color: var(--text-strong);
  font-size: 1rem;
}

.updated {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: .78rem;
}

.interpretation-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  padding: 21px;
  border-color: #b8d6e9;
  background:
    linear-gradient(135deg, rgba(47, 125, 188, .10), rgba(47, 125, 188, .03)),
    var(--surface);
}

.interpretation-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  font-size: 1.35rem;
}

.analysis-text {
  margin: 0;
  color: var(--text-strong);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 590;
}

.analysis-note {
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px solid #cfe1ec;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}

.featured-days {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.day-card {
  padding: 20px;
}

.day-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.day-kicker {
  margin: 0;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.day-date {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.day-icon {
  font-size: 2.55rem;
}

.day-main {
  margin-top: 14px;
}

.day-main strong {
  color: var(--text-strong);
  font-size: 1.15rem;
}

.day-summary {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: .9rem;
}

.day-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.day-stats span {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: var(--surface-soft);
  border-radius: 13px;
  color: var(--muted);
  font-size: .7rem;
}

.day-stats strong {
  color: var(--text-strong);
  font-size: .88rem;
}

.gust-alert {
  color: var(--bad) !important;
}

.hourly-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.hour-card {
  padding: 14px 12px;
  text-align: center;
}

.hour-time {
  color: var(--text-strong);
  font-weight: 850;
}

.hour-icon {
  margin: 7px 0 4px;
  font-size: 1.65rem;
}

.hour-temp {
  display: block;
  color: var(--text-strong);
  font-size: 1.05rem;
  font-weight: 850;
}

.hour-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.calendar-card {
  display: grid;
  gap: 8px;
  padding: 15px 13px;
  text-align: center;
}

.calendar-day {
  color: var(--accent);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.calendar-date {
  color: var(--muted);
  font-size: .74rem;
}

.calendar-icon {
  font-size: 2rem;
}

.calendar-condition {
  min-height: 34px;
  color: var(--text-strong);
  font-size: .84rem;
  font-weight: 800;
}

.calendar-temp {
  color: var(--text-strong);
  font-size: .98rem;
  font-weight: 850;
}

.calendar-rain,
.calendar-wind {
  color: var(--muted);
  font-size: .72rem;
}

.sources-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 28px;
  padding: 18px 20px;
}

.sources-card strong {
  color: var(--text-strong);
}

.sources-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .84rem;
}

.source-pill {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--surface-blue);
  color: var(--accent-strong);
  font-size: .75rem;
  font-weight: 850;
}

.footer-note {
  margin: 18px 8px 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 900px) {
  .current-card {
    grid-template-columns: 1fr;
  }

  .hourly-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  html { font-size: 17px; }

  .topbar {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .topbar h1 {
    font-size: 1.65rem;
  }

  .page-shell {
    width: min(100% - 18px, 1080px);
    padding-top: 14px;
  }

  .section-heading {
    align-items: center;
    margin-top: 22px;
  }

  .section-heading h2 {
    font-size: 1.08rem;
  }

  .current-card {
    gap: 18px;
    padding: 18px;
  }

  .current-main {
    align-items: center;
  }

  .current-icon {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    font-size: 3.25rem;
  }

  .current-temperature strong {
    font-size: 4rem;
  }

  .current-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .current-metrics article {
    min-height: 72px;
    padding: 12px;
  }

  .interpretation-card {
    grid-template-columns: 1fr;
    padding: 17px;
  }

  .interpretation-icon {
    width: 40px;
    height: 40px;
  }

  .analysis-text {
    font-size: .95rem;
  }

  .featured-days {
    grid-template-columns: 1fr;
  }

  .day-card {
    padding: 17px;
  }

  .hourly-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .hour-card {
    padding: 12px 8px;
  }

  .hour-meta {
    font-size: .67rem;
  }

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-card {
    padding: 13px 10px;
  }

  .sources-card {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 390px) {
  html { font-size: 16.5px; }

  .current-icon {
    width: 78px;
    height: 78px;
    font-size: 2.85rem;
  }

  .current-temperature strong {
    font-size: 3.5rem;
  }

  .hourly-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.brand-name {
  margin: 2px 0 1px;
  color: var(--accent-strong);
  font-size: .86rem;
  font-weight: 850;
  letter-spacing: .02em;
}


/* Versión 1.2 */
.brand-title {
  margin: 0 0 2px;
  color: var(--text-strong);
  font-size: clamp(2rem, 5vw, 2.65rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.035em;
}

.topbar h1 {
  margin: 5px 0 4px;
  font-size: clamp(1.15rem, 2.8vw, 1.45rem);
  font-weight: 760;
  letter-spacing: -.015em;
}

.day-analysis {
  margin-top: 16px;
  padding: 14px 15px;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(47,125,188,.085), rgba(47,125,188,.025));
  border: 1px solid #c9deeb;
}

.day-analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.day-analysis-head strong {
  color: var(--text-strong);
  font-size: .84rem;
}

.day-analysis-head span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(47,125,188,.09);
  color: var(--accent-strong);
  font-size: .66rem;
  font-weight: 800;
}

.day-analysis p {
  margin: 0;
  color: var(--text);
  font-size: .86rem;
  line-height: 1.5;
}

.day-analysis small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: .67rem;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .brand-title { font-size: 2rem; }
  .topbar h1 { font-size: 1.1rem; }
  .day-analysis-head { align-items: flex-start; flex-direction: column; gap: 5px; }
}


/* v1.3 · interpretación meteorológica detallada */
.analysis-text,
.day-analysis p {
  white-space: pre-line;
}


/* v1.4 · Rediseño visual inspirado en la lectura clara de Meteo Lucas */
:root {
  --bg: #edf4f8;
  --surface: #ffffff;
  --surface-soft: #f5f9fc;
  --surface-blue: #e9f4fb;
  --text: #24313b;
  --text-strong: #111b22;
  --muted: #667786;
  --line: #d4e0e7;
  --accent: #1d77b8;
  --accent-strong: #135f96;
  --rain: #2588c4;
  --sun: #f4b62f;
  --shadow: 0 10px 28px rgba(42, 71, 91, .08);
  --radius: 18px;
}

body {
  background:
    linear-gradient(180deg, #f8fbfd 0%, #eff5f8 42%, #edf4f8 100%);
}

.topbar {
  position: relative;
  padding: 20px max(20px, env(safe-area-inset-right)) 18px max(20px, env(safe-area-inset-left));
  background: #ffffff;
  border-bottom: 1px solid #d8e3e9;
  box-shadow: 0 2px 12px rgba(35, 61, 77, .04);
}

.brand-title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(1.9rem, 4.6vw, 2.7rem);
  line-height: .95;
  font-weight: 900;
  letter-spacing: -.045em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 6px 0 2px;
  color: var(--accent-strong);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 800;
  letter-spacing: .01em;
}

.header-location {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .79rem;
}

.credit {
  font-size: .72rem;
}

.page-shell {
  width: min(1180px, calc(100% - 28px));
  padding-top: 18px;
}

.section-heading {
  margin-top: 24px;
  margin-bottom: 10px;
}

.section-heading .eyebrow {
  font-size: .67rem;
}

.section-heading h2 {
  margin-top: 2px;
  font-size: 1.12rem;
}

.current-card {
  display: block;
  padding: 0;
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
}

.current-hero {
  min-height: 265px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 30px 24px 26px;
  background:
    radial-gradient(circle at 70% 15%, rgba(246, 190, 51, .16), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #f7fbfd 100%);
  border-bottom: 1px solid var(--line);
}

.current-icon {
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: inherit;
}

.current-primary {
  min-width: 200px;
}

.current-temperature strong {
  font-size: clamp(4.8rem, 10vw, 7.5rem);
  font-weight: 800;
  color: #111;
  letter-spacing: -.07em;
}

.current-temperature span {
  margin-top: 9px;
  color: #4b5963;
  font-size: 1.55rem;
}

.current-condition {
  margin-top: 8px;
  color: #111;
  font-size: 1.18rem;
  font-weight: 800;
}

.current-feels {
  margin-top: 3px;
  font-size: .9rem;
}

.current-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  background: #fff;
}

.current-metrics article {
  min-height: 108px;
  border-radius: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 14px 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
}

.current-metrics article:last-child {
  border-right: 0;
}

.metric-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 3px;
  color: #1e74ae;
}

.metric-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.current-metrics span {
  color: #687986;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 750;
}

.current-metrics strong {
  font-size: .91rem;
  color: #15222c;
}

.current-secondary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: #f8fbfd;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .72rem;
}

.current-secondary strong {
  color: var(--text);
}

.weather-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.weather-svg .wx-sun circle {
  fill: #ffd24a;
  stroke: #111;
  stroke-width: 2.2;
}

.weather-svg .wx-sun path {
  fill: none;
  stroke: #111;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.weather-svg .wx-cloud path {
  fill: #fff;
  stroke: #111;
  stroke-width: 2.6;
  stroke-linejoin: round;
}

.weather-svg .wx-rain path {
  fill: none;
  stroke: #2d93ca;
  stroke-width: 3;
  stroke-linecap: round;
}

.weather-svg .wx-moon path {
  fill: #e7edf1;
  stroke: #111;
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.weather-svg .wx-snow path {
  fill: none;
  stroke: #66a9d0;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.weather-svg .wx-bolt path {
  fill: #f6c03d;
  stroke: #111;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.weather-svg .wx-fog path {
  fill: none;
  stroke: #8796a0;
  stroke-width: 2.3;
  stroke-linecap: round;
}

.featured-days {
  gap: 12px;
}

.day-card {
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(42, 71, 91, .06);
  padding: 17px;
}

.day-card-header {
  align-items: center;
}

.day-icon {
  width: 64px;
  height: 64px;
  font-size: inherit;
}

.day-main {
  margin-top: 8px;
}

.day-stats {
  margin-top: 13px;
}

.day-stats span {
  background: #f4f8fa;
  border: 1px solid #e4edf2;
}

.day-analysis {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.interpretation-card {
  border-radius: 18px;
  background: #fff;
  border-left: 4px solid var(--accent);
  box-shadow: 0 6px 18px rgba(42, 71, 91, .06);
}

.interpretation-icon {
  background: #2c83bd;
}

.hourly-list {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(42, 71, 91, .05);
}

.hour-card {
  flex: 0 0 112px;
  min-width: 112px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: #fff;
  padding: 12px 8px;
}

.hour-card:last-child {
  border-right: 0;
}

.hour-icon {
  width: 48px;
  height: 48px;
  margin: 8px auto 3px;
}

.hour-time {
  font-size: .79rem;
}

.hour-temp {
  font-size: 1.05rem;
}

.hour-meta {
  font-size: .66rem;
}

.calendar-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.calendar-card {
  padding: 13px 10px;
  border-radius: 16px;
  box-shadow: 0 5px 15px rgba(42, 71, 91, .05);
}

.calendar-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto;
}

.sources-card {
  border-radius: 16px;
  box-shadow: none;
  background: #f8fbfd;
}

.refresh-button {
  box-shadow: none;
  background: #f7fafc;
}

@media (max-width: 900px) {
  .current-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .current-metrics article {
    border-bottom: 1px solid var(--line);
  }

  .current-metrics article:nth-child(3n) {
    border-right: 0;
  }

  .current-metrics article:nth-last-child(-n+3) {
    border-bottom: 0;
  }
}

@media (max-width: 640px) {
  html { font-size: 17px; }

  .topbar {
    padding: max(15px, env(safe-area-inset-top)) 14px 14px;
  }

  .brand-title {
    font-size: 2rem;
  }

  .topbar h1 {
    font-size: .98rem;
  }

  .header-location,
  .credit {
    font-size: .69rem;
  }

  .page-shell {
    width: min(100% - 14px, 1180px);
    padding-top: 9px;
  }

  .current-hero {
    min-height: 210px;
    gap: 18px;
    padding: 22px 14px;
  }

  .current-icon {
    width: 110px;
    height: 110px;
  }

  .current-primary {
    min-width: 0;
  }

  .current-temperature strong {
    font-size: 4.6rem;
  }

  .current-temperature span {
    font-size: 1.15rem;
  }

  .current-condition {
    font-size: 1rem;
  }

  .current-feels {
    font-size: .78rem;
  }

  .current-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .current-metrics article {
    min-height: 94px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .current-metrics article:nth-child(2n) {
    border-right: 0;
  }

  .current-metrics article:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  .current-metrics article:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .current-secondary {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  .featured-days {
    grid-template-columns: 1fr;
  }

  .day-icon {
    width: 58px;
    height: 58px;
  }

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 390px) {
  .current-hero {
    gap: 10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .current-icon {
    width: 94px;
    height: 94px;
  }

  .current-temperature strong {
    font-size: 4rem;
  }
}
