/* ═══════════════════════════════════════════════════════════════════
   恆基工程 HENG KI ENGINEERING — Dark Industrial Theme
   TOBY Frontend Design System
   Fonts: Space Grotesk + Inter Tight | Orange + Steel on Dark
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter+Tight:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ── CUSTOM PROPERTIES ──────────────────────────────────────────── */
:root {
  /* Depth layers */
  --bg-deep: #060609;
  --bg-primary: #0c0c10;
  --bg-secondary: #111118;
  --bg-elevated: #18181f;
  --bg-card: #1c1c25;
  --bg-card-hover: #22222d;

  /* Text */
  --text-primary: #eaeaef;
  --text-secondary: #9e9eb5;
  --text-muted: #5e5e75;
  --text-inverse: #0a0a0c;

  /* Accent — Orange */
  --accent: #ff601c;
  --accent-light: #ff8c4a;
  --accent-glow: rgba(255, 96, 28, 0.25);
  --accent-glow-strong: rgba(255, 96, 28, 0.45);

  /* Accent — Steel */
  --steel: #8797b5;
  --steel-light: #aab9d4;
  --steel-subtle: rgba(135, 151, 181, 0.12);
  --steel-glow: rgba(135, 151, 181, 0.18);

  /* Borders & Dividers */
  --border: #24242f;
  --border-light: #2e2e3b;

  /* Spacing */
  --section-pad: clamp(4rem, 8vw, 8rem);
  --content-max: 1280px;
  --content-narrow: 900px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 40px var(--accent-glow), 0 0 80px var(--accent-glow-strong);
  --shadow-steel: 0 0 30px var(--steel-glow);

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ── RESET & BASE ────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter Tight', -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.65;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.25s;
}
a:hover { color: var(--accent); }

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

::selection {
  background: var(--accent);
  color: var(--text-inverse);
}

/* ── SCROLLBAR ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--steel); }

/* ═══════════════════════════════════════════════════════════════════
   ANIMATIONS — KEYFRAMES
   ═══════════════════════════════════════════════════════════════════ */

/* Floating particles */
@keyframes float-up {
  0% { transform: translateY(100vh) translateX(0) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-10vh) translateX(var(--drift)) scale(1); opacity: 0; }
}

@keyframes float-diagonal {
  0% { transform: translate(0, 100vh) scale(0); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.3; }
  100% { transform: translate(var(--drift-x), -10vh) scale(1.2); opacity: 0; }
}

/* Mesh gradient */
@keyframes mesh-shift {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
}

/* Orange pulse glow */
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 50px var(--accent-glow-strong), 0 0 100px var(--accent-glow); }
}

@keyframes glow-pulse-subtle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* Typography hero cascade */
@keyframes char-reveal {
  0% { opacity: 0; transform: translateY(60px) rotateX(-45deg); filter: blur(8px); }
  100% { opacity: 1; transform: translateY(0) rotateX(0); filter: blur(0); }
}

@keyframes line-rise {
  0% { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Marquee */
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes marquee-reverse {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

/* Page fade transitions */
@keyframes page-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Stagger reveal (used with JS) */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Reveal children stagger */
.reveal-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}
.reveal-children.visible > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.reveal-children.visible > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.reveal-children.visible > *:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.reveal-children.visible > *:nth-child(4) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.reveal-children.visible > *:nth-child(5) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
.reveal-children.visible > *:nth-child(6) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }
.reveal-children.visible > *:nth-child(7) { transition-delay: 0.55s; opacity: 1; transform: translateY(0); }
.reveal-children.visible > *:nth-child(8) { transition-delay: 0.6s; opacity: 1; transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT — NAVIGATION
   ═══════════════════════════════════════════════════════════════════ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 2rem;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(12, 12, 16, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}

.nav--scrolled {
  background: rgba(6, 6, 9, 0.95);
  border-bottom-color: var(--border-light);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.nav__brand-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-inverse);
  font-weight: 700;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav__links a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color 0.25s, background 0.25s;
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav__links a.active { color: var(--accent-light); }

.nav__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  background: var(--accent);
  color: var(--text-inverse) !important;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.25s, transform 0.25s, box-shadow 0.25s !important;
}

.nav__cta:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* Mobile nav toggle */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-primary);
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT — FOOTER
   ═══════════════════════════════════════════════════════════════════ */

.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  padding: 4rem 2rem 2rem;
}

.footer__grid {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
}

.footer__brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.footer__desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.footer__heading {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  margin-bottom: 1.25rem;
}

