/* ==================== Base & Resets ==================== */
html {
  scroll-behavior: smooth;
}

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

::selection {
  background-color: rgba(212, 160, 23, 0.3);
  color: #fff;
}

/* ==================== Scroll Reveal Animations ==================== */
.reveal-up,
.reveal-left,
.reveal-right {
  opacity: 0;
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
  will-change: opacity, transform;
}

.reveal-up {
  transform: translateY(40px);
}

.reveal-left {
  transform: translateX(-40px);
}

.reveal-right {
  transform: translateX(40px);
}

.reveal-up.revealed,
.reveal-left.revealed,
.reveal-right.revealed {
  opacity: 1;
  transform: translate(0, 0);
}

/* Stagger children */
.reveal-up:nth-child(2) {
  transition-delay: 0.1s;
}
.reveal-up:nth-child(3) {
  transition-delay: 0.2s;
}
.reveal-up:nth-child(4) {
  transition-delay: 0.3s;
}
.reveal-up:nth-child(5) {
  transition-delay: 0.4s;
}
.reveal-up:nth-child(6) {
  transition-delay: 0.5s;
}

/* ==================== Navbar States ==================== */
#navbar {
  background: transparent;
}

#navbar.scrolled {
  background: rgba(10, 25, 41, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(212, 160, 23, 0.08);
}

/* ==================== Mobile Menu Hamburger Animation ==================== */
.menu-open #bar1 {
  transform: rotate(45deg) translateY(4px);
}

.menu-open #bar2 {
  opacity: 0;
  transform: translateX(-10px);
}

.menu-open #bar3 {
  width: 1.5rem;
  transform: rotate(-45deg) translateY(-4px);
}

/* ==================== Service Cards ==================== */
.service-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(212, 160, 23, 0);
  border-radius: 1rem;
  transition: border-color 0.4s ease;
  z-index: 2;
  pointer-events: none;
}

.service-card:hover::before {
  border-color: rgba(212, 160, 23, 0.25);
}

/* ==================== Gallery Masonry Hint ==================== */
.gallery-item {
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ==================== Form Focus Glow ==================== */
input:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.08);
}

select option {
  background-color: #102a43;
  color: #fff;
}

/* ==================== Smooth Pulse for Stats ==================== */
@keyframes gentlePulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ==================== Loading Shimmer ==================== */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ==================== Gradient Borders ==================== */
.gradient-border {
  position: relative;
}

.gradient-border::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #fbbf24, #d4a017);
  border-radius: 2px;
}

/* ==================== Smooth Scrollbar ==================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #0a1929;
}

::-webkit-scrollbar-thumb {
  background: #334e68;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #486581;
}

/* ==================== Hero Crossfade Slideshow ==================== */
/* 5 images, each visible ~5s, fade ~2s, total cycle 30s.
   Negative delays stagger images so #1 is visible immediately. */
@keyframes heroFade {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  17% {
    opacity: 1;
    transform: scale(1.06);
  }
  25% {
    opacity: 0;
    transform: scale(1.08);
  }
  92% {
    opacity: 0;
    transform: scale(1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.hero-slide {
  position: absolute;
  inset: 0;
  animation: heroFade 30s ease-in-out infinite;
  /* will-change removed — 5 GPU layers caused compositing flicker */
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-slide:nth-child(1) {
  animation-delay: 0s;
}
.hero-slide:nth-child(2) {
  animation-delay: -24s;
}
.hero-slide:nth-child(3) {
  animation-delay: -18s;
}
.hero-slide:nth-child(4) {
  animation-delay: -12s;
}
.hero-slide:nth-child(5) {
  animation-delay: -6s;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .hero-slide {
    animation: none;
  }
  .hero-slide:nth-child(n + 2) {
    opacity: 0;
  }
}

/* ==================== Cookie Banner Enter ==================== */
#cookieBanner.show {
  transform: translateY(0);
}

/* ==================== Video Section ==================== */
#videoContainer::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(212, 160, 23, 0.15);
  border-radius: 1rem;
  pointer-events: none;
  transition: border-color 0.3s ease;
}

#videoContainer:hover::after {
  border-color: rgba(212, 160, 23, 0.35);
}

/* ==================== Responsive Adjustments ==================== */
@media (max-width: 640px) {
  .reveal-up,
  .reveal-left,
  .reveal-right {
    transform: translateY(20px) !important;
  }

  .reveal-up.revealed,
  .reveal-left.revealed,
  .reveal-right.revealed {
    transform: translateY(0) !important;
  }
}

/* ==================== Mobile Menu Height ==================== */
/* Menu is absolute top-full inside fixed navbar (h-20 = 80px),
   so subtract navbar height to fill the remaining viewport.
   100vh fallback for iOS Safari, 100dvh for modern (excludes dynamic toolbar). */
#mobileMenu.is-open {
  height: calc(100vh - 80px);
  height: calc(100dvh - 80px);
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
}

