/* Module: sections 07-10 of automation 03 (AI Customer Support Agent).
   #features (uses features.css tiles), #dashboard, #stack and #industries.
   Every rule is scoped under its section id; every class invented here starts with sup-.
   Frames and shared pieces come from features.css, dashboard.css and site.css. */

/* ---------- 07 / Features: every title reserves two lines, so each body starts on the same y ---------- */

#features .features-tile .cell-t {
  min-height: 2.3em;
  max-width: 14ch;
  text-wrap: pretty;
}

#features .features-tile .cell-p {
  text-wrap: pretty;
}

/* At 1280+ the grid is wide enough for the longest title ("Speaks your customers' language") in two lines */
@media (min-width: 1280px) {
  #features .features-tile .cell-t {
    max-width: 20ch;
  }
}

/* ---------- 08 / Dashboard: window body (sidebar | main) ---------- */

#dashboard .sup-dash-body {
  display: block;
}

@media (min-width: 1280px) {
  #dashboard .sup-dash-body {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
  }
}

@media (min-width: 1440px) {
  #dashboard .sup-dash-body {
    grid-template-columns: 168px minmax(0, 1fr);
  }
}

#dashboard .sup-dash-main {
  min-width: 0;
}

/* Labels and sub-lines wrap rather than truncate: the cards are narrow at 1280 and 390 */
#dashboard .sup-dash .dashboard-stat-l,
#dashboard .sup-dash .dashboard-stat-s,
#dashboard .sup-dash .dashboard-meta {
  white-space: normal;
  text-overflow: clip;
}

#dashboard .sup-dash .dashboard-stat-l {
  text-wrap: balance;
}

/* The window title may wrap on phones instead of being cut off */
#dashboard .sup-dash .dashboard-bar-title {
  white-space: normal;
  line-height: 1.4;
}

@media (max-width: 639px) {
  #dashboard .sup-dash .dashboard-bar {
    height: auto;
    min-height: 40px;
    padding-block: 10px;
  }
}

/* The footer keeps "Synced from your helpdesk" on phones too */
#dashboard .sup-dash .dashboard-foot-sync {
  display: inline;
}

/* ---------- Two columns under the cards ---------- */

#dashboard .sup-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

#dashboard .sup-block {
  min-width: 0;
}

#dashboard .sup-block + .sup-block {
  border-top: 1px solid var(--line);
}

#dashboard .sup-block .dashboard-toolbar {
  padding-bottom: 16px;
}

@media (min-width: 1024px) {
  #dashboard .sup-columns {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    grid-template-areas:
      "topq gaps"
      "topq sat";
  }

  #dashboard .sup-topq {
    grid-area: topq;
    border-right: 1px solid var(--line);
  }

  #dashboard .sup-gaps {
    grid-area: gaps;
    border-top: 0;
  }

  #dashboard .sup-sat {
    grid-area: sat;
  }
}

/* ---------- Top questions: bars ---------- */

#dashboard .sup-bars {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0 20px 20px;
  list-style: none;
}

#dashboard .sup-bar-row {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#dashboard .sup-bar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

#dashboard .sup-bar-name {
  min-width: 0;
  font-size: 15px;
  line-height: 1.3;
  color: var(--bone);
}

#dashboard .sup-bar-val {
  flex: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
}

#dashboard .sup-bar-track {
  display: block;
  height: 4px;
  background: var(--line);
}

#dashboard .sup-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: hsl(42 30% 94% / 0.22);
  transform-origin: left center;
}

#dashboard .sup-bar-fill--gold {
  background: var(--accent);
}

/* Bars grow once when the window scrolls into view. The finished width is already set in the
   markup by the script, so ?static=1, reduced motion and no-JS all show the finished state. */
#dashboard .sup-dash--play .sup-bar-fill {
  animation: sup-grow 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0s);
}

@keyframes sup-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* ---------- Knowledge gaps ---------- */

#dashboard .sup-gaps-list {
  display: grid;
  margin: 0;
  padding: 0 20px 12px;
  list-style: none;
}

#dashboard .sup-gap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

#dashboard .sup-gap:first-child {
  border-top: 0;
}

