/* ==========================================================================
   A. PARMEGGIANI & FIGLI S.R.L. — DESIGN SYSTEM v2.0 (Bootstrap 5 + jQuery)
   Industrial Precision | Dark Graphite + Signature Crimson + Technical Slate
   ========================================================================== */

:root {
  --bg-dark: #090c10;
  --bg-surface: #111620;
  --bg-surface-2: #18202e;
  --bg-light: #f4f6f9;
  --brand-red: #e11d2e;
  --brand-red-hover: #be1222;
  --brand-red-glow: rgba(225, 29, 46, 0.25);
  --cert-blue: #005596;
  --text-light: #f8fafc;
  --text-muted-dark: #94a3b8;
  --text-dark: #0f172a;
  --text-muted-light: #475569;
  --border-dark: rgba(255, 255, 255, 0.09);
  --border-light: rgba(15, 23, 42, 0.1);
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-light);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.font-mono-tech {
  font-family: var(--font-mono);
}

.mono-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-red);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mono-eyebrow::before {
  content: '';
  width: 18px;
  height: 2px;
  background: var(--brand-red);
  display: inline-block;
}

/* ---------- Utility Bar & Navbar ---------- */
.utility-bar {
  background: #05070a;
  border-bottom: 1px solid var(--border-dark);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted-dark);
}

.iso-pill {
  color: #7dd3fc;
  font-weight: 500;
}

.site-navbar {
  background: rgba(9, 12, 16, 0.9) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-dark);
  min-height: 76px;
}

.site-navbar .nav-link {
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link.active {
  color: #ffffff;
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.lang-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.2s ease;
}

.lang-flag:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.lang-flag.active {
  color: #ffffff;
  background: rgba(225, 29, 46, 0.22);
  border: 1px solid rgba(225, 29, 46, 0.5);
}

.btn-brand {
  background-color: var(--brand-red);
  border-color: var(--brand-red);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 600;
  box-shadow: 0 8px 24px -6px var(--brand-red-glow);
  transition: all 0.25s ease;
}

.btn-brand:hover,
.btn-brand:focus {
  background-color: var(--brand-red-hover);
  border-color: var(--brand-red-hover);
  color: #ffffff;
  transform: translateY(-2px);
}

/* ---------- Hero Section ---------- */
.hero-section {
  position: relative;
  background:
    radial-gradient(circle at 82% 20%, rgba(225, 29, 46, 0.14), transparent 45%),
    radial-gradient(circle at 12% 85%, rgba(0, 85, 150, 0.16), transparent 45%),
    linear-gradient(180deg, #090c10 0%, #0f141d 100%);
  border-bottom: 1px solid var(--border-dark);
  overflow: hidden;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.45rem);
  font-weight: 700;
  line-height: 1.1;
}

.hero-frame {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 50px -15px rgba(2, 6, 23, 0.65);
  background: #0b0e14;
}

.hero-frame img {
  width: 100%;
  height: clamp(260px, 40vw, 430px);
  object-fit: cover;
}

.hero-telemetry {
  background: rgba(9, 12, 16, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
}

.telemetry-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 5px 10px;
  background: rgba(225, 29, 46, 0.16);
  border: 1px solid rgba(225, 29, 46, 0.45);
  color: #fda4af;
  border-radius: 4px;
  white-space: nowrap;
}

.kpi-strip {
  border-top: 1px solid var(--border-dark);
}

/* ---------- Light / Surface Sections ---------- */
.section-light {
  background: var(--bg-light);
  color: var(--text-dark);
}

.section-white {
  background: #ffffff;
  color: var(--text-dark);
}

.section-surface {
  background: var(--bg-surface);
  color: var(--text-light);
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
}

/* ---------- Division Showcase Tabs ---------- */
.div-tab-btn {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px 18px;
  text-align: left;
  transition: all 0.25s ease;
  height: 100%;
  width: 100%;
}

.div-tab-btn:hover {
  border-color: rgba(225, 29, 46, 0.45);
  transform: translateY(-2px);
}

.div-tab-btn.active {
  background: var(--bg-dark);
  color: #ffffff;
  border-color: var(--brand-red);
  box-shadow: 0 12px 28px -10px rgba(15, 23, 42, 0.35);
}

.division-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 48px -20px rgba(15, 23, 42, 0.12);
}