.footer__links {
  list-style: none;
}
.footer__links li { margin-bottom: 0.6rem; }
.footer__links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.25s;
}
.footer__links a:hover { color: var(--text-primary); }

.footer__contact-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.footer__contact-item svg {
  flex-shrink: 0;
  margin-top: 0.15rem;
  color: var(--accent-light);
}

.footer__bottom {
  max-width: var(--content-max);
  margin: 3rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — BUTTONS
   ═══════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn--primary:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--accent-glow-strong);
}

.btn--outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border-light);
}
.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
}
.btn--ghost:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — SECTION HEADERS
   ═══════════════════════════════════════════════════════════════════ */

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-light);
  margin-bottom: 1rem;
}

.section-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--accent);
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.section-title .highlight {
  color: var(--accent-light);
  position: relative;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — CARDS (with 3D tilt support)
   ═══════════════════════════════════════════════════════════════════ */

.tilt-card {
  perspective: 1000px;
  transform-style: preserve-3d;
}

.tilt-card__inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: transform 0.1s ease-out, box-shadow 0.3s, border-color 0.3s;
  transform-style: preserve-3d;
  position: relative;
  overflow: hidden;
}

.tilt-card__inner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--steel-subtle), transparent 50%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  border-radius: inherit;
}

.tilt-card:hover .tilt-card__inner {
  border-color: var(--border-light);
  box-shadow: var(--shadow-card), 0 0 40px var(--steel-glow);
}

.tilt-card:hover .tilt-card__inner::after {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — STAT COUNTER
   ═══════════════════════════════════════════════════════════════════ */

.stat {
  text-align: center;
}

.stat__number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: -0.04em;
  line-height: 1;
  display: block;
}

.stat__label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — TESTIMONIAL
   ═══════════════════════════════════════════════════════════════════ */

.testimonial {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
}

.testimonial__quote {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 1.5rem;
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid var(--accent);
}

.testimonial__author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.testimonial__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-light);
}

.testimonial__name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.testimonial__role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — MARQUEE BAR
   ═══════════════════════════════════════════════════════════════════ */

.marquee-bar {
  overflow: hidden;
  white-space: nowrap;
  background: var(--accent);
  padding: 0.75rem 0;
  position: relative;
}

.marquee-bar__track {
  display: inline-flex;
  animation: marquee 25s linear infinite;
}

.marquee-bar__item {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-inverse);
  letter-spacing: -0.02em;
}

.marquee-bar__item::after {
  content: '◆';
  font-size: 0.5rem;
  margin-left: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — FLOATING PARTICLES
   ═══════════════════════════════════════════════════════════════════ */

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.particle--dot {
  width: 2px;
  height: 2px;
  background: var(--steel-light);
  animation: float-up var(--dur, 8s) linear infinite;
  animation-delay: var(--delay, 0s);
  left: var(--x, 50%);
  --drift: var(--drift-px, 0px);
}

.particle--glow {
  width: 3px;
  height: 3px;
  background: var(--accent-light);
  box-shadow: 0 0 6px var(--accent-glow), 0 0 12px var(--accent-glow-strong);
  animation: float-diagonal var(--dur, 10s) linear infinite;
  animation-delay: var(--delay, 0s);
  left: var(--x, 50%);
  --drift-x: var(--drift-x-px, 0px);
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — MESH GRADIENT BACKGROUND
   ═══════════════════════════════════════════════════════════════════ */

.mesh-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(255, 96, 28, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 90%, rgba(135, 151, 181, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 40%, rgba(135, 151, 181, 0.03) 0%, transparent 70%);
  animation: mesh-shift 20s ease infinite;
  background-size: 200% 200%;
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — ORANGE GLOW ACCENTS
   ═══════════════════════════════════════════════════════════════════ */

.glow-orange {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  filter: blur(80px);
  opacity: 0.08;
  pointer-events: none;
  animation: glow-pulse-subtle 4s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════════
   PAGE TRANSITIONS
   ═══════════════════════════════════════════════════════════════════ */

.page-transition {
  animation: page-in 0.4s var(--ease-out-expo) both;
}

.page-content {
  position: relative;
  z-index: 1;
  padding-top: 72px;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__toggle { display: block; }

  .nav--open .nav__links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0;
  }

  .nav--open .nav__links a {
    padding: 0.75rem 1rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer__bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

/* ── Gallery zoom effect ─────────────────────────────────────────── */
.img-zoom {
  overflow: hidden;
  border-radius: var(--radius-md);
}
.img-zoom img {
  transition: transform 0.6s var(--ease-out-expo);
}
.img-zoom:hover img {
  transform: scale(1.05);
}

/* ── Skeleton loading shimmer ────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