/* ==================== Mobile Menu Scrolled State ==================== */
/* When navbar has backdrop-filter (scrolled), child backdrop-filter breaks.
   Override mobile menu to match the solid header background. */
#navbar.scrolled #mobileMenu {
  background: rgba(10, 25, 41, 0.97);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ==================== Legal Modals ==================== */
.legal-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(10, 25, 41, 0.98);
  overflow-y: auto;
  padding: 2rem 1rem;
}

.legal-modal.active {
  display: block;
}

.legal-modal-inner {
  max-width: 800px;
  margin: 0 auto;
  padding-bottom: 4rem;
}

.legal-modal h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 0.5rem;
}

.legal-modal h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fbbf24;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-modal p,
.legal-modal li {
  color: #bcccdc;
  line-height: 1.75;
  font-size: 0.95rem;
}

.legal-modal ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-top: 0.5rem;
}

.legal-modal li {
  margin-bottom: 0.35rem;
}

.legal-modal a {
  color: #fbbf24;
  text-decoration: underline;
}

/* ==================== Lightbox ==================== */
#lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

#lightbox img {
  transition: transform 0.3s ease;
}

/* ==================== Hero Content Entry Animations ==================== */
/* Hero elements must NOT use scroll-reveal (reveal-up) because they are
   above the fold — they use CSS animation instead so there's no
   invisible-frame flash and no dependency on the async IntersectionObserver. */
@keyframes heroRevealUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-anim {
  animation: heroRevealUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Stagger each direct sibling */
.hero-anim:nth-child(1) { animation-delay: 0.1s; }
.hero-anim:nth-child(2) { animation-delay: 0.25s; }
.hero-anim:nth-child(3) { animation-delay: 0.4s; }
.hero-anim:nth-child(4) { animation-delay: 0.55s; }
.hero-anim:nth-child(5) { animation-delay: 0.7s; }

@media (prefers-reduced-motion: reduce) {
  .hero-anim {
    animation: none;
  }
}

/* ==================== Inline-style replacements ==================== */

/* Slideshow container — isolates inner stacking contexts */
.slides-container {
  isolation: isolate;
}

/* Hero dark gradient overlay */
.hero-overlay {
  z-index: 1;
}

/* SHINE background text wrapper */
.hero-shine-wrapper {
  z-index: 1;
  contain: layout style;
}

/* SHINE text size */
.hero-shine-text {
  font-size: clamp(8rem, 22vw, 22rem);
}

/* Scroll indicator animation */
.hero-scroll-indicator {
  animation: heroBounce 2s ease-in-out infinite;
  will-change: transform;
}

/* Background decorative section numbers (About, Pricing) */
.bg-section-num {
  font-size: clamp(10rem, 18vw, 18rem);
  opacity: 0.6;
}

/* Contact section bg number — slightly smaller */
.bg-section-num-sm {
  font-size: clamp(10rem, 16vw, 16rem);
  opacity: 0.5;
}

/* Services inline section index number "02" */
.services-index-num {
  font-size: 4rem;
  line-height: 1;
}

/* Footer watermark "NAUTIC SHINE" */
.footer-watermark-text {
  font-size: clamp(4rem, 10vw, 9rem);
  -webkit-text-stroke-color: rgba(212, 160, 23, 0.04);
}

/* Cookie modal table */
.cookie-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.cookie-table th {
  text-align: left;
  padding: 0.5rem;
  color: #fbbf24;
}

.cookie-table td {
  padding: 0.5rem;
  color: #bcccdc;
}

.cookie-table tr {
  border-bottom: 1px solid #334e68;
}

.cookie-table tbody tr {
  border-color: #243b53;
}

.cookie-table code {
  color: #fbbf24;
}

/* ==================== Floating Action Stack ==================== */
#floatingActions {
  /* wrapper — no own transition, children handle it */
}