.division-gallery {
  background: #0b0e14;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.division-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 320px;
  max-height: 400px;
  background: radial-gradient(circle at center, #18202e 0%, #090c10 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 18px 56px;
}

.division-stage img {
  max-width: 100%;
  max-height: 315px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  filter: contrast(1.04) saturate(1.04);
}

.division-caption {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: rgba(9, 12, 16, 0.88);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 3px solid var(--brand-red);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.division-thumbs {
  background: #0d1118;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.gallery-thumb {
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  overflow: hidden;
  background: #090c10;
  cursor: pointer;
  opacity: 0.62;
  transition: all 0.2s ease;
  height: 54px;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb:hover {
  opacity: 0.9;
  border-color: rgba(255, 255, 255, 0.4);
}

.gallery-thumb.active {
  opacity: 1;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 1px var(--brand-red);
}

.spec-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  font-size: 0.94rem;
}

.spec-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--brand-red);
  font-weight: 700;
}

/* ---------- Compound Matrix ---------- */
.filter-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-dark);
  background: var(--bg-surface-2);
  color: var(--text-muted-dark);
  transition: all 0.2s ease;
}

.filter-pill:hover,
.filter-pill.active {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: #ffffff;
}

.compound-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-dark);
  border-radius: 12px;
  padding: 24px;
  height: 100%;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.compound-card:hover {
  border-color: rgba(225, 29, 46, 0.5);
  transform: translateY(-3px);
}

.tag-tech {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 85, 150, 0.24);
  border: 1px solid rgba(0, 152, 201, 0.35);
  color: #bae6fd;
}

/* ---------- Timeline & RINA Card ---------- */
.timeline-list {
  border-left: 2px solid var(--border-light);
  padding-left: 22px;
}

.timeline-entry {
  position: relative;
  margin-bottom: 20px;
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: -29px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand-red);
  border: 3px solid var(--bg-light);
}

.rina-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--cert-blue);
  border-radius: 14px;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.14);
}

.hq-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: 0 12px 26px -14px rgba(15, 23, 42, 0.25);
  cursor: pointer;
}

.hq-card img {
  width: 100%;
  height: 165px;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.hq-card:hover img {
  transform: scale(1.04);
}

.hq-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 12px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(9, 12, 16, 0.88) 100%);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.gemini-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(9, 12, 16, 0.45);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  opacity: 0.62;
  pointer-events: none;
}

.division-stage .gemini-badge {
  bottom: 58px;
}

.hq-card .gemini-badge {
  bottom: 36px;
}

.hero-frame .gemini-badge {
  bottom: 94px;
}

/* ---------- Contact Form & Footer ---------- */
.contact-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-dark);
  border-radius: 14px;
}

.form-control-dark,
.form-select-dark {
  background-color: #0b0e14 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

.form-control-dark:focus,
.form-select-dark:focus {
  border-color: var(--brand-red) !important;
  box-shadow: 0 0 0 0.2rem rgba(225, 29, 46, 0.2) !important;
}

.form-control-dark::placeholder {
  color: #64748b;
}

.site-footer {
  background: #05070a;
  border-top: 1px solid var(--border-dark);
  color: var(--text-muted-dark);
  font-size: 0.84rem;
}

/* ---------- Orientation & Small Mobile Safeguards ---------- */
@media (max-width: 575.98px) {
  .hero-frame img {
    height: 240px;
  }
  .division-media img {
    min-height: 220px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .site-navbar {
    min-height: 60px;
  }
  .hero-section {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
}
