/* ============================================
   BEST METALL - BASE STYLES
   Reset, Typography & Foundation
   ============================================ */

/* ============================================
   SELF-HOSTED FONTS (latin) — no external request
   Inter & JetBrains Mono are variable fonts: one
   file covers the whole weight range.
   ============================================ */
@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/bebas-neue/bebas-neue-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/inter/inter-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/jetbrains-mono/jetbrains-mono-latin.woff2') format('woff2');
}

/* ============================================
   CSS RESET
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: auto; /* Lenis handles smooth scroll */
}

html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
  cursor: none; /* Custom cursor */
}

/* Hide default cursor on interactive elements */
a, button, [role="button"], input, textarea, select, [data-cursor="pointer"] {
  cursor: none;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  /* Wrap-safe defaults — long RU/UZ words shouldn't clip or overflow */
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* Prevent any heading from overflowing its container */
.section__title,
.hero__title,
.hero__title-line,
.service-card__title,
.equipment-card__title,
.project-card__title,
.process__step-title,
.cta__title {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

/* Generic safety for grid/flex children so they can shrink and wrap */
.services__grid > article,
.equipment__grid > article,
.projects__grid > article,
.about__features > div {
  min-width: 0;
}

h1 {
  font-size: var(--text-hero);
  letter-spacing: 0.05em;
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

p {
  color: var(--text-secondary);
  max-width: 65ch;
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--accent-fire);
}

strong, b {
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   SELECTION
   ============================================ */

::selection {
  background-color: var(--accent-fire);
  color: var(--bg-primary);
}

::-moz-selection {
  background-color: var(--accent-fire);
  color: var(--bg-primary);
}

/* ============================================
   FOCUS STATES
   ============================================ */

:focus-visible {
  outline: 2px solid var(--accent-fire);
  outline-offset: 4px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--steel-dark);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--steel);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--steel-dark) var(--bg-secondary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent-fire) 0%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-accent {
  color: var(--accent-fire);
}

.text-muted {
  color: var(--text-muted);
}

.font-mono {
  font-family: var(--font-mono);
  font-feature-settings: 'ss01' on, 'tnum' on;
}

/* Brushed metal surface utilities */
.surface-brushed {
  background: var(--brushed-steel);
  position: relative;
  overflow: hidden;
}

.surface-brushed::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.018) 0px,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}

.surface-brushed-h {
  background: var(--brushed-steel-horizontal);
  position: relative;
  overflow: hidden;
}

.surface-brushed-h::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}

/* Line clamp utilities */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   ANIMATED BACKGROUND GRID
   ============================================ */

.animated-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-background);
  opacity: 0.4;
}

.animated-grid::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image: 
    linear-gradient(to right, var(--steel-dark) 1px, transparent 1px),
    linear-gradient(to bottom, var(--steel-dark) 1px, transparent 1px);
  background-size: 80px 80px;
  animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(80px, 80px);
  }
}

/* ============================================
   NOISE TEXTURE OVERLAY
   ============================================ */

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: calc(var(--z-background) + 1);
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ============================================
   IMAGE STYLES
   ============================================ */

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

/* ============================================
   BUTTON RESET
   ============================================ */

button {
  font-family: inherit;
  font-size: inherit;
  background: none;
  border: none;
  color: inherit;
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .animated-grid::before {
    animation: none;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
