* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: url('data:image/svg+xml;utf8,<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><polygon points="3,3 26,11 15,15 11,26" fill="rgba(0,245,255,0.2)" stroke="%2300f5ff" stroke-width="2" stroke-linejoin="round"/><polygon points="8,8 19,11 14,14 11,19" fill="%23050508"/><line x1="15" y1="15" x2="26" y2="26" stroke="%2300f5ff" stroke-width="3" stroke-linecap="round"/></svg>') 3 3, auto !important;
}

:root {
  --bg-dark: #06060e;
  --bg-secondary: #0c0c1d;
  --bg-glass: rgba(18, 18, 42, 0.6);
  --bg-glass-hover: rgba(18, 18, 42, 0.8);
  --border-glass: rgba(108, 92, 231, 0.15);
  --border-glass-glow: rgba(0, 240, 255, 0.3);
  --accent-primary: #6c5ce7;
  --accent-secondary: #a29bfe;
  --neon-cyan: #00f0ff;
  --accent-cyan: #00f0ff;
  --accent-violet: #8b5cf6;
  --text-main: #f0f0f8;
  --text-muted: #8892b0;
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'Space Grotesk', monospace;
  
  --gradient-primary: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #00f0ff 100%);
}

body {
  background-color: transparent;
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

/* WebGL Container */
#webgl-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: -5;
  pointer-events: none;
  background: #020205; /* Deep space base */
}

/* Hero Grid Background */
.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(108, 92, 231, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 92, 231, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 30%, transparent 80%);
  z-index: -1;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* Noise overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-image: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
  opacity: 0.02;
}

/* Cursor elements hidden by default as they use the SVG cursor above */
.cursor-dot, .cursor-trail { display: none; }

/* Background animated orbs */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.3;
  animation: float 20s infinite ease-in-out alternate;
}
.orb-cyan {
  top: -15%;
  left: -10%;
  width: 45vw;
  height: 45vw;
  background-color: var(--accent-cyan);
}
.orb-violet {
  bottom: -15%;
  right: -10%;
  width: 55vw;
  height: 55vw;
  background-color: var(--accent-violet);
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(8%, 12%) scale(1.15); }
}

/* Header & Typography */
.header {
  padding: 3rem 5%;
  max-width: 1400px;
  margin: 0 auto;
}
.nav {
  margin-bottom: 4rem;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition-fast);
  position: relative;
  padding: 8px 18px;
}
.back-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}
.back-link:hover {
  color: var(--text-primary);
}
.back-link:hover::after {
  width: 60%;
}

.hero {
  text-align: center;
  margin-bottom: 4rem;
}
.hero-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.hero-badge::before {
  content: '';
  width: 40px;
  height: 2px;
  background: var(--accent-primary);
}
.hero-badge-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  color: var(--text-muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Filters */
.filter-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.filter-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.6rem 1.75rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-normal);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.filter-btn:hover {
  border-color: var(--accent-primary);
  background: rgba(108, 92, 231, 0.1);
  color: var(--text-primary);
}
.filter-btn.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

/* Grid layout */
.main-content {
  padding: 0 5% 6rem;
  max-width: 1400px;
  margin: 0 auto;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2.5rem;
}

/* Certificate Card */
.cert-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  transform-style: preserve-3d;
  opacity: 0;
  transform: translateY(30px);
}
.cert-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.cert-card:hover {
  background: rgba(18, 18, 42, 0.8);
  border-color: rgba(108, 92, 231, 0.35);
  box-shadow: 0 8px 32px rgba(108, 92, 231, 0.15), inset 0 0 32px rgba(108, 92, 231, 0.05);
}

.card-thumb {
  width: 100%;
  height: 220px;
  position: relative;
  overflow: hidden;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--border-glass);
}
.card-embed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none; /* Prevents capturing scroll/click within embed */
}
.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5,5,8,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(3px);
}
.card-overlay-btn {
  background: rgba(0,245,255,0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 0.6rem 1.5rem;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  transform: translateY(15px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  box-shadow: 0 0 15px rgba(0,245,255,0.2);
}
.cert-card:hover .card-overlay {
  opacity: 1;
}
.cert-card:hover .card-overlay-btn {
  transform: translateY(0);
}

.card-body {
  padding: 1.75rem;
}
.card-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 6px 12px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-violet);
  border-radius: 20px;
  border: 1px solid rgba(139, 92, 246, 0.2);
  margin-bottom: 0.75rem;
  display: inline-block;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}
.card-issuer {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Fullscreen Dialog */
.cert-dialog {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.cert-dialog::backdrop {
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
}

/* Entry Animation */
.cert-dialog[open] {
  animation: dialog-show 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.cert-dialog[open]::backdrop {
  animation: backdrop-show 0.5s ease forwards;
}

/* Exit Animation */
.cert-dialog.closing {
  animation: dialog-hide 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.cert-dialog.closing::backdrop {
  animation: backdrop-hide 0.4s ease forwards;
}

@keyframes dialog-show {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes backdrop-show {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes dialog-hide {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(0.95) translateY(10px); }
}
@keyframes backdrop-hide {
  from { opacity: 1; }
  to { opacity: 0; }
}

.dialog-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: auto;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 2rem;
  left: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main);
  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(10px);
}
.close-btn:hover {
  background: rgba(255,255,255,0.1);
  transform: translateX(-5px);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.dialog-body {
  display: flex;
  flex-direction: row;
  gap: 5rem;
  padding: 8rem 5% 5rem;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100%;
  align-items: center;
}

.dialog-preview {
  flex: 1.2;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6), 0 0 30px rgba(0,245,255,0.05);
  aspect-ratio: 1.414 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.dialog-preview embed {
  width: 100%;
  height: 100%;
}
.dialog-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dialog-info {
  flex: 1;
}
.dialog-badge {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-violet);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
}
.dialog-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: #ffffff;
}
.dialog-about {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
  line-height: 1.6;
}
.dialog-meta {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 3rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-glass);
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.meta-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.meta-value {
  color: var(--text-main);
  font-weight: 500;
  font-size: 1.125rem;
}

.glow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 1.15rem;
  border-radius: 12px;
  background: var(--gradient-primary);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
  transition: var(--transition-normal);
  border: none;
}
.glow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(108, 92, 231, 0.5);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .dialog-body {
    flex-direction: column;
    gap: 3rem;
    padding-top: 6rem;
  }
  .dialog-preview {
    width: 100%;
    aspect-ratio: auto;
    height: 400px;
  }
}
@media (max-width: 768px) {
  .header { padding: 2rem 5%; }
  .cert-card { border-radius: 20px; }
  .cert-card::before { border-radius: 20px; }
  .close-btn { top: 1.25rem; left: 1.25rem; padding: 0.5rem 1rem; }
  .dialog-title { font-size: 2rem; }
  .dialog-preview { height: 300px; }
}
