/* Monitoring — MFP online monitoring section
   Adapted from sections/monitoring/premium-mfp-monitoring-section */

#monitoring.mon-section {
  --mon-blue: var(--cyan);
  --mon-blue-soft: var(--cyan-dark);
  --mon-ink: #0f172a;
  --mon-muted: #475569;
  --mon-faint: #64748b;
  --mon-line: #e7edf4;
  --mon-bg: #f8fafc;
  --mon-white: #ffffff;
  --mon-ease: cubic-bezier(0.22, 1, 0.36, 1);

  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(10, 128, 128, 0.08), transparent 55%),
    radial-gradient(ellipse 40% 35% at 5% 90%, rgba(236, 0, 140, 0.05), transparent 50%),
    var(--mon-bg);
  padding: clamp(72px, 9vw, 120px) 0;
}

.mon-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  align-items: center;
}

.mon-title {
  margin: 0;
}

.mon-sub {
  margin: 20px 0 0;
  font-size: var(--text-lead);
  line-height: 1.7;
  color: var(--mon-muted);
}

/* ---- Cards (base styles before layout media queries) ---- */

.monitor-card {
  position: relative;
  width: 100%;
  min-width: 0;
  background: var(--mon-white);
  border: 1px solid var(--mon-line);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow:
    0 10px 30px -14px rgba(15, 23, 42, 0.14),
    0 2px 6px rgba(15, 23, 42, 0.04);
  transition:
    transform 0.35s var(--mon-ease),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
}

.monitor-card:hover {
  transform: translateY(-4px);
  border-color: #d3dce7;
  box-shadow:
    0 22px 46px -18px rgba(15, 23, 42, 0.2),
    0 4px 12px rgba(15, 23, 42, 0.06);
}

.monitor-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.monitor-card__dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--mon-blue);
}

.monitor-card__label {
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mon-faint);
}

.monitor-card__rows {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.monitor-card__rows li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.monitor-card__name {
  font-size: var(--text-sm);
  line-height: 1.35;
  color: var(--mon-muted);
  white-space: nowrap;
}

.monitor-card__value {
  font-size: var(--text-sm);
  line-height: 1.35;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--mon-ink);
  flex: none;
  white-space: nowrap;
  text-align: right;
}

.monitor-card__caption {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  font-size: var(--text-2xs);
  line-height: 1.4;
  color: var(--mon-faint);
  white-space: nowrap;
}

/* ---- Stage ---- */

.mon-stage {
  position: relative;
  width: 100%;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  row-gap: 28px;
}

.mon-stage__glow {
  position: absolute;
  inset: -12% -6%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 42% at 50% 44%, rgba(10, 128, 128, 0.1), transparent 70%),
    radial-gradient(28% 28% at 16% 14%, rgba(10, 128, 128, 0.06), transparent 70%),
    radial-gradient(26% 26% at 84% 84%, rgba(236, 0, 140, 0.05), transparent 70%);
}

.mon-stage__connectors {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.mon-stage__mfp {
  /* Mobile: privilege cards grid — hide illustration */
  display: none;
  position: relative;
  z-index: 10;
  justify-content: center;
  align-items: center;
}

.mon-stage__cards {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
  max-width: 460px;
}

.mfp-scale {
  --mfp-scale: 1;
  position: relative;
  width: calc(300px * var(--mfp-scale));
  height: calc(340px * var(--mfp-scale));
  transform-origin: top left;
}

.mfp-scale .mfp {
  transform: scale(var(--mfp-scale));
  transform-origin: top left;
}

/* Tablet+: show MFP, cards grid, stacked shell
   (earlier than hero — monitoring content is lighter) */
@media (min-width: 640px) {
  .mon-shell {
    gap: 44px;
  }

  .mon-stage__mfp {
    display: flex;
  }

  .mon-stage__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 560px;
  }

  .mon-stage__cards .monitor-card--department {
    grid-column: 1 / -1;
  }

  .mfp-scale {
    --mfp-scale: 0.88;
  }
}

