/* ==========================================================================
   CODEPEN PAGE — styles/codepen.css
   Hero · Filter · Pen Cards · CSS Demo Previews · CTA
   ========================================================================== */

/* --------------------------------------------------------------------------
   PAGE HERO
   -------------------------------------------------------------------------- */
.codepen-hero {
  background: linear-gradient(to bottom, var(--background-primary), var(--background-secondary));
  padding: 5rem 2rem 4rem;
  position: relative;
  overflow: hidden;
}

.codepen-hero-orb {
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 450px;
  background: radial-gradient(ellipse, rgba(95, 45, 241, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.codepen-hero-orb--secondary {
  top: auto;
  bottom: -80px;
  left: 20%;
  width: 400px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(199, 120, 221, 0.08) 0%, transparent 70%);
}

.codepen-hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.8rem);
  font-weight: 700;
  margin-bottom: 1.2rem;
}

.codepen-hero-subtitle {
  font-size: 1.1rem;
  max-width: 580px;
  margin: 0 auto 2rem;
}

.codepen-hero-cta {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* --------------------------------------------------------------------------
   FILTER SECTION
   -------------------------------------------------------------------------- */
.filter-section {
  padding: 1.5rem 2rem;
  background: var(--background-secondary);
  border-bottom: 1px solid rgba(95, 45, 241, 0.1);
  position: sticky;
  top: 72px; /* nav-height */
  z-index: 10;
}

.filter-tags {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: var(--container-max);
  margin: 0 auto;
}

.filter-tag {
  background: rgba(99, 108, 113, 0.08);
  border: 1px solid rgba(99, 108, 113, 0.2);
  color: var(--color-light-grey);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-base);
}

.filter-tag:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: rgba(100, 255, 218, 0.05);
}

.filter-tag--active {
  background: rgba(100, 255, 218, 0.1);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   PENS SECTION
   -------------------------------------------------------------------------- */
.pens-section {
  background: var(--background-primary);
}

.pens-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.8rem;
}

/* --------------------------------------------------------------------------
   PEN CARD
   -------------------------------------------------------------------------- */
.pen-card {
  background: var(--background-secondary);
  border: 1px solid rgba(99, 108, 113, 0.15);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.pen-card:hover {
  transform: translateY(-6px);
  border-color: rgba(95, 45, 241, 0.4);
  box-shadow: 0 16px 40px rgba(95, 45, 241, 0.15);
}

.pen-card-body {
  padding: 1.4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pen-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pen-coming-badge {
  background: rgba(199, 120, 221, 0.1);
  border: 1px solid rgba(199, 120, 221, 0.3);
  color: var(--color-pink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-pill);
}

.pen-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-white);
  line-height: 1.3;
}

.pen-card-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-light-grey);
  flex: 1;
}

.pen-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.pen-card-tags .skill-tag {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
}

/* --------------------------------------------------------------------------
   PEN PREVIEW — shared styles
   -------------------------------------------------------------------------- */
.pen-preview {
  height: 200px;
  position: relative;
  overflow: hidden;
  background: #1a1e23;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(99, 108, 113, 0.1);
}

/* --------------------------------------------------------------------------
   DEMO 1 — GSAP Scroll Animation Preview
   -------------------------------------------------------------------------- */
