/* ==========================================================
   نِبْرَا | الطقس — شريط الطقس وصفحة الطقس
   النهار والليل: الصنفان is-day / is-night (يبدّلهما weather.js تلقائيًا).
   ========================================================== */

/* أيقونات: الشمس/القمر داخل الرموز تظهر حسب --wx-d / --wx-n */
.wx-ic { display: inline-flex; flex: none; width: 22px; height: 22px; line-height: 0; }
.wx-ic svg { width: 100%; height: 100%; display: block; overflow: visible; }
.is-day { --wx-d: inline; --wx-n: none; }
.is-night { --wx-d: none; --wx-n: inline; }

/* ---------- شريط الطقس (فوق العاجل) ---------- */
.wx-bar {
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
	--wx-c1: #f2f6fb; --wx-c2: #bccbdc; --wx-rain: #a9dcff; --wx-snow: #ffffff;
	position: relative; overflow: hidden; color: #fff;
	background: linear-gradient(90deg, #1b67ad 0%, #2f86cf 55%, #4aa1e2 100%);
	transition: background-color .8s ease;
}
[dir="rtl"] .wx-bar { background: linear-gradient(270deg, #1b67ad 0%, #2f86cf 55%, #4aa1e2 100%); }
.wx-bar::before, .wx-bar::after { content: ""; position: absolute; inset: 0; pointer-events: none; transition: opacity .8s ease; }
/* توهج الشمس نهارًا */
.wx-bar::before { background: radial-gradient(120px 60px at 8% 0%, rgba(255, 214, 102, .35), transparent 70%); opacity: 1; }
[dir="rtl"] .wx-bar::before { background: radial-gradient(120px 60px at 92% 0%, rgba(255, 214, 102, .35), transparent 70%); }
/* نجوم ليلًا */
.wx-bar::after {
	opacity: 0;
	background-image:
		radial-gradient(1.2px 1.2px at 6% 30%, #fff 60%, transparent 61%),
		radial-gradient(1px 1px at 17% 70%, #fff 60%, transparent 61%),
		radial-gradient(1.4px 1.4px at 29% 22%, #fff 60%, transparent 61%),
		radial-gradient(1px 1px at 41% 64%, #fff 60%, transparent 61%),
		radial-gradient(1.2px 1.2px at 53% 28%, #fff 60%, transparent 61%),
		radial-gradient(1px 1px at 66% 74%, #fff 60%, transparent 61%),
		radial-gradient(1.3px 1.3px at 78% 26%, #fff 60%, transparent 61%),
		radial-gradient(1px 1px at 90% 62%, #fff 60%, transparent 61%);
}
.wx-bar.is-night { --wx-c1: #d9e1ec; --wx-c2: #8d9db5; }
.wx-bar.is-night { background: linear-gradient(90deg, #3a3b86 0%, #26296b 45%, #161c4c 100%); }
[dir="rtl"] .wx-bar.is-night { background: linear-gradient(270deg, #3a3b86 0%, #26296b 45%, #161c4c 100%); }
.wx-bar.is-night::before { opacity: 1; background: radial-gradient(120px 60px at 8% 0%, rgba(246, 217, 122, .22), transparent 70%); }
[dir="rtl"] .wx-bar.is-night::before { background: radial-gradient(120px 60px at 92% 0%, rgba(246, 217, 122, .22), transparent 70%); }
.wx-bar.is-night::after { opacity: .55; }

.wx-bar-inner { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; min-height: 40px; padding-block: 6px; }
.wx-badge {
	flex: none; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding-inline: 8px 10px;
	border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .14);
	color: #fff; font-size: 12.5px; font-weight: 700; line-height: 1; text-decoration: none; white-space: nowrap;
}
a.wx-badge:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.wx-bar.is-night .wx-badge { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); }
.wx-badge .wx-ic { width: 19px; height: 19px; }
.wx-date { flex: none; display: none; font-size: 13px; font-weight: 500; opacity: .92; white-space: nowrap; }
.wx-bar .wx-track { height: 26px; }
.wx-bar .ticker-item.wx-item {
	display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: #fff;
	padding-inline-end: 40px; text-decoration: none;
}
.wx-bar .ticker-item.wx-item::after { width: 5px; height: 5px; margin-top: -2.5px; inset-inline-end: 18px; background: rgba(255, 255, 255, .5); }
.wx-bar a.ticker-item.wx-item:hover .wx-city { text-decoration: underline; text-underline-offset: 4px; }
.wx-item .wx-ic { width: 22px; height: 22px; }
.wx-item .wx-t { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.wx-hl { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.wx-hi::before, .wx-lo::before { display: inline-block; font-size: .62em; margin-inline-end: 2px; vertical-align: .18em; }
.wx-hi::before { content: "▲"; color: #ffb4a3; }
.wx-lo::before { content: "▼"; color: #b9e2ff; }
.wx-bar .wx-hl { opacity: .95; }
.wx-more {
	flex: none; display: none; font-size: 12.5px; font-weight: 600; color: #fff; text-decoration: none; white-space: nowrap;
	border-bottom: 1px solid rgba(255, 255, 255, .45); line-height: 1.5;
}
.wx-more:hover { color: #fff; border-bottom-color: #fff; }
@media (min-width: 720px) { .wx-more { display: inline-block; } }
@media (min-width: 960px) { .wx-date { display: inline; } }
@media (max-width: 480px) {
	.wx-bar-inner { gap: 10px; }
	.wx-badge { padding-inline: 6px 8px; font-size: 12px; }
}
html[data-theme="dark"] .wx-bar.is-day { filter: saturate(.85) brightness(.88); }
@media (prefers-reduced-motion: reduce) { .wx-bar, .wx-bar::before, .wx-bar::after { transition: none; } }
@media print { .wx-bar { display: none !important; } }

/* ---------- صفحة الطقس ---------- */
.article.article--page.article--wx { max-width: none; }
.article--wx .entry-content { font-size: 15px; line-height: 1.6; }
.wx-page { margin-top: 6px; }
.wx-page h2, .wx-page h3 { margin: 0; line-height: 1.35; }
.wx-lead { margin: 0 0 18px; color: var(--muted, #5c5c5c); font-size: 16px; line-height: 1.8; max-width: 860px; }
.wx-empty { padding: 18px; border: 1px dashed var(--line, #e8e8e6); color: var(--muted, #5c5c5c); }

/* السماء: لون النهار والليل */
.wx-sky {
	--wx-c1: #f2f6fb; --wx-c2: #bccbdc; --wx-rain: #a9dcff; --wx-snow: #ffffff;
	position: relative; color: #fff;
	background: linear-gradient(160deg, #1d6db5 0%, #3a92d8 60%, #5aade8 100%);
}
.is-night > .wx-sky { --wx-c1: #d9e1ec; --wx-c2: #8d9db5; background: linear-gradient(160deg, #141a4a 0%, #262a6c 60%, #3a3b86 100%); }
.wx-sky .wx-hi::before { color: #ffc6b8; }
.wx-sky .wx-lo::before { color: #c4e7ff; }

/* المدينة الرئيسية */
.wx-feature { border: 1px solid var(--line, #e8e8e6); margin: 0 0 26px; background: var(--surface, #fff); }
.wx-feature > .wx-sky { padding: 20px 22px 22px; }
.wx-f-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.wx-f-name { font-size: 26px; font-weight: 800; color: #fff; }
.wx-f-date { font-size: 14px; opacity: .9; }
.wx-f-main { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin-top: 12px; }
.wx-ic--xl { width: 96px; height: 96px; }
.wx-f-now { display: flex; flex-direction: column; gap: 4px; }
.wx-temp { font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.wx-temp--xl { font-size: 58px; }
.wx-f-now .wx-cond { font-size: 17px; font-weight: 600; }
.wx-f-now .wx-hl { font-size: 14px; }
.wx-f-facts { display: grid; grid-template-columns: repeat(2, minmax(110px, auto)); gap: 8px 22px; margin: 0; margin-inline-start: auto; }
.wx-f-facts div, .wx-facts div { display: flex; flex-direction: column; gap: 1px; }
.wx-f-facts dt { font-size: 12.5px; opacity: .8; }
.wx-f-facts dd { margin: 0; font-size: 16px; font-weight: 700; }

.wx-hours { list-style: none; margin: 0; padding: 0; display: flex; overflow-x: auto; scrollbar-width: thin; border-top: 1px solid var(--line, #e8e8e6); }
.wx-hours li { flex: 1 0 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-inline-end: 1px solid var(--line, #e8e8e6); text-align: center; }
.wx-hours li:last-child { border-inline-end: 0; }
.wx-hr { font-size: 12.5px; color: var(--muted, #5c5c5c); white-space: nowrap; }
.wx-ht { font-size: 15px; font-weight: 800; color: var(--ink, #161616); }
.wx-hp { font-size: 11.5px; color: #2a86d6; }
.wx-hours .wx-ic { width: 30px; height: 30px; }
.wx-hours li.is-night { background: rgba(16, 32, 73, .05); }
html[data-theme="dark"] .wx-hours li.is-night { background: rgba(0, 0, 0, .18); }

.wx-week { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line, #e8e8e6); display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.wx-week li { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; align-items: center; gap: 2px 10px; padding: 12px 14px; border-inline-end: 1px solid var(--line, #e8e8e6); border-bottom: 1px solid var(--line, #e8e8e6); }
.wx-week .wx-dn { grid-column: 1 / -1; font-weight: 700; font-size: 14px; color: var(--ink, #161616); }
.wx-week .wx-ic { width: 34px; height: 34px; grid-row: span 2; }
.wx-wl { font-size: 13px; color: var(--muted, #5c5c5c); }
.wx-week .wx-hl, .wx-days .wx-hl { color: var(--ink, #161616); }

/* الأدوات */
.wx-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 18px; }
.wx-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.wx-tab {
	appearance: none; border: 1px solid var(--line, #e8e8e6); background: var(--surface-2, #f7f8fa); color: var(--ink, #161616);
	padding: 7px 16px; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.3; cursor: pointer; border-radius: 0;
}
.wx-tab:hover { border-color: var(--navy, #111d38); }
.wx-tab[aria-pressed="true"] { background: var(--navy, #111d38); border-color: var(--navy, #111d38); color: #fff; }
.wx-search input {
	width: 240px; max-width: 100%; height: 38px; padding: 0 12px; font: inherit; font-size: 14px;
	border: 1px solid var(--input-line, #d9dde4); background: var(--input-bg, #fff); color: var(--ink, #161616); border-radius: 0;
}
@media (max-width: 600px) { .wx-search, .wx-search input { width: 100%; } }

/* البطاقات */
.wx-group { margin: 0 0 28px; }
.wx-h { font-size: 21px; font-weight: 800; color: var(--ink, #161616); padding-bottom: 8px; margin-bottom: 14px !important; border-bottom: 2px solid var(--red, #b52632); }
.wx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.wx-card { display: flex; flex-direction: column; border: 1px solid var(--line, #e8e8e6); background: var(--surface, #fff); scroll-margin-top: 90px; }
.wx-card:target { outline: 2px solid var(--red, #b52632); outline-offset: 2px; }
.wx-card > .wx-sky { padding: 12px 14px 12px; }
.wx-sky-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.wx-name { font-size: 17px; font-weight: 800; color: #fff; }
.wx-country { font-size: 12px; opacity: .85; white-space: nowrap; }
.wx-sky-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.wx-ic--lg { width: 58px; height: 58px; }
.wx-card .wx-temp { font-size: 40px; }
.wx-card .wx-cond { font-size: 14px; font-weight: 600; margin-top: 4px; }
.wx-card .wx-sky .wx-hl { margin-top: 2px; }
.wx-clock { margin-top: 6px; font-size: 12px; opacity: .85; }
.wx-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line, #e8e8e6); }
.wx-facts dt { font-size: 11.5px; color: var(--muted, #5c5c5c); }
.wx-facts dd { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink, #161616); }
.wx-days { list-style: none; margin: 0; padding: 6px 8px 8px; display: grid; grid-template-columns: repeat(4, 1fr); }
.wx-days li { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; text-align: center; }
.wx-days .wx-dn { font-size: 12px; font-weight: 600; color: var(--muted, #5c5c5c); }
.wx-days .wx-ic { width: 28px; height: 28px; }
.wx-days .wx-hl { flex-direction: column; gap: 0; font-size: 12px; }
.wx-none { padding: 14px; color: var(--muted, #5c5c5c); }
.wx-credit { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--line, #e8e8e6); font-size: 13px; color: var(--muted, #5c5c5c); }
.wx-credit a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* أيقونات على خلفية فاتحة (التوقعات والساعات) */
.wx-hours, .wx-week, .wx-days { --wx-c1: #a9b8cb; --wx-c2: #d3dce8; --wx-rain: #2a86d6; --wx-snow: #86bce9; }
.wx-week, .wx-days { --wx-d: inline; --wx-n: none; }
html[data-theme="dark"] .wx-hours, html[data-theme="dark"] .wx-week, html[data-theme="dark"] .wx-days { --wx-c1: #dbe3ee; --wx-c2: #8495ad; --wx-rain: #7cc4ff; --wx-snow: #ffffff; }
html[data-theme="dark"] .wx-hp { color: #7cc4ff; }
@media (prefers-color-scheme: dark) {
	html:not([data-theme]) .wx-hours, html:not([data-theme]) .wx-week, html:not([data-theme]) .wx-days { --wx-c1: #dbe3ee; --wx-c2: #8495ad; --wx-rain: #7cc4ff; --wx-snow: #ffffff; }
}
.wx-card[hidden], .wx-group[hidden] { display: none !important; }
