/*
 * devs.dev — Premium design system
 */

/* ─── Base ─────────────────────────────────── */
::selection {
  background: rgba(168, 85, 247, 0.3);
  color: #e7e9ea;
}

/* Premium scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2f3336; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #536471; }

/* Smooth transitions globally */
* { -webkit-tap-highlight-color: transparent; }
a, button { transition: all 0.15s ease; }
img { transition: opacity 0.2s ease; }

/* ─── Layout chrome ────────────────────────── */
.main-column {
  border-left: 1px solid #2f3336;
  border-right: 1px solid #2f3336;
  min-height: 100vh;
  overflow-x: clip;
}

/* ─── Animations ───────────────────────────── */

/* Heart pop on like */
@keyframes heart-pop {
  0% { transform: scale(1); }
  15% { transform: scale(1.25); }
  30% { transform: scale(0.95); }
  45% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.animate-heart-pop svg {
  animation: heart-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Repost bounce */
@keyframes repost-bounce {
  0% { transform: scale(1) rotate(0); }
  30% { transform: scale(1.2) rotate(8deg); }
  60% { transform: scale(0.95) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}
.animate-repost-bounce svg {
  animation: repost-bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Button press */
@keyframes btn-press {
  0% { transform: scale(1); }
  50% { transform: scale(0.96); }
  100% { transform: scale(1); }
}
.animate-btn-press { animation: btn-press 0.15s ease-out; }

/* Fade slide in for turbo stream appends */
@keyframes fade-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
turbo-stream + * > article,
turbo-stream + div[id^="comment_"] {
  animation: fade-slide-in 0.25s ease-out;
}

/* Subtle shimmer for skeleton loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ─── Landing page animations ────────────── */

/* Hero entrance */
.hero-hidden {
  opacity: 0;
  transform: translateY(20px);
}
.hero-hidden.hero-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Scroll reveal variants */
.reveal-up,
.reveal-scale,
.reveal-left,
.reveal-right {
  opacity: 0;
  will-change: opacity, transform;
}
.reveal-up { transform: translateY(30px); }
.reveal-scale { transform: scale(0.95); }
.reveal-left { transform: translateX(-40px); }
.reveal-right { transform: translateX(40px); }

.reveal-up.revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

/* Gradient text color shift */
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.gradient-animate {
  background-size: 200% 200%;
  animation: gradient-shift 6s ease infinite;
}

/* Hero background glow drift */
@keyframes float-glow {
  0%, 100% { transform: translate(-50%, 0) scale(1); opacity: 0.07; }
  50% { transform: translate(-50%, -20px) scale(1.05); opacity: 0.12; }
}
.glow-drift {
  animation: float-glow 8s ease-in-out infinite;
}

/* Hero geometric shapes floating */
@keyframes float-shape {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-8px); opacity: 0.7; }
}

/* Typewriter blinking cursor */
.typewriter-cursor::after {
  content: '▋';
  animation: cursor-blink 0.7s step-end infinite;
  color: #3fb950;
  margin-left: 1px;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Counter completion glow */
@keyframes count-glow {
  0% { text-shadow: none; }
  50% { text-shadow: 0 0 12px rgba(168, 85, 247, 0.5); }
  100% { text-shadow: none; }
}
.count-glow {
  animation: count-glow 0.6s ease;
}

/* CTA button pulse ring */
@keyframes cta-pulse {
  0% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(168, 85, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}
.cta-pulse {
  animation: cta-pulse 2.5s ease-in-out infinite;
}

/* Subtle dot grid pattern */
.dot-grid {
  background-image: radial-gradient(circle, rgba(168, 85, 247, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Card hover lift */
.card-hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.15);
}

/* Glow intensify on scroll reveal */
.glow-intensify {
  opacity: 0.05;
  transition: opacity 1s ease;
}
.glow-intensify.revealed {
  opacity: 0.12;
}

/* Reduced motion: show final state immediately, no animations */
@media (prefers-reduced-motion: reduce) {
  .hero-hidden {
    opacity: 1;
    transform: none;
  }
  .reveal-up,
  .reveal-scale,
  .reveal-left,
  .reveal-right {
    opacity: 1;
    transform: none;
  }
  .gradient-animate { animation: none; }
  .glow-drift { animation: none; }
  .hero-shape { animation: none !important; }
  .cta-pulse { animation: none; }
  .typewriter-cursor::after { animation: none; }
  .count-glow { animation: none; }
  .card-hover-lift:hover { transform: none; }
}

/* ─── Dev identity: gradient avatar rings ──── */
.avatar-gradient-ring {
  padding: 2px;
  background: linear-gradient(135deg, #a855f7, #6366f1, #3b82f6);
  border-radius: 9999px;
  transition: all 0.2s ease;
  align-self: flex-start;
  flex-shrink: 0;
}
.avatar-gradient-ring:hover {
  background: linear-gradient(135deg, #c084fc, #818cf8, #60a5fa);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.3), 0 0 24px rgba(99, 102, 241, 0.15);
}
.avatar-gradient-ring > * {
  border-radius: 9999px;
  overflow: hidden;
  display: block;
}

/* ─── Dev identity: terminal commit box ────── */
.terminal-box {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 8px;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', ui-monospace, monospace;
  overflow: hidden;
}
.terminal-box summary {
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', ui-monospace, monospace;
}
.terminal-header {
  background: #161b22;
  border-bottom: 1px solid #21262d;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}
.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.terminal-dot-red { background: #ff5f57; }
.terminal-dot-yellow { background: #febc2e; }
.terminal-dot-green { background: #28c840; }

/* ─── Dev identity: monospace handles ─────── */
.handle-mono {
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', ui-monospace, monospace;
  letter-spacing: -0.01em;
}

/* ─── Dev identity: left nav active bar ────── */
.nav-item-active {
  position: relative;
}
.nav-item-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  background: linear-gradient(180deg, #a855f7, #6366f1);
  border-radius: 0 3px 3px 0;
}

/* ─── Dev identity: sidebar card headers ──── */
.sidebar-card {
  background: #16181c;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #21262d;
}
.sidebar-card-header {
  padding: 10px 12px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Interactive elements ─────────────────── */

/* Align button_to forms inside flex action bars */
article form {
  display: flex;
  align-items: center;
  margin: 0;
}

/* Post card hover */
article {
  transition: background-color 0.15s ease;
}

/* Action button hover glow */
.action-btn {
  transition: all 0.15s ease;
}

/* Primary button glow */
.btn-primary {
  transition: all 0.2s ease;
}
.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
}

/* Language bar */
.lang-segment { transition: opacity 0.15s ease; }
.lang-segment:hover { opacity: 0.8; }

/* ─── Nav active states ────────────────────── */
.nav-link {
  position: relative;
  transition: color 0.15s ease;
}
.nav-link.active {
  color: #e7e9ea;
  font-weight: 700;
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: #a855f7;
  border-radius: 2px;
}

/* ─── Toast notifications ──────────────────── */
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translate(-50%, 0) scale(1); }
  to { opacity: 0; transform: translate(-50%, -8px) scale(0.95); }
}
.toast {
  animation: toast-in 0.25s ease-out;
}

/* ─── New posts pulse ─────────────────────── */
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.7; }
}
.new-posts-dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ─── Focus states ─────────────────────────── */
input:focus, textarea:focus {
  outline: none;
}
input[type="text"]:focus {
  caret-color: #a855f7;
}

/* ─── Three-column responsive layout ─────── */
.top-nav      { display: block; }
.left-sidebar { display: none; }
.right-sidebar { display: none; }
.center-column { padding-top: 53px; }

/* lg+ (1024px): show right sidebar */
@media (min-width: 1024px) {
  .right-sidebar { display: block; }
  .right-sidebar > div {
    top: 53px;
    height: calc(100vh - 53px);
  }
}

/* desktop (1080px+): show left sidebar, hide hamburger */
@media (min-width: 1080px) {
  .mobile-menu-toggle { display: none; }
  .left-sidebar  { display: flex; width: 220px; }
  .left-sidebar > div { width: 220px; }
  .right-sidebar { width: 300px; }
  .right-sidebar > div { width: 300px; }
  .sticky-top    { top: 53px; }
}

/* wide desktop (1280px+): full-width sidebars */
@media (min-width: 1280px) {
  .left-sidebar  { width: 275px; }
  .left-sidebar > div { width: 275px; }
  .right-sidebar { width: 350px; }
  .right-sidebar > div { width: 350px; }
}

/* ─── Search ─────────────────────────────── */
.search-results {
  display: none;
}
.search-results.search-results-visible {
  display: block;
}

.search-input:focus {
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.5);
}

/* Mobile search overlay */
.search-mobile-overlay {
  display: none;
}
.search-mobile-overlay.search-mobile-open {
  display: block;
}

/* ─── Sidebar scroll ──────────────────────── */
.sidebar-scroll {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-scroll::-webkit-scrollbar {
  display: none;
}

/* ─── Flowbite tooltip support ────────────── */
.tooltip {
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.tooltip[data-popper-placement] {
  visibility: visible;
  opacity: 1;
}
.tooltip-arrow,
.tooltip-arrow::before {
  position: absolute;
  width: 8px;
  height: 8px;
  background: inherit;
}
.tooltip-arrow {
  visibility: hidden;
}
.tooltip-arrow::before {
  content: '';
  visibility: visible;
  transform: rotate(45deg);
}
.tooltip[data-popper-placement^='top'] .tooltip-arrow { bottom: -4px; }
.tooltip[data-popper-placement^='bottom'] .tooltip-arrow { top: -4px; }
.tooltip[data-popper-placement^='left'] .tooltip-arrow { right: -4px; }
.tooltip[data-popper-placement^='right'] .tooltip-arrow { left: -4px; }

/* ─── Follow button hover transition ─────── */
.follow-btn-following:hover {
  border-color: rgb(244, 33, 46) !important;
  color: rgb(244, 33, 46) !important;
  background: rgba(244, 33, 46, 0.1) !important;
}
