/* ==========================================================================
   FerroMate Engi-Tech LLP — Clean White Translucent Glassmorphism System
   ========================================================================== */

:root {
  --bg-canvas: #f8fafc;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.88);
  --glass-bg-subtle: rgba(255, 255, 255, 0.52);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-strong: rgba(15, 23, 42, 0.14);

  --ink-primary: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #475569;

  --accent-copper: #ea580c;
  --accent-copper-bright: #ff7a30;
  --accent-cobalt: #0284c7;
  --accent-emerald: #059669;

  --font-editorial: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  background-color: #f4f7fb;
  color: var(--ink-primary);
  font-family: var(--font-editorial);
  max-width: 100%;
  overflow-x: hidden;
}

/* Clean ~10% proportional scale on laptop & desktop without CSS zoom layout side-effects */
@media (min-width: 1024px) {
  html {
    font-size: 14.5px;
  }
}

body {
  background:
    radial-gradient(circle at 12% 8%, rgba(234, 88, 12, 0.07) 0%, transparent 42%),
    radial-gradient(circle at 88% 14%, rgba(2, 132, 199, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 60%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #f4f7fb 50%, #eef2f7 100%);
  color: var(--ink-primary);
  max-width: 100%;
  overflow-x: hidden;
}

/* Responsive Calculator Shell: fits smoothly on mobile (max 420px), full width on desktop */
.calculator-shell {
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 1024px) {
  .calculator-shell {
    max-width: 100%;
  }
}

/* Responsive Table Scroll Wrapper */
.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #ea580c;
}

/* Subtle Architectural Grid Overlay on White */
.forge-grid-overlay {
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Translucent Glass Panel Utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.95),
    0 12px 36px -12px rgba(15, 23, 42, 0.08);
}

.glass-subcard {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.85);
}

/* Light-Mode Dropdown Styling */
select option, select optgroup {
  background-color: #ffffff;
  color: #0f172a;
}
select optgroup {
  color: #ea580c;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   RANGE SLIDERS (CLEAN LIGHT GLASS CONTROLS)
   -------------------------------------------------------------------------- */
.range-slider {
  -webkit-appearance: none;
  height: 6px;
  background: rgba(15, 23, 42, 0.09);
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ea580c;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.45);
  transition: transform 0.12s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

/* --------------------------------------------------------------------------
   CALIBRATED TOLERANCE GAUGE
   -------------------------------------------------------------------------- */
.linear-gauge-body {
  box-shadow: inset 0 1px 4px rgba(15, 23, 42, 0.12);
}

.gauge-green-zone {
  pointer-events: none;
}

.gauge-indicator-needle {
  transform: translateX(-50%);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   ACTIVE BUTTON STATES
   -------------------------------------------------------------------------- */
.spectro-tab-btn,
.product-filter-btn,
.smys-quick-btn,
.preset-btn {
  transition: background-color 280ms ease-out, color 280ms ease-out, border-color 280ms ease-out, box-shadow 280ms ease-out, transform 180ms ease-out;
}

.tabular-nums,
.font-code-metric-lg,
.font-code-metric-md {
  font-variant-numeric: tabular-nums;
}

.preset-btn.active {
  background-color: #ea580c !important;
  color: #ffffff !important;
  border-color: #ea580c !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

.calc-append-btn {
  transition: background-color 220ms ease-out, box-shadow 220ms ease-out, transform 160ms ease-out;
}

.calc-append-btn:hover {
  transform: translateY(-1px);
}

.calc-append-btn.is-confirmed {
  background-color: #059669 !important;
  box-shadow: 0 0 20px rgba(5, 150, 105, 0.35) !important;
}

.spectro-tab-btn.active,
.product-filter-btn.active {
  background-color: #ea580c !important;
  color: #ffffff !important;
  border-color: #ea580c !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.28);
}

.product-filter-btn.active {
  view-transition-name: product-filter-active;
}

.smys-quick-btn.active {
  border-color: #ea580c !important;
  background-color: rgba(234, 88, 12, 0.08) !important;
  color: #0f172a !important;
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.14);
  view-transition-name: smys-active-pill;
}

/* --------------------------------------------------------------------------
   CSS VIEW TRANSITIONS API & MORPH FALLBACKS (250ms–350ms ease-out)
   -------------------------------------------------------------------------- */
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: 280ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-group(product-card-morph),
::view-transition-group(product-filter-active),
::view-transition-group(smys-active-pill) {
  animation-duration: 300ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.product-detail-modal {
  display: none;
}

.product-detail-modal.open {
  display: flex;
}

.product-detail-modal.fallback-anim.open .product-detail-panel {
  animation: modalMorphFallback 280ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes modalMorphFallback {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .spectro-tab-btn,
  .product-filter-btn,
  .smys-quick-btn,
  .product-card,
  .product-detail-modal.fallback-anim.open .product-detail-panel {
    transition: none !important;
    animation: none !important;
  }
}

/* Mouse-Reactive Hero Logo Medallion */
.hero-logo-reactive {
  transform-style: preserve-3d;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  will-change: transform;
}

#heroLogoStage:hover .hero-logo-reactive {
  box-shadow:
    0 32px 70px -12px rgba(15, 23, 42, 0.22),
    0 0 48px rgba(2, 132, 199, 0.2),
    0 0 48px rgba(234, 88, 12, 0.16);
}

/* --------------------------------------------------------------------------
   MOBILE DRAWER (No off-screen overflow)
   -------------------------------------------------------------------------- */
.mobile-drawer {
  display: none;
}

.mobile-drawer.open {
  display: flex !important;
  animation: drawerSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawerSlideIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --------------------------------------------------------------------------
   TOAST NOTIFICATION STACK (FROSTED WHITE)
   -------------------------------------------------------------------------- */
.toast-stack {
  z-index: 1000;
}

.toast {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.16);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
  animation: slideToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-copper { border-left: 3px solid #ea580c; }
.toast.toast-cobalt { border-left: 3px solid #0284c7; }
.toast.toast-emerald { border-left: 3px solid #059669; }

@keyframes slideToast {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
