/* ═══════════════════════════════════════════════════════
   Mohammed Essam — Neo-Brutalist Portfolio
   Custom CSS (extends Tailwind)
═══════════════════════════════════════════════════════ */

/* ─── Base Reset & Fonts ─── */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(255, 230, 0, 0.08), transparent 32%),
              radial-gradient(circle at bottom right, rgba(0, 229, 255, 0.06), transparent 25%),
              #0A0A0A;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

section {
  position: relative;
}

section .reveal-up,
section .reveal-right {
  will-change: opacity, transform;
}

::selection {
  background: #FFE600;
  color: #0A0A0A;
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #0A0A0A;
}
::-webkit-scrollbar-thumb {
  background: #FFE600;
  border: 2px solid #0A0A0A;
}
::-webkit-scrollbar-thumb:hover {
  background: #FF5C00;
}

/* ─── Navbar scroll behavior ─── */
#navbar {
  background: transparent;
  backdrop-filter: none;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}

#navbar.scrolled {
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 0 0 #FFE600;
}

/* ─── Hero Canvas ─── */
#hero-canvas {
  pointer-events: none;
}

/* ─── Animated Shapes ─── */
@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(12deg); }
  50%       { transform: translateY(-20px) rotate(18deg); }
}

@keyframes float-slow {
  0%, 100% { transform: translateY(0px) rotate(-6deg); }
  50%       { transform: translateY(-14px) rotate(-10deg); }
}

.shape-float {
  animation: float 5s ease-in-out infinite;
}

.shape-float-slow {
  animation: float-slow 7s ease-in-out infinite;
}

/* ─── Pulse dot ─── */
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%       { transform: scale(2.5); opacity: 0.2; }
}

.pulse-dot {
  animation: pulse-dot 2.5s ease-in-out infinite;
}

/* ─── Marquee text ─── */
@keyframes marquee {
  0%   { transform: translateX(0%); }
  100% { transform: translateX(-50%); }
}

.marquee-text {
  animation: marquee 30s linear infinite;
  white-space: nowrap;
}

/* ─── Hero name stroke ─── */
.hero-name-stroke {
  -webkit-text-stroke: 3px #FFE600;
  color: transparent;
  font-size: clamp(3rem, 9vw, 6rem);
}

