/* ══════════════════════════════════════════════════
   InfraScope — Global Design Tokens & Base Styles
   ══════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Brand */
  --color-brand:        #0ea5e9;
  --color-brand-hover:  #0284c7;
  --color-brand-light:  #e0f2fe;
  --color-brand-dark:   #0369a1;

  /* Surfaces */
  --bg-page:            #f1f5f9;
  --bg-surface:         #ffffff;
  --bg-input:           #ffffff;
  --bg-header:          #0f172a;
  --bg-footer:          #1e293b;

  /* Text */
  --text-primary:       #1e293b;
  --text-secondary:     #64748b;
  --text-muted:         #94a3b8;
  --text-on-dark:       #f8fafc;
  --text-on-dark-muted: #94a3b8;

  /* Borders */
  --border-color:       #e2e8f0;
  --border-focus:       #0ea5e9;

  /* Semantic */
  --color-success:      #22c55e;
  --color-danger:       #ef4444;
  --color-warning:      #eab308;
  --color-info:         #3b82f6;
  --color-purple:       #8b5cf6;

  /* Shadows */
  --shadow-sm:          0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:          0 4px 12px rgba(0, 0, 0, 0.10);
  --shadow-lg:          0 8px 24px rgba(0, 0, 0, 0.12);

  /* Radius */
  --radius-sm:          4px;
  --radius:             8px;
  --radius-lg:          12px;

  /* Typography */
  --font-family:        system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:          'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-brand-hover);
  text-decoration: underline;
}

/* ── Typography ── */
.heading-xl {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.heading-lg {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.heading-md {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.text-secondary {
  color: var(--text-secondary);
}

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

/* ── Site Header ── */
.site-header {
  background: var(--bg-header);
  padding: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 2rem;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}

.site-header__brand:hover {
  text-decoration: none;
}

.site-header__logo {
  font-size: 1.25rem;
}

.site-header__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-on-dark);
  letter-spacing: -0.02em;
}

.site-header__title span {
  color: var(--color-brand);
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-header__nav a {
  color: var(--text-on-dark-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.site-header__nav a:hover,
.site-header__nav a.active {
  color: var(--text-on-dark);
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Site Footer ── */
.site-footer {
  background: var(--bg-footer);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: auto;
}

.site-footer__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer__text {
  color: var(--text-on-dark-muted);
  font-size: 0.8rem;
}

.site-footer__links {
  display: flex;
  gap: 1rem;
}

.site-footer__links a {
  color: var(--text-on-dark-muted);
  font-size: 0.8rem;
  transition: color 0.2s;
}

.site-footer__links a:hover {
  color: var(--text-on-dark);
  text-decoration: none;
}

/* ── Cards & Surfaces ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.card__body {
  padding: 1.25rem;
}

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
}

.badge--default {
  background: #f1f5f9;
  color: var(--text-secondary);
}

.badge--info {
  background: var(--color-brand-light);
  color: var(--color-brand-dark);
}

.badge--success {
  background: #dcfce7;
  color: #15803d;
}

.badge--danger {
  background: #fef2f2;
  color: #b91c1c;
}

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-page);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

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

.data-table tr:hover td {
  background: #f8fafc;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn--primary {
  background: var(--color-brand);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-brand-hover);
  color: #fff;
  text-decoration: none;
}

.btn--outline {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn--outline:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
  text-decoration: none;
}

/* ── Section spacing ── */
.section {
  margin-top: 1.75rem;
}

.section__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

/* ── Info List ── */
.info-list {
  list-style: none;
  padding: 0;
}

.info-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.info-list li:last-child {
  border-bottom: none;
}

.info-list strong {
  color: var(--text-secondary);
  min-width: 130px;
  flex-shrink: 0;
}

/* ── Peer list ── */
.peer-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
}

.peer-list li {
  font-size: 0.9rem;
}

.peer-list a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: border-color 0.2s, background 0.2s;
}

.peer-list a:hover {
  border-color: var(--color-brand);
  background: var(--color-brand-light);
  text-decoration: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .site-header__inner {
    padding: 0 1rem;
    gap: 1rem;
  }

  .site-header__nav {
    gap: 0.15rem;
  }

  .site-header__nav a {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
  }

  .page-content {
    padding: 1.25rem 1rem;
  }

  .site-footer__inner {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .peer-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .site-header__inner {
    height: 48px;
  }

  .site-header__title {
    font-size: 0.95rem;
  }
}
