/*
  ============================================================
  SZE LOI HARDWARE MANUFACTORY LTD.
  custom.css — Minimal overrides & helpers beyond Tailwind utilities
  ============================================================
  Load order: After Tailwind CDN, before page-specific styles.
  Contents:
    1. Base resets & global styles
    2. Smooth scroll
    3. Focus / accessibility
    4. Skip navigation
    5. Typography fluid scale
    6. Navbar scroll state
    7. Animations (fade-up on scroll)
    8. Hero overlay gradient
    9. Section divider helpers
   10. Button & form helpers
   11. Table helpers
   12. Responsive utilities
  ============================================================
*/


/* ============================================================
   1. BASE RESETS & GLOBAL
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Remove default list styles when lists are used for navigation/UI */
nav ul, nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
}


/* ============================================================
   2. SMOOTH SCROLL
   ============================================================ */

html {
  scroll-behavior: smooth;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* ============================================================
   3. FOCUS / ACCESSIBILITY
   ============================================================ */

/* Brand-sky focus ring — visible on keyboard navigation */
*:focus-visible {
  outline: 2px solid #a1cdf4;
  outline-offset: 3px;
  border-radius: 2px;
}

/* Remove focus ring for mouse users (shown only on keyboard) */
*:focus:not(:focus-visible) {
  outline: none;
}


/* ============================================================
   4. SKIP NAVIGATION
   ============================================================ */

.skip-nav {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: -1;
}

.skip-nav:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  overflow: visible;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: #336699;   /* brand-navy */
  color: #ffffff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 4px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}


/* ============================================================
   5. TYPOGRAPHY — FLUID SCALE
   Note: Tailwind handles most type via utility classes.
   These cover edge cases that need clamp() for fluid scaling.
   ============================================================ */

/* Hero H1 */
.text-hero {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1.1;
  font-weight: 900;
  font-family: 'Playfair Display', Georgia, serif;
}

/* Section H2 titles */
.text-section-title {
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.2;
  font-weight: 700;
  font-family: 'Playfair Display', Georgia, serif;
}

/* Eyebrow labels above section titles */
.text-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: 'Inter', system-ui, sans-serif;
  color: #a1cdf4; /* brand-sky */
}


/* ============================================================
   6. NAVBAR SCROLL STATE
   JS adds .scrolled to #navbar after 80px scroll.
   ============================================================ */

#navbar {
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

#navbar.scrolled {
  box-shadow: 0 1px 8px 0 rgba(124, 128, 155, 0.15);
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Dropdown menus — hidden by default, shown on hover/focus */
.nav-dropdown {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Mobile nav overlay — slides in from top */
#mobile-menu {
  transition: max-height 0.35s ease, opacity 0.3s ease;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

#mobile-menu.open {
  max-height: 100vh;
  opacity: 1;
}


/* ============================================================
   7. SCROLL ANIMATIONS — fade-up on enter viewport
   JS (IntersectionObserver in main.js) adds .visible class
   when element enters viewport at 15% threshold.
   ============================================================ */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delay variants for grouped elements (cards, grid items) */
.animate-on-scroll.delay-100 { transition-delay: 0.1s; }
.animate-on-scroll.delay-200 { transition-delay: 0.2s; }
.animate-on-scroll.delay-300 { transition-delay: 0.3s; }
.animate-on-scroll.delay-400 { transition-delay: 0.4s; }
.animate-on-scroll.delay-500 { transition-delay: 0.5s; }

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* ============================================================
   8. HERO OVERLAY GRADIENT
   Applied to a child div inside the hero section.
   Sits on top of the background image (bg-blend-overlay).
   ============================================================ */

.hero-overlay {
  background: linear-gradient(
    135deg,
    rgba(51, 102, 153, 0.92) 0%,    /* brand-navy 92% opacity */
    rgba(51, 102, 153, 0.75) 60%,   /* brand-navy 75% opacity */
    rgba(169, 175, 209, 0.65) 100%  /* brand-lavender 65% — subtle violet tint */
  );
}

/* Hero section base — background image is set via inline style or page CSS */
.hero-section {
  position: relative;
  background-color: #336699;        /* brand-navy fallback if image not loaded */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-section > .hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-section > .hero-content {
  position: relative;
  z-index: 1;
}


/* ============================================================
   9. SECTION HELPERS
   ============================================================ */

/* Consistent section padding */
.section-pad {
  padding-top: 6rem;    /* 96px */
  padding-bottom: 6rem;
}

@media (max-width: 768px) {
  .section-pad {
    padding-top: 4rem;  /* 64px */
    padding-bottom: 4rem;
  }
}

/* Centred content container — consistent across all sections */
.section-container {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .section-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .section-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Centred section title block */
.section-header {
  text-align: center;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 3rem;
}


/* ============================================================
   10. BUTTON & FORM HELPERS
   ============================================================ */

/* Primary CTA button — brand-sky fill */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #a1cdf4;    /* brand-sky */
  color: #336699;               /* brand-navy text */
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #336699;    /* swap to brand-navy */
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(124, 128, 155, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary / outlined button — white outline (for dark backgrounds) */
.btn-outline-white {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: transparent;
  color: #ffffff;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  text-decoration: none;
  border: 2px solid rgba(255, 255, 255, 0.65);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.btn-outline-white:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: #ffffff;
}

/* Secondary / outlined button — navy outline (for light backgrounds) */
.btn-outline-navy {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: transparent;
  color: #336699;               /* brand-navy */
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  text-decoration: none;
  border: 2px solid #336699;
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.btn-outline-navy:hover {
  background-color: #336699;
  color: #ffffff;
}

/* Form input base styles */
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #b5b1b2;    /* brand-stone */
  border-radius: 4px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9375rem;
  color: #1e1f2e;
  background-color: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: #a1cdf4;        /* brand-sky */
  box-shadow: 0 0 0 3px rgba(161, 205, 244, 0.25);
}

.form-input.error {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15);
}

.form-label {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e1f2e;
  margin-bottom: 0.375rem;
}

.form-label .required-star {
  color: #e53e3e;
  margin-left: 2px;
}

.form-error-msg {
  display: none;
  font-size: 0.8125rem;
  color: #e53e3e;
  margin-top: 0.25rem;
}

.form-input.error + .form-error-msg {
  display: block;
}


/* ============================================================
   11. TABLE HELPERS
   ============================================================ */

/* Responsive table wrapper — horizontal scroll on mobile */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid #e5e3e4;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9375rem;
}

.data-table th {
  background-color: #336699;    /* brand-navy */
  color: #ffffff;
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #ede8e9;
  color: #1e1f2e;
  vertical-align: top;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:nth-child(even) td {
  background-color: #f8f8fa;
}

.data-table tbody tr:hover td {
  background-color: rgba(169, 175, 209, 0.12);  /* brand-lavender tint */
}


/* ============================================================
   12. CARD HELPERS
   ============================================================ */

.service-card {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 3px 0 rgba(0,0,0,0.08), 0 1px 2px -1px rgba(0,0,0,0.06);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.service-card:hover {
  box-shadow: 0 4px 12px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.08);
  transform: translateY(-3px);
}

/* Pill / tag badges */
.pill-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
}

.pill-tag-navy {
  background-color: rgba(124, 128, 155, 0.12);
  color: #336699;
}

.pill-tag-sky {
  background-color: rgba(161, 205, 244, 0.2);
  color: #4a7fa5;
}

.pill-tag-lavender {
  background-color: rgba(169, 175, 209, 0.2);
  color: #336699;
}

.pill-tag-white {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.25);
}


/* ============================================================
   END OF custom.css
   ============================================================ */
