/* ===================================================================
 * breachCalc.css — the phishing risk calculator dialog
 *
 * Rebuilt as a single compact surface: the three outputs used to be
 * stacked full-width bars, which made the dialog 760px tall on a
 * 950px screen. They are now one three-column readout row, so the
 * whole panel is roughly a third shorter and the numbers carry the
 * design instead of the boxes.
 * =================================================================== */

.popup-container {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  overscroll-behavior: contain;
  z-index: 1000;
}

.popup-container.is-open {
  display: block;
  animation: calc-fade 0.25s ease both;
}

/* ---------------------------------------------------------------- */
/* panel                                                             */
/* ---------------------------------------------------------------- */

.popup-content {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(92vw, 66rem);
  max-height: 92vh;
  overflow-y: auto;
  padding: 3.6rem 3.8rem 3.4rem;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(172, 20, 90, 0.45);
  border-radius: 1.4rem;
  background:
    radial-gradient(120% 90% at 50% -30%, rgba(172, 20, 90, 0.24), transparent 62%),
    linear-gradient(180deg, #121014 0%, #0b0b0d 100%);
  box-shadow:
    0 4rem 9rem -2rem rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  color: #ffffff;
  font-family: "metropolis-regular", sans-serif;
}

.popup-container.is-open .popup-content {
  animation: calc-pop 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes calc-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes calc-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -47%) scale(0.965);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.popup-content:focus {
  outline: none;
}

.calc-eyebrow {
  margin: 0 0 1rem;
  font-family: "metropolis-medium", sans-serif;
  font-size: 1.02rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--pink-bright, #ff4d9d);
}

.popup-content h2 {
  margin: 0;
  padding-right: 4.4rem;
  font-family: "domine-regular", serif;
  font-weight: normal;
  font-size: clamp(2.8rem, 3.1vw, 3.6rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.calc-intro {
  margin: 1.2rem 0 0;
  font-size: 1.3rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.52);
}

/* ---------------------------------------------------------------- */
/* headcount slider                                                  */
/* ---------------------------------------------------------------- */

.calc-control {
  margin-top: 3.2rem;
}

.calc-control__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.6rem;
}

.calc-control label {
  font-family: "metropolis-medium", sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.calc-control__value {
  font-family: "metropolis-semibold", sans-serif;
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--pink-bright, #ff4d9d);
  font-variant-numeric: tabular-nums;
}

/* the track is painted with a hard-stop gradient driven by --fill */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 0.6rem;
  margin: 1.5rem 0 1rem;
  padding: 0;
  border-radius: 10rem;
  background:
    linear-gradient(
      to right,
      #ac145a 0%,
      #ff4d9d var(--fill, 40%),
      rgba(255, 255, 255, 0.1) var(--fill, 40%),
      rgba(255, 255, 255, 0.1) 100%
    );
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 0 0 0.5rem rgba(172, 20, 90, 0.28),
    0 0.4rem 1.2rem rgba(0, 0, 0, 0.55);
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.25s ease;
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.08);
  box-shadow:
    0 0 0 0.7rem rgba(255, 77, 157, 0.26),
    0 0.4rem 1.6rem rgba(0, 0, 0, 0.6);
}

input[type="range"]:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(0.98);
}

input[type="range"]::-moz-range-thumb {
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 0.5rem rgba(172, 20, 90, 0.28);
  cursor: grab;
}

input[type="range"]::-moz-range-track {
  height: 0.6rem;
  border-radius: 10rem;
  background: rgba(255, 255, 255, 0.1);
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--pink-bright, #ff4d9d);
  outline-offset: 0.6rem;
}

.calc-scale {
  display: flex;
  justify-content: space-between;
  font-family: "metropolis-medium", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.32);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- */
/* readout                                                           */
/* ---------------------------------------------------------------- */

.results {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 1px;
  margin-top: 3.2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.result-item {
  padding: 2.4rem 2rem 2.6rem;
  background: #0d0d10;
  min-width: 0;
}

.result-label {
  font-family: "metropolis-medium", sans-serif;
  font-size: 0.98rem;
  line-height: 1.4;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.44);
}

.result-label span {
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.26);
}

.result-value {
  margin-top: 0.9rem;
  font-family: "metropolis-semibold", sans-serif;
  font-size: clamp(2rem, 2.4vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.result-item--primary .result-value {
  font-size: clamp(2.3rem, 2.9vw, 3.3rem);
  background: linear-gradient(120deg, #ffffff 10%, #ff9cc4 55%, #ff4d9d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* the readout settles when the slider is released */
.results.is-settling .result-value {
  animation: calc-settle 0.44s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes calc-settle {
  0% { transform: scale(1); text-shadow: none; }
  40% { transform: scale(1.045); text-shadow: 0 0 2rem rgba(255, 77, 157, 0.8); }
  100% { transform: scale(1); text-shadow: none; }
}

/* cards lift in, one after another, when the dialog opens */
.popup-container.is-open .result-item {
  animation: calc-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms + 140ms);
}

@keyframes calc-rise {
  from { opacity: 0; transform: translateY(0.9rem); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- */
/* footnote row                                                      */
/* ---------------------------------------------------------------- */

.calc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 2rem;
  margin-top: 2.6rem;
  font-size: 1.08rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.34);
}

.calc-meta b {
  font-family: "metropolis-medium", sans-serif;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.72);
}

/* ---------------------------------------------------------------- */
/* close                                                             */
/* ---------------------------------------------------------------- */

.calc-close-btn {
  position: absolute;
  top: 1.6rem;
  right: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 3.4rem;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 2.4rem;
  line-height: 1;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.calc-close-btn:hover {
  background-color: #ac145a;
  border-color: #ac145a;
  transform: rotate(90deg);
}

.calc-close-btn:focus-visible {
  outline: 2px solid #ff3d8f;
  outline-offset: 2px;
}

.calc-close-btn:focus {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.06);
  outline: 0;
}

/* ---------------------------------------------------------------- */
/* small screens                                                     */
/* ---------------------------------------------------------------- */

@media screen and (max-width: 620px) {
  .popup-content {
    width: calc(100% - 3.2rem);
    max-height: 90vh;
    padding: 3rem 2.2rem 2.6rem;
  }

  .popup-content h2 {
    font-size: 2.5rem;
  }

  .results {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.6rem;
    padding: 1.5rem 1.8rem;
  }

  .result-value {
    margin-top: 0;
    font-size: 2rem;
  }

  .result-item--primary .result-value {
    font-size: 2.3rem;
  }

  .calc-meta {
    gap: 0.6rem 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .popup-container.is-open,
  .popup-container.is-open .popup-content,
  .popup-container.is-open .result-item,
  .results.is-settling .result-value {
    animation: none;
  }

  .calc-close-btn,
  input[type="range"]::-webkit-slider-thumb {
    transition: none;
  }
}