@media (min-width: 900px) {
  .mon-shell {
    gap: 48px;
  }

  .mfp-scale {
    --mfp-scale: 0.92;
  }
}

/* Wide: side-by-side shell + orbit stage */
@media (min-width: 1200px) {
  .mon-shell {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
    gap: 32px;
  }

  .mon-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: clamp(12px, 1.8vw, 28px);
    row-gap: clamp(14px, 2vw, 24px);
    align-items: center;
    justify-items: stretch;
    min-height: 0;
  }

  .mon-stage__connectors {
    display: block;
  }

  .mon-stage__mfp {
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: center;
    align-self: center;
  }

  .mon-stage__cards {
    display: contents;
    max-width: none;
  }

  .monitor-card {
    width: max-content;
    min-width: 200px;
    max-width: 260px;
    z-index: 20;
  }

  .monitor-card--person {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: start;
  }

  .monitor-card--device {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: start;
  }

  .mon-stage__cards .monitor-card--department,
  .monitor-card--department {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    align-self: end;
  }

  .mfp-scale {
    --mfp-scale: 0.78;
  }
}

@media (min-width: 1280px) {
  .monitor-card {
    min-width: 210px;
    max-width: 270px;
  }

  .mfp-scale {
    --mfp-scale: 0.88;
  }
}

@media (min-width: 1440px) {
  .mfp-scale {
    --mfp-scale: 1;
  }
}

/* ---- Connectors ---- */

.connector-base {
  fill: none;
  stroke: rgba(148, 163, 184, 0.3);
  stroke-width: 1;
}

.connector-flow {
  fill: none;
  stroke: rgba(10, 128, 128, 0.55);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 1.5 8;
  animation: mon-connector-flow 3.6s linear infinite;
}

@keyframes mon-connector-flow {
  to {
    stroke-dashoffset: -19;
  }
}

/* ---- MFP (scoped: must not leak into #hero .machine-par) ---- */

#monitoring .mfp {
  position: relative;
  width: 300px;
  height: 340px;
}

#monitoring .mfp__shadow {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -8px;
  height: 26px;
  z-index: 0;
  background: radial-gradient(50% 100% at 50% 50%, rgba(15, 23, 42, 0.18), rgba(15, 23, 42, 0) 70%);
  filter: blur(2px);
}

#monitoring .mfp__doc {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%) rotate(-5deg);
  width: 128px;
  height: 38px;
  z-index: 6;
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
  border: 1px solid #e3e9f1;
  border-radius: 4px;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

#monitoring .mfp__doc::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 9px;
  height: 2px;
  background: #e6ecf3;
  border-radius: 1px;
  box-shadow: 0 6px 0 #e6ecf3, 0 12px 0 #e6ecf3;
}

#monitoring .mfp__adf {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  height: 50px;
  z-index: 5;
  background: linear-gradient(180deg, #fcfdff 0%, #e6ecf4 100%);
  border: 1px solid #d8e0ea;
  border-radius: 12px 12px 7px 7px;
  box-shadow: inset 0 1px 0 #ffffff, 0 4px 10px rgba(15, 23, 42, 0.06);
}

#monitoring .mfp__adf::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 7px;
  height: 2px;
  background: #cfd9e4;
  border-radius: 2px;
}

#monitoring .mfp__scanner {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 262px;
  height: 24px;
  z-index: 3;
  background: linear-gradient(180deg, #eef2f7 0%, #ffffff 100%);
  border: 1px solid #dde5ee;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.05);
}

#monitoring .mfp__panel {
  position: absolute;
  top: 98px;
  left: 50%;
  transform: translateX(-50%);
  width: 206px;
  height: 122px;
  z-index: 4;
  padding: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #eef2f7 100%);
  border: 1px solid #d7e0ea;
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1), inset 0 1px 0 #ffffff;
}

