:root {
  --bg-base: #14171B;
  --bg-surface: #1B1F24;
  --bg-elevated: #22272E;

  --accent: #3A5F7D;
  --accent-soft: #4E7899;

  --text-primary: #F5F7FA;
  --text-secondary: #9CA3AF;

  --border-subtle: rgba(255,255,255,0.05);

  --grid-line: rgba(255,255,255,0.04);
  --grid-line-strong: rgba(58,95,125,0.10);
}

/* ---------- RESET ---------- */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  padding-top: 80px;
  position: relative;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- LAB GRID OVERLAY ---------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;

  background:
    radial-gradient(900px 420px at 18% 16%, rgba(58,95,125,0.14), transparent 55%),
    radial-gradient(900px 420px at 85% 70%, rgba(78,120,153,0.10), transparent 55%),
    linear-gradient(to bottom, rgba(0,0,0,0.35), transparent 25%, rgba(0,0,0,0.55)),

    repeating-linear-gradient(
      to right,
      var(--grid-line) 0px,
      var(--grid-line) 1px,
      transparent 1px,
      transparent 96px
    ),
    repeating-linear-gradient(
      to bottom,
      var(--grid-line) 0px,
      var(--grid-line) 1px,
      transparent 1px,
      transparent 96px
    ),

    repeating-linear-gradient(
      to right,
      transparent 0px,
      transparent 479px,
      var(--grid-line-strong) 479px,
      var(--grid-line-strong) 480px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 479px,
      var(--grid-line-strong) 479px,
      var(--grid-line-strong) 480px
    );

  opacity: 0.55;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;

  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.03) 0px,
    rgba(255,255,255,0.03) 1px,
    transparent 1px,
    transparent 6px
  );

  opacity: 0.12;
  mix-blend-mode: overlay;
}

@media (max-width: 640px) {
  body::before { opacity: 0.35; }
  body::after  { opacity: 0.07; }
}

/* Ensure content layers above overlays */

nav { z-index: 2000; }

main,
.section,
.container,
footer {
  position: relative;
  z-index: 1;
}

/* ---------- NAVIGATION ---------- */

nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;

  backdrop-filter: blur(12px);
  background: rgba(20,23,27,0.85);
  border-bottom: 1px solid var(--border-subtle);
}

nav::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(58,95,125,0.10), transparent);
  opacity: 0.6;
}

.nav-container {
  height: 80px;
  max-width: 1100px;
  margin: auto;
  padding: 0 28px;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-weight: 600;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 48px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  letter-spacing: 0.5px;
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 100%;
  height: 1px;
  background: rgba(78,120,153,0.55);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

section {
  scroll-margin-top: 100px;
}

/* ---------- LAYOUT ---------- */

.section {
  padding: clamp(90px, 8vw, 130px) 28px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.4px;
  margin-bottom: clamp(40px, 4vw, 60px);
  text-align: center;
}

.section-title + .divider-steel {
  margin-top: -28px;
}

/* ---------- HERO ---------- */

.hero {
  min-height: clamp(560px, 80vh, 900px);
  display: flex;
  align-items: center;

  background:
    radial-gradient(circle at 20% 30%, rgba(58,95,125,0.18), transparent 40%),
    linear-gradient(rgba(15,17,20,0.92),rgba(15,17,20,0.96)),
    url('./assets/hero.jpg') center/cover no-repeat;
}

.hero h1 {
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero h2 {
  color: var(--text-secondary);
  margin-bottom: 18px;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.divider {
  width: 70px;
  height: 2px;
  background: var(--accent);
  margin: 28px 0 36px;
}

.divider-steel {
  width: 140px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(78,120,153,0.65), transparent);
  margin: 22px auto 0;
}

.support {
  max-width: 720px;
  color: var(--text-secondary);
  margin-bottom: 48px;
  letter-spacing: 0.2px;
}

/* ---------- BUTTONS ---------- */

.btn {
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 22px rgba(0,0,0,0.45);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.55);
}

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

.btn-secondary {
  border: 1px solid rgba(78,120,153,0.45);
  color: var(--accent);
}

.btn-secondary:hover {
  background: rgba(58,95,125,0.12);
}

/* ---------- GRID ---------- */

.grid-3,
.portfolio-grid {
  display: grid;
  gap: 48px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* ---------- EQUIPMENT MODULE CARDS ---------- */

.service,
.portfolio-item,
.contact-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 34%),
    var(--bg-elevated);

  border: 1px solid var(--border-subtle);
  border-radius: 12px;

  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 14px 36px rgba(0,0,0,0.45);

  padding: 36px;
  position: relative;
  overflow: hidden;

  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.contact-panel {
  padding: 60px;
}

.service::before,
.portfolio-item::before,
.contact-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.55;
}

.service:hover,
.portfolio-item:hover {
  transform: translateY(-6px);
  border-color: rgba(78,120,153,0.25);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 22px 56px rgba(0,0,0,0.62);
}

@supports not (clip-path: polygon(0 0)) {
  .service,
  .portfolio-item,
  .contact-panel {
    border-radius: 12px;
  }
}

/* ---------- PORTFOLIO IMAGES ---------- */

.portfolio-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
  filter: saturate(0.92) contrast(1.06);
}

/* ---------- FORM ---------- */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

textarea {
  width: 100%;
  margin-bottom: 24px;
}

input,
select,
textarea {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  padding: 14px;
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- FOOTER ---------- */

footer {
  padding: 100px 28px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

footer p {
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

/* FINAL SAFETY */
nav { z-index: 2000; }
