/* ============================================
   Rocha Carlos MD — Custom Styles
   ============================================ */

/* --- Base & Typography --- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
}

::selection {
  background: #F97066;
  color: #ffffff;
}

/* --- Navigation --- */
#header {
  background: rgba(250, 250, 249, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

#header.scrolled {
  background: rgba(250, 250, 249, 0.95);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.06);
}

.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: #F97066;
  border-radius: 1px;
  transition: width 0.2s ease;
}

.nav-link:hover::after {
  width: 60%;
}

/* --- Mobile Menu --- */
#mobileMenu.open {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#mobileMenu:not(.open) {
  opacity: 0 !important;
  pointer-events: none !important;
}

.mobile-nav-link {
  transition: all 0.2s ease;
}

/* Hamburger animation */
#menuBtn[aria-expanded="true"] #bar1 {
  transform: rotate(45deg) translate(4px, 4px);
}

#menuBtn[aria-expanded="true"] #bar2 {
  opacity: 0;
  transform: scaleX(0);
}

#menuBtn[aria-expanded="true"] #bar3 {
  transform: rotate(-45deg) translate(4px, -4px);
  width: 100%;
  margin-left: 0;
}

/* --- Reveal Animations (progressive enhancement) --- */
.reveal {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .reveal.revealed {
    opacity: 1;
    transform: translateY(0);
  }

  .reveal:nth-child(2) { transition-delay: 0.08s; }
  .reveal:nth-child(3) { transition-delay: 0.16s; }
  .reveal:nth-child(4) { transition-delay: 0.24s; }
  .reveal:nth-child(5) { transition-delay: 0.32s; }
  .reveal:nth-child(6) { transition-delay: 0.40s; }
}

/* --- Service Cards --- */
.service-card {
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.service-card:hover {
  transform: translateY(-4px);
}

/* --- Buttons --- */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover::before {
  opacity: 1;
}

/* --- Form Inputs --- */
input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(249, 112, 102, 0.15);
}

/* --- Back to Top --- */
#backToTop.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#backToTop:not(.visible) {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

/* --- Subtle Grain Texture (optional aesthetic) --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --- Print Styles --- */
@media print {
  #header, #backToTop, #mobileMenu { display: none !important; }
  body { background: white !important; color: black !important; }
  a { color: black !important; }
}
