/* ============================================
   Portfolio - Custom Styles
   Manohar Rao | Web Developer
   ============================================ */

/* --- Coding particles (full-page wavy code snippets) --- */
.coding-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.code-particle {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0.4;
  color: #f59e0b;
  will-change: transform;
}
.dark .code-particle {
  opacity: 0.4;
  color: #fbbf24;
}
.code-particle--tag { color: #0ea5e9; }
.dark .code-particle--tag { color: #38bdf8; }
.code-particle--bracket { color: #f59e0b; }
.code-particle--prop { color: #8b5cf6; }
.dark .code-particle--prop { color: #a78bfa; }
@keyframes codeFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(8px, -12px) rotate(2deg); }
  50% { transform: translate(-5px, -20px) rotate(-1deg); }
  75% { transform: translate(10px, -10px) rotate(1deg); }
}
@keyframes codeFloatAlt {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(-10px, 15px) rotate(-2deg); }
  66% { transform: translate(6px, 8px) rotate(1deg); }
}
@media (prefers-reduced-motion: reduce) {
  .code-particle { animation: none !important; opacity: 0.06; }
}

/* --- Hero image --- */
.hero-image-wrap {
  max-width: 320px;
  width: 100%;
}
@media (min-width: 1024px) {
  .hero-image-wrap {
    max-width: 420px;
  }
}
.hero-image {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
}

.scroll-smooth.dark #hero-image{
  display:block;
}

.scroll-smooth.dark #hero-image-light{
  display:none;
}

/* --- Accessibility: Skip link --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: var(--tw-color-accent, #f59e0b);
  color: #0f172a;
  font-weight: 600;
  border-radius: 0.5rem;
  z-index: 100;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 1rem;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* --- Navbar: scrolled state --- */
header {
  transition: background 0.4s ease-in-out, box-shadow 0.4s ease-in-out;
}
header.scrolled {
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.dark header.scrolled {
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* --- Nav links --- */
.nav-link {
  color: inherit;
  font-weight: 500;
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: #f59e0b;
  transition: width 0.35s ease-in-out;
}
.nav-link:hover::after,
.nav-link:focus-visible::after {
  width: 100%;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 0.75rem;
  transition: transform 0.35s ease-in-out, box-shadow 0.35s ease-in-out, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.btn:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}
.btn-primary {
  background: #f59e0b;
  color: #0f172a;
}
.btn-primary:hover {
  background: #d97706;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.3);
}
.btn-outline {
  border: 2px solid #f59e0b;
  color: #f59e0b;
  background: transparent;
}
.btn-outline:hover {
  background: #f59e0b;
  color: #0f172a;
  transform: translateY(-2px);
}

/* --- Project category filters --- */
.project-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  max-width: 36rem;
  margin: -1.5rem auto 2.5rem;
  padding: 0 0.5rem;
}
@media (max-width: 640px) {
  .project-filters {
    max-width: 100%;
  }
}
.project-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 9999px;
  border: 2px solid #f59e0b;
  background: transparent;
  color: #f59e0b;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.project-filter-btn:hover {
  background: rgba(245, 158, 11, 0.12);
}
.project-filter-btn.is-active {
  background: #f59e0b;
  color: #0f172a;
  border-color: #f59e0b;
}
.project-filter-btn:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}
.dark .project-filter-btn {
  border-color: #f59e0b;
  color: #fbbf24;
}
.dark .project-filter-btn:hover {
  background: rgba(245, 158, 11, 0.18);
}
.dark .project-filter-btn.is-active {
  background: #f59e0b;
  color: #0f172a;
  border-color: #f59e0b;
}

/* When filtering: flatten "more" wrapper so all matching cards share one grid */
#projects.filter-active .projects-more-wrapper {
  display: contents;
}
#projects.filter-active .project-card--more:not(.is-filtered-out):not(.is-filter-hiding) {
  opacity: 1;
  transform: translateY(0);
}
#projects.filter-active .project-card:not(.is-filtered-out) {
  animation: projectFilterIn 0.2s ease;
}
@keyframes projectFilterIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
#projects-toggle-wrap.is-hidden {
  display: none;
}
/* Hide non-matches immediately from layout so grid reflows without holes */
.project-card.is-filter-hiding,
.project-card.is-filtered-out {
  display: none !important;
}

