/* =============================================================================
   CERTIFICATIONS — NEON GRID SKIN
   -----------------------------------------------------------------------------
   Applied to /certifications/ only. `_layouts/default.html` adds `grid-neon`
   to <body>; `_includes/head.html` loads this file plus the Orbitron webfont.
   The backdrop (grid floor, horizon, light racers + their light walls) is a
   fixed canvas drawn by assets/js/certs-neon.js.

     void     #000306     panel   rgba(2, 10, 16, 0.78)
     cyan     #4df3ff     cyan-dim rgba(77, 243, 255, 0.35)
     orange   #ff9a3c     white   #e9fdff

   Scoped body.theme-typesafe.grid-neon .site-shell … (four selectors deep)
   so it outranks both style.css and the certifications block in
   typesafe.css without !important.
   ========================================================================== */

body.theme-typesafe.grid-neon {
  --gn-void: #000306;
  --gn-panel: rgba(2, 10, 16, 0.78);
  --gn-cyan: #4df3ff;
  --gn-cyan-dim: rgba(77, 243, 255, 0.35);
  --gn-cyan-faint: rgba(77, 243, 255, 0.12);
  --gn-orange: #ff9a3c;
  --gn-orange-dim: rgba(255, 154, 60, 0.4);
  --gn-white: #e9fdff;
  --gn-head: "Orbitron", "Space Grotesk", "Arial Narrow", sans-serif;

  background: var(--gn-void);
  color: var(--gn-white);
}

/* Fixed full-screen backdrop behind all content. */
.grid-neon .gn-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  display: block;
  pointer-events: none;
}

/* -----------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

body.theme-typesafe.grid-neon .topnav {
  background: rgba(0, 3, 6, 0.82);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--gn-cyan-dim);
  box-shadow: 0 1px 14px rgba(77, 243, 255, 0.18);
}

body.theme-typesafe.grid-neon .topnav-brand {
  font-family: var(--gn-head);
  color: var(--gn-white);
  text-shadow: 0 0 8px var(--gn-cyan-dim);
}

body.theme-typesafe.grid-neon .topnav-link {
  border-radius: 0;
  color: rgba(233, 253, 255, 0.72);
}

body.theme-typesafe.grid-neon.dark-mode .topnav-link:hover {
  background: var(--gn-cyan-faint);
  color: var(--gn-cyan);
}

body.theme-typesafe.grid-neon.dark-mode .topnav-link.active {
  background: transparent;
  color: var(--gn-cyan);
  box-shadow: inset 0 -2px 0 var(--gn-cyan), 0 6px 12px -6px var(--gn-cyan);
  text-shadow: 0 0 8px var(--gn-cyan-dim);
}

/* -----------------------------------------------------------------------------
   Heading block
   -------------------------------------------------------------------------- */

body.theme-typesafe.grid-neon .site-shell .gn-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
  font-family: var(--ts-term);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gn-orange);
  text-shadow: 0 0 8px var(--gn-orange-dim);
}

.grid-neon .gn-dot {
  width: 7px;
  height: 7px;
  background: var(--gn-orange);
  box-shadow: 0 0 8px var(--gn-orange);
  animation: gn-blink 1.6s steps(2, jump-none) infinite;
}

@keyframes gn-blink {
  50% { opacity: 0.2; }
}

body.theme-typesafe.grid-neon .site-shell .certs-section .section-title {
  position: relative;
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  font-family: var(--gn-head);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gn-white);
  -webkit-text-stroke: 0;
  text-shadow: 0 0 6px rgba(77, 243, 255, 0.75), 0 0 22px rgba(77, 243, 255, 0.45),
    0 0 48px rgba(77, 243, 255, 0.25);
  border: 0;
}

/* Light line that draws itself under the title. */
body.theme-typesafe.grid-neon .site-shell .certs-section .section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(420px, 70%);
  height: 2px;
  background: linear-gradient(90deg, var(--gn-cyan), rgba(77, 243, 255, 0));
  box-shadow: 0 0 10px var(--gn-cyan);
  transform-origin: left;
  animation: gn-draw 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) both 0.2s;
}

@keyframes gn-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

body.theme-typesafe.grid-neon .site-shell .certs-section .research-intro {
  max-width: 62ch;
  color: rgba(233, 253, 255, 0.78);
}

/* Empty arena between the heading and the cards: the racers ride here. */
.grid-neon .gn-stage {
  position: relative;
  height: 46vh;
  min-height: 260px;
}

