/* Base Layout & Reset */
:root {
  --bg-primary: #050505;
  --bg-secondary: #0A0A0A;
  --text-main: #FFFFFF;
  --text-muted: #888888;
  --accent: #007aff;
  --border-color: #222222;
  --code-bg: #0C1017;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Layout Asimétrico */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 320px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  overflow-y: auto;
}

.profile .back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 2rem;
  transition: color 0.2s;
}
.profile .back-link:hover {
  color: var(--text-main);
}
.profile .logo {
  font-size: 1.5rem;
  margin: 0 0 0.5rem 0;
}
.profile .bio {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.categories {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
  font-weight: 500;
}

/* Main Content Area */
.content {
  flex: 1;
  margin-left: 320px; /* offset sidebar */
  padding: 4rem;
  display: flex;
  flex-direction: column;
  gap: 5rem;
}

/* Responsive: collapse sidebar on mobile */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    position: relative;
    width: 100%;
    top: auto;
    bottom: auto;
    left: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    gap: 1.5rem;
  }
  .profile .back-link {
    margin-bottom: 1rem;
  }
  .categories {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .nav-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  .content {
    margin-left: 0;
    padding: 2rem 1rem;
    gap: 3rem;
  }
  .showcase-header h2 {
    font-size: 1.5rem;
  }
  .preview-area {
    min-height: 180px;
  }
}

.showcase-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 800px;
}

.showcase-header {
  margin-bottom: 1rem;
}

.showcase-header .badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 99px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.showcase-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
}

.showcase-header p {
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* Preview Areas */
.preview-area {
  min-height: 250px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  position: relative;
  overflow: hidden;
}

.preview-area.dark-preview {
  background: #000;
}

.preview-area.gradient-preview {
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
}

/* Code Window (macOS style) */
.code-window {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background-color: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border-color);
}

.traffic-lights {
  display: flex;
  gap: 8px;
  width: 60px; /* balance copy btn width */
}

.traffic-lights .light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.light.red { background-color: #ff5f56; }
.light.yellow { background-color: #ffbd2e; }
.light.green { background-color: #27c93f; }

.window-title {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.copy-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 75px;
  font-family: var(--font-sans);
}
.copy-btn:hover {
  background: rgba(255,255,255,0.2);
}
.copy-btn.copied {
  background: #27c93f;
  border-color: #27c93f;
  color: #000;
  font-weight: 500;
}

.window-body {
  padding: 0 1.25rem 1.25rem 1.25rem;
  overflow-x: auto;
}

.window-body pre {
  margin: 0;
  background: transparent !important;
  font-family: var(--font-mono) !important;
  font-size: 0.9rem !important;
}

/* COMPONENT 1: Magnetic Button */
.magnetic-btn {
  background: white;
  color: black;
  border: none;
  padding: 1rem 2rem;
  border-radius: 99px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease-out; /* Smooth physical return */
}
.magnetic-btn:hover {
  transition: none; /* Instant follow when hovered */
}
.magnetic-text {
  display: inline-block;
  pointer-events: none;
  transition: transform 0.15s ease-out;
}
.magnetic-btn:hover .magnetic-text {
  transition: none;
}

/* COMPONENT 2: Glow Card */
.glow-card {
  position: relative;
  background: #111;
  border-radius: 16px;
  padding: 1px; /* the gap for the glow border */
  overflow: hidden;
  width: 280px;
}

.glow-card::before {
  content: "";
  position: absolute;
  top: var(--y, 0);
  left: var(--x, 0);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,215,0,0.5) 0%, transparent 60%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.glow-card:hover::before {
  opacity: 1;
}

.glow-card-content {
  background: #111;
  border-radius: 15px;
  position: relative;
  z-index: 1;
  padding: 2rem;
  min-height: 120px;
}

.glow-card-content h3 { margin-top: 0; }
.glow-card-content p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; margin-bottom: 0;}

/* COMPONENT 3: Glass OTP */
.otp-container {
  display: flex;
  gap: 12px;
}

.otp-input {
  width: 50px;
  height: 60px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  font-size: 1.5rem;
  text-align: center;
  transition: all 0.2s;
  outline: none;
  font-family: var(--font-mono);
}

.otp-input:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

/* COMPONENT 4: Spring Toggle */
.spring-toggle input {
  display: none;
}

.toggle-track {
  width: 60px; 
  height: 32px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 99px;
  padding: 4px;
  cursor: pointer;
  transition: background 0.4s ease, border-color 0.4s ease;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.toggle-thumb {
  width: 24px; 
  height: 24px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  /* Cubic bezier para el efecto rebote / spring */
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spring-toggle input:checked + .toggle-track {
  background: #27c93f;
  border-color: #27c93f;
}

.spring-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(26px);
}

/* COMPONENT 5: Parallax 3D Card */
.parallax-card {
  perspective: 1000px;
  width: 280px;
  height: 350px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.1s;
}

.parallax-content {
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  transition: box-shadow 0.3s;
}

.parallax-content h3 { margin: 0 0 0.5rem 0; font-size: 1.5rem; }
.parallax-content p { color: var(--text-muted); margin: 0; }

/* COMPONENT 6: Text Scrambler */
.scramble-text {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  color: var(--text-main);
  background: linear-gradient(90deg, #ff0080, #7928ca);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: crosshair;
  padding: 1rem;
}

/* COMPONENT 7: Infinite Marquee */
.marquee-container {
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
  background: var(--code-bg);
  padding: 1.5rem 0;
  display: flex;
}

.marquee-content {
  display: flex;
  gap: 3rem;
  animation: scroll 15s linear infinite;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: bold;
}

@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* COMPONENT 8: Meteor Background */
.meteor {
  position: absolute;
  width: 2px;
  height: 60px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
  border-radius: 99px;
  transform: rotate(45deg);
  animation: meteorFall linear infinite;
  opacity: 0;
}

.meteor::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 10px 2px rgba(255,255,255,0.8);
}

@keyframes meteorFall {
  0% { transform: rotate(45deg) translateY(-200px); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: rotate(45deg) translateY(600px); opacity: 0; }
}

/* COMPONENT 9: Blob Button */
.blob-btn {
  position: relative;
  padding: 1rem 3rem;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  color: white;
  transition: transform 0.2s;
}

.blob-btn:hover {
  transform: scale(1.05);
}

.blob-text {
  position: relative;
  z-index: 10;
  font-weight: 600;
  font-size: 1rem;
}

.blob-bg {
  position: absolute;
  inset: 0;
  background: #111;
  z-index: 1;
}

.blob-bg::before, .blob-bg::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  filter: blur(20px);
  animation: blobMotion 4s infinite alternate ease-in-out;
}

.blob-bg::before { background: #ff0080; left: -20px; top: -20px; }
.blob-bg::after { background: #7928ca; right: -20px; bottom: -20px; animation-delay: -2s; }

@keyframes blobMotion {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 40px) scale(1.5); }
}

/* Syntax Highlighting Tweaks */
:not(pre) > code[class*="language-"], pre[class*="language-"] {
  background: transparent !important;
}
.token.keyword { color: #ff7b72 !important; }
.token.string { color: #a5d6ff !important; }
.token.function { color: #d2a8ff !important; }
.token.number { color: #f2cc60 !important; }
.token.operator { color: #79c0ff !important; }
.token.property { color: #7ee787 !important; }
