:root {
  /* Light Mode (Default) */
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-hover: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --accent-prod: #0ea5e9;
  --accent-beta: #16a34a;
  --font-main: "Inter", system-ui, -apple-system, sans-serif;
  --accent-color: #2563eb;
  --hover-bg: #f8fafc;
}

:root[data-theme="dark"] {
  --bg-color: #1a1b1e;
  --card-bg: #212226;
  --card-border: #343740;
  --card-hover: #282a2f;
  --text-primary: #eef1f7;
  --text-secondary: #b9c0cd;
  --accent-prod: #38bdf8;
  --accent-beta: #22c55e;
  --accent-color: #aeb3c1;
  --hover-bg: #282a2f;
}

.logo-dark {
  display: none;
}

[data-theme="dark"] .logo-light {
  display: none;
}

[data-theme="dark"] .logo-dark {
  display: block;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  padding-top: 48px;
}

/* Subtle background accent */
.background-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(
      circle at 50% 0%,
      rgba(56, 189, 248, 0.03) 0%,
      transparent 50%
    );
  z-index: -1;
  pointer-events: none;
}

.container {
  width: 100%;
  max-width: 1200px;
  padding: 2rem;
  text-align: center;
}

header {
  margin-bottom: 4rem;
  animation: fadeInDown 0.6s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 300;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease-in-out;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  background: var(--card-hover);
  border-color: var(--accent-color);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  opacity: 0.9;
  transition: transform 0.2s ease;
}

.card:hover .icon {
  transform: scale(1.05);
  color: var(--accent-color);
}

.icon img, .icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.content h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status.prod {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-prod);
  border: 1px solid rgba(56, 189, 248, 0.15);
}

.status.beta {
  background: rgba(22, 163, 74, 0.1);
  color: var(--accent-beta);
  border: 1px solid rgba(22, 163, 74, 0.15);
}

.port {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  font-family: monospace;
  opacity: 0.7;
}

/* Info Tooltip Styles */
.info-trigger {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.info-icon {
  width: 100%;
  height: 100%;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.info-trigger:hover .info-icon {
  opacity: 1;
}

.info-tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  width: 220px;
  padding: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all 0.15s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 20;
  text-align: left;
}

.info-trigger:hover .info-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

footer {
  margin-top: 4rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  opacity: 0.6;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  header h1 {
    font-size: 2rem;
  }
  .grid {
    grid-template-columns: 1fr;
  }
}

/* Theme Toggle */
.theme-toggle-container {
    position: absolute;
    top: 20px;
    right: 20px;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.theme-toggle:focus-visible .theme-toggle-track {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-color);
}
.theme-toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 3.9rem;
  height: 1.95rem;
  padding: 0.25rem 0.35rem;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
  background: linear-gradient(135deg, var(--card-bg), var(--hover-bg));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); /* faint inner border */
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.theme-toggle:hover .theme-toggle-track {
  border-color: var(--accent-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.theme-toggle-thumb {
  position: absolute;
  top: 50%;
  left: 0.32rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-color), var(--text-primary));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: translate(0, -50%); /* default for dark or light? usually left */
  /* We will handle positions via CSS classes based on data-mode */
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  z-index: 2;
}

/* Toggle States - assuming data-mode on button */
.theme-toggle[data-mode="light"] .theme-toggle-thumb {
  transform: translate(1.95rem, -50%); /* Shift to right */
}

.theme-toggle-icons {
  position: relative;
  z-index: 1;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
}
.theme-toggle-icon {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}
.theme-toggle-icon svg {
  width: 100%;
  height: 100%;
}

.theme-toggle[data-mode="light"] .theme-toggle-icon--sun {
  color: #fea500;
  opacity: 1;
}
.theme-toggle[data-mode="light"] .theme-toggle-icon--moon {
  opacity: 0.5;
}
.theme-toggle[data-mode="dark"] .theme-toggle-icon--moon {
  color: var(--accent-color);
  opacity: 1;
}
.theme-toggle[data-mode="dark"] .theme-toggle-icon--sun {
  opacity: 0.5;
}
