
/* Keyword Density category selector and word cloud */

.density-cloud-frame {
  display: block;
  width: 100%;
  margin: 20px 0;
  padding: 20px;
  border: 1px solid #b8d6eb;
  border-radius: 0;
  background: rgba(39, 136, 203, .045);
}

.density-cloud-frame h3,
.density-frequency-panel h3 {
  margin: 0 0 10px;
}

.density-cloud-description {
  margin: 0 0 12px;
  font-size: .9rem;
}

.density-word-cloud {
  display: block;
  width: 100%;
  height: auto;
  min-height: 220px;
  max-height: 420px;
}

.density-word-cloud text {
  font-family: Inter, system-ui, sans-serif;
  /* Font weight is controlled by each phrase's density in JavaScript. */
}

.density-frequency-panel {
  width: 100%;
  min-width: 0;
  margin-top: 20px;
}

.density-category-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.density-category-button {
  min-width: 0;
  padding: 12px 8px;
  border: 1px solid #b8d6eb;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 600 .9rem Inter, system-ui, sans-serif;
  cursor: pointer;
}

.density-category-button:hover,
.density-category-button:focus-visible {
  border-color: #287fbc;
  outline-offset: 2px;
}

.density-category-button.is-active {
  background: #287fbc;
  border-color: #287fbc;
  color: #fff;
}

.density-frequency-panel .density-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.density-frequency-panel .density-table {
  width: 100%;
}

html[data-theme="dark"] .density-cloud-frame,
body.dark-mode .density-cloud-frame {
  background: rgba(39, 136, 203, .09);
  border-color: rgba(155, 191, 225, .3);
}

@media (max-width: 700px) {
  .density-cloud-frame {
    padding: 10px;
  }

  .density-category-selector {
    gap: 4px;
  }

  .density-category-button {
    padding: 10px 3px;
    font-size: .7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .density-category-button {
    transition: none;
  }
}


/* Word cloud SVG */
.density-word-cloud {
  overflow: visible;
}


/* compact input controls */
.density-mode-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.density-input-toggle {
  margin: 0;
  white-space: nowrap;
}

/* Keep the floating bubble comfortably inside its own panel */
.density-word-cloud {
  overflow: hidden;
}


/* draggable word cloud */
.density-word-cloud {
  cursor: grab;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}

.density-word-cloud.is-dragging {
  cursor: grabbing;
}

.density-cloud-reset {
  display: inline-block;
  margin: 0 0 12px;
  padding: 7px 13px;
  border: 1px solid #287fbc;
  border-radius: 8px;
  background: transparent;
  color: #1b5787;
  font: 600 .85rem Inter, system-ui, sans-serif;
  cursor: pointer;
}

.density-cloud-reset:hover,
.density-cloud-reset:focus-visible {
  background: #287fbc;
  color: #fff;
}


/* fixed watermark and draggable cloud viewport */
.density-cloud-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.density-cloud-viewport .density-word-cloud {
  position: relative;
  z-index: 2;
}

.density-cloud-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  max-width: 92%;
  color: #45698e;
  opacity: 0.08;
  font-family: Inter, sans-serif;
  font-size: clamp(18px, 3.5vw, 48px);
  font-weight: 700;
  letter-spacing: 0.025em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

html[data-theme="dark"] .density-cloud-watermark,
body.dark-mode .density-cloud-watermark {
  color: #c4ddf5;
  opacity: 0.10;
}

@media (max-width: 600px) {
  .density-cloud-watermark {
    font-size: clamp(14px, 4vw, 24px);
  }
}

/* Keep the workspace heading visible when returning to the star button. */
#toolStarCorner {
  scroll-margin-top: 180px;
}

/* LOCAL ONLY: Minimal animated keyword-frequency hero artwork. */
.density-hero-art {
  display: flex;
  align-items: center;
  justify-content: center;
}

.density-hero-visual {
  width: min(100%, 420px);
  padding: 28px 24px;
  display: grid;
  gap: 17px;
  border: 1px solid rgba(64, 145, 207, .18);
  border-radius: 18px;
  background: rgba(230, 244, 255, .45);
}

.density-hero-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.density-hero-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #245c88;
}

.density-hero-track {
  display: block;
  height: 13px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(70, 150, 211, .12);
}

.density-hero-bar {
  display: block;
  height: 100%;
  width: var(--density-bar-width);
  border-radius: inherit;
  background: var(--density-bar-colour);
  transform-origin: left center;
  animation: density-hero-pulse 5s ease-in-out infinite;
}

.density-hero-row-1 {
  --density-bar-width: 92%;
  --density-bar-colour: #123b61;
}

.density-hero-row-2 {
  --density-bar-width: 76%;
  --density-bar-colour: #287fbc;
}

.density-hero-row-3 {
  --density-bar-width: 59%;
  --density-bar-colour: #5a9fce;
}

.density-hero-row-4 {
  --density-bar-width: 43%;
  --density-bar-colour: #8dbbdd;
}

.density-hero-row-5 {
  --density-bar-width: 27%;
  --density-bar-colour: #a4cbe8;
}

.density-hero-row:nth-child(2) .density-hero-bar {
  animation-delay: -.9s;
}

.density-hero-row:nth-child(3) .density-hero-bar {
  animation-delay: -1.8s;
}

.density-hero-row:nth-child(4) .density-hero-bar {
  animation-delay: -2.7s;
}

.density-hero-row:nth-child(5) .density-hero-bar {
  animation-delay: -3.6s;
}

@keyframes density-hero-pulse {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  50% { transform: scaleX(.88); opacity: .78; }
}

@media (prefers-reduced-motion: reduce) {
  .density-hero-bar {
    animation: none !important;
  }
}

@media (max-width: 640px) {
  .density-hero-visual {
    padding: 20px 16px;
    gap: 13px;
  }

  .density-hero-row {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
  }

  .density-hero-label {
    font-size: 10px;
  }
}

@media (prefers-color-scheme: dark) {
  .density-hero-visual {
    background: rgba(15, 47, 76, .35);
    border-color: rgba(119, 181, 226, .25);
  }

  .density-hero-label {
    color: #b8d9f1;
  }
}


/* Local-only JavaScript-rendering warning */
.density-js-warning {
  position: relative;
  margin: 0 0 20px;
  padding: 20px 48px 18px 20px;
  border: 1px solid #e5b75c;
  border-left: 4px solid #bd780e;
  border-radius: 12px;
  background: rgba(217, 145, 30, .10);
  color: inherit;
}

.density-js-warning strong {
  display: block;
  margin-bottom: 10px;
}

.density-js-warning p {
  margin: 8px 0;
  line-height: 1.6;
}

.density-js-warning-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.density-js-warning-close:focus-visible {
  outline: 3px solid #3985db;
  outline-offset: 3px;
}

html[data-theme="dark"] .density-js-warning,
body[data-theme="dark"] .density-js-warning,
body.dark-mode .density-js-warning {
  background: rgba(217, 145, 30, .13);
  border-color: #d9a74a;
  border-left-color: #e5b75c;
}

@media (max-width: 480px) {
  .density-js-warning {
    padding: 16px 46px 16px 14px;
  }
}
