:root {
  --bg-surface: #0a0a0a;
  --border-color: rgba(255, 255, 255, 0.1);
  --accent: #00c3ff;
  --accent-dim: rgba(0, 195, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: #a3a3a3;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  --bg-surface: #f7f7f9;
  --border-color: rgba(0, 0, 0, 0.1);
  --accent: #007bff;
  --accent-dim: rgba(0, 123, 255, 0.15);
  --text-primary: #121212;
  --text-secondary: #5a5a5a;
  --glass-bg: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.1);
}

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

body {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, .card-title, .changelog-heading {
  font-family: 'Outfit', sans-serif;
}

/* Fluid Typography */
h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 700; margin-bottom: 0.5rem; letter-spacing: -0.02em; }
header p { font-size: clamp(1.125rem, 2vw, 1.5rem); color: var(--accent); font-weight: 500; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1rem; }
p { font-size: clamp(0.95rem, 1.2vw, 1.125rem); color: var(--text-secondary); }

header {
  padding: 4rem 1.5rem 2rem;
  text-align: center;
}

main {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.portal-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

/* Glass Card */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover, .glass-card:focus-visible {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.2);
  border-color: var(--accent);
  outline: none;
}

/* Status Pill */
.status-pill {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Outfit', sans-serif;
}

.status-live {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.status-dev {
  background: rgba(255, 152, 0, 0.15);
  color: #ff9800;
  border: 1px solid rgba(255, 152, 0, 0.5);
}

.card-icon {
  font-size: 2.75rem;
  margin-bottom: 1.5rem;
  display: block;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  font-size: 1.25rem;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s;
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* Footer & Changelog */
footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  margin-top: 2rem;
}

.version-history {
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: var(--glass-bg);
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
}

.version-history a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.version-history a:hover {
  opacity: 0.8;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(30px);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--accent);
}

.changelog-list {
  list-style: none;
  margin-top: 1.5rem;
}

.changelog-list li {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.changelog-list li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.changelog-version {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
}

.changelog-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: block;
  font-family: 'Outfit', sans-serif;
}

/* Responsive adjustments */
@media (max-width: 320px) {
  .portal-matrix {
    grid-template-columns: 1fr;
  }
}
