:root {
  --page: #EEF2F4; --ink: #14222A; --mist: #6C7C86; --rime: #D2DBE0; --ice: #2B7BA6;
  --s1: #EBC03A; --s2: #E27A2E; --s3: #C8352E; --on-warm: #14222A;
  --num: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --text: "Barlow", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto; max-width: 560px; background: transparent; color: var(--ink);
  font: 400 17px/1.45 var(--text);
  padding: calc(env(safe-area-inset-top) + 18px) 20px calc(env(safe-area-inset-bottom) + 32px);
}
a { color: inherit; text-underline-offset: 2px; }
.mist { color: var(--mist); }
h1 { font: 600 22px/1.2 var(--text); margin: 0; letter-spacing: -0.01em; }
h2 { font: 500 17px/1.3 var(--text); margin: 0; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; border-radius: 4px; }

/* Header */
.top { display: flex; justify-content: space-between; align-items: flex-start; }
#updated { font-size: 15px; margin-top: 2px; }
.icon { background: none; border: 1px solid var(--rime); color: var(--ink); width: 40px; height: 40px; border-radius: 50%; font-size: 19px; line-height: 1; cursor: pointer; }

/* Warnings: full-bleed bands, only when active */
#warnings { margin: 18px -20px 0; }
.warn { padding: 14px 20px; color: var(--on-warm); }
.warn + .warn { margin-top: 2px; }
.warn.Yellow { background: var(--s1); } .warn.Orange { background: var(--s2); } .warn.Red { background: var(--s3); color: #fff; }
.warn strong { font-weight: 600; }
.warn p { font-size: 15px; margin-top: 4px; }
.warn details summary { font-size: 15px; margin-top: 6px; cursor: pointer; }
#closures { margin: 2px -20px 0; }
.closure { background: var(--s3); color: #fff; padding: 14px 20px; }
.closure + .closure { margin-top: 2px; }
.closure.unknown { background: #4A5560; }
#summary { position: relative; z-index: 1; margin-top: 16px; font-size: 17px; }
#summary p { margin-top: 2px; }
#summary b { font-weight: 600; }
#summary .ice { color: var(--ice); font-weight: 500; }
.closure strong { font-weight: 600; font-size: 19px; }
.closure p { font-size: 15px; margin-top: 4px; }
.calm { margin: 18px 0 0; font-size: 15px; color: var(--mist); }

/* Hotspots: the one bold element */
#hotspots { margin-top: 26px; }
.spot { padding: 18px 0 20px; border-top: 1px solid var(--rime); }
.spot:last-child { border-bottom: 1px solid var(--rime); }
.spot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.spot-name { font: 600 22px/1.2 var(--text); }
.surface { font-size: 15px; font-weight: 500; color: var(--mist); text-align: right; }
.surface.ice { color: var(--ice); }
.figures { display: flex; align-items: baseline; gap: 22px; margin-top: 6px; flex-wrap: wrap; }
.gust { font: 600 56px/1 var(--num); letter-spacing: -0.02em; }
.gust .u { font: 500 17px var(--text); color: var(--mist); margin-left: 4px; letter-spacing: 0; }
.fig { font: 500 22px/1 var(--num); }
.fig span { display: block; font: 400 14px/1.4 var(--text); color: var(--mist); margin-top: 3px; }

.verdict { font-size: 15px; margin-top: 2px; }
.verdict b { font-weight: 600; }
.lvl1 { color: #9C7A06; } .lvl2 { color: #C25F17; } .lvl3 { color: var(--s3); }
html[data-sky="dusk"] .lvl1, html[data-sky="night"] .lvl1 { color: var(--s1); }
html[data-sky="dusk"] .lvl2, html[data-sky="night"] .lvl2 { color: var(--s2); }
html[data-sky="dusk"] .lvl3, html[data-sky="night"] .lvl3 { color: #FF6B5E; }
/* Gusts at or above 20 m/s turn red */
.hot, .hot .u { color: var(--s3) !important; }
html[data-sky="dusk"] .hot, html[data-sky="night"] .hot, html[data-sky="dusk"] .hot .u, html[data-sky="night"] .hot .u { color: #FF6B5E !important; }
/* ---------- Scene: sky, sun, stars, clouds, Skarðsheiði ---------- */
html { background: var(--sky); min-height: 100%; transition: background 1s ease; }
html[data-sky="day"]   { --sky: linear-gradient(180deg, #7FB3DB 0%, #B7D6EA 55%, #E3EEF4 100%); --mist: #3E5562; --rime: #FFFFFF66; --ice: #1C5F85; }
html[data-sky="day"][data-wx="cloudy"], html[data-sky="day"][data-wx="precip"]
                       { --sky: linear-gradient(180deg, #A9B8C3 0%, #C9D3DA 60%, #E1E6E9 100%); --mist: #46565F; }
html[data-sky="dusk"]  { --page: #1B2D44; --ink: #EEF3F6; --mist: #C3D0DA; --rime: #FFFFFF2E; --ice: #8ED0F2;
                         --sky: linear-gradient(180deg, #1F3556 0%, #3D5378 50%, #C98F7A 88%, #E8B48C 100%); }
html[data-sky="dusk"][data-wx="cloudy"], html[data-sky="dusk"][data-wx="precip"]
                       { --sky: linear-gradient(180deg, #2A3846 0%, #43505E 60%, #6B6F74 100%); }
html[data-sky="night"] { --page: #0F1A21; --ink: #E6EDF0; --mist: #9AAAB4; --rime: #FFFFFF22; --ice: #6FC0E8;
                         --sky: linear-gradient(180deg, #050B14 0%, #0B1726 60%, #13243A 100%); }
html[data-sky="night"][data-wx="cloudy"], html[data-sky="night"][data-wx="precip"]
                       { --sky: linear-gradient(180deg, #11161B 0%, #1A2229 60%, #252E36 100%); }

#scene { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#scene .mtn { position: absolute; left: 0; bottom: 0; width: 100%; height: 28vh; object-fit: cover; object-position: 42% 100%; transition: filter 1s ease; }
html[data-wx="cloudy"] #scene .mtn, html[data-wx="precip"] #scene .mtn { filter: saturate(.6) brightness(.93) contrast(.9); }
html[data-sky="dusk"] #scene .mtn { filter: brightness(.5) saturate(.75) sepia(.15); opacity: .8; }
html[data-sky="night"] #scene .mtn { filter: none; opacity: .85; }
html[data-sky="dusk"] main, html[data-sky="night"] main, html[data-sky="dusk"] #summary, html[data-sky="night"] #summary { text-shadow: 0 1px 3px #0009; }
html[data-sky="day"] main, html[data-sky="day"] #summary { text-shadow: 0 0 2px #FFFFFFE6, 0 0 8px #FFFFFFCC; }
html[data-sky="day"] #scene .mtn { opacity: .65; }

#stars { position: absolute; inset: 0; width: 100%; height: 40vh; opacity: 0; transition: opacity 1.5s ease; }
html[data-sky="night"]:not([data-wx="cloudy"]):not([data-wx="precip"]) #stars { opacity: 1; }

.sun { position: absolute; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; opacity: 0; transition: opacity 1s ease;
  background: radial-gradient(circle, #FFF7DD 0 22%, #FFE6A6 30%, #FFD98A55 48%, transparent 70%); }
html[data-sun="1"][data-wx="clear"] .sun { opacity: .7; }
html[data-sun="1"][data-wx="cloudy"] .sun { opacity: .35; }

.clouds { position: absolute; inset: 0 0 0 0; opacity: 0; transition: opacity 1.2s ease; }
html[data-wx="cloudy"] .clouds { opacity: .85; }
html[data-wx="precip"] .clouds { opacity: 1; filter: brightness(.82); }
.clouds { background: url("clouds.webp") repeat-x; background-size: auto 22vh; background-position: 0 calc(100% - 20vh);
  animation: drift 240s linear infinite; animation-play-state: paused; }
html[data-wx="cloudy"] .clouds, html[data-wx="precip"] .clouds { animation-play-state: running; }
html[data-sky="dusk"] .clouds { filter: brightness(.55) saturate(.7); }
html[data-sky="night"] .clouds { filter: grayscale(1) brightness(.38); }
html[data-sky="night"][data-wx="precip"] .clouds, html[data-sky="dusk"][data-wx="precip"] .clouds { filter: grayscale(1) brightness(.32); }
@keyframes drift { from { background-position-x: 0; } to { background-position-x: -2400px; } }

.aurora { position: absolute; left: -10%; right: -10%; top: 8vh; height: 34vh; opacity: 0; transition: opacity 2s ease;
  background: radial-gradient(60% 40% at 40% 60%, #47F59A55, transparent 70%), radial-gradient(40% 30% at 70% 45%, #5CF0C044, transparent 70%);
  filter: blur(10px); animation: sway 18s ease-in-out infinite alternate; animation-play-state: paused; }
html[data-aurora="1"][data-sky="night"]:not([data-wx="cloudy"]):not([data-wx="precip"]) .aurora { opacity: 1; animation-play-state: running; }
@keyframes sway { from { transform: translateX(-3vw) skewX(-6deg); } to { transform: translateX(3vw) skewX(6deg); } }
@media (prefers-reduced-motion: reduce) { .clouds, .aurora { animation: none; } }
/* Painted canvas texture over the whole sky, so the CSS sky reads as paint too */
#scene::after { content: ""; position: absolute; inset: 0; background: url("canvas.webp") repeat; background-size: 128px; opacity: .5; pointer-events: none; }

/* Aurora check */
.verdict-big { font: 600 22px/1.2 var(--text); }


#precip { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.top, #warnings, #closures, main, footer { position: relative; z-index: 1; }
main { padding-bottom: 14vh; }
.stale { color: var(--s3); }

/* Weather blocks */
.block { margin-top: 34px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.block-head .mist { font-size: 15px; text-align: right; }
.now { display: flex; align-items: baseline; gap: 22px; }
.now .gust { font-size: 44px; }
.now-note { font-size: 15px; color: var(--mist); margin-top: 6px; }
.arrow { display: inline-block; width: 1em; text-align: center; font-style: normal; font-family: var(--text); font-weight: 500; }
.fig .arrow { font-size: 18px; color: var(--mist); }

.strip { display: flex; overflow-x: auto; gap: 0; margin: 14px -20px 0; padding: 0 20px 4px; scroll-snap-type: x proximity; scroll-padding-left: 20px; -webkit-overflow-scrolling: touch; }
.hour { flex: 0 0 58px; scroll-snap-align: start; padding: 8px 0; border-left: 1px solid var(--rime); padding-left: 8px; }
.hour:first-child { border-left: 0; padding-left: 0; }
.hour .t { font: 500 15px var(--num); color: var(--mist); }
.hour .w { font: 600 20px/1.2 var(--num); margin-top: 4px; }
.hour .c { font: 500 15px var(--num); }
.hour .x { font-size: 13px; line-height: 1.2; color: var(--mist); margin-top: 3px; min-height: 2.4em; }

/* Nearby roads */
.road { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-top: 1px solid var(--rime); }
.road:last-child { border-bottom: 1px solid var(--rime); }
.road .name { font-weight: 500; }
.road .val { font: 600 20px var(--num); text-align: right; }
.road .sub { font-size: 15px; color: var(--mist); grid-column: 1 / -1; }
.road .sub .ice { color: var(--ice); font-weight: 500; }

/* Search */
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; font: 400 17px var(--text); padding: 12px 0; border: 0; border-bottom: 1px solid var(--rime); background: transparent; color: var(--ink); border-radius: 0; }
.search input:focus { outline: none; border-bottom-color: var(--ink); }
.search button { font: 500 17px var(--text); background: var(--ink); color: var(--page); border: 0; border-radius: 22px; padding: 0 18px; cursor: pointer; }
.results { list-style: none; margin: 4px 0 0; padding: 0; }
.results li { padding: 11px 0; border-bottom: 1px solid var(--rime); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.results li span { color: var(--mist); font-size: 15px; text-align: right; }
#picked .block-head { margin-top: 22px; }
.remove { background: none; border: 0; color: var(--mist); font: 400 15px var(--text); text-decoration: underline; padding: 0; cursor: pointer; }

.info { margin-top: 40px; font-size: 15px; color: var(--mist); }
.info summary { cursor: pointer; color: var(--ink); }
.info p { margin-top: 10px; }
.info table { border-collapse: collapse; width: 100%; margin-top: 10px; font-family: var(--num); }
.info th, .info td { border-bottom: 1px solid var(--rime); padding: 5px 4px; text-align: center; font-weight: 400; }
.info td:first-child, .info th:first-child { text-align: left; font-family: var(--text); }
footer { margin-top: 32px; font-size: 13px; line-height: 1.6; }
.err { color: var(--s3); }
.primary { margin-top: 10px; font: 500 17px var(--text); background: var(--ink); color: var(--page); border: 0; border-radius: 22px; padding: 10px 18px; cursor: pointer; }
