:root {
  --bg: #070a12;
  --bg-elevated: rgba(15, 22, 37, 0.76);
  --bg-card-hover: rgba(20, 29, 49, 0.92);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --muted: #8b9bb4;
  --accent: #06b6d4;
  --emerald: #22c55e;
  --amber: #f59e0b;
  --radius-lg: 20px;
  --radius-md: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  position: relative;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 75% 45% at 50% -10%, rgba(6, 182, 212, 0.14), transparent 70%),
    radial-gradient(ellipse 50% 35% at 90% 10%, rgba(59, 130, 246, 0.08), transparent 65%);
}

.ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 44px) 36px;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  border: 1px solid rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.14);
  display: grid;
  place-items: center;
  color: #f8fafc;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-domain {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-soft);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Main & Hero */
.main-content {
  flex: 1;
  padding: clamp(36px, 6vw, 68px) 0 48px;
}

.hero {
  margin-bottom: 36px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero-title {
  margin: 0;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.06;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-tagline {
  margin: 14px 0 0;
  max-width: 640px;
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.6;
  color: var(--muted);
}

/* Toolbar */
.toolbar {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.filter-pill.active {
  color: #04131c;
  background: var(--text);
  border-color: var(--text);
  font-weight: 600;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  color: var(--muted);
}

.search-wrap:focus-within {
  border-color: var(--accent);
  color: var(--text);
}

.search-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  width: 150px;
}

.count-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Project Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 22px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: color-mix(in srgb, var(--card-accent, #06b6d4) 48%, rgba(255, 255, 255, 0.14));
  box-shadow:
    0 20px 44px -18px rgba(0, 0, 0, 0.75),
    0 0 0 1px color-mix(in srgb, var(--card-accent, #06b6d4) 18%, transparent);
}

.card-stretched-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius-lg);
}

.card-stretched-link:focus-visible {
  outline: 2px solid var(--card-accent, var(--accent));
  outline-offset: 3px;
}

/* Card Visual Banner */
.card-visual {
  position: relative;
  height: 196px;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--card-accent, #06b6d4) 22%, transparent), transparent 68%),
    linear-gradient(180deg, rgba(10, 15, 28, 0.92), rgba(7, 10, 18, 0.96));
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-visual svg {
  width: 100%;
  height: 100%;
  display: block;
}

.card-visual-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 90%);
  pointer-events: none;
}

.card-top-badges {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.category-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(7, 10, 18, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
  backdrop-filter: blur(8px);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(7, 10, 18, 0.78);
  border: 1px solid rgba(34, 197, 94, 0.32);
  font-family: var(--font-mono);
  font-size: 11px;
  color: #86efac;
  backdrop-filter: blur(8px);
}

.status-badge.status-beta {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Card Body */
.card-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.card-year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.card-subtitle {
  margin: 5px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--card-accent, var(--accent));
}

.card-desc {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.tag-chip {
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.12);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
}

.card-actions {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.open-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.18s ease, transform 0.18s ease;
}

.project-card:hover .open-cta {
  color: var(--card-accent, var(--accent));
}

.project-card:hover .open-cta .arrow {
  transform: translate(2px, -2px);
}

.open-cta .arrow {
  display: inline-block;
  transition: transform 0.18s ease;
}

.secondary-links {
  position: relative;
  z-index: 2;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.09);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.16s ease;
}

.secondary-link:hover {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.45);
  color: #fff;
}

/* SVG Visual Animations */
.spin-slow {
  transform-origin: 180px 98px;
  animation: spinSlow 24s linear infinite;
}

.spin-reverse {
  transform-origin: 180px 98px;
  animation: spinReverse 18s linear infinite;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spinReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
  color: var(--muted);
}

.btn-reset {
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mono {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

.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;
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot,
  .spin-slow,
  .spin-reverse {
    animation: none;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding-bottom: 16px;
  }
  .card-visual {
    height: 170px;
  }
  .card-body {
    padding: 18px;
  }
}
