/* UAE Retro Forecast - shared styles for the English (/) and Arabic (/ar/) pages.
   The Arabic page adds /style-ar.css on top (RTL mirroring and Arabic type). */

:root {
  --ink: #070a2e;
  --title: #ffe066;
  --text: #f4f6ff;
  --label: #a9dcff;
  --hi: #ffcf4a;
  --lo: #8fdcff;
  --panel-a: rgba(46, 82, 186, .93);
  --panel-b: rgba(25, 48, 138, .93);
  --edge: rgba(170, 196, 255, .7);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; color: var(--text); }
body { font-family: 'Jersey 15', 'Segoe UI', system-ui, sans-serif; }
button { font: inherit; }

#viewport { position: fixed; inset: 0; display: grid; place-items: center; background: #000; }
#viewport.tv { cursor: none; }
#stage {
  position: relative; width: 640px; height: 480px; overflow: hidden; flex: none;
  overflow: clip; /* clip without becoming scrollable: find-in-page or focus can't shift the picture */
  transform-origin: center center;
  font-weight: 400; letter-spacing: .5px;
  text-shadow: 2px 2px 0 var(--ink), 1px 1px 0 var(--ink), 0 0 7px rgba(0, 0, 0, .3);
  background: #120f3d;
}
#stage.soft { filter: saturate(1.08) contrast(1.04); }

/* ---------- sky backdrop ---------- */
#sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 60% at 50% 115%, rgba(255, 145, 90, .55), transparent 60%),
    linear-gradient(180deg, #17134a 0%, #26237c 35%, #3534a0 62%, #5a46a8 84%, #a0607d 100%);
}
.cloud {
  position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .13); filter: blur(10px);
  animation: drift linear infinite;
}
@keyframes drift { from { transform: translateX(-260px); } to { transform: translateX(900px); } }

/* ---------- header ---------- */
#hdr { position: absolute; left: 0; top: 0; width: 640px; height: 92px; z-index: 3; }
#hdr .band {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, #22186a 0%, #3c2a8e 40%, #873e90 70%, #e0743d 100%);
}
#hdr .band::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, #ffb35c, #ffe2a0, #ffb35c);
}
#logo { position: absolute; left: 24px; top: 12px; width: 86px; height: 66px; filter: drop-shadow(2px 3px 0 rgba(7, 10, 46, .8)); }
#title { position: absolute; left: 126px; top: 15px; color: var(--title); font-size: 31px; line-height: 31px; white-space: nowrap; }
#clock { position: absolute; right: 28px; top: 17px; text-align: right; font-size: 25px; line-height: 30px; white-space: nowrap; }

/* ---------- main panel ---------- */
#panel {
  position: absolute; left: 36px; top: 104px; width: 568px; height: 286px; z-index: 2;
  border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, var(--panel-a), var(--panel-b));
  box-shadow: inset 0 0 0 2px var(--edge), inset 0 0 22px rgba(4, 8, 50, .55), 0 5px 0 rgba(0, 0, 0, .35);
  transition: opacity .16s linear;
}
#panel.out { opacity: 0; }
#panel.bare { background: none; box-shadow: 0 5px 0 rgba(0, 0, 0, .35), inset 0 0 0 2px var(--edge); }
.src {
  position: absolute; right: 12px; bottom: 6px; font-size: 14px; color: rgba(225, 233, 255, .82);
  text-shadow: 1px 1px 0 var(--ink); letter-spacing: .4px;
}

/* current conditions */
.cc { position: absolute; inset: 0; }
.cc-left { position: absolute; left: 14px; top: 8px; width: 236px; text-align: center; }
.cc-temp { font-size: 66px; line-height: 62px; }
.cc-cond { font-size: 28px; line-height: 30px; margin-top: 2px; }
.cc-icon { height: 126px; display: grid; place-items: center; margin-top: 2px; }
.cc-wind { font-size: 24px; margin-top: 0; }
.cc-right { position: absolute; left: 266px; top: 12px; width: 282px; }
.cc-city { color: var(--title); font-size: 28px; margin-bottom: 4px; }
.rows { margin: 0; }
.rows div { display: flex; justify-content: space-between; font-size: 25px; line-height: 33px; }
.rows dt { margin: 0; }
.rows dd { margin: 0; text-align: right; }
.trend { display: inline-block; width: 12px; height: 14px; margin-left: 4px; vertical-align: -1px; }

