/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #04082e;
  --bg-card:   #070d3d;
  --bg-hover:  #0a1148;
  --border:    rgba(255,255,255,0.08);
  --border-hi: rgba(255,255,255,0.16);
  --text:      #ffffff;
  --muted:     rgba(255,252,220,0.82);
  --subtle:    rgba(255,252,220,0.55);
  --accent:    #3481F5;
  --mono:      'JetBrains Mono', 'Monaco', 'Courier New', monospace;
  --sans:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --head:      'Space Grotesk', var(--sans);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; text-decoration: none; }

code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: rgba(52,129,245,0.12);
  border: 1px solid rgba(52,129,245,0.2);
  border-radius: 3px;
  padding: 1px 6px;
  color: #60a5fa;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 24px;
  background: rgba(4,8,46,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--head);
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-right: 20px;
  flex-shrink: 0;
}

.logo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}

.nav-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-link.active { color: #fff; }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-signin {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-hi);
  transition: all 0.15s;
}

.header-signin:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

/* ── Main ──────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 24px;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-align: center;
}

/* ── Dashboard header ──────────────────────────────────────────────────────── */
.dashboard-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-header h1 {
  font-family: var(--head);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
}

.dashboard-header .subtitle {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Tab bar ────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px 10px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.tab-btn:hover { color: #fff; }

.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--accent);
}

.tab-count {
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,0.07);
  color: var(--muted);
}

.tab-btn.active .tab-count {
  background: rgba(52,129,245,0.18);
  color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Sensor grid ───────────────────────────────────────────────────────────── */
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

/* ── Sensor card ───────────────────────────────────────────────────────────── */
.sensor-card {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
  transform-origin: center center;
  transition:
    background   0.13s ease-out,
    transform    0.13s ease-out,
    box-shadow   0.13s ease-out,
    filter       0.13s ease-out,
    opacity      0.13s ease-out;
  will-change: transform;
}

/* Allow lifted card to overflow grid boundary */
.sensor-grid:has(.sensor-card:hover) {
  overflow: visible;
}

/* ── Dormant cards: subtle step back, still fully readable ── */
.sensor-grid:has(.sensor-card:hover) .sensor-card:not(:hover) {
  filter: brightness(0.72);
  opacity: 0.85;
}

/* Light overlay just to separate from hovered card */
.sensor-grid:has(.sensor-card:hover) .sensor-card:not(:hover)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 28, 0.18);
  pointer-events: none;
}

/* ── Hovered card: lift out of the deck ──────────────────── */
.sensor-grid .sensor-card:hover {
  transform: scale(1.035) translateY(-2px);
  background: color-mix(in srgb, var(--card-color, var(--accent)) 9%, var(--bg-hover));
  box-shadow:
    0 0 0 1px var(--card-color, var(--accent)),
    0 0 20px 2px color-mix(in srgb, var(--card-color, var(--accent)) 22%, transparent),
    0 8px 24px -4px color-mix(in srgb, var(--card-color, var(--accent)) 35%, transparent),
    0 3px 9px -1px rgba(0,0,0,0.5);
  z-index: 10;
}

/* Accent bar widens on hover */
.sensor-card:hover .card-accent {
  width: 5px;
  opacity: 1;
}

/* Name + meta fully lit on hover */
.sensor-card:hover .card-name     { color: #fff; text-shadow: 0 0 6px rgba(255,255,255,0.15); }
.sensor-card:hover .card-category { opacity: 1; }
.sensor-card:hover .card-desc     { color: var(--muted); }

/* left color accent bar — driven by --card-color CSS var */
.card-accent {
  width: 3px;
  flex-shrink: 0;
  background: var(--card-color, var(--accent));
  opacity: 0.7;
  transition: width 0.18s ease-out, opacity 0.18s ease-out;
}

/* emoji icon between accent bar and body */
.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  font-size: 1.25rem;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.sensor-card:hover .card-icon { opacity: 1; }

/* main content */
.card-body {
  flex: 1;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.card-category {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--card-color, var(--accent));
  opacity: 0.85;
}

.card-protocol {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--subtle);
  border: 1px solid var(--border-hi);
  border-radius: 3px;
  padding: 0 5px;
  line-height: 1.6;
}

.card-name {
  font-family: var(--head);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 1px;
}

.card-specs {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--subtle);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-sep {
  margin: 0 5px;
  opacity: 0.4;
}

/* right cta */
.card-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 16px;
  flex-shrink: 0;
  color: var(--subtle);
  font-size: 0.65rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-left: 1px solid var(--border);
  transition: all 0.15s;
}

.card-cta svg { transition: transform 0.15s; }

.sensor-card:hover .card-cta {
  color: var(--card-color, var(--accent));
  border-left-color: var(--border-hi);
}

.sensor-card:hover .card-cta svg { transform: translateX(2px); }

.card-cta--soon { opacity: 0.35; pointer-events: none; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 5rem 2rem;
  color: var(--muted);
  text-align: center;
}

.empty-icon { font-size: 1.5rem; opacity: 0.3; }
.empty-title { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.empty-hint  { font-size: 0.75rem; color: var(--subtle); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */

/* Large desktops (1400px+) */
@media (min-width: 1400px) {
  main {
    max-width: 1400px;
  }
  .sensor-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

/* Tablets landscape / small desktops (1024px and below) */
@media (max-width: 1024px) {
  main {
    padding: 2rem 16px;
  }
  .sensor-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

/* Tablets portrait (768px and below) */
@media (max-width: 768px) {
  .site-header {
    height: auto;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .site-logo {
    margin-right: auto;
  }

  .site-logo img {
    height: 28px;
  }

  .header-right {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  main {
    padding: 1.5rem 12px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 1.25rem;
  }

  .dashboard-header h1 {
    font-size: 1.2rem;
  }

  .sensor-grid {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tab-bar::-webkit-scrollbar { display: none; }

  .tab-btn {
    flex-shrink: 0;
    padding: 8px 12px 10px;
    font-size: 0.78rem;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  html, body {
    font-size: 14px;
  }

  .site-header {
    padding: 8px 12px;
  }

  .site-logo img {
    height: 24px;
  }

  main {
    padding: 1rem 10px;
  }

  .dashboard-header h1 {
    font-size: 1.1rem;
  }

  .dashboard-header .subtitle {
    font-size: 0.72rem;
  }

  .sensor-grid {
    grid-template-columns: 1fr;
    border-radius: 8px;
  }

  .card-body {
    padding: 12px 12px 10px;
  }

  .card-icon {
    width: 32px;
    font-size: 1.1rem;
  }

  .card-cta {
    padding: 0 12px;
  }

  .card-name {
    font-size: 0.88rem;
  }

  .tab-btn {
    padding: 7px 10px 9px;
    font-size: 0.75rem;
  }

  .site-footer {
    font-size: 0.65rem;
    padding: 12px;
  }
}

/* Extra small mobile (360px and below) */
@media (max-width: 360px) {
  .card-specs {
    display: none;
  }

  .card-cta span {
    display: none;
  }

  .card-cta {
    padding: 0 10px;
  }
}