body.theme-typesafe.grid-neon .site-shell .gn-stage span {
  position: absolute;
  left: 50%;
  bottom: 0.4rem;
  transform: translateX(-50%);
  font-family: var(--ts-term);
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(233, 253, 255, 0.55);
}

/* -----------------------------------------------------------------------------
   Cards: dark glass, neon edge, corner brackets, sweeping light on hover
   -------------------------------------------------------------------------- */

body.theme-typesafe.grid-neon .site-shell .cert-card {
  --cert-accent: var(--gn-orange);
  --cert-glow: rgba(77, 243, 255, 0.35);
  border: 1px solid var(--gn-cyan-dim);
  border-radius: 2px;
  background: linear-gradient(160deg, rgba(4, 18, 26, 0.86) 0%, rgba(0, 4, 8, 0.9) 100%);
  backdrop-filter: blur(3px);
  box-shadow: inset 0 0 24px rgba(77, 243, 255, 0.06), 0 0 14px rgba(77, 243, 255, 0.12);
}

/* Every issuer shares the grid palette; the tint lives in the artwork glow. */
body.theme-typesafe.grid-neon .site-shell .cert-card--lablabai,
body.theme-typesafe.grid-neon .site-shell .cert-card--freecodecamp {
  --cert-glow: rgba(77, 243, 255, 0.35);
}
body.theme-typesafe.grid-neon .site-shell .cert-card--udemy,
body.theme-typesafe.grid-neon .site-shell .cert-card--deeplearningai {
  --cert-glow: rgba(255, 154, 60, 0.32);
}

body.theme-typesafe.grid-neon .site-shell .cert-card:hover,
body.theme-typesafe.grid-neon .site-shell .cert-card:focus-within {
  border-color: var(--gn-cyan);
  box-shadow: inset 0 0 30px rgba(77, 243, 255, 0.12), 0 0 0 1px rgba(77, 243, 255, 0.4),
    0 0 26px rgba(77, 243, 255, 0.38), 0 0 60px rgba(77, 243, 255, 0.16);
}

/* Corner brackets (top-left cyan, bottom-right orange). */
body.theme-typesafe.grid-neon .site-shell .cert-content::before,
body.theme-typesafe.grid-neon .site-shell .cert-content::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

body.theme-typesafe.grid-neon .site-shell .cert-content::before {
  top: 6px;
  left: 6px;
  border-top: 2px solid var(--gn-cyan);
  border-left: 2px solid var(--gn-cyan);
  filter: drop-shadow(0 0 4px var(--gn-cyan));
}

body.theme-typesafe.grid-neon .site-shell .cert-card::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 14px;
  height: 14px;
  border-right: 2px solid var(--gn-orange);
  border-bottom: 2px solid var(--gn-orange);
  filter: drop-shadow(0 0 4px var(--gn-orange));
  pointer-events: none;
  z-index: 1;
}

/* Light beam that races along the top edge, and back along the bottom. */
body.theme-typesafe.grid-neon .site-shell .cert-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 38%;
  height: 2px;
  background: linear-gradient(90deg, rgba(77, 243, 255, 0), var(--gn-cyan) 70%, #fff);
  box-shadow: 0 0 12px var(--gn-cyan);
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

body.theme-typesafe.grid-neon .site-shell .cert-card:hover::before,
body.theme-typesafe.grid-neon .site-shell .cert-card:focus-within::before {
  opacity: 1;
  animation: gn-race 1.1s cubic-bezier(0.5, 0, 0.3, 1) infinite;
}

@keyframes gn-race {
  from { transform: translateX(-110%); }
  to { transform: translateX(290%); }
}

/* Scanlines over the certificate artwork. */
body.theme-typesafe.grid-neon .site-shell .cert-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(77, 243, 255, 0.05) 0 1px,
    transparent 1px 3px
  );
  pointer-events: none;
}

body.theme-typesafe.grid-neon .site-shell .cert-art-img {
  border-radius: 0;
  filter: saturate(0.6) brightness(0.8) hue-rotate(-12deg);
  box-shadow: 0 0 30px var(--cert-glow);
}

body.theme-typesafe.grid-neon .site-shell .cert-card:hover .cert-art-img,
body.theme-typesafe.grid-neon .site-shell .cert-card:focus-within .cert-art-img {
  filter: none;
}

