/* ---------------------------------------------------------------------
   KTE Security — custom stylesheet.

   Layout and colour come from Tailwind; this file holds the photographic
   treatments, the animation system and the few things utility classes
   cannot express cleanly.
   --------------------------------------------------------------------- */

:root {
  --kte-navy-900: #060f1d;
  --kte-navy: #0a1a2f;
  --kte-navy-700: #122b4a;
  --kte-blue: #1266c7;
  --kte-blue-400: #3ba7e6;
  --kte-red: #e11b22;

  --kte-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =====================================================================
   1. Photographic bands
   ===================================================================== */

/* Home hero ---------------------------------------------------------- */
.kte-hero {
  position: relative;
  isolation: isolate;
  background-color: var(--kte-navy-900);
  background-image: var(--kte-hero-image);
  background-size: cover;
  background-position: 68% center; /* keeps the officer in frame as it narrows */
  background-repeat: no-repeat;
}

/* Shown only on narrow screens — see the mobile block below. */
.kte-hero-image {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Readability scrim: heaviest on the left, where the text sits. */
.kte-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(
      100deg,
      rgba(6, 15, 29, 0.95) 0%,
      rgba(6, 15, 29, 0.88) 38%,
      rgba(10, 26, 47, 0.62) 62%,
      rgba(10, 26, 47, 0.42) 100%
    );
}

/* Faint perimeter grid over the photograph. */
.kte-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 68px 68px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
}

@media (max-width: 767px) {
  /* A 2.5:1 photograph inside a tall, narrow hero crops to a thin vertical
     slice — and this one is a night scene, so that slice reads as a black
     rectangle. Instead: drop the background on mobile, keep a clean brand
     gradient behind the headline, and show the photograph whole underneath
     (.kte-hero-image in the markup). */
  .kte-hero {
    background-image: none;
  }

  .kte-hero::before {
    background: linear-gradient(165deg, var(--kte-navy-900) 0%, var(--kte-navy) 55%, var(--kte-navy-700) 100%);
  }
}

/* Inner page headers ------------------------------------------------- */
.kte-page-header {
  position: relative;
  isolation: isolate;
  background-color: var(--kte-navy);
  background-size: cover;
  background-position: center 38%;
  background-repeat: no-repeat;
}

.kte-page-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    95deg,
    rgba(6, 15, 29, 0.94) 0%,
    rgba(6, 15, 29, 0.86) 45%,
    rgba(10, 26, 47, 0.66) 100%
  );
}

/* Full-bleed brand band --------------------------------------------- */
.kte-band {
  display: block;
  width: 100%;
  height: auto;
}

/* Footer ------------------------------------------------------------- */
.kte-footer {
  position: relative;
  isolation: isolate;
  background-color: var(--kte-navy-900);
  background-size: cover;
  background-position: center 35%;
  background-repeat: no-repeat;
}

.kte-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(6, 15, 29, 0.95) 0%, rgba(6, 15, 29, 0.97) 100%);
}

/* Diagonal hatch behind flat dark sections. */
.kte-diagonal {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 2px,
    transparent 2px,
    transparent 8px
  );
}

/* =====================================================================
   2. Small decorative pieces
   ===================================================================== */

.kte-rule::before {
  content: "";
  display: block;
  width: 2.75rem;
  height: 3px;
  margin-bottom: 1rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--kte-red), var(--kte-blue));
}

.kte-steps {
  counter-reset: kte-step;
}

.kte-step {
  counter-increment: kte-step;
}

.kte-step::before {
  content: counter(kte-step, decimal-leading-zero);
  display: block;
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1;
  color: rgba(18, 102, 199, 0.18);
  transition: color 0.35s var(--kte-ease);
}

.kte-step:hover::before {
  color: rgba(18, 102, 199, 0.4);
}

.kte-break {
  overflow-wrap: anywhere;
}

/* =====================================================================
   3. Animation
   ===================================================================== */

/* On-load entrance, used in the hero and page headers. */
@keyframes kteFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.kte-fade-up {
  animation: kteFadeUp 0.7s var(--kte-ease) both;
}

.kte-delay-1 { animation-delay: 0.1s; }
.kte-delay-2 { animation-delay: 0.2s; }
.kte-delay-3 { animation-delay: 0.3s; }
.kte-delay-4 { animation-delay: 0.4s; }

