:root {
  --bg-carbon-slate: #0F172A;
  --bg-deep-graphite: #0B0D10;
  --bg-surface-card: #131C31;
  --bg-surface-elevated: #1E293B;
  --border-tech: rgba(148, 163, 184, 0.16);
  --accent-extruder-orange: #FF6D00;
  --accent-extruder-orange-hover: #FF8524;
  --accent-laser-cyan: #00E5FF;
  --text-titanium-white: #F8FAFC;
  --text-machined-steel: #94A3B8;
  --status-amber: #F59E0B;
  --status-emerald: #10B981;
  --status-rose: #F43F5E;
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease-precision: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  background-color: var(--bg-carbon-slate);
  color: var(--text-titanium-white);
  font-family: var(--font-sans);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-carbon-slate);
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text-titanium-white);
  overflow-x: hidden;
}

/* Typography System */
.font-display, h1, h2, h3, .brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-headline {
  font-size: clamp(2rem, 4.2vw, 3.5rem);
  line-height: 1.08;
}

.section-headline {
  font-size: clamp(1.45rem, 2.5vw, 2.15rem);
  line-height: 1.15;
}

.font-mono-tech {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Layer Lines Texture */
.layer-texture {
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 109, 0, 0.025) 0px,
      rgba(255, 109, 0, 0.025) 1px,
      transparent 1px,
      transparent 4px
    ),
    radial-gradient(circle at 85% 20%, rgba(0, 229, 255, 0.09), transparent 48%),
    radial-gradient(circle at 15% 80%, rgba(255, 109, 0, 0.1), transparent 50%);
}

/* Industrial Cards & Vernier Registration Marks */
.tech-card {
  position: relative;
  background-color: var(--bg-surface-card);
  border: 1px solid var(--border-tech);
  border-radius: 6px;
  transition: border-color 200ms var(--ease-precision), transform 200ms var(--ease-precision), box-shadow 200ms var(--ease-precision);
}

.tech-card:hover {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: 0 10px 30px -12px rgba(0, 229, 255, 0.14);
}

.tech-card-orange:hover {
  border-color: rgba(255, 109, 0, 0.55);
  box-shadow: 0 10px 30px -12px rgba(255, 109, 0, 0.18);
}

.vernier-box {
  position: relative;
}

.vernier-box::before,
.vernier-box::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  pointer-events: none;
  transition: border-color 200ms var(--ease-precision);
}

.vernier-box::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--accent-laser-cyan);
  border-left: 2px solid var(--accent-laser-cyan);
}

.vernier-box::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--accent-extruder-orange);
  border-right: 2px solid var(--accent-extruder-orange);
}

/* Tactile Buttons & Controls */
.btn-primary-v3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 56px;
  min-width: 48px;
  padding: 0.75rem 1.5rem;
  background-color: var(--accent-extruder-orange);
  color: #0B0D10;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid #FF8524;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 180ms var(--ease-precision), transform 180ms var(--ease-precision), box-shadow 180ms var(--ease-precision);
}

.btn-primary-v3d::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 65%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 250ms var(--ease-precision);
}

.btn-primary-v3d:hover {
  background-color: var(--accent-extruder-orange-hover);
  box-shadow: 0 0 22px rgba(255, 109, 0, 0.38);
}

.btn-primary-v3d:hover::after {
  left: 140%;
}

.btn-secondary-v3d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 56px;
  min-width: 48px;
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-surface-elevated);
  color: var(--text-titanium-white);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--border-tech);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 180ms var(--ease-precision), color 180ms var(--ease-precision), background-color 180ms var(--ease-precision);
}

.btn-secondary-v3d:hover {
  border-color: var(--accent-laser-cyan);
  color: var(--accent-laser-cyan);
  background-color: rgba(0, 229, 255, 0.06);
}

.ops-mode .btn-primary-v3d,
.ops-mode .btn-secondary-v3d,
.ops-mode .input-v3d,
.ops-mode .select-v3d {
  min-height: 48px;
}

.nav-tab-v3d {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 56px;
  padding: 0 1rem;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-machined-steel);
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: color 180ms var(--ease-precision), border-color 180ms var(--ease-precision);
}

.nav-tab-v3d:hover {
  color: var(--text-titanium-white);
}

.nav-tab-v3d.active {
  color: var(--accent-laser-cyan);
  border-bottom-color: var(--accent-laser-cyan);
}

.ops-mode .nav-tab-v3d {
  min-height: 48px;
  font-size: 0.95rem;
}

/* Inputs & Selects */
.input-v3d,
.select-v3d,
.textarea-v3d {
  width: 100%;
  min-height: 56px;
  padding: 0.65rem 0.9rem;
  background-color: var(--bg-deep-graphite);
  color: var(--text-titanium-white);
  border: 1px solid var(--border-tech);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color 180ms var(--ease-precision), box-shadow 180ms var(--ease-precision);
}

.input-v3d:focus,
.select-v3d:focus,
.textarea-v3d:focus {
  outline: none;
  border-color: var(--accent-laser-cyan);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.18);
}

/* Layer-by-layer Tracking Timeline */
@keyframes layerPrintFill {
  0% {
    transform: scaleX(0);
    opacity: 0.4;
  }
  100% {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes layerStepPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.45);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(0, 229, 255, 0);
  }
}

.timeline-layer-bar {
  transform-origin: left center;
  animation: layerPrintFill 550ms var(--ease-precision) forwards;
}

.timeline-step-active {
  animation: layerStepPulse 2s infinite;
}

/* Custom Accessible Tooltip [data-tip] */
#v3d-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background-color: var(--bg-deep-graphite);
  color: var(--text-titanium-white);
  border: 1px solid var(--accent-laser-cyan);
  padding: 0.38rem 0.65rem;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms var(--ease-precision), transform 150ms var(--ease-precision);
}

#v3d-tooltip[data-visible="true"] {
  opacity: 1;
  transform: translateY(0);
}

/* Skeleton Loader */
@keyframes shimmerLayer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-v3d {
  background: linear-gradient(90deg, #131C31 25%, #1E293B 50%, #131C31 75%);
  background-size: 200% 100%;
  animation: shimmerLayer 1.5s infinite;
  border-radius: 4px;
}

/* Reduced Motion Respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
