:root {
    --bg1: #3a7bd5;
    --bg2: #3a6073;
    --ink: #fff;
    --muted: rgba(255, 255, 255, .72);
    --glass: rgba(255, 255, 255, .14);
    --line: rgba(255, 255, 255, .24);
}

/* the background follows the weather and the time of day */
body[data-weather="clear-day"]   { --bg1: #2f80ed; --bg2: #56ccf2; }
body[data-weather="clear-night"] { --bg1: #0f2027; --bg2: #2c5364; }
body[data-weather="clouds-day"]  { --bg1: #667db6; --bg2: #8ea4c8; }
body[data-weather="clouds-night"]{ --bg1: #232526; --bg2: #414345; }
body[data-weather="rain"]        { --bg1: #3a4a63; --bg2: #5f7a96; }
body[data-weather="storm"]       { --bg1: #1f1c2c; --bg2: #3b3b6d; }
body[data-weather="snow"]        { --bg1: #6d8bb0; --bg2: #b7cbe0; }
body[data-weather="mist"]        { --bg1: #6b7b8c; --bg2: #a3b1be; }

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(1rem, 5vw, 3rem) 1rem;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: linear-gradient(160deg, var(--bg1), var(--bg2)) fixed;
    transition: background .6s;
}

.app { width: min(460px, 100%); }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
h1 { margin: 0; font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

button, input { font: inherit; color: inherit; }

.units { display: flex; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.units button { border: 0; background: transparent; padding: .35rem .8rem; border-radius: 999px; cursor: pointer; opacity: .8; }
.units button[aria-pressed="true"] { background: #fff; color: #1b2a41; opacity: 1; font-weight: 600; }

.search { display: flex; gap: .5rem; }
input[type="text"] {
    flex: 1; min-width: 0;
    padding: .8rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(10px);
    outline: none;
}
input::placeholder { color: var(--muted); }
input:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.search button {
    border: 0; border-radius: 14px; padding: 0 1.1rem; cursor: pointer; font-weight: 600;
    background: #fff; color: #1b2a41;
}
.search button.ghost { background: var(--glass); color: var(--ink); border: 1px solid var(--line); font-size: 1.2rem; padding: 0 .9rem; }
.search button:hover { filter: brightness(.94); }

.status { min-height: 1.5rem; margin: .8rem .2rem; color: var(--muted); }
.status.error { color: #ffd2d2; }

.card {
    margin-top: .4rem;
    padding: 1.5rem;
    border-radius: 24px;
    background: var(--glass);
    border: 1px solid var(--line);
    backdrop-filter: blur(16px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
    animation: rise .5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.place h2 { margin: 0; font-size: 1.5rem; }
.place p { margin: .15rem 0 0; color: var(--muted); }

.now { display: flex; align-items: center; gap: .5rem; margin: .5rem 0 1rem; }
.temp { margin: 0; font-size: clamp(3.5rem, 18vw, 5rem); font-weight: 300; line-height: 1; letter-spacing: -.04em; }
.temp sup { font-size: .4em; font-weight: 400; vertical-align: top; margin-left: .1em; }
.desc { margin: .3rem 0 0; font-size: 1.1rem; text-transform: capitalize; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin: 0; }
.grid div { padding: .7rem .9rem; border-radius: 14px; background: rgba(255, 255, 255, .1); }
.grid dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.grid dd { margin: .15rem 0 0; font-size: 1.1rem; font-weight: 600; }


a { color: #fff; }
.icon { font-size: 5.2rem; line-height: 1; width: 120px; text-align: center; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); }
h3 { margin: 1.4rem 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tips { padding: .9rem 1rem; border-radius: 16px; background: rgba(255, 255, 255, .16); margin-bottom: 1rem; }
.tips h3 { margin: 0 0 .4rem; }
.tips ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; font-weight: 500; }
.others { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: -.2rem 0 .8rem; font-size: .88rem; color: var(--muted); }
.others button { border: 1px solid var(--line); background: var(--glass); color: var(--ink); border-radius: 999px; padding: .3rem .75rem; cursor: pointer; }
.hourly { list-style: none; margin: 0; padding: 0 0 .4rem; display: flex; gap: .5rem; overflow-x: auto; scroll-snap-type: x proximity; }
.hourly li { flex: 0 0 auto; min-width: 64px; padding: .6rem .5rem; border-radius: 14px; background: rgba(255, 255, 255, .1); text-align: center; display: grid; gap: .15rem; scroll-snap-align: start; }
.h-t { font-size: .8rem; color: var(--muted); } .h-i { font-size: 1.5rem; } .h-r { font-size: .75rem; color: var(--muted); }
.daily { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.daily li { display: grid; grid-template-columns: 3.4rem 2rem 3rem 1fr 1fr; align-items: center; gap: .4rem; padding: .5rem .8rem; border-radius: 12px; background: rgba(255, 255, 255, .1); }
.daily b, .d-lo { text-align: right; } .d-lo, .d-r { color: var(--muted); } .d-i { font-size: 1.3rem; text-align: center; }
[hidden] { display: none !important; }
footer { margin-top: 1.5rem; text-align: center; font-size: .82rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .card { animation: none; } body { transition: none; } }

/* back to the list of all apps */
.back { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; margin: 0 0 .5rem; padding: 0 1rem 0 .8rem; border: 1px solid var(--line, rgba(127,127,127,.4)); border-radius: 999px; color: var(--muted, var(--mut, inherit)); font-size: .92rem; font-weight: 600; text-decoration: none; background: transparent; }
.back:hover { color: var(--ink, inherit); border-color: currentColor; }
.back:focus-visible { outline: 3px solid var(--accent, var(--acc, #fff)); outline-offset: 2px; }
@media print { .back { display: none; } }

/* laptops and desktops: two columns instead of one phone-sized column */
@media (min-width: 900px) {
    .app { width: min(1040px, 100%); }
    #weather-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 2rem; align-items: start; }
    #weather-info[hidden] { display: none; }
    #weather-info .col-later > h3:first-child { margin-top: 0; }
    .search { max-width: 620px; }
}

/* loading dots (the five app colours) */
.dots{display:inline-flex;align-items:center;gap:.3em;vertical-align:middle;margin-right:.1em}
.dots i{display:block;width:8px;height:8px;border-radius:50%;background:#f97316;box-shadow:0 0 0 1.5px rgba(255,255,255,.6)}
.dots i:nth-child(2){background:#d946ef}.dots i:nth-child(3){background:#6366f1}.dots i:nth-child(4){background:#0ea5e9}.dots i:nth-child(5){background:#10b981}
.dots.load i{animation:hop 1.1s ease-in-out infinite}
.dots.load i:nth-child(2){animation-delay:.12s}.dots.load i:nth-child(3){animation-delay:.24s}.dots.load i:nth-child(4){animation-delay:.36s}.dots.load i:nth-child(5){animation-delay:.48s}
@keyframes hop{0%,55%,100%{transform:translateY(0)}25%{transform:translateY(-.55em)}}
@media (prefers-reduced-motion:reduce){.dots.load i{animation:none}}