.float-item {
  opacity: 0;
  transform: translateY(10px) translateX(4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

#floatingActions.is-visible .float-item {
  opacity: 1;
  transform: translateY(0) translateX(0);
  pointer-events: auto;
}

#floatingActions.is-visible .float-item:nth-child(1) { transition-delay: 0.0s; }
#floatingActions.is-visible .float-item:nth-child(2) { transition-delay: 0.07s; }
#floatingActions.is-visible .float-item:nth-child(3) { transition-delay: 0.14s; }

/* Hide CTAs when footer bottom bar is in view */
.float-cta {
  transition: opacity 0.3s ease, transform 0.3s ease, pointer-events 0s;
}
.float-cta.footer-in-view {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

/* ==================== Marquee Band ==================== */
@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-track {
  animation: marqueeScroll 28s linear infinite;
  will-change: transform;
  white-space: nowrap;
}
.marquee-track:hover {
  animation-play-state: paused;
}

/* ==================== Scroll indicator bounce ==================== */
@keyframes heroBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(6px); }
}

/* ==================== Nav underline indicator ==================== */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: #fbbf24;
  transition: width 0.35s ease;
}
.nav-link:hover::after {
  width: 100%;
}

/* ==================== Background outline text ==================== */
.outline-text {
  -webkit-text-stroke: 1px rgba(212, 160, 23, 0.07);
  color: transparent;
  line-height: 1;
  user-select: none;
  pointer-events: none;
  letter-spacing: -0.02em;
}

/* ==================== CTA gold shimmer ==================== */
@keyframes goldShimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
.btn-shimmer {
  background-size: 200% auto;
  background-image: linear-gradient(
    90deg,
    #c49510 0%,
    #fbbf24 30%,
    #ffe082 50%,
    #fbbf24 70%,
    #c49510 100%
  );
  animation: goldShimmer 4s linear infinite;
}
.btn-shimmer:hover {
  animation-duration: 2s;
}

/* ==================== Gallery gold frame on hover ==================== */
.gallery-item {
  position: relative;
}
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid rgba(212, 160, 23, 0);
  border-radius: inherit;
  transition: border-color 0.35s ease;
  pointer-events: none;
  z-index: 2;
}
.gallery-item:hover::after {
  border-color: rgba(212, 160, 23, 0.55);
}

/* ==================== Section decorative number ==================== */
.section-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.04em;
}

/* ==================== Stat item bar ==================== */
.stat-bar {
  position: relative;
  padding-left: 1.25rem;
}
.stat-bar::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, #fbbf24, rgba(251,191,36,0.2));
  border-radius: 2px;
}

/* ==================== Service card featured (first, wider) ==================== */
@media (min-width: 1024px) {
  .service-card-featured {
    grid-column: span 2;
    aspect-ratio: 16/9;
  }
}

/* ==================== Divider wave line ==================== */
.divider-wave {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(212,160,23,0.12) 20%,
    rgba(34,211,238,0.08) 50%,
    rgba(212,160,23,0.12) 80%,
    transparent 100%
  );
}

/* ==================== Process step line ==================== */
.process-line::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 2rem;
  background: linear-gradient(to bottom, rgba(212,160,23,0.3), transparent);
  transform: translateX(-50%);
}