/* Scroll reveal.
   The CSS only hides .reveal elements once JavaScript has confirmed it can
   reveal them again (site.js adds .js-reveal-ready). Without JS, everything
   stays visible rather than leaving the page blank below the fold. */
.js-reveal-ready .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s var(--kte-ease),
    transform 0.6s var(--kte-ease);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Stagger for grids: site.js sets --kte-i on each child. */
.js-reveal-ready .reveal[style*="--kte-i"] {
  transition-delay: calc(var(--kte-i) * 70ms);
}

/* Live indicator dot in the hero badge. */
@keyframes ktePing {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.kte-ping {
  animation: ktePing 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* =====================================================================
   4. Interaction — hover and focus
   ===================================================================== */

/* Buttons lift slightly and deepen their shadow. */
.kte-btn {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.25s var(--kte-ease),
    box-shadow 0.25s var(--kte-ease),
    background-color 0.25s var(--kte-ease);
}

.kte-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(6, 15, 29, 0.55);
}

.kte-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px -6px rgba(6, 15, 29, 0.5);
}

/* A light sweep across the button on hover. */
.kte-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s var(--kte-ease);
  pointer-events: none;
}

.kte-btn:hover::after {
  left: 130%;
}

/* Cards lift on hover. */
.kte-card {
  transition:
    transform 0.3s var(--kte-ease),
    box-shadow 0.3s var(--kte-ease),
    border-color 0.3s var(--kte-ease);
}

.kte-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 40px -24px rgba(6, 15, 29, 0.45);
}

/* Navigation underline that grows from the left. */
.kte-nav-link {
  position: relative;
}

.kte-nav-link::after {
  content: "";
  position: absolute;
  left: 0.875rem;
  right: 0.875rem;
  bottom: 0.25rem;
  height: 2px;
  border-radius: 2px;
  background: var(--kte-blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--kte-ease);
}

.kte-nav-link:hover::after,
.kte-nav-link[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Visible focus ring for keyboard users, on every interactive element. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--kte-blue-400);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Sticky header condenses once the page is scrolled. */
.kte-header {
  transition: box-shadow 0.3s var(--kte-ease), background-color 0.3s var(--kte-ease);
}

.kte-header.is-stuck {
  box-shadow: 0 10px 30px -18px rgba(6, 15, 29, 0.5);
}

.kte-header .kte-logo {
  transition: height 0.3s var(--kte-ease), width 0.3s var(--kte-ease);
}

.kte-header.is-stuck .kte-logo {
  height: 2.75rem;
  width: 2.75rem;
}

/* Mobile menu slide-down. */
@keyframes kteSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.kte-menu-open {
  animation: kteSlideDown 0.28s var(--kte-ease) both;
}

/* Back-to-top button. */
.kte-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 5.5rem;
  z-index: 39;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 26, 47, 0.9);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 0.3s var(--kte-ease),
    transform 0.3s var(--kte-ease),
    visibility 0.3s,
    background-color 0.3s var(--kte-ease);
}

.kte-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.kte-to-top:hover {
  background: var(--kte-blue);
}

/* Floating WhatsApp button. */
.kte-whatsapp {
  transition: transform 0.25s var(--kte-ease), box-shadow 0.25s var(--kte-ease);
}

.kte-whatsapp:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 30px -14px rgba(16, 185, 129, 0.7);
}

/* =====================================================================
   5. Gallery lightbox
   ===================================================================== */

.kte-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(3, 8, 16, 0.93);
}

.kte-lightbox.is-open {
  display: flex;
  animation: kteFadeUp 0.25s var(--kte-ease) both;
}

.kte-lightbox img {
  max-width: min(100%, 1100px);
  max-height: 82vh;
  border-radius: 0.5rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

/* =====================================================================
   6. Accessibility and print
   ===================================================================== */

/* Honour the visitor's motion preference: no movement, nothing hidden. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .js-reveal-ready .reveal,
  .reveal,
  .reveal.is-visible,
  .kte-fade-up {
    opacity: 1;
    transform: none;
  }
}

@media print {
  header,
  footer,
  .kte-noprint,
  .kte-to-top,
  .kte-whatsapp {
    display: none !important;
  }
}