/* latest observations */
table.obs { position: absolute; left: 18px; top: 8px; width: 532px; border-collapse: collapse; font-size: 25px; }
table.obs th { color: var(--title); font-weight: 400; text-align: left; font-size: 23px; padding: 0 4px 4px; }
table.obs td { padding: 0 4px; height: 32px; white-space: nowrap; }
table.obs .num { text-align: right; padding-right: 22px; }
table.obs .dim { color: rgba(240, 244, 255, .55); }

/* maps */
svg.map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.m-temp { font-family: 'Jersey 15', sans-serif; fill: #ffe066; paint-order: stroke; stroke: #0a0e36; stroke-width: 5px; stroke-linejoin: round; }
.m-name { font-family: 'Jersey 15', sans-serif; fill: #f4f6ff; paint-order: stroke; stroke: #0a0e36; stroke-width: 4px; stroke-linejoin: round; letter-spacing: .5px; }
.m-lo { fill: #8fdcff; }
.map-tag {
  position: absolute; left: 12px; top: 10px; padding: 3px 12px 2px; border-radius: 4px;
  background: rgba(10, 16, 70, .85); box-shadow: inset 0 0 0 2px var(--edge);
  color: var(--title); font-size: 26px;
}

/* local forecast text */
.lf { position: absolute; left: 26px; top: 16px; right: 26px; font-size: 28px; line-height: 32px; text-transform: uppercase; }
.lf p { margin: 0 0 18px; }
.lf .hd { color: var(--title); }

/* extended forecast */
.ext { position: absolute; inset: 8px 10px 30px; display: flex; justify-content: space-around; }
.ext .day { width: 130px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.ext .dname { color: var(--title); font-size: 29px; }
.ext .dicon { height: 86px; display: grid; place-items: center; }
.ext .dtext { font-size: 21px; line-height: 21px; height: 44px; display: grid; place-items: center; }
.ext .temps { display: flex; gap: 18px; margin-top: 8px; font-size: 27px; line-height: 26px; }
.ext .temps small { display: block; font-size: 19px; line-height: 20px; }
.ext .lo small { color: var(--lo); }
.ext .hi small { color: var(--hi); }

/* almanac */
.alm { position: absolute; inset: 10px 18px; }
.alm table { border-collapse: collapse; margin: 0 auto; font-size: 25px; }
.alm th { color: var(--title); font-weight: 400; padding: 0 18px 2px; }
.alm td { padding: 1px 18px; text-align: center; }
.alm td:first-child { text-align: right; color: var(--label); }
.moon-row { display: flex; justify-content: space-around; margin-top: 10px; }
.moon svg { display: block; margin: 2px auto 0; }
.moon { text-align: center; width: 120px; font-size: 23px; line-height: 24px; }
.moon .mname { color: var(--title); font-size: 24px; }

/* climate */
.clim { position: absolute; inset: 0; }
.clim-facts { position: absolute; left: 22px; top: 14px; width: 214px; }
.clim-facts .hd { color: var(--title); font-size: 28px; line-height: 30px; margin-bottom: 8px; }
.clim-facts div.r { display: flex; justify-content: space-between; font-size: 24px; line-height: 33px; }
.clim-facts span:first-child { color: var(--label); }
.clim svg { position: absolute; left: 248px; top: 16px; width: 304px; height: 236px; overflow: visible; }

/* ---------- lower display line ---------- */
#ldl {
  position: absolute; left: 0; top: 402px; width: 640px; height: 78px; z-index: 3; overflow: hidden;
  background: linear-gradient(180deg, #2a3c8c 0%, #18245f 100%);
  box-shadow: inset 0 2px 0 rgba(170, 196, 255, .65);
}
#ldl-text { position: absolute; left: 40px; right: 40px; top: 23px; font-size: 27px; line-height: 32px; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
#ldl-crawl { position: absolute; left: 0; top: 23px; font-size: 27px; line-height: 32px; white-space: nowrap; text-transform: uppercase; color: var(--title); will-change: transform; }

/* ---------- intro ---------- */
#intro { position: absolute; inset: 0; z-index: 6; text-align: center; }
#intro .intro-head { position: absolute; left: 0; right: 0; top: 60px; font-size: 28px; line-height: 32px; }
#intro .intro-head b { color: var(--title); font-weight: 400; }
b, strong, th, h2 { font-weight: 400; }
.radar { position: absolute; left: 230px; top: 140px; width: 180px; height: 180px; border-radius: 50%; }
.radar .disc {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #2e4fb8 0%, #1d2f86 70%, #121c58 100%);
  box-shadow: 0 0 0 3px rgba(225, 233, 255, .85), 0 0 0 9px rgba(20, 26, 80, .7), 0 0 0 11px rgba(225, 233, 255, .55), 0 0 30px rgba(255, 190, 90, .35);
}
.radar svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.radar .beam {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255, 196, 80, 0) 0deg, rgba(255, 196, 80, 0) 285deg, rgba(255, 205, 100, .28) 335deg, rgba(255, 228, 150, .85) 359deg, rgba(255, 228, 150, 0) 360deg);
  animation: sweep 3.6s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.radar .ring { position: absolute; border-radius: 50%; border: 1px solid rgba(220, 230, 255, .28); }
.blip { fill: #ffe066; animation: blip 3.6s linear infinite; }
@keyframes blip { 0%, 6% { opacity: 1; r: 6; } 40% { opacity: .25; r: 3.5; } 100% { opacity: .25; r: 3.5; } }
#intro-status { position: absolute; left: 0; right: 0; top: 334px; font-size: 25px; line-height: 28px; }
#intro-status.err { color: #ffc2b2; font-size: 20px; line-height: 23px; padding: 0 60px; }
.btn-start {
  position: absolute; left: 50%; top: 372px; transform: translateX(-50%);
  padding: 7px 24px 6px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  color: var(--text); background: rgba(14, 20, 74, .75); border: 2px solid rgba(240, 244, 255, .9);
  font-size: 25px; letter-spacing: 1.5px; text-transform: uppercase; text-shadow: inherit;
}
.btn-start:hover, .btn-start:focus-visible { background: rgba(60, 74, 170, .85); outline: none; box-shadow: 0 0 0 3px rgba(255, 224, 102, .7); }
.btn-start[disabled] { opacity: .45; cursor: default; }
.btn-city {
  position: absolute; left: 50%; top: 424px; transform: translateX(-50%);
  background: none; border: 0; color: var(--text); cursor: pointer; font-size: 19px;
  letter-spacing: 1.5px; text-transform: uppercase; text-shadow: inherit; display: inline-flex; align-items: center; gap: 6px;
}
.btn-city:hover, .btn-city:focus-visible { color: var(--title); outline: none; }
.intro-credit { position: absolute; left: 0; right: 0; bottom: 8px; font-size: 14px; color: rgba(230, 236, 255, .8); letter-spacing: .4px; }
#intro.starting .btn-start, #intro.starting .btn-city { display: none; }
#stage.at-intro #hdr, #stage.at-intro #panel, #stage.at-intro #ldl { visibility: hidden; }

/* language switch: a small link in the top corner of the start screen, and a button in Settings */
.lang-link {
  position: absolute; left: 14px; top: 10px; padding: 1px 10px 2px; border-radius: 6px;
  font-family: 'Handjet', 'Segoe UI', Tahoma, sans-serif; font-weight: 600; font-size: 19px; line-height: 24px; letter-spacing: 0;
  color: rgba(230, 236, 255, .85); text-decoration: none; text-shadow: inherit;
  background: rgba(10, 16, 64, .35); border: 1px solid rgba(170, 196, 255, .35);
}
.lang-link:hover, .lang-link:focus-visible { color: var(--title); border-color: rgba(255, 224, 102, .7); outline: none; }
#intro.starting .lang-link { display: none; }
/* the link sits just outside the Settings dialog's corner: hide it while the dialog is open */
#stage.settings-open .lang-link { visibility: hidden; }

/* Shown only when this stylesheet did not load, e.g. index.html opened straight from disk
   (file://), where the absolute /style.css and /app.js paths cannot resolve. */
.file-hint { display: none; }

/* ---------- settings ---------- */
#settings {
  position: absolute; inset: 22px 34px; z-index: 8; border-radius: 10px; padding: 16px 22px;
  background: linear-gradient(180deg, rgba(36, 56, 150, .97), rgba(18, 28, 92, .97));
  box-shadow: inset 0 0 0 2px var(--edge), 0 10px 30px rgba(0, 0, 0, .55);
  display: none;
}
#settings.open { display: block; }
#settings h2 { margin: 0 0 6px; color: var(--title); font-size: 30px; font-weight: 400; }
/* compact rows: the city and music options wrap to two or three lines when many stations report */
.set-row { display: flex; align-items: center; gap: 10px; margin: 5px 0; font-size: 20px; }
.set-row > span { width: 108px; flex: none; color: var(--label); }
.set-row .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  padding: 2px 9px 1px; border-radius: 6px; cursor: pointer; font-size: 19px; letter-spacing: .5px;
  color: var(--text); background: rgba(10, 16, 64, .6); border: 2px solid rgba(170, 196, 255, .45); text-shadow: inherit;
}
.opt[aria-pressed="true"] { background: #ffe066; color: #1a1650; border-color: #fff4bf; text-shadow: none; }
.opt:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.opt[disabled] { opacity: .4; cursor: default; }
.set-note { font-size: 16px; color: rgba(225, 233, 255, .85); line-height: 18px; margin-top: 6px; max-width: 470px; }
.set-done { position: absolute; right: 20px; bottom: 14px; }
.set-lang {
  position: absolute; right: 22px; top: 18px; display: inline-block; text-decoration: none;
  font-family: 'Handjet', 'Segoe UI', Tahoma, sans-serif; font-weight: 600; letter-spacing: 0;
}

/* ---------- CRT finish ---------- */
#crt { position: absolute; inset: 0; z-index: 9; pointer-events: none; }
#crt::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .16) 0, rgba(0, 0, 0, .16) 1px, transparent 1px, transparent 3px);
}
#crt::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, .42) 100%);
  animation: flicker 4s steps(2) infinite;
}
@keyframes flicker { 0%, 100% { opacity: 1; } 50% { opacity: .9; } }
#noise { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 9; pointer-events: none; opacity: .07; image-rendering: pixelated; mix-blend-mode: screen; }
#stage.no-crt #crt, #stage.no-crt #noise { display: none; }

/* ---------- weather icon animation ---------- */
.wx-spin { animation: spin 22s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wx-drop { animation: fall .9s linear infinite; }
@keyframes fall { 0% { transform: translate(2px, -7px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(-3px, 9px); opacity: 0; } }
.wx-bolt { animation: bolt 2.6s steps(1) infinite; }
@keyframes bolt { 0%, 58%, 66%, 100% { opacity: 1; } 60%, 64% { opacity: .1; } }
.wx-drift { animation: sway 3.2s ease-in-out infinite alternate; }
@keyframes sway { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
.wx-twinkle { animation: twinkle 2.2s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.wx-float { animation: float 5s ease-in-out infinite alternate; }
@keyframes float { from { transform: translateX(-1.5px); } to { transform: translateX(1.5px); } }

/* ---------- HUD (outside the TV frame) ---------- */
#hud {
  position: fixed; top: 12px; right: 12px; z-index: 20; display: flex; gap: 6px; padding: 6px;
  border-radius: 12px; background: rgba(10, 12, 40, .72); border: 1px solid rgba(170, 196, 255, .35);
  opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; pointer-events: none;
}
#hud.show { opacity: 1; transform: none; pointer-events: auto; }
#hud button {
  width: 36px; height: 36px; border-radius: 8px; border: 0; cursor: pointer; display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); color: #eef1ff;
}
#hud button:hover, #hud button:focus-visible { background: rgba(255, 224, 102, .25); outline: none; }
#hud svg { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .wx-spin, .wx-drop, .wx-bolt, .wx-drift, .wx-twinkle, .wx-float, .cloud, #crt::after { animation: none !important; }
  .radar .beam { animation-duration: 12s; }
}
