/* 
 * KTT - Kuang Tsan Technology
 * Design System & Main Stylesheet
 */

:root {
  /* Colors */
  --color-primary: #E62314;
  --color-primary-dark: #b81c10;
  --color-secondary: #1A1A1A;
  --color-accent: #FF5E00;
  --color-surface: #242424;
  --color-surface-light: #333333;
  --color-background: #0A0A0A;
  --color-text-primary: #FFFFFF;
  --color-text-secondary: #A0A0A0;
  --color-border: #333333;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 32px;
  --spacing-xl: 64px;
  --spacing-xxl: 128px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 20px rgba(230, 35, 20, 0.4);
}

/* Reset & BaseStyles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: 'Inter', 'Noto Sans TC', sans-serif;
  background-color: var(--color-background);
  color: var(--color-text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Use smooth styling via JS lenis, but fallback here */
  scroll-behavior: smooth;
}

a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--color-primary);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--color-text-secondary);
}

/* Layout Core */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.section {
  padding: var(--spacing-xxl) 0;
}

/* Components - Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  color: var(--color-text-primary);
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(230, 35, 20, 0.6);
}

.btn-outline {
  background-color: rgba(255, 255, 255, 0.03);
  /* Subtle backdrop */
  color: var(--color-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.3);
  /* Much brighter than var(--color-border) */
  backdrop-filter: blur(4px);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}


/* Component - Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding: var(--spacing-md) 0;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.3s ease;
  
  /* GPU Hardware Acceleration to eliminate scrolling lag from blur repaint */
  transform: translateZ(0); 
  will-change: transform, backdrop-filter;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.logo-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-primary);
  border-radius: 50%;
  display: inline-block;
  box-shadow: var(--shadow-glow);
}

.nav-links {
  display: flex;
  gap: var(--spacing-xl);
  align-items: center;
}

.nav-links a {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--color-text-primary);
}

.nav-links a.btn-outline:hover {
  color: var(--color-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--color-text-primary);
}

.nav-links a.btn-outline::after {
  display: none !important;
}

/* Mobile Hamburger Toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
}

.mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-text-primary);
  margin-bottom: 5px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mobile-toggle span:last-child {
  margin-bottom: 0;
}

.mobile-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Cinematic Outline Text - Refined Awwwards Style */
.hero-brand-text {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  /* Smaller, more discreet */
  font-weight: 300;
  /* Ultra thin */
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  /* Soft, elegant white */
  letter-spacing: 8px;
  /* Base wide tracking */
  display: inline-block;
  white-space: nowrap;
  position: relative;
}

/* Add a delicate luminous line below to anchor it */
.hero-brand-text::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(230, 35, 20, 0.8), transparent);
  transition: width 1.5s cubic-bezier(0.2, 1, 0.3, 1) 1s;
}

/* Class to trigger the line expanding */
.hero-brand-text.assembled::after {
  width: 120%;
}

/* Utilities */
.text-center {
  text-align: center;
}

/* Premium Product Card Styling */
.product-card {
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.5s cubic-bezier(0.2, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transform: translateY(0);
}

.product-card:hover {
  /* More assertive red stroke so it's clearly visible */
  border-color: var(--color-primary);
  /* Use a hard 2px box-shadow to visually thicken the border to 3px without causing layout shifts */
  box-shadow: 0 0 0 2px var(--color-primary),
    0 20px 40px rgba(0, 0, 0, 0.6),
    0 0 35px rgba(230, 35, 20, 0.4),
    inset 0 0 25px rgba(230, 35, 20, 0.2);
  transform: translateY(-8px);
}

/* Subtly scale and tint the product image drop-shadow on card hover */
.product-card:hover .card-img {
  transform: scale(1.05) !important;
  filter: drop-shadow(0 20px 40px rgba(230, 35, 20, 0.15)) !important;
}

.text-primary {
  color: var(--color-primary);
}

.text-gradient {
  background: linear-gradient(90deg, #FFFFFF 0%, #A0A0A0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.red-gradient {
  background: linear-gradient(90deg, #FF5E00 0%, #E62314 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* RWD Grid Utilities */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  align-items: center;
}

.grid-detail {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--spacing-xxl);
  align-items: start;
}

.grid-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

/* Image Utilities */
.img-box-lg {
  height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-box-md {
  height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-box-sm {
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-box-thumb {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive */
@media (max-width: 992px) {

  /* Collapse grids to 1 column on tablet/mobile */
  .grid-2-col,
  .grid-detail {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
  }

  /* Reset direction for alternating project rows on mobile */
  .project-row {
    direction: ltr !important;
  }

  /* Adjust hero spacing */
  .section {
    padding: var(--spacing-xl) 0;
  }

  .hero-content {
    margin-left: 0;
  }

  /* Adjust image heights */
  .img-box-lg {
    height: 400px;
  }

  .img-box-md {
    height: 300px;
  }

  .img-box-sm {
    height: 200px;
  }
}

@media (max-width: 768px) {

  /* Reduce excessive padding gaps drastically for phone */
  :root {
    --spacing-xxl: 64px;
    --spacing-xl: 32px;
    --spacing-lg: 20px;
    --spacing-md: 16px;
  }

  /* Further reduce image heights */
  .img-box-lg {
    height: 300px;
  }

  .img-box-md {
    height: 250px;
  }

  .img-box-sm {
    height: 200px;
  }

  .img-box-thumb {
    height: 100px;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-xl);
    transition: right 0.6s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 100;
  }

  .nav-links.active {
    right: 0;
  }

  .mobile-toggle {
    display: block;
  }

  /* Force override inline hardcoded values */
  h1 {
    font-size: 2.25rem !important;
    margin-bottom: var(--spacing-sm);
  }

  h2 {
    font-size: 1.75rem !important;
    margin-bottom: var(--spacing-sm);
  }

  h3 {
    font-size: 1.25rem !important;
  }

  .container {
    padding: 0 var(--spacing-lg);
    /* Slightly more breathing room on mobile */
  }

  .hero-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .hero-actions .btn {
    width: 100%;
    margin-right: 0 !important;
  }

  /* Make buttons full width on small screens */
  .btn-mobile-full {
    width: 100%;
  }
}

/* =========================================================================
   Global Interactive Components
   ========================================================================= */

/* Global Scroll Discover Indicator Animation */
.scroll-indicator {
  transition: color 0.3s ease, opacity 0.3s ease;
}

.scroll-indicator:hover {
  color: #FFFFFF !important;
}

@keyframes bounce-arrow {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-4px);
  }
}

.bounce-arrow {
  animation: bounce-arrow 2s infinite cubic-bezier(0.28, 0.84, 0.42, 1); /* Smoother Red Dot style bounce */
}