body.theme-typesafe.grid-neon .site-shell .cert-content {
  background: linear-gradient(90deg, rgba(0, 4, 8, 0.94) 0%, rgba(0, 4, 8, 0.78) 55%, transparent 85%);
}

body.theme-typesafe.grid-neon .site-shell .cert-brand {
  font-family: var(--ts-term);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gn-cyan);
}

body.theme-typesafe.grid-neon .site-shell .cert-date {
  font-family: var(--ts-term);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gn-orange);
}

body.theme-typesafe.grid-neon .site-shell .cert-title {
  font-family: var(--gn-head);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gn-white);
  text-shadow: 0 0 10px rgba(77, 243, 255, 0.35);
}

body.theme-typesafe.grid-neon .site-shell .cert-desc {
  color: rgba(233, 253, 255, 0.72);
}

body.theme-typesafe.grid-neon .site-shell .cert-tag {
  border: 1px solid var(--gn-cyan-dim);
  border-radius: 0;
  background: rgba(77, 243, 255, 0.06);
  color: var(--gn-white);
  font-family: var(--ts-term);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.theme-typesafe.grid-neon .site-shell .cert-tag--lead {
  border-color: var(--gn-orange);
  color: var(--gn-orange);
  background: rgba(255, 154, 60, 0.08);
  box-shadow: 0 0 10px rgba(255, 154, 60, 0.25);
}

body.theme-typesafe.grid-neon .site-shell .cert-id {
  font-family: var(--ts-term);
  color: rgba(233, 253, 255, 0.5);
}

body.theme-typesafe.grid-neon .site-shell .cert-id span {
  color: var(--gn-cyan);
}

body.theme-typesafe.grid-neon .site-shell .cert-go {
  border-radius: 0;
  border-color: var(--gn-cyan);
  color: var(--gn-cyan);
  background: rgba(0, 6, 10, 0.8);
  box-shadow: 0 0 12px rgba(77, 243, 255, 0.3);
}

body.theme-typesafe.grid-neon .site-shell .cert-card:hover .cert-go,
body.theme-typesafe.grid-neon .site-shell .cert-hit:focus-visible .cert-go {
  background: var(--gn-cyan);
  color: #00161c;
  box-shadow: 0 0 22px var(--gn-cyan);
}

body.theme-typesafe.grid-neon .site-shell .cert-hit:focus-visible {
  outline-color: var(--gn-cyan);
}

/* -----------------------------------------------------------------------------
   Build-in: cards materialise left-to-right behind a bright scan edge when
   the typesafe reveal script marks them `.ts-in`.
   -------------------------------------------------------------------------- */

body.theme-typesafe.grid-neon.ts-reveal-ready .cert-card.ts-reveal {
  opacity: 0;
  transform: none;
  transition: none;
}

body.theme-typesafe.grid-neon.ts-reveal-ready .cert-card.ts-reveal.ts-in {
  opacity: 1;
  animation: gn-build 0.9s cubic-bezier(0.25, 0.7, 0.2, 1) both;
}

body.theme-typesafe.grid-neon.ts-reveal-ready .cert-card.ts-reveal.ts-in:nth-child(3n + 2) {
  animation-delay: 0.12s;
}
body.theme-typesafe.grid-neon.ts-reveal-ready .cert-card.ts-reveal.ts-in:nth-child(3n) {
  animation-delay: 0.24s;
}

@keyframes gn-build {
  0% {
    clip-path: inset(0 100% 0 0);
    filter: brightness(2.4) saturate(0);
  }
  60% {
    clip-path: inset(0 0 0 0);
    filter: brightness(1.5) saturate(0.6);
  }
  100% {
    clip-path: inset(-40px -40px -40px -40px);
    filter: none;
  }
}

body.theme-typesafe.grid-neon.ts-reveal-ready .cert-card.ts-reveal.ts-in:hover,
body.theme-typesafe.grid-neon.ts-reveal-ready .cert-card.ts-reveal.ts-in:focus-within {
  transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
  body.theme-typesafe.grid-neon.ts-reveal-ready .cert-card.ts-reveal,
  body.theme-typesafe.grid-neon.ts-reveal-ready .cert-card.ts-reveal.ts-in {
    opacity: 1;
    animation: none;
  }
  body.theme-typesafe.grid-neon .site-shell .cert-card:hover::before {
    animation: none;
    opacity: 0;
  }
  .grid-neon .gn-dot,
  body.theme-typesafe.grid-neon .site-shell .certs-section .section-title::after {
    animation: none;
  }
}