#dashboard .sup-gap-q {
  min-width: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--bone);
  text-wrap: pretty;
}

#dashboard .sup-gap-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

#dashboard .sup-gap-n {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
}

#dashboard .sup-gap-add {
  min-height: 34px;
  padding: 0.375rem 1rem;
  font-size: 14px;
  pointer-events: none;
}

@media (max-width: 639px) {
  #dashboard .sup-gap {
    grid-template-columns: minmax(0, 1fr);
  }

  #dashboard .sup-gap-side {
    justify-self: start;
  }
}

/* ---------- Satisfaction ---------- */

#dashboard .sup-sat-body {
  display: grid;
  gap: 14px;
  padding: 0 20px 20px;
}

#dashboard .sup-sat-n {
  font-family: var(--font-display);
  font-size: clamp(3rem, 5vw, 4rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  color: var(--bone);
}

#dashboard .sup-sat-l {
  font-size: 16px;
  line-height: 1.5;
  color: var(--bone-70);
}

#dashboard .sup-split {
  display: flex;
  height: 8px;
  margin-top: 6px;
  background: var(--line);
}

#dashboard .sup-split-ok,
#dashboard .sup-split-bad {
  display: block;
  height: 100%;
  width: 0;
  opacity: 0.7;
}

#dashboard .sup-split-ok {
  background: var(--ok);
}

#dashboard .sup-split-bad {
  background: var(--danger);
}

#dashboard .sup-split-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 4px;
}

#dashboard .sup-split-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
}

#dashboard .sup-split-item svg {
  width: 16px;
  height: 16px;
  flex: none;
}

#dashboard .sup-split-item--ok svg {
  color: var(--ok);
}

#dashboard .sup-split-item--bad svg {
  color: var(--danger);
}

#dashboard .sup-split-ratings {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 09 / Stack: seven tools on hairlines ----------
   Each cell draws its own hairlines, so any column count works. 7 across from 1280,
   4 + 3 from 1024, 2 wide from 640 and one wide below that. */

#stack .sup-stack {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#stack .sup-stack > * {
  min-width: 0;
  padding: 28px 22px;
  border-left: 0;
  border-top: 0;
}

#stack .sup-stack .features-glyph {
  margin-bottom: 24px;
}

/* The caption sits 24px under the grid at every width */
#stack .features-caption {
  margin-top: 24px;
}

#stack .sup-tool-text {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#stack .sup-tool-r {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ash);
  text-wrap: pretty;
}

#stack .sup-stack > *:hover .sup-tool-r {
  color: var(--bone-70);
}

@media (min-width: 1280px) {
  #stack .sup-stack {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  #stack .sup-stack > *:nth-child(n + 2) {
    border-left: 1px solid var(--line);
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  #stack .sup-stack > *:nth-child(4n + 2),
  #stack .sup-stack > *:nth-child(4n + 3),
  #stack .sup-stack > *:nth-child(4n + 4) {
    border-left: 1px solid var(--line);
  }

  #stack .sup-stack > *:nth-child(n + 5) {
    border-top: 1px solid var(--line);
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  #stack .sup-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #stack .sup-stack > *:nth-child(2n) {
    border-left: 1px solid var(--line);
  }

  #stack .sup-stack > *:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 639px) {
  #stack .sup-stack {
    grid-template-columns: minmax(0, 1fr);
  }

  #stack .sup-stack > *:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }

  /* One tool per row: glyph on the left, name with its line of copy beside it */
  #stack .sup-stack > * {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0;
  }

  #stack .sup-stack .features-glyph {
    flex: none;
    margin: 2px 0 0;
  }

  #stack .sup-stack .sup-tool-r {
    font-size: 1rem;
  }
}

/* ---------- 10 / Built for: name and one line per row ---------- */

#industries .sup-ind-row {
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: start;
  padding: 24px 0;
}

#industries .sup-ind-text {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#industries .sup-ind-row .features-hex {
  margin-top: 8px;
}

#industries .sup-ind-line {
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ash);
  text-wrap: pretty;
}

@media (max-width: 767px) {
  #industries .sup-ind-row {
    min-height: 0;
    padding: 20px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #dashboard .sup-dash--play .sup-bar-fill {
    animation: none;
  }
}