.pen-preview--gsap {
  background: radial-gradient(ellipse at 50% 0%, rgba(95, 45, 241, 0.08) 0%, #1a1e23 70%);
}

.gsap-demo {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}

.gsap-track {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

.gsap-box {
  width: 28px;
  border-radius: 4px;
  animation: gsapRise 2s ease-in-out infinite;
}

.gsap-box--1 {
  height: 60px;
  background: var(--color-purple);
  animation-delay: 0s;
}

.gsap-box--2 {
  height: 80px;
  background: linear-gradient(to top, var(--color-purple), var(--color-pink));
  animation-delay: 0.2s;
}

.gsap-box--3 {
  height: 50px;
  background: var(--color-pink);
  animation-delay: 0.4s;
}

.gsap-box--4 {
  height: 70px;
  background: linear-gradient(to top, var(--color-pink), var(--color-accent));
  animation-delay: 0.6s;
}

@keyframes gsapRise {
  0%, 100% { opacity: 0.3; transform: scaleY(0.4) translateY(20px); }
  50%       { opacity: 1;   transform: scaleY(1)   translateY(0); }
}

.gsap-label-demo {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(100, 255, 218, 0.5);
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   DEMO 2 — CSS Glassmorphism Card Preview
   -------------------------------------------------------------------------- */
.pen-preview--glass {
  background: linear-gradient(135deg, #0d0221 0%, #1a0533 50%, #0a1628 100%);
}

.glass-demo {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glass-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(20px);
  animation: glassOrb 4s ease-in-out infinite alternate;
}

.glass-orb--1 {
  width: 100px;
  height: 100px;
  background: rgba(95, 45, 241, 0.6);
  top: 5%;
  left: 5%;
}

.glass-orb--2 {
  width: 80px;
  height: 80px;
  background: rgba(199, 120, 221, 0.5);
  bottom: 10%;
  right: 10%;
  animation-delay: 1s;
}

@keyframes glassOrb {
  from { transform: scale(1)   translate(0, 0); }
  to   { transform: scale(1.2) translate(8px, -8px); }
}

.glass-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.glass-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  margin-bottom: 0.2rem;
}

.glass-card-lines {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.glass-line {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  animation: glassPulse 2.5s ease-in-out infinite;
}

.glass-line--wide  { width: 100%; }
.glass-line--narrow { width: 60%; animation-delay: 0.3s; }
.glass-line--mid   { width: 80%; animation-delay: 0.6s; }

@keyframes glassPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

/* --------------------------------------------------------------------------
   DEMO 3 — SVG Path Animation Preview
   -------------------------------------------------------------------------- */
.pen-preview--svg {
  background: radial-gradient(ellipse at 50% 50%, rgba(100, 255, 218, 0.04) 0%, #1a1e23 70%);
}

.svg-demo {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.svg-path-demo {
  width: 85%;
  max-width: 220px;
}

.svg-path {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
}

.svg-path--1 {
  stroke: var(--color-accent);
  animation: svgDraw 2.5s ease-in-out infinite alternate;
}

.svg-path--2 {
  stroke: var(--color-pink);
  animation: svgDraw 2.5s ease-in-out infinite alternate;
  animation-delay: 0.4s;
}

.svg-path--3 {
  stroke: rgba(95, 45, 241, 0.6);
  animation: svgDraw 2.5s ease-in-out infinite alternate;
  animation-delay: 0.8s;
}

@keyframes svgDraw {
  0%   { stroke-dashoffset: 400; opacity: 0.2; }
  100% { stroke-dashoffset: 0;   opacity: 1; }
}

.svg-dot {
  fill: var(--color-accent);
  animation: svgDotPulse 2.5s ease-in-out infinite;
}

@keyframes svgDotPulse {
  0%, 100% { r: 4; opacity: 0.6; }
  50%       { r: 6; opacity: 1; }
}

.svg-label-demo {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(100, 255, 218, 0.5);
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   DEMO 4 — Magnetic Button Effect Preview
   -------------------------------------------------------------------------- */
.pen-preview--magnetic {
  background: #0e0e1a;
}

.magnetic-demo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.magnetic-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.magnetic-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(95, 45, 241, 0.3);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: magneticPulse 2.5s ease-out infinite;
}

.magnetic-ring--1 {
  width: 80px;
  height: 80px;
  animation-delay: 0s;
}

.magnetic-ring--2 {
  width: 120px;
  height: 120px;
  animation-delay: 0.5s;
  border-color: rgba(95, 45, 241, 0.2);
}

.magnetic-ring--3 {
  width: 160px;
  height: 160px;
  animation-delay: 1s;
  border-color: rgba(95, 45, 241, 0.1);
}

@keyframes magneticPulse {
  0%   { opacity: 1;   transform: translate(-50%, -50%) scale(0.8); }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(1.4); }
}

.magnetic-btn {
  position: relative;
  z-index: 1;
  background: var(--gradient-primary);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.65rem 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: default;
  box-shadow: 0 0 20px rgba(95, 45, 241, 0.5), 0 0 40px rgba(95, 45, 241, 0.2);
  animation: magneticBtnGlow 2s ease-in-out infinite alternate;
}

@keyframes magneticBtnGlow {
  from { box-shadow: 0 0 15px rgba(95, 45, 241, 0.4), 0 0 30px rgba(95, 45, 241, 0.15); }
  to   { box-shadow: 0 0 30px rgba(95, 45, 241, 0.7), 0 0 60px rgba(199, 120, 221, 0.3); }
}

.magnetic-btn-text {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   DEMO 5 — Particle Background Preview
   -------------------------------------------------------------------------- */
.pen-preview--particles {
  background: #0c0c14;
}

.particles-demo {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: particleFloat var(--dur, 4s) ease-in-out infinite alternate;
}

.particle--1  { width: 3px; height: 3px; background: var(--color-accent);  top: 15%; left: 10%; --dur: 3.1s; }
.particle--2  { width: 2px; height: 2px; background: var(--color-purple);  top: 25%; left: 80%; --dur: 4.2s; animation-delay: 0.5s; }
.particle--3  { width: 4px; height: 4px; background: var(--color-pink);    top: 70%; left: 20%; --dur: 3.7s; animation-delay: 1s; }
.particle--4  { width: 2px; height: 2px; background: var(--color-accent);  top: 60%; left: 75%; --dur: 5.0s; animation-delay: 0.3s; }
.particle--5  { width: 3px; height: 3px; background: var(--color-purple);  top: 40%; left: 35%; --dur: 3.4s; animation-delay: 0.8s; }
.particle--6  { width: 2px; height: 2px; background: var(--color-pink);    top: 10%; left: 55%; --dur: 4.8s; animation-delay: 1.2s; }
.particle--7  { width: 4px; height: 4px; background: var(--color-accent);  top: 80%; left: 50%; --dur: 3.9s; animation-delay: 0.2s; }
.particle--8  { width: 2px; height: 2px; background: rgba(255,255,255,0.4); top: 35%; left: 90%; --dur: 4.5s; animation-delay: 1.5s; }
.particle--9  { width: 3px; height: 3px; background: var(--color-purple);  top: 85%; left: 8%;  --dur: 3.2s; animation-delay: 0.7s; }
.particle--10 { width: 2px; height: 2px; background: var(--color-accent);  top: 5%;  left: 40%; --dur: 4.1s; animation-delay: 0.9s; }
.particle--11 { width: 3px; height: 3px; background: var(--color-pink);    top: 50%; left: 60%; --dur: 3.6s; animation-delay: 0.4s; }
.particle--12 { width: 2px; height: 2px; background: rgba(255,255,255,0.3); top: 90%; left: 35%; --dur: 5.2s; animation-delay: 1.1s; }

@keyframes particleFloat {
  0%   { opacity: 0.2; transform: translate(0, 0) scale(1); }
  50%  { opacity: 1;   transform: translate(8px, -12px) scale(1.5); }
  100% { opacity: 0.4; transform: translate(-6px, 8px) scale(0.8); }
}

.particles-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.particles-label-demo {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(100, 255, 218, 0.4);
  letter-spacing: 0.08em;
  display: block;
}

/* --------------------------------------------------------------------------
   DEMO 6 — Typewriter Effect Preview
   -------------------------------------------------------------------------- */
.pen-preview--typewriter {
  background: #0d1117;
}

.typewriter-demo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.typewriter-window {
  background: #161b22;
  border: 1px solid rgba(99, 108, 113, 0.3);
  border-radius: 8px;
  width: 220px;
  overflow: hidden;
}

.typewriter-dots {
  background: #21262d;
  padding: 0.4rem 0.7rem;
  display: flex;
  gap: 5px;
  border-bottom: 1px solid rgba(99, 108, 113, 0.2);
}

.typewriter-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: block;
}

.typewriter-dots span:nth-child(1) { background: #ff5f57; }
.typewriter-dots span:nth-child(2) { background: #ffbd2e; }
.typewriter-dots span:nth-child(3) { background: #28c840; }

.typewriter-content {
  padding: 0.6rem 0.8rem 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-light-grey);
  display: flex;
  align-items: center;
}

.typewriter-prompt {
  color: var(--color-accent);
  margin-right: 0.2rem;
  flex-shrink: 0;
}

.typewriter-text {
  color: var(--color-white);
  overflow: hidden;
  white-space: nowrap;
  width: 0;
  animation: typewrite 3s steps(12, end) infinite;
}

/* Inline text content via content property */
.typewriter-text::after {
  content: 'hello_world';
}

@keyframes typewrite {
  0%, 10%  { width: 0; }
  60%, 80% { width: 7.5em; }
  90%      { width: 7.5em; }
  100%     { width: 0; }
}

.typewriter-cursor {
  color: var(--color-accent);
  animation: blinkCursor 0.7s step-end infinite;
  margin-left: 1px;
  font-weight: 400;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.typewriter-line2 {
  padding: 0 0.8rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.typewriter-output {
  color: var(--color-pink);
  animation: outputFade 3s ease-in-out infinite;
  display: inline-block;
}

@keyframes outputFade {
  0%, 20%  { opacity: 0; }
  40%, 80% { opacity: 1; }
  100%     { opacity: 0; }
}

/* --------------------------------------------------------------------------
   CODEPEN CTA BANNER — override/extend shared .cta-banner
   -------------------------------------------------------------------------- */
.codepen-cta {
  background: var(--background-secondary);
}

.codepen-cta-banner {
  position: relative;
  text-align: center;
}

.cta-banner-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1.2rem;
  color: var(--color-purple);
  opacity: 0.8;
}

.codepen-cta-banner .section-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-purple);
  margin-bottom: 0.75rem;
}

.codepen-cta-banner h2 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.codepen-cta-banner > p {
  font-size: 1rem;
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------------------------------------
   REVEAL ANIMATION STATES
   (GSAP sets initial state via JS; these are fallback/structural styles)
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(30px);
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .pens-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .pens-grid {
    grid-template-columns: 1fr;
  }

  .codepen-hero h1 {
    font-size: 2rem;
  }

  .filter-section {
    top: 72px;
    padding: 1rem;
  }

  .filter-tags {
    gap: 0.4rem;
  }

  .pen-preview {
    height: 180px;
  }
}

@media (max-width: 480px) {
  .codepen-hero {
    padding: 3.5rem 1rem 3rem;
  }

  .codepen-cta-banner h2 {
    font-size: 1.5rem;
  }
}