.section-title {
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.section-subtitle {
  max-width: 42rem;
  color: rgba(245, 245, 240, 0.7);
}

@media (max-width: 640px) {
  .hero-name-stroke {
    -webkit-text-stroke: 2px #FFE600;
  }
}

/* ─── Typing cursor ─── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.typing-cursor {
  animation: blink 1s step-end infinite;
}

/* ─── Scroll dot ─── */
@keyframes scroll-bounce {
  0%         { transform: translateY(0); opacity: 1; }
  80%, 100%  { transform: translateY(16px); opacity: 0; }
}

.scroll-dot {
  animation: scroll-bounce 1.8s ease-in-out infinite;
}

/* ─── Reveal animations ─── */
.reveal-up {
  opacity: 0;
  transform: translateY(48px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(48px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ─── Skill bar animation ─── */
.bar-fill {
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── CTA Button pulse glow ─── */
@keyframes btn-glow {
  0%, 100% { box-shadow: 8px 8px 0 0 #0A0A0A; }
  50%       { box-shadow: 8px 8px 0 0 #0A0A0A, 0 0 20px rgba(255, 230, 0, 0.4); }
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 13rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.cta-btn:hover {
  animation: btn-glow 1.5s ease-in-out infinite;
}

#hero .cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

#hero .cta-group .cta-btn {
  flex: 1 1 auto;
}

#hero .hero-copy {
  max-width: 42rem;
}

.project-card {
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  min-height: 18rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(26, 26, 26, 0.96);
  border-radius: 1rem;
  overflow: hidden;
}

.project-card .relative.overflow-hidden.h-44 {
  border-radius: 1rem 1rem 0 0;
}

.project-card .p-4 {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-bottom: 1.25rem;
}

.project-card h3 {
  line-height: 1.25;
}

.project-card.blurred-project {
  filter: blur(6px);
  opacity: 0.72;
  pointer-events: none;
}

.project-card.blurred-project:hover {
  transform: none;
  box-shadow: none;
}

.project-card-blurred-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid #FFE600;
  color: #FFE600;
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.45rem 0.75rem;
  border-radius: 9999px;
}

/* ─── Form input focus glow ─── */
input:focus,
textarea:focus,
select:focus {
  box-shadow: 4px 4px 0 0 #FFE600;
}

/* ─── Form styles ─── */
select option {
  background: #1A1A1A;
  color: #F5F5F0;
}

/* ─── Stat item counter animation ─── */
.stat-item {
  position: relative;
}

.stat-item span:first-child {
  display: block;
  min-width: 3.5rem;
}

/* ─── About card tilt ─── */
.about-card {
  transform-origin: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ─── Upcoming card progress ─── */
.upcoming-progress-bar {
  border: 1px solid rgba(255,255,255,0.1);
}

/* ─── Skill tags hover ─── */
.skill-tag {
  display: inline-block;
  user-select: none;
}

/* ─── Noise texture overlay ─── */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── Mobile menu animation ─── */
#mobile-menu {
  transition: max-height 0.3s ease, opacity 0.3s ease;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

#mobile-menu.open {
  max-height: 400px;
  opacity: 1;
}

/* Mobile menu item hover */
.mobile-nav-link:active {
  background: rgba(255, 230, 0, 0.1);
}

/* ─── Glitch effect on logo ─── */
@keyframes glitch-1 {
  0%   { clip-path: inset(40% 0 61% 0); transform: translate(-2px, 0); }
  20%  { clip-path: inset(92% 0 1% 0);  transform: translate(2px, 0); }
  40%  { clip-path: inset(43% 0 1% 0);  transform: translate(-1px, 0); }
  60%  { clip-path: inset(25% 0 58% 0); transform: translate(0, 0); }
  80%  { clip-path: inset(54% 0 7% 0);  transform: translate(1px, 0); }
  100% { clip-path: inset(58% 0 43% 0); transform: translate(-2px, 0); }
}

/* ─── Active nav link ─── */
.nav-link.active {
  border-bottom-color: #FFE600;
  color: #FFE600;
}

/* ─── Responsive: portfolio cards ─── */
@media (max-width: 640px) {
  .project-card:hover {
    transform: none;
    box-shadow: none;
  }
}

/* ─── Skill category ─── */
.skill-category {
  height: 100%;
}

/* ─── Transition for stat counters ─── */
@keyframes count-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stat-item.animate {
  animation: count-up 0.6s ease forwards;
}

/* ─── Contact form success state ─── */
#form-status.success {
  display: block;
  border-color: #00FF88;
  color: #00FF88;
  background: rgba(0, 255, 136, 0.05);
}

#form-status.error {
  display: block;
  border-color: #FF2D78;
  color: #FF2D78;
  background: rgba(255, 45, 120, 0.05);
}

/* ─── Portfolio grid entrance stagger ─── */
#portfolio-grid .project-card:nth-child(1)  { transition-delay: 0.05s; }
#portfolio-grid .project-card:nth-child(2)  { transition-delay: 0.10s; }
#portfolio-grid .project-card:nth-child(3)  { transition-delay: 0.15s; }
#portfolio-grid .project-card:nth-child(4)  { transition-delay: 0.20s; }
#portfolio-grid .project-card:nth-child(5)  { transition-delay: 0.25s; }
#portfolio-grid .project-card:nth-child(6)  { transition-delay: 0.30s; }
#portfolio-grid .project-card:nth-child(7)  { transition-delay: 0.35s; }
#portfolio-grid .project-card:nth-child(8)  { transition-delay: 0.40s; }
#portfolio-grid .project-card:nth-child(9)  { transition-delay: 0.45s; }
#portfolio-grid .project-card:nth-child(10) { transition-delay: 0.50s; }
#portfolio-grid .project-card:nth-child(11) { transition-delay: 0.55s; }
#portfolio-grid .project-card:nth-child(12) { transition-delay: 0.60s; }
#portfolio-grid .project-card:nth-child(13) { transition-delay: 0.65s; }
#portfolio-grid .project-card:nth-child(14) { transition-delay: 0.70s; }
#portfolio-grid .project-card:nth-child(15) { transition-delay: 0.75s; }
#portfolio-grid .project-card:nth-child(16) { transition-delay: 0.80s; }

/* ─── Cursor custom (optional) ─── */
@media (pointer: fine) {
  body {
    cursor: default;
  }
  a, button, [role="button"] {
    cursor: pointer;
  }
}

/* ─── Social Icon Buttons (Hero) ─── */
.social-icon-btn {
  position: relative;
  overflow: hidden;
}

.social-icon-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.social-icon-btn:hover::after {
  opacity: 0.08;
}

/* ─── Social Profile Cards (Contact section) ─── */
.social-profile-card {
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.social-profile-card:hover {
  transform: translateY(-2px) translateX(-2px);
}

/* ─── Photo Frame Hero ─── */
.photo-frame-hero {
  position: relative;
  width: min(100%, 310px);
  aspect-ratio: 310 / 420;
  overflow: hidden;
}

.photo-frame-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 8%;
  transition: transform 0.5s ease;
}

.photo-frame-hero:hover img {
  transform: scale(1.03);
}

/* ─── Portfolio Screenshot Cards ─── */
.project-card .h-44 {
  position: relative;
  overflow: hidden;
}

/* ─── AI Projects screenshot cards ─── */
.ai-projects-card {
  display: block;
  background: #171717;
  border-color: rgba(255, 230, 0, 0.15);
}

.ai-project-screenshot {
  position: relative;
  width: 100%;
  min-height: 14rem;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.ai-project-screenshot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 5;
  pointer-events: none;
}

.ai-project-browser-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  z-index: 15;
}

.ai-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 9999px;
  display: inline-block;
  border: 1px solid rgba(10, 10, 10, 0.08);
}

.ai-browser-url {
  color: #111;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.ai-project-screenshot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(1.5px) brightness(1.05);
  transform: scale(1.02);
  transition: transform 0.4s ease, filter 0.4s ease;
}

.ai-project-screenshot:hover img {
  transform: scale(1.05);
  filter: blur(1px) brightness(1.08);
}

.ai-projects-card:hover {
  transform: translateY(-6px) translateX(-6px);
}

.ai-projects-card .p-4 {
  padding: 1.25rem;
}

/* ─── Mobile-specific improvements (performance + layout) ─── */
@media (max-width: 768px) {
  /* disable heavy canvas on small screens for performance */
  #hero-canvas {
    display: none !important;
    pointer-events: none;
  }

  /* reduce decorative marquee for small screens */
  .marquee-text {
    display: none;
  }

  /* scale down photo frame on mobile */
  .photo-frame-hero {
    width: min(100%, 280px) !important;
    height: auto !important;
    margin: 0 auto;
  }

  .photo-frame-hero img {
    object-position: center 12%;
    min-height: 320px;
  }

  /* soften hero name stroke on small screens */
  .hero-name-stroke {
    -webkit-text-stroke: 2px #FFE600;
  }

  #hero .cta-group {
    flex-direction: column;
  }

  .cta-btn {
    width: 100%;
    min-width: auto;
  }

  #hero .hero-copy {
    max-width: 100%;
  }

  #hero {
    min-height: auto !important;
    height: auto !important;
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  #hero .relative.z-10.max-w-6xl {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* ensure large headings don't overflow */
  h1 .block {
    font-size: clamp(1.6rem, 6vw, 3.6rem) !important;
    line-height: 1.02;
  }

  /* mobile menu full height and scrollable */
  #mobile-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 64px;
    z-index: 60;
    background: #0A0A0A;
    border-top: 4px solid #FFE600;
    padding-bottom: 1rem;
  }

  #mobile-menu.open {
    max-height: calc(100vh - 64px);
    overflow: auto;
  }

  #mobile-menu .mobile-nav-link {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* mobile carousel for large sections */
  .carousel-snap {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-left: -0.5rem;
    padding-left: 0.5rem;
    justify-content: flex-start;
  }

  .carousel-snap::-webkit-scrollbar {
    display: none;
  }

  .carousel-snap {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .carousel-snap .project-card,
  .carousel-snap .ai-projects-card,
  .carousel-snap .skill-category {
    scroll-snap-align: start;
    flex: 0 0 auto;
    width: min(90vw, 360px);
    max-width: 360px;
  }

  .carousel-snap .project-card {
    min-height: 18rem;
  }

  .carousel-snap .ai-projects-card {
    width: min(90vw, 340px);
    max-width: 340px;
  }

  .carousel-snap .skill-category {
    width: min(90vw, 320px);
    max-width: 320px;
  }

  /* reduce motion for reveal animations on mobile */
  .reveal-up, .reveal-right {
    transition: none;
    transform: none !important;
    opacity: 1 !important;
  }
}

.project-card img {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-card:hover img {
  transform: scale(1.06);
}

/* Fix fallback gradient divs */
.project-card [style*="display:none"] {
  display: none !important;
}

/* ─── Print styles ─── */
@media print {
  #navbar, .shape-float, .shape-float-slow,
  #hero-canvas, .scroll-arrow { display: none; }
  body { background: white; color: black; }
}
