/*
Theme Name:  Sota Status
Description: Одностраничный сайт статусов сервисов и серверов Sota VPN: данные из REST API с кэшем, 7 языков, поиск по серверам, автообновление. Настройки: Внешний вид → Sota Status.
Version:     1.1.0
Requires at least: 5.8
Requires PHP: 7.4
Text Domain: sota-status
*/

:root {
	--bg: #1c1c1c;
	--card: #242424;
	--card-hover: #2a2a2a;
	--field: #2b2b2b;
	--line: rgba(255, 255, 255, .08);
	--text: #fff;
	--muted: rgba(255, 255, 255, .62);
	--faint: rgba(255, 255, 255, .12);
	--brand: #efe02b;
	--ok: #84e35b;
	--warn: #f5b83d;
	--bad: #ff5c5c;
	--r: 24px;
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 800px; margin: 0 auto; padding-left: 15px; padding-right: 15px; }

/* ---------- Шапка ---------- */
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; padding-bottom: 20px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; flex: none; }
.logo { display: block; height: 40px; width: auto; max-width: 160px; object-fit: contain; }
.logo-sm { height: 28px; }
.logo-text { font-family: Manrope, "Noto Sans", sans-serif; font-weight: 800; font-size: 34px; line-height: 40px; letter-spacing: -.03em; }
.logo-sm.logo-text { font-size: 24px; line-height: 28px; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.btn {
	display: inline-flex; align-items: center; justify-content: center;
	padding: 12px 24px; border-radius: 14px; border: 0;
	font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
	transition: filter .15s ease, transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-brand { background: var(--brand); color: #1c1c1c; }
.btn-brand:hover { filter: brightness(1.07); }
.btn-white { background: #fff; color: #1c1c1c; }
.btn-white:hover { background: #ececec; }

/* Языки */
.lang { position: relative; }
.lang-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 14px; background: transparent; cursor: pointer; transition: background .15s ease; }
.lang-btn:hover, .lang-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .1); }
.lang-btn svg { width: 26px; height: 26px; stroke-width: 1.7; }
.lang-pop {
	position: absolute; top: 100%; right: 0; z-index: 50; width: 140px; margin-top: 12px; padding: 8px;
	display: flex; flex-direction: column; gap: 4px;
	background: #2a2a2a; border: 1px solid var(--line); border-radius: 20px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.lang-item {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	width: 100%; padding: 11px 16px; border: 0; border-radius: 14px;
	background: transparent; font-weight: 600; text-align: left; cursor: pointer;
}
.lang-item:hover { background: rgba(255, 255, 255, .06); }
.lang-item[aria-checked="true"] { background: rgba(255, 255, 255, .1); color: var(--brand); }
.lang-check { width: 18px; height: 18px; stroke-width: 2.2; visibility: hidden; }
.lang-item[aria-checked="true"] .lang-check { visibility: visible; }

/* ---------- Главный блок ---------- */
.main { padding-top: 32px; padding-bottom: 32px; }
.hero { text-align: center; margin-bottom: 32px; }
.hero h1, .section-title { margin: 0; font-family: Manrope, "Noto Sans", sans-serif; font-weight: 800; letter-spacing: -.02em; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); line-height: 1.15; margin-bottom: 16px; }
.hero-description { margin: 0 auto 14px; max-width: 600px; color: rgba(255, 255, 255, .9); }
.support-link { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .35); text-underline-offset: 3px; }
.support-link:hover { color: var(--brand); text-decoration-color: currentColor; }
.updated { margin: 0; min-height: 1.4em; font-size: 14px; color: var(--muted); }
.updated .stale { color: var(--warn); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.services { margin-bottom: 48px; }
.service { display: flex; align-items: center; gap: 16px; padding: 22px 24px; }
.service + .service { border-top: 1px solid var(--line); }
.service-ico { width: 24px; height: 24px; flex: none; color: rgba(255, 255, 255, .85); }
.service-name { flex: 1; font-weight: 700; }
.service-link { text-decoration: none; color: inherit; cursor: pointer; }
.service-link:hover { background: var(--card-hover); }
.service-link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.service-arrow { width: 18px; height: 18px; flex: none; margin-left: -4px; color: var(--muted); stroke-width: 2; }
.support-text { color: rgba(255, 255, 255, .9); }

.state { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); }
.is-partial .dot, .dot.is-partial { background: var(--warn); }
.is-down .dot, .dot.is-down { background: var(--bad); }
.is-unknown .dot, .dot.is-unknown { background: rgba(255, 255, 255, .35); }
.state.is-partial { color: var(--warn); }
.state.is-down { color: var(--bad); }

.section-title { font-size: clamp(24px, 4.5vw, 32px); text-align: center; margin-bottom: 24px; }

.search {
	display: flex; align-items: center; gap: 12px; height: 58px; margin-bottom: 20px; padding: 0 20px;
	background: var(--field); border: 1px solid var(--line); border-radius: 18px; transition: border-color .15s ease;
}
.search:focus-within { border-color: rgba(239, 224, 43, .55); }
.search svg { width: 22px; height: 22px; flex: none; color: var(--muted); stroke-width: 2; }
.search input {
	flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0;
	background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 17px;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }

.countries { display: flex; flex-direction: column; gap: 12px; }
.country { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.country-head {
	display: flex; align-items: center; gap: 16px; width: 100%; padding: 18px 20px;
	background: transparent; border: 0; text-align: left; cursor: pointer; transition: background .15s ease;
}
.country-head:hover { background: var(--card-hover); }
.country-head:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: var(--r); }

.flag { position: relative; width: 48px; height: 48px; flex: none; }
.flag img, .flag-fallback { display: block; width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--faint); }
.flag-fallback { display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.flag .dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border: 2px solid var(--card); }

.country-info { flex: 1; min-width: 0; }
.country-name { display: block; font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.country-count { display: block; font-size: 15px; color: var(--muted); }

.load { display: flex; align-items: center; gap: 12px; flex: none; }
.bar { width: 76px; height: 5px; border-radius: 5px; background: var(--faint); overflow: hidden; }
.bar i { display: block; height: 100%; min-width: 5px; border-radius: inherit; background: var(--ok); transition: width .4s ease; }
.pct { width: 44px; text-align: right; font-weight: 600; color: var(--ok); font-variant-numeric: tabular-nums; }
.is-mid .bar i { background: var(--warn); }
.is-mid .pct { color: var(--warn); }
.is-high .bar i { background: var(--bad); }
.is-high .pct { color: var(--bad); }

.chevron { width: 20px; height: 20px; flex: none; color: var(--muted); transition: transform .2s ease; }
.country.is-open .chevron { transform: rotate(180deg); }

.servers { display: none; padding: 6px 20px 10px; border-top: 1px solid var(--line); }
.country.is-open .servers { display: block; }
.server { display: flex; align-items: center; gap: 14px; padding: 12px 0 12px 64px; }
.server + .server { border-top: 1px solid var(--line); }
.server-name { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; color: rgba(255, 255, 255, .88); }
.server .load, .server .state { margin-right: 36px; }

.empty { margin: 0; padding: 32px 0; text-align: center; color: var(--muted); }
.skeleton { height: 86px; border-radius: var(--r); background: linear-gradient(90deg, #242424 0%, #2c2c2c 50%, #242424 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Подвал ---------- */
.site-footer { margin-top: 48px; padding: 32px 16px 32px; border-top: 1px solid var(--line); }
.footer-inner { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; }
.footer-top { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.footer-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.footer-cta .btn { padding: 10px 16px; font-size: 14px; }
.footer-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 16px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 13px; text-decoration: none; transition: color .15s ease; }
.footer-col a:hover { color: #c7c7c7; }
.footer-bottom { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.copyright { font-size: 13px; }
.socials { display: flex; gap: 12px; }
.socials a { display: block; transition: opacity .15s ease; }
.socials a:hover { opacity: .8; }
.social { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #1c1c1c; }
.social svg { width: 55%; height: 55%; }

@media (min-width: 768px) {
	.wrap { padding-left: 16px; padding-right: 16px; }
	.main { padding-top: 64px; padding-bottom: 64px; }
	.services { margin-bottom: 56px; }
	.site-footer { margin-top: 96px; padding: 40px 40px 56px; }
	.footer-top { flex-direction: row; justify-content: space-between; }
	.footer-cta .btn { padding: 12px 20px; font-size: 16px; }
	.footer-nav { display: flex; justify-content: space-between; align-items: flex-start; }
	.footer-col { gap: 12px; }
	.footer-col a { font-size: 14px; }
	.footer-bottom { flex-direction: row; justify-content: space-between; }
	.copyright { font-size: 14px; }
	.socials { gap: 16px; }
	.social { width: 36px; height: 36px; }
}
@media (min-width: 1024px) {
	.site-footer { padding-left: 80px; padding-right: 80px; }
}

@media (max-width: 560px) {
	.logo { height: 34px; }
	.logo-text { font-size: 30px; line-height: 34px; }
	.btn { padding: 11px 18px; }
	.service { padding: 18px 20px; }
	.country-head { padding: 16px; gap: 12px; }
	.flag, .flag img, .flag-fallback { width: 42px; height: 42px; }
	.bar { width: 44px; }
	.load { gap: 10px; }
	.pct { width: 40px; }
	.country-name { font-size: 17px; }
	.servers { padding: 4px 16px 8px; }
	.server { padding-left: 0; }
	.server .load, .server .state { margin-right: 32px; }
}

@media (max-width: 420px) {
	.country-head { gap: 10px; padding: 14px; }
	.flag, .flag img, .flag-fallback { width: 40px; height: 40px; }
	.flag .dot { width: 12px; height: 12px; }
	.bar { width: 32px; }
	.load { gap: 8px; }
	.pct { width: 36px; font-size: 15px; }
	.country-name { font-size: 16px; }
	.country-count { font-size: 14px; }
	.chevron { width: 18px; height: 18px; }
	.state { gap: 8px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}