#monitoring .mfp__screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 7px;
  background: #0b1220;
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

#monitoring .mfp__screen-ui {
  position: relative;
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
}

#monitoring .mfp__screen-kicker {
  display: block;
  white-space: nowrap;
  font-size: var(--text-3xs);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #94a3b8;
}

#monitoring .mfp__online {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
}

#monitoring .mfp__screen-divider {
  height: 1px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.1);
}

#monitoring .mfp__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#monitoring .mfp__metric-label {
  font-size: var(--text-3xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  white-space: nowrap;
}

#monitoring .mfp__metric-value {
  font-size: var(--text-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

#monitoring .mfp__body {
  position: absolute;
  top: 182px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 122px;
  z-index: 2;
  background: linear-gradient(180deg, #ffffff 0%, #edf1f7 100%);
  border: 1px solid #d9e1ea;
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.09), inset 0 1px 0 #ffffff;
}

#monitoring .mfp__output-slot {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 8px;
  border-radius: 4px;
  background: #c3ced9;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.2);
}

#monitoring .mfp__output-tray {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 170px;
  height: 20px;
  border-radius: 4px 4px 9px 9px;
  background: linear-gradient(180deg, #ffffff, #e7edf5);
  border: 1px solid #dbe3ec;
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.09);
}

#monitoring .mfp__grill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  width: 170px;
  height: 3px;
  border-radius: 3px;
  background: #e2e8f0;
  box-shadow: 0 7px 0 #e2e8f0, 0 14px 0 #e2e8f0;
}

#monitoring .mfp__tray {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 276px;
  height: 32px;
  z-index: 1;
  background: linear-gradient(180deg, #fcfdff 0%, #e7edf5 100%);
  border: 1px solid #d9e1ea;
  border-radius: 9px;
  box-shadow: 0 9px 20px rgba(15, 23, 42, 0.09), inset 0 1px 0 #ffffff;
}

#monitoring .mfp__tray::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 66px;
  height: 13px;
  border: 1px solid #d6dee8;
  border-radius: 7px;
  background: #ffffff;
}

#monitoring .mfp__tray::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 14px;
  width: 62px;
  height: 4px;
  border-radius: 2px;
  background: #ffffff;
  border: 1px solid #e5ebf2;
}

.pulse-dot {
  position: relative;
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 9999px;
  background: #60a5fa;
}

.pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: #60a5fa;
  animation: mon-pulse-ring 2.4s ease-out infinite;
}

@keyframes mon-pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  80%,
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

.scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1.5px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.75), transparent);
  animation: mon-scanline 4.6s ease-in-out infinite;
}

@keyframes mon-scanline {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  12% {
    opacity: 0.85;
  }
  50% {
    transform: translateY(94px);
    opacity: 0.85;
  }
  62% {
    opacity: 0;
  }
  100% {
    transform: translateY(94px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot::after,
  .connector-flow {
    animation: none !important;
  }
  .scanline {
    animation: none !important;
    opacity: 0;
  }
  .monitor-card {
    transition: none !important;
  }
}

/* Bilingual inside section */
#monitoring .lang-fr,
#monitoring .lang-en {
  display: none;
}
html[lang="fr"] #monitoring .lang-fr {
  display: block;
}
html[lang="en"] #monitoring .lang-en {
  display: block;
}
html[lang="fr"] #monitoring span.lang-fr,
html[lang="en"] #monitoring span.lang-en {
  display: inline;
}
html[lang="fr"] #monitoring h2.lang-fr,
html[lang="en"] #monitoring h2.lang-en,
html[lang="fr"] #monitoring p.lang-fr,
html[lang="en"] #monitoring p.lang-en,
html[lang="fr"] #monitoring .monitor-card__caption.lang-fr,
html[lang="en"] #monitoring .monitor-card__caption.lang-en {
  display: block;
}
