/* Studily status page — status.studily.org
 * Plain CSS, mobile-first, blue-led palette.
 */

:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --blue: #38bdf8;
  --blue-light: #e0f2fe;
  --success: #22c55e;
  --success-soft: #dcfce7;
  --error: #dc2626;
  --error-soft: #fee2e2;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --ink: #0f172a;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-dark: #0b1220;
  --radius: 12px;
  --radius-sm: 8px;
  --max: 1120px;
  --touch: 44px;
  --header-h: 60px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

button {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.header-glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(80% 120% at 10% 0%, rgba(56, 189, 248, 0.08) 0%, transparent 50%),
    radial-gradient(60% 90% at 90% 0%, rgba(14, 165, 233, 0.08) 0%, transparent 50%);
}

.header-inner {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  max-width: var(--max);
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  min-height: var(--touch);
}

.header-brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.header-brand-sub {
  font-weight: 500;
  color: var(--text-muted);
}

.header-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.header-nav a,
.header-nav span {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.header-nav a:hover,
.header-nav a.active,
.header-nav a[aria-current="page"] {
  color: var(--primary-dark);
  background: var(--blue-light);
}

.header-end {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.header-status {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.header-status-dot,
.mobile-status-dot,
.footer-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}

.header-status-dot.ok,
.mobile-status-dot.ok,
.footer-live-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.header-status-dot.degraded,
.mobile-status-dot.degraded,
.footer-live-dot.degraded {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.16);
}

.header-status-dot.error,
.mobile-status-dot.error,
.footer-live-dot.error {
  background: var(--error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
}

.header-status-dot.checking,
.mobile-status-dot.checking,
.footer-live-dot.checking {
  background: var(--text-muted);
  box-shadow: none;
}

.header-session {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

.header-session:hover {
  background: var(--primary);
  color: #fff;
}

.header-session.signed-in {
  background: var(--bg-alt);
  color: var(--ink);
  border: 1px solid var(--border);
}

.hamburger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  z-index: 52;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, background 0.2s ease;
  margin: 3px 0;
  transform-origin: center;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(8px) rotate(-45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-8px) rotate(45deg);
}

/* Mobile nav */

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  visibility: hidden;
}

.mobile-nav.open {
  pointer-events: auto;
  visibility: visible;
}

.mobile-nav-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-nav.open .mobile-nav-backdrop {
  opacity: 1;
}

.mobile-nav-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(320px, 86vw);
  height: 100%;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  box-shadow: -16px 0 48px -20px rgba(15, 23, 42, 0.25);
  padding: 88px 24px 32px;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 0.9, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.mobile-nav.open .mobile-nav-panel {
  transform: translateX(0);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-nav-links a {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active,
.mobile-nav-links a[aria-current="page"] {
  background: var(--blue-light);
  color: var(--primary-dark);
}

.mobile-nav-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.mobile-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.mobile-session {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  border-radius: var(--radius-sm);
  background: var(--blue-light);
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 700;
  padding: 10px 16px;
}

.mobile-session.signed-in {
  background: var(--bg-alt);
  color: var(--ink);
  border: 1px solid var(--border);
}

/* ---------- API banner ---------- */

.api-banner {
  background: var(--error-soft);
  color: #991b1b;
  border-bottom: 1px solid rgba(220, 38, 38, 0.15);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.api-banner[hidden] {
  display: none !important;
}

.api-banner-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
  animation: pulse 1.8s ease-in-out infinite;
}

.api-banner.ok {
  background: var(--success-soft);
  color: #15803d;
  border-bottom-color: rgba(34, 197, 94, 0.15);
}

.api-banner.ok .api-banner-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: var(--touch);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.08s ease,
    box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px -4px rgba(14, 165, 233, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--primary-dark);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: var(--primary);
}

.btn-outline {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn-danger {
  background: var(--error-soft);
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.15);
}

.btn-danger:hover:not(:disabled) {
  background: var(--error);
  color: #fff;
}

/* ---------- Forms ---------- */

.form-card {
  max-width: 620px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 8px 30px -24px rgba(2, 132, 199, 0.18);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-label .optional {
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.form-input,
.form-select,
.form-textarea {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  min-height: var(--touch);
  width: 100%;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: #cbd5e1;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  background: var(--bg);
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-select {
  appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.form-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--error-soft);
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}

.form-error[hidden] {
  display: none !important;
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 100% at 80% 0%, rgba(14, 165, 233, 0.09) 0%, transparent 60%),
    radial-gradient(45% 70% at 5% 20%, rgba(56, 189, 248, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border);
  padding: 40px 16px 56px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 75%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 75%);
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, transparent 65%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  left: 70%;
  top: 20%;
}

.hero-inner {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 32px;
}

.hero-copy {
  animation: hero-in 0.7s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.hero-visual {
  animation: hero-in 0.7s cubic-bezier(0.22, 0.9, 0.3, 1) 0.12s both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: rgba(224, 242, 254, 0.6);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 16px;
  min-height: 34px;
}

.eyebrow-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.eyebrow-dot.pulse {
  animation: pulse 1.8s ease-in-out infinite;
}

.eyebrow-dot.degraded {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}

.eyebrow-dot.error {
  background: var(--error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 7vw, 52px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--ink);
}

.hero-sub {
  margin: 0 0 24px;
  max-width: 460px;
  font-size: 16px;
  color: var(--text-secondary);
}

.hero a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 110px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  flex: 1 1 auto;
}

.stat-chip-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-chip-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.last-check {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- Probe card ---------- */

.probe-card {
  width: 100%;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 24px 48px -24px rgba(2, 132, 199, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.probe-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.probe-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.probe-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.probe-dot.degraded {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}

.probe-dot.error {
  background: var(--error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

.probe-dot.pulse {
  animation: pulse 1.8s ease-in-out infinite;
}

.probe-sparkline {
  height: 56px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}

.probe-sparkline svg {
  width: 100%;
  height: 100%;
  display: block;
}

.probe-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ---------- Sections ---------- */

.section {
  padding: 52px 16px;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.section-kicker {
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}

.section h2 {
  margin: 0 0 12px;
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.025em;
  text-align: center;
  color: var(--ink);
}

.section-sub {
  margin: 0 auto 32px;
  max-width: 560px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
}

/* ---------- Services ---------- */

.services-status {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 36px 0;
  margin: 0;
}

.services-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.service-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.service-card:hover {
  border-color: rgba(14, 165, 233, 0.35);
  box-shadow: 0 8px 24px -16px rgba(2, 132, 199, 0.28);
  transform: translateY(-2px);
}

.service-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.service-main h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.service-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.service-detail {
  color: var(--text-muted);
}

.service-latency {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.service-sparkline {
  height: 44px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 6px;
  overflow: hidden;
}

.service-sparkline svg {
  width: 100%;
  height: 100%;
  display: block;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.operational {
  background: var(--success-soft);
  color: #15803d;
}

.status-pill.degraded {
  background: var(--amber-soft);
  color: #92400e;
}

.status-pill.down {
  background: var(--error-soft);
  color: #991b1b;
}

.status-pill.unknown {
  background: var(--bg-alt);
  color: var(--text-muted);
}

/* ---------- Traffic / charts ---------- */

.traffic-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.traffic-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.traffic-card h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chart-wrap {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.chart-svg {
  width: 100%;
  height: auto;
  max-height: 340px;
  display: block;
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-animated {
  stroke-dasharray: var(--path-len);
  stroke-dashoffset: var(--path-len);
  animation: line-draw 0.85s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}

.chart-area {
  stroke: none;
  fill: url(#area-grad);
  opacity: 0;
}

.chart-area-animated {
  animation: area-fade 0.7s ease 0.15s forwards;
}

.chart-dot {
  fill: var(--primary);
  r: 3.5;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.chart-dot-animated {
  animation: dot-pop 0.35s cubic-bezier(0.22, 0.9, 0.3, 1) 0.75s both;
}

.chart-dot.selected {
  fill: var(--primary-dark);
  r: 5;
}

.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}

.chart-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-label {
  font-size: 10px;
  fill: var(--text-muted);
  font-weight: 600;
}

.chart-tick {
  font-size: 10px;
  fill: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
  justify-content: center;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Bar chart (top countries) */

.bar-chart {
  width: 100%;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.bar-row:last-child {
  margin-bottom: 0;
}

.bar-label {
  width: 42px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.bar-track {
  flex: 1;
  height: 10px;
  background: var(--bg-alt);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  min-width: 2px;
  width: 0;
  transform-origin: left;
  transition: width 0.7s cubic-bezier(0.22, 0.9, 0.3, 1);
}

.bar-value {
  width: 50px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Donut charts */

.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.donut-svg {
  width: 180px;
  height: auto;
  display: block;
}

.donut-segment {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: var(--len) var(--circ);
  animation: donut-sweep 0.85s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
  transform-origin: center;
  transform: rotate(var(--start, 0deg));
}

.donut-center {
  font-size: 11px;
  fill: var(--text-muted);
  font-weight: 700;
  text-anchor: middle;
}

.donut-center-value {
  font-size: 24px;
  fill: var(--ink);
  font-weight: 800;
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}

/* ---------- Traffic table ---------- */

.traffic-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}

.traffic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 420px;
}

.traffic-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.traffic-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  vertical-align: middle;
}

.traffic-table tr:last-child td {
  border-bottom: none;
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
}

.country-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.country-flag {
  font-size: 16px;
  line-height: 1;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.trend-up {
  color: var(--success);
}

.trend-down {
  color: var(--error);
}

.trend-stable {
  color: var(--text-muted);
}

.trend svg {
  width: 12px;
  height: 12px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot.up {
  color: var(--success);
}

.status-dot.down {
  color: var(--error);
}

.status-dot.stable {
  color: var(--text-muted);
}

/* ---------- Locations page ---------- */

.location-hero {
  padding: 32px 16px 24px;
}

.location-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.location-hero p {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 15px;
}

.window-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 4px;
}

.window-tabs::-webkit-scrollbar {
  display: none;
}

.window-tab {
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: var(--touch);
  padding: 8px 16px;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.window-tab:hover {
  border-color: var(--primary);
  color: var(--ink);
}

.window-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.location-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.search-field {
  position: relative;
  flex: 1 1 100%;
  min-width: 0;
}

.search-field input {
  width: 100%;
  min-height: var(--touch);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-field input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.sort-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
}

.sort-field select {
  min-height: var(--touch);
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    var(--bg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23475569' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  appearance: none;
  cursor: pointer;
}

.sort-field select:focus {
  border-color: var(--primary);
  outline: none;
}

.refresh-hint {
  color: var(--text-muted);
  font-size: 12.5px;
  flex: 1 1 auto;
  text-align: right;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.kpi-card .kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-card .kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 600;
}

.chart-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chart-card h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chart-card .updated {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

.country-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.country-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.country-card:hover {
  border-color: rgba(14, 165, 233, 0.35);
  box-shadow: 0 8px 24px -16px rgba(2, 132, 199, 0.28);
  transform: translateY(-2px);
}

.country-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.country-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.country-card-title .country-flag {
  font-size: 20px;
}

.country-card-name {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.country-card-count {
  text-align: right;
}

.country-card-count .count {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.country-card-count .trend {
  font-size: 12.5px;
  margin-top: 2px;
}

.country-share {
  margin-bottom: 12px;
}

.country-share-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.country-share-bar {
  height: 8px;
  background: var(--bg-alt);
  border-radius: 999px;
  overflow: hidden;
}

.country-share-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  min-width: 2px;
  width: 0;
  transition: width 0.6s cubic-bezier(0.22, 0.9, 0.3, 1);
}

.country-mini-chart {
  margin-top: 14px;
}

.country-mini-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.country-mini-chart svg {
  width: 100%;
  height: auto;
  max-height: 120px;
  display: block;
}

.country-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 0;
}

/* ---------- Report / inquiry teaser ---------- */

.report-inner {
  max-width: 620px;
}

.report-teaser {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}

.report-teaser .btn {
  margin-bottom: 12px;
}

.report-teaser p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Auth / inquiry pages ---------- */

.auth-hero,
.inquiry-hero {
  padding: 28px 16px 32px;
}

.inquiry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.inquiry-card,
.locked-card,
.confirm-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.inquiry-card h3,
.locked-card h3,
.confirm-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.locked-card {
  background: var(--blue-light);
  border-color: rgba(14, 165, 233, 0.3);
}

.locked-card h3 {
  color: var(--primary-dark);
}

.inquiry-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary-dark);
}

.confirm-card {
  background: var(--success-soft);
  border-color: rgba(34, 197, 94, 0.3);
}

.confirm-card h3 {
  color: #15803d;
}

.inquiry-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inquiry-help {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.inquiry-help h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--ink);
}

.inquiry-help p,
.inquiry-help ul {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.inquiry-help ul {
  padding-left: 18px;
  margin-top: 6px;
}

.inquiry-help li {
  margin-bottom: 4px;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--bg-dark);
  color: #94a3b8;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 44px 16px 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  margin-bottom: 36px;
}

.footer-col h4 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 10px;
}

.footer-brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.footer-tagline {
  margin: 0 0 8px;
  font-size: 14px;
  color: #94a3b8;
}

.footer-powered {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}

.footer-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links-list a {
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.footer-links-list a:hover {
  color: #fff;
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 12.5px;
  color: #64748b;
}

.footer-bottom p {
  margin: 0;
}

/* ---------- Animations ---------- */

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.85;
  }
}

@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes line-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes area-fade {
  to {
    opacity: 1;
  }
}

@keyframes dot-pop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes donut-sweep {
  from {
    stroke-dasharray: 0, var(--circ);
  }
  to {
    stroke-dasharray: var(--len), var(--circ);
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .eyebrow-dot.pulse,
  .probe-dot.pulse,
  .api-banner-dot,
  .footer-live-dot {
    animation: none;
  }

  .hero-copy,
  .hero-visual {
    animation: none;
  }

  .service-card,
  .country-card,
  .bar-fill,
  .country-share-fill {
    transition: none;
  }

  .chart-line-animated,
  .donut-segment,
  .bar-fill,
  .country-share-fill {
    animation: none !important;
  }

  .chart-line-animated {
    stroke-dasharray: none;
    stroke-dashoffset: 0 !important;
  }

  .chart-area-animated {
    opacity: 1;
    animation: none;
  }

  .chart-dot-animated,
  .chart-dot {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .donut-segment {
    stroke-dasharray: var(--len), var(--circ);
  }

  .bar-fill,
  .country-share-fill {
    width: var(--bar-pct, 0);
  }

  .btn,
  .header-nav a,
  .mobile-nav-links a,
  .form-input,
  .form-select,
  .form-textarea {
    transition: none;
  }
}

/* ---------- Responsive ---------- */

@media (min-width: 640px) {
  .header-inner {
    padding: 0 24px;
  }

  .hero {
    padding: 64px 24px 80px;
  }

  .hero h1 {
    font-size: clamp(40px, 5vw, 52px);
  }

  .hero-sub {
    font-size: 17px;
  }

  .stat-chips {
    gap: 12px;
  }

  .stat-chip {
    padding: 14px 18px;
  }

  .stat-chip-value {
    font-size: 22px;
  }

  .probe-card {
    max-width: 340px;
    margin-left: auto;
    padding: 18px;
  }

  .section {
    padding: 72px 24px;
  }

  .services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .service-card {
    padding: 18px 20px;
  }

  .traffic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 32px;
  }

  .traffic-card,
  .chart-card {
    padding: 20px;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .country-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .location-hero {
    padding: 48px 24px 32px;
  }

  .search-field {
    flex: 1 1 auto;
    min-width: 220px;
  }

  .location-controls {
    flex-wrap: nowrap;
  }

  .form-card,
  .report-teaser {
    padding: 28px;
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .inquiry-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }

  .footer-inner {
    padding: 54px 24px 28px;
  }

  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

@media (min-width: 860px) {
  :root {
    --header-h: 64px;
  }

  .hamburger,
  .mobile-nav,
  .mobile-nav.open {
    display: none !important;
  }

  .header-nav {
    display: flex;
  }

  .header-status {
    display: inline-flex;
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 48px;
  }

  .hero-copy {
    text-align: left;
  }

  .hero-sub {
    margin-left: 0;
    margin-right: 0;
  }

  .stat-chips {
    justify-content: flex-start;
  }

  .country-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .country-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Mobile table as cards ---------- */

@media (max-width: 639px) {
  .traffic-table-wrap {
    overflow-x: visible;
    border: none;
    background: transparent;
  }

  .traffic-table,
  .traffic-table thead,
  .traffic-table tbody,
  .traffic-table th,
  .traffic-table td,
  .traffic-table tr {
    display: block;
    width: 100%;
  }

  .traffic-table thead {
    display: none;
  }

  .traffic-table tr {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
  }

  .traffic-table td {
    border: none;
    padding: 6px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .traffic-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }

  .traffic-table td.table-empty {
    justify-content: center;
  }

  .traffic-table td.table-empty::before {
    content: none;
  }
}

/* ---------- Focus styles ---------- */

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- 360px safety ---------- */

@media (max-width: 360px) {
  .header-brand {
    font-size: 14px;
  }

  .header-brand img {
    width: 24px;
    height: 24px;
  }

  .eyebrow {
    font-size: 11px;
    padding: 4px 10px;
  }

  .stat-chip {
    min-width: 0;
  }

  .window-tab {
    padding: 8px 12px;
    font-size: 13px;
  }
}