/* --- Section titles (for Intersection Observer animation) --- */
.section-title {
  font-size: 2.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: inherit;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.75s ease-in-out, transform 0.75s ease-in-out;
}
.section-title.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (min-width: 768px) {
  .section-title { font-size: 2.5rem; }
}

/* --- Skill cards --- */
.skill-card {
  padding: 1.5rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-in-out, transform 0.6s ease-in-out, box-shadow 0.4s ease-in-out, border-color 0.4s ease-in-out;
}
.dark .skill-card {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(255, 255, 255, 0.08);
}
.skill-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.skill-card:hover {
  box-shadow: 0 10px 40px -10px rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.3);
}

/* --- Project cards --- */
.project-card {
  border-radius: 1rem;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease-in-out, transform 0.65s ease-in-out;
  cursor: pointer;
}
.project-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.project-card-inner {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 1rem;
  height: 100%;
  transition: transform 0.45s ease-in-out, box-shadow 0.45s ease-in-out, border-color 0.4s ease-in-out;
}
.dark .project-card-inner {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.08);
}
.project-card:hover .project-card-inner {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.2);
  border-color: rgba(245, 158, 11, 0.4);
}
.project-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 600;
  color: #f59e0b;
  transition: transform 0.35s ease-in-out, color 0.35s ease-in-out;
}
.project-link:hover {
  color: #d97706;
  transform: translateX(4px);
}

/* --- Projects: View More wrapper (same grid as main projects so cards look identical) --- */
.projects-more-wrapper {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.6s ease-in-out, opacity 0.5s ease-in-out;
}
@media (min-width: 768px) {
  .projects-more-wrapper {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .projects-more-wrapper {
    grid-template-columns: repeat(3, 1fr);
  }
}
.projects-more-wrapper.revealed {
  max-height: 5000px;
  opacity: 1;
}
.project-card--more {
  border-radius: 1rem;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  cursor: pointer;
}
.project-card--more .project-card-inner {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 1rem;
  height: 100%;
  transition: transform 0.45s ease-in-out, box-shadow 0.45s ease-in-out, border-color 0.4s ease-in-out;
}
.dark .project-card--more .project-card-inner {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.08);
}
.project-card--more:hover .project-card-inner {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.2);
  border-color: rgba(245, 158, 11, 0.4);
}
.project-card--more.visible {
  opacity: 1;
  transform: translateY(0);
}
.project-link-no-url {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 600;
  color: #f59e0b;
  cursor: default;
}

/* --- Contact icons (Lucide) --- */
.contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.contact-icon svg {
  width: 1.15rem;
  height: 1.15rem;
  stroke-width: 2;
}
.contact-item:hover .contact-icon {
  background: rgba(245, 158, 11, 0.22);
}
.dark .contact-icon {
  background: rgba(245, 158, 11, 0.15);
}

/* --- Contact form inputs --- */
.input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  color: #0f172a;
  font-size: 1rem;
  transition: border-color 0.35s ease-in-out, box-shadow 0.35s ease-in-out;
}
.dark .input-field {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}
.input-field:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
.input-field::placeholder {
  color: #94a3b8;
}

/* --- Typing cursor: solid while typing, blink only when paused --- */
@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.cursor-solid {
  opacity: 1;
  animation: none;
}
.cursor-blink-on {
  animation: cursor-blink 1s step-end infinite;
}
#typing-cursor {
  transition: none;
}

/* --- Slow pulse for hero background --- */
@keyframes pulse-slow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}
.animate-pulse-slow {
  animation: pulse-slow 4s ease-in-out infinite;
}

/* --- Modal open state --- */
#project-modal {
  transition: opacity 0.4s ease-in-out;
}
#project-modal .modal-content {
  transition: transform 0.4s ease-in-out;
}
#project-modal.open {
  opacity: 1;
  pointer-events: auto;
}
#project-modal.open .modal-content {
  transform: scale(1);
}

/* --- Reduced motion preference --- */
@media (prefers-reduced-motion: reduce) {
  .section-title,
  .skill-card,
  .project-card,
  .project-card--more,
  .btn,
  .project-card-inner,
  .nav-link::after,
  .projects-more-wrapper,
  .project-filter-btn,
  .project-card.is-filter-hiding {
    transition: none;
  }
  .animate-bounce,
  .animate-pulse-slow,
  .cursor-blink-on {
    animation: none;
  }
}
