/* ===== Base & Utilities ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* ===== Scroll Reveal (Progressive Enhancement) ===== */
@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-delay-1 { transition-delay: 0.1s; }
  .reveal-delay-2 { transition-delay: 0.2s; }
  .reveal-delay-3 { transition-delay: 0.3s; }
  .reveal-delay-4 { transition-delay: 0.4s; }
}

/* ===== Navbar scroll state ===== */
.navbar-scrolled #navbar {
  background: rgba(31, 31, 37, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.navbar-scrolled #navbar nav {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

/* ===== Focus visible for keyboard nav ===== */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #E86A5B;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== Selection color ===== */
::selection {
  background: rgba(232, 106, 91, 0.2);
  color: #1F1F25;
}

/* ===== Custom scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #F5F5F7;
}
::-webkit-scrollbar-thumb {
  background: #D1D1D8;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #A1A1AA;
}

/* ===== Form validation styles ===== */
input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
  border-color: #EF4444;
}
input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
  border-color: #22C55E;
}

/* ===== Print styles ===== */
@media print {
  header, #back-to-top, .reveal { display: none; }
  body { color: #000; background: #fff; }
  a { color: #000; }
}
