:root {
    --ink: #122039;
    --muted: #5a6b82;
    --line: #ccdae8;
    --paper: #f4f8fc;
    --blue: #0878c9;
    --blue-dark: #07486f;
    --blue-soft: #e7f4ff;
    --green: #15865d;
    --shadow: 0 18px 45px rgba(16, 56, 86, .14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    background: #eaf1f7;
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, select, input { font: inherit; }
.forecast-shell {
    width: min(1560px, calc(100% - 24px));
    margin: 12px auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.forecast-hero {
    min-height: 150px;
    padding: 28px 30px;
    color: #fff;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 28px;
    position: relative;
    background:
        linear-gradient(105deg, rgba(6, 61, 92, .98), rgba(10, 135, 213, .94)),
        repeating-linear-gradient(90deg, transparent 0 74px, rgba(255,255,255,.07) 75px 76px);
}
.eyebrow, .location-panel label > span, .location-kicker {
    display: block;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.forecast-hero h1 { margin: 5px 0 5px; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.04; }
.forecast-hero p { margin: 0; font-size: 1.05rem; opacity: .94; }
.hero-brand { display: flex; align-items: center; gap: 14px; }
.hero-brand img { background: #fff; border-radius: 12px; object-fit: contain; padding: 8px; }
.hero-brand > span { border: 1px solid rgba(255,255,255,.55); border-radius: 999px; padding: 10px 14px; font-size: .72rem; font-weight: 800; text-align: center; max-width: 230px; }
.language-switch { position: absolute; right: 18px; top: 10px; font-size: .74rem; }
.language-switch a { color: rgba(255,255,255,.75); font-weight: 700; text-decoration: none; }
.language-switch a.active { color: #fff; text-decoration: underline; }

.location-panel {
    display: grid;
    grid-template-columns: minmax(150px, .68fr) minmax(180px, .95fr) minmax(210px, 1.15fr) auto auto;
    gap: 14px;
    padding: 20px 22px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    align-items: end;
}
.location-panel label > span { margin: 0 0 7px; color: var(--muted); }
.location-panel select, .location-panel input, .geo-button {
    width: 100%;
    min-height: 48px;
    border: 1px solid #b9cadb;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    font-weight: 750;
    padding: 0 14px;
}
.location-panel input::placeholder { color: #7a899b; font-weight: 550; }
.location-panel select:disabled { color: #6d7e91; background: #f3f6f9; }
.geo-button { width: auto; cursor: pointer; color: #fff; background: linear-gradient(90deg, #086aa8, #078dd2); border: 0; padding-inline: 20px; }
.geo-button:disabled { opacity: .6; cursor: wait; }
.municipality-actions { display: flex; align-items: center; gap: 7px; }
.municipality-apply, .municipality-clear {
    min-height: 48px;
    border-radius: 11px;
    padding: 0 16px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
.municipality-apply { border: 0; color: #fff; background: var(--blue); }
.municipality-apply:disabled { opacity: .5; cursor: not-allowed; }
.municipality-clear { border: 1px solid #b9cadb; color: var(--blue-dark); background: #fff; }

.forecast-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 19px 22px 15px; background: var(--paper); border-bottom: 1px solid var(--line); }
.location-kicker { color: var(--blue); margin: 0 0 3px; }
.forecast-toolbar h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.1rem); }
.view-tabs { display: flex; padding: 4px; background: #dfeaf4; border-radius: 12px; }
.view-tabs button { min-height: 39px; border: 0; border-radius: 9px; padding: 0 18px; background: transparent; color: #52657c; font-weight: 800; cursor: pointer; }
.view-tabs button.active { color: #fff; background: var(--blue); box-shadow: 0 4px 12px rgba(0, 105, 175, .25); }

.forecast-content { min-height: 330px; padding: 20px 22px 24px; background: var(--paper); }
.status-box { display: grid; place-items: center; min-height: 280px; color: var(--muted); font-weight: 750; }
.status-box.error { color: #a62f2f; }
.days-grid { display: grid; grid-template-columns: repeat(7, minmax(145px, 1fr)); gap: 10px; }
.day-card { border: 1px solid var(--line); border-radius: 15px; background: #fff; padding: 14px 12px; min-height: 238px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.day-card:hover, .day-card:focus-visible { transform: translateY(-2px); border-color: #76b7df; box-shadow: 0 10px 24px rgba(34, 100, 145, .12); outline: none; }
.day-name { font-weight: 850; font-size: 1.02rem; }
.day-date { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.weather-icon { width: 70px; height: 70px; object-fit: contain; margin: 5px 0; }
.condition { min-height: 38px; color: #34465e; font-size: .85rem; }
.temperatures { font-size: 1.18rem; font-weight: 850; margin-top: auto; }
.temperature-max { color: #d44747; }
.temperature-min { color: #1672b9; }
.day-secondary { margin-top: 8px; width: 100%; display: grid; gap: 4px; color: var(--muted); font-size: .78rem; }
.day-secondary span { display: flex; justify-content: space-between; gap: 8px; }

.hours-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(125px, 145px); overflow-x: auto; gap: 9px; padding: 2px 2px 12px; scroll-snap-type: x proximity; scrollbar-color: var(--blue) #dbe7f2; }
.hour-card { position: relative; scroll-snap-align: start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px 42px; text-align: center; min-height: 252px; }
.hour-time { font-size: 1.04rem; font-weight: 850; }
.hour-date { color: var(--muted); font-size: .74rem; }
.hour-temperature { font-size: 1.35rem; font-weight: 850; }
.hour-data { color: var(--muted); font-size: .76rem; display: grid; gap: 4px; margin-top: 7px; }
.hour-more-button { position: absolute; right: 10px; bottom: 9px; width: 28px; height: 28px; padding: 0; border: 1px solid var(--blue); border-radius: 50%; background: #fff; color: var(--blue); font-size: 1.18rem; line-height: 1; font-weight: 800; cursor: pointer; }
.hour-more-button:hover, .hour-more-button:focus-visible, .hour-more-button[aria-expanded="true"] { color: #fff; background: var(--blue); outline: none; }

.day-detail, .hour-detail { margin-top: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; overflow: hidden; }
.detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 14px 16px; background: #e7f2fb; }
.detail-heading h3 { margin: 0; font-size: 1rem; }
.detail-heading button { border: 0; background: transparent; color: var(--blue-dark); font-weight: 800; cursor: pointer; }
.period-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.period-card { padding: 16px; border-right: 1px solid var(--line); }
.period-card:last-child { border-right: 0; }
.period-card h4 { margin: 0 0 8px; }
.period-main { display: flex; align-items: center; gap: 10px; }
.period-main .weather-icon { width: 52px; height: 52px; margin: 0; }
.period-data { color: var(--muted); font-size: .82rem; display: grid; gap: 5px; }
.hour-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.hour-metric { min-height: 92px; padding: 15px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.hour-metric:nth-child(4n) { border-right: 0; }
.hour-metric strong { font-size: 1.08rem; color: var(--blue-dark); }
.hour-metric-label { color: var(--muted); font-size: .78rem; font-weight: 750; }
.hour-metric small { color: var(--muted); font-size: .67rem; line-height: 1.3; }

.forecast-footer { padding: 13px 22px; display: flex; justify-content: space-between; gap: 18px; color: var(--muted); font-size: .76rem; border-top: 1px solid var(--line); }
.forecast-footer strong { color: var(--ink); }
.forecast-footer a { color: var(--blue-dark); }

/* Modo integrado en la portada: conserva todo el contenido meteorológico y
   elimina únicamente la cabecera corporativa duplicada. */
body.is-embedded { background: transparent; }
.is-embedded .forecast-shell {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.is-embedded .forecast-hero { display: none; }
.is-embedded .location-panel { padding: 12px 16px; gap: 10px; }
.is-embedded .location-panel select,
.is-embedded .location-panel input,
.is-embedded .geo-button { min-height: 43px; }
.is-embedded .municipality-apply,
.is-embedded .municipality-clear { min-height: 43px; }
.is-embedded .forecast-toolbar { padding: 12px 16px 10px; }
.is-embedded .forecast-toolbar h2 { font-size: clamp(1.25rem, 2.4vw, 1.75rem); }
.is-embedded .forecast-content { min-height: 275px; padding: 12px 14px 15px; }
.is-embedded .status-box { min-height: 250px; }
.is-embedded .days-grid { gap: 8px; }
.is-embedded .day-card { min-height: 218px; padding: 10px 9px; }
.is-embedded .weather-icon { width: 58px; height: 58px; margin: 3px 0; }
.is-embedded .condition { min-height: 34px; }
.is-embedded .day-secondary { margin-top: 5px; }
.is-embedded .forecast-footer { padding: 9px 16px; }

@media (max-width: 980px) {
    .forecast-hero { grid-template-columns: 1fr; }
    .hero-brand { position: absolute; right: 20px; bottom: 18px; }
    .hero-brand > span { display: none; }
    .hero-brand img { width: 104px; height: 58px; }
    .days-grid { grid-template-columns: repeat(7, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
    .day-card { scroll-snap-align: start; }
    .location-panel { grid-template-columns: 1fr 1fr; }
    .municipality-actions { align-self: end; }
    .geo-button { width: 100%; }
    .municipality-actions { width: 100%; }
    .municipality-apply { flex: 1; }
    .hour-metric-grid { grid-template-columns: repeat(3, 1fr); }
    .hour-metric:nth-child(4n) { border-right: 1px solid var(--line); }
    .hour-metric:nth-child(3n) { border-right: 0; }
}

@media (max-width: 720px) {
    .forecast-shell { width: 100%; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
    .forecast-hero { min-height: 190px; padding: 29px 20px 76px; align-items: start; }
    .forecast-hero h1 { font-size: 2rem; }
    .forecast-hero p { font-size: .94rem; max-width: 90%; }
    .hero-brand { left: 20px; right: auto; bottom: 13px; }
    .hero-brand img { width: 96px; height: 54px; }
    .location-panel { grid-template-columns: 1fr; padding: 17px 16px; }
    .geo-button { width: 100%; }
    .forecast-toolbar { align-items: stretch; flex-direction: column; padding: 17px 16px 14px; }
    .view-tabs { width: 100%; }
    .view-tabs button { flex: 1; }
    .forecast-content { padding: 15px 12px 20px; }
    .days-grid { grid-template-columns: repeat(7, minmax(145px, 72vw)); }
    .day-card { min-height: 228px; }
    .period-grid { grid-template-columns: 1fr 1fr; }
    .period-card { border-bottom: 1px solid var(--line); }
    .period-card:nth-child(2) { border-right: 0; }
    .period-card:nth-child(3), .period-card:nth-child(4) { border-bottom: 0; }
    .forecast-footer { flex-direction: column; padding: 12px 16px; }
    .hour-metric-grid { grid-template-columns: 1fr 1fr; }
    .hour-metric:nth-child(3n) { border-right: 1px solid var(--line); }
    .hour-metric:nth-child(2n) { border-right: 0; }
    .is-embedded .location-panel { grid-template-columns: 1fr 1fr; padding: 12px; }
    .is-embedded .forecast-toolbar { padding: 12px; }
    .is-embedded .forecast-content { padding: 10px 9px 13px; }
    .is-embedded .days-grid { grid-template-columns: repeat(7, minmax(140px, 66vw)); }
    .is-embedded .day-card { min-height: 214px; }
}

@media (max-width: 520px) {
    .is-embedded .location-panel { grid-template-columns: 1fr; }
    .municipality-actions { display: grid; grid-template-columns: 1fr auto; }
}

@media (max-width: 420px) {
    .period-grid { grid-template-columns: 1fr; }
    .period-card { border-right: 0; border-bottom: 1px solid var(--line) !important; }
    .period-card:last-child { border-bottom: 0 !important; }
    .hour-metric-grid { grid-template-columns: 1fr; }
    .hour-metric { border-right: 0 !important; }
}
