/* =====================================================================
   styles.css  —  shared across all pages (performance-optimized)
   - backdrop-filter limited to the header
   - no fixed blurred background layers, no permanent pulses/will-change
   - interactions use transform/opacity only; respects reduced-motion
   - content-visibility:auto only on below-the-fold sections
   ===================================================================== */

:root {
  --bg-1: #081120;
  --bg-2: #0e1b31;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #eef4ff;
  --muted: #aab8d2;
  --accent: #66b3ff;
  --accent-2: #8ef2ff;
  --success: #67f89b;
  --warning: #ffd166;
  --danger: #ff8f8f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  /* Static gradient only — no fixed blurred elements to repaint on scroll. */
  background:
    linear-gradient(160deg, #0a1322 0%, var(--bg-2) 60%, #0a1730 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

.page {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 50px;
}

/* ---------------- HEADER / TOPBAR ---------------- */
.site-header { position: sticky; top: 0; z-index: 1000; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  margin: 12px 0 22px;
  border-radius: 16px;
  background: rgba(13, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  /* backdrop-filter intentionally kept ONLY here */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 800; letter-spacing: -0.03em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--success); flex: 0 0 auto;
}

.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Dynamic, transparent, animated nav buttons (hover/active only) */
.nav-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 15px; border-radius: 13px;
  font-weight: 700; font-size: 14px; white-space: nowrap;
  overflow: hidden; isolation: isolate;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.35s ease, color 0.35s ease, background 0.35s ease;
}
.nav-btn .nav-btn-label { position: relative; z-index: 2; }
.nav-btn::before {
  content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0; transform: scale(0.6); transform-origin: center;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}
.nav-btn:hover { transform: scale(1.05); border-color: rgba(142, 242, 255, 0.5); color: #04111f; }
.nav-btn:hover::before { opacity: 0.95; transform: scale(1); }
.nav-btn:active { transform: scale(0.97); transition-duration: 0.1s; }
.nav-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.nav-btn.is-active { color: #04111f; border-color: transparent; }
.nav-btn.is-active::before { opacity: 1; transform: scale(1); }
.nav-btn.is-active:hover { transform: scale(1.03); }

/* Mobile nav toggle (CSS-only, works without JS) */
.nav-toggle, .nav-toggle-btn { display: none; }
.nav-toggle-btn {
  width: 44px; height: 40px; border-radius: 11px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.05);
  align-items: center; justify-content: center; flex-direction: column; gap: 4px;
}
.nav-toggle-bar { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }
.nav-toggle-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------------- HERO ---------------- */
.hero { text-align: center; padding: 20px 12px 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 15px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--accent-2); font-size: 14px; font-weight: 600;
}
.badge .dot-static { width: 9px; height: 9px; border-radius: 50%; background: var(--success); }

h1 {
  margin: 14px auto 12px;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05; letter-spacing: -0.04em; max-width: 920px;
}
.hero p { margin: 0 auto; max-width: 780px; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.7; }

/* ---------------- FAST HERO SNAPSHOT (home) ---------------- */
.snapshot {
  margin: 22px auto 0;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 20px 24px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--shadow);
}
.snap-flag { font-size: 54px; line-height: 1; width: 70px; text-align: center; }
.snap-main { text-align: left; min-width: 0; }
.snap-country { font-size: clamp(22px, 3.2vw, 32px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.snap-ip { margin-top: 6px; font-size: clamp(18px, 2.4vw, 24px); font-weight: 700; color: var(--accent-2); word-break: break-all; }
.snap-sub { margin-top: 6px; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* VPN indicator (now in the top connection area) */
.vpn-indicator {
  display: inline-flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 12px 16px; border-radius: 16px; min-width: 190px;
  background: rgba(142, 242, 255, 0.10);
  border: 1px solid rgba(142, 242, 255, 0.20);
}
.vpn-indicator .vpn-top { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.vpn-indicator .vdot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.vpn-indicator .vpn-meta { font-size: 12px; color: var(--muted); line-height: 1.5; }
.vpn-indicator.safe { color: var(--success); background: rgba(103,248,155,0.10); border-color: rgba(103,248,155,0.22); }
.vpn-indicator.warning { color: var(--warning); background: rgba(255,209,102,0.12); border-color: rgba(255,209,102,0.26); }
.vpn-indicator.danger { color: var(--danger); background: rgba(255,143,143,0.12); border-color: rgba(255,143,143,0.28); }

/* ---------------- LAYOUT / CARDS ---------------- */
.layout { display: grid; grid-template-columns: 1.05fr 1.25fr; gap: 22px; margin-top: 22px; align-items: stretch; }
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 24px; }
.section-title { margin: 0 0 16px; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }

.status {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border-radius: 15px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted); font-size: 14px; margin-bottom: 16px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-2); flex: 0 0 auto; }

/* top connection bar holds VPN indicator + copy button */
.conn-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.conn-actions .spacer { flex: 1 1 auto; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-box { padding: 15px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); min-height: 88px; }
.label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.value { font-size: 18px; line-height: 1.4; font-weight: 700; word-break: break-word; }
.value.small { font-size: 15px; font-weight: 600; opacity: 0.95; }

.footnote { margin-top: 16px; padding: 15px; border-radius: 16px; background: rgba(102, 179, 255, 0.08); border: 1px solid rgba(102, 179, 255, 0.16); line-height: 1.65; font-size: 14px; }

.map-wrap { overflow: hidden; position: relative; min-height: 540px; }
#map { width: 100%; height: 100%; min-height: 540px; border-radius: var(--radius); display: grid; place-items: center; color: var(--muted); font-weight: 700; background: linear-gradient(135deg, rgba(102, 179, 255, 0.10), rgba(142, 242, 255, 0.05)); }
.map-overlay { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; justify-content: space-between; gap: 12px; padding: 13px 15px; border-radius: 16px; background: rgba(7, 15, 28, 0.82); border: 1px solid rgba(255, 255, 255, 0.1); z-index: 500; flex-wrap: wrap; }
.overlay-item { min-width: 140px; flex: 1 1 140px; }
.overlay-label { color: #a7b9d8; font-size: 12px; margin-bottom: 4px; }
.overlay-value { font-weight: 700; font-size: 15px; word-break: break-word; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  padding: 12px 18px; border-radius: 13px; font-weight: 700; font-size: 14px;
  transition: transform 0.18s ease, background 0.2s ease, opacity 0.2s ease;
  white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04111f; }
.btn-secondary { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); color: var(--text); }
.copy-ip-cta { background: linear-gradient(135deg, #00e0a4, #00c6ff); color: #04111f; }

.error { margin-top: 13px; color: #ffc7c7; font-size: 14px; line-height: 1.6; }

/* ---------------- PRIVACY / CHECKS ---------------- */
.privacy-section { margin-top: 22px; }
.privacy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.privacy-card { padding: 18px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); }
.privacy-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.privacy-title { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; line-height: 1; background: rgba(142, 242, 255, 0.12); color: var(--accent-2); border: 1px solid rgba(142, 242, 255, 0.16); white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.safe { background: rgba(103,248,155,0.12); color: var(--success); border-color: rgba(103,248,155,0.22); }
.status-pill.warning { background: rgba(255,190,92,0.14); color: #ffd18a; border-color: rgba(255,190,92,0.25); }
.status-pill.danger { background: rgba(255,111,111,0.14); color: #ffb2b2; border-color: rgba(255,111,111,0.25); }
.privacy-text { color: var(--muted); font-size: 13px; line-height: 1.65; margin: 0; }
.privacy-list { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.privacy-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.08); font-size: 13px; color: var(--muted); }
.privacy-list strong { color: var(--text); text-align: right; word-break: break-word; }
.privacy-note { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.privacy-note a, .article-card a, .footnote a { color: var(--accent-2); font-weight: 700; }

/* ---------------- IP LOOKUP TOOL ---------------- */
.lookup-tool { margin-top: 22px; }
.lookup-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.lookup-field { flex: 1 1 280px; min-width: 0; }
.lookup-field label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; font-weight: 600; }
.lookup-field input {
  width: 100%; padding: 13px 15px; border-radius: 13px; font-size: 16px;
  color: var(--text); background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14); font-family: inherit;
}
.lookup-field input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; border-color: transparent; }
.lookup-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lookup-error { margin-top: 12px; color: #ffc7c7; font-size: 14px; line-height: 1.6; }
.lookup-result { margin-top: 18px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.result-flag { font-size: 30px; line-height: 1; }

/* ---------------- ARTICLE / CONTENT ---------------- */
.content-page { width: min(980px, calc(100% - 32px)); }
.article-card { padding: 28px; margin-top: 18px; }
.article-card p { color: var(--muted); font-size: 16px; line-height: 1.85; }
.article-card h2 { font-size: 26px; letter-spacing: -0.03em; margin: 26px 0 10px; }
.article-card h3 { font-size: 19px; margin: 20px 0 8px; }
.article-card ul { color: var(--muted); line-height: 1.85; }
.mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 16px 0; }
.mini { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 16px; }
.mini strong { display: block; margin-bottom: 6px; font-size: 15px; }
.mini p { margin: 0; font-size: 14px; }

/* FAQ */
.faq { margin-top: 14px; }
.faq details { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 14px 16px; margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 800; }
.faq summary:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.faq details p { margin: 10px 0 0; color: var(--muted); line-height: 1.7; }

.footer { color: var(--muted); padding: 26px 4px 0; font-size: 14px; line-height: 1.7; text-align: center; }

/* ---------------- WEBRTC PAGE ---------------- */
.wr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; }
.result-card { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; }
.status-title { font-size: clamp(24px, 4vw, 38px); font-weight: 900; letter-spacing: -0.05em; margin-bottom: 8px; }
.status-desc { color: var(--muted); line-height: 1.65; }
.big-pill { padding: 11px 17px; border-radius: 999px; font-weight: 900; white-space: nowrap; background: rgba(255,255,255,0.08); display: inline-flex; align-items: center; gap: 8px; }
.big-pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.safe { color: var(--success); } .warning { color: var(--warning); } .danger { color: var(--danger); }
.pill-safe { color: #04111f; background: var(--success); }
.pill-warning { color: #04111f; background: var(--warning); }
.pill-danger { color: #04111f; background: var(--danger); }
.wr-card h2 { margin: 0 0 14px; font-size: 22px; letter-spacing: -0.03em; }
.item { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.item:last-child { border-bottom: 0; }
.item .label { min-width: 126px; margin: 0; }
.item .value { text-align: right; overflow-wrap: anywhere; word-break: break-word; }
.ip-list { display: grid; gap: 10px; margin-top: 4px; }
.ip-box { padding: 12px; border-radius: 13px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); font-weight: 800; overflow-wrap: anywhere; word-break: break-word; line-height: 1.5; }

/* ---------------- BELOW-THE-FOLD content-visibility ---------------- */
.below-fold { content-visibility: auto; contain-intrinsic-size: 1px 600px; }
.below-fold-sm { content-visibility: auto; contain-intrinsic-size: 1px 400px; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .map-wrap, #map { min-height: 440px; }
  .privacy-grid { grid-template-columns: 1fr; }
  .wr-grid { grid-template-columns: 1fr; }
  .result-card { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .page { width: min(100% - 20px, 1180px); }
  .nav-toggle-btn { display: inline-flex; }
  .topbar { flex-wrap: wrap; }
  .topbar-actions {
    flex-basis: 100%;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.25s ease;
    margin-top: 0;
  }
  .nav-toggle:checked ~ .topbar-actions { max-height: 320px; opacity: 1; margin-top: 10px; }
  .nav-btn { width: 100%; }
  .panel { padding: 18px; }
  .grid { grid-template-columns: 1fr; }
  .cta-row { flex-direction: column; }
  .cta-row .btn { width: 100%; }
  .snapshot { grid-template-columns: 1fr; text-align: center; gap: 12px; }
  .snap-main { text-align: center; }
  .snap-flag { margin: 0 auto; }
  .vpn-indicator { align-items: center; width: 100%; }
  .mini-grid { grid-template-columns: 1fr; }
  .conn-actions { flex-direction: column; align-items: stretch; }
  .conn-actions .btn { width: 100%; }
  .result-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  h1 { font-size: 30px; }
  .map-wrap, #map { min-height: 320px; }
  .overlay-item { min-width: 100%; }
  .item { flex-direction: column; }
  .item .value { text-align: left; }
}

/* ---------------- REDUCED MOTION ---------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .nav-btn:hover, .nav-btn:active, .btn:hover { transform: none; }
}
