/* Module: sections of automation 04 (Lead Generation Scraper): #features (07), #dashboard (08),
   #stack (09) and #industries (10). Every rule is scoped under those ids; every class invented here
   starts with lg-. 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 ("Delivered where you work") in two lines */
@media (min-width: 1280px) {
  #features .features-tile .cell-t {
    max-width: 20ch;
  }
}

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

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

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

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

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

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

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

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

/* The footer keeps "Synced from Google Sheets and HubSpot" on phones too */
#dashboard .lg-dash .dashboard-foot-sync {
  display: inline;
}

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

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

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

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

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

#dashboard .lg-sub {
  border-top: 1px solid var(--line);
}

#dashboard .lg-sub > .dashboard-toolbar {
  padding-top: 20px;
}

@media (min-width: 1024px) {
  #dashboard .lg-columns {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  }

  #dashboard .lg-markets {
    border-right: 1px solid var(--line);
  }

  #dashboard .lg-fit {
    border-top: 0;
  }
}

/* ---------- Markets table ---------- */

#dashboard .lg-mtable {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

/* Auto layout: the niche and city may wrap, the numbers, headers and last run never do */
#dashboard .lg-mtable thead th,
#dashboard .lg-mtable tbody .lg-m-found,
#dashboard .lg-mtable tbody .lg-m-good,
#dashboard .lg-mtable tbody .lg-m-last {
  white-space: nowrap;
}

#dashboard .lg-mtable thead th {
  height: 36px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ash);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dashboard .lg-mtable thead th:first-child,
#dashboard .lg-mtable tbody td:first-child {
  padding-left: 20px;
}

#dashboard .lg-mtable thead th:last-child,
#dashboard .lg-mtable tbody td:last-child {
  padding-right: 20px;
}

#dashboard .lg-mtable .lg-num {
  text-align: right;
}

#dashboard .lg-mtable tbody td {
  height: 56px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  font-size: 15px;
  line-height: 1.35;
  color: var(--bone-80);
}

#dashboard .lg-mtable tbody tr:last-child td {
  border-bottom: 0;
}

#dashboard .lg-mtable tbody tr {
  transition: background-color 0.2s var(--ease-std);
}

#dashboard .lg-mtable tbody tr:hover {
  background: var(--elev);
}

#dashboard .lg-m-niche {
  display: block;
  color: var(--bone);
  text-wrap: balance;
}

#dashboard .lg-m-city {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  color: var(--ash);
}

#dashboard .lg-mtable .lg-m-found {
  text-align: right;
  color: var(--bone);
  font-size: 16px;
}

#dashboard .lg-m-fit {
  display: flex;
  align-items: center;
  gap: 10px;
}

#dashboard .lg-m-pct {
  min-width: 3ch;
  color: var(--bone);
}

#dashboard .lg-m-bar {
  display: block;
  width: 56px;
  height: 4px;
  flex: none;
  background: var(--line);
}

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

#dashboard .lg-row--key .lg-m-bar i {
  background: var(--accent);
}

#dashboard .lg-m-last {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
  white-space: nowrap;
}

/* ---------- Export history ---------- */

#dashboard .lg-exports {
  display: grid;
  margin: 0;
  padding: 0 20px 20px;
  list-style: none;
}

#dashboard .lg-exp {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "market n"
    "meta status";
  align-items: center;
  gap: 8px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

#dashboard .lg-exp:first-child {
  border-top: 0;
}

#dashboard .lg-exp-market {
  grid-area: market;
  min-width: 0;
  font-size: 15px;
  line-height: 1.35;
  color: var(--bone);
}

#dashboard .lg-exp-n {
  grid-area: n;
  font-size: 15px;
  color: var(--bone-80);
  white-space: nowrap;
  text-align: right;
}

#dashboard .lg-exp-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-width: 0;
}

#dashboard .lg-exp-when {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
  white-space: nowrap;
}

#dashboard .lg-exp-dest {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

#dashboard .lg-chip-dest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bone-70);
  white-space: nowrap;
}

#dashboard .lg-chip-dest svg {
  width: 10px;
  height: 10px;
  flex: none;
  color: var(--ash);
}

#dashboard .lg-status {
  grid-area: status;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid hsl(152 60% 48% / 0.4);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ok);
  white-space: nowrap;
}

/* ---------- Fit scores: histogram, axis, bands ---------- */

#dashboard .lg-hist-wrap {
  padding: 0 20px;
}

#dashboard .lg-hist {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
}

#dashboard .lg-bin {
  flex: 1 1 0;
  min-width: 0;
  height: 0;
  background: hsl(42 30% 94% / 0.22);
  border-radius: 2px 2px 0 0;
  transform-origin: 50% 100%;
}

#dashboard .lg-bin--key {
  background: var(--accent);
}

#dashboard .lg-axis {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
}

#dashboard .lg-axis span {
  white-space: nowrap;
}

#dashboard .lg-axis span:last-child {
  justify-self: end;
}

#dashboard .lg-bands {
  display: grid;
  margin: 14px 0 0;
  padding: 0 20px 20px;
  list-style: none;
}

#dashboard .lg-band {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

#dashboard .lg-band:first-child {
  border-top: 0;
}

#dashboard .lg-band-l {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  min-width: 0;
}

#dashboard .lg-band-name {
  font-size: 15px;
  line-height: 1.3;
  color: var(--bone);
}

#dashboard .lg-band--key .lg-band-name {
  color: var(--accent);
}

#dashboard .lg-band-r {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ash);
  white-space: nowrap;
}

#dashboard .lg-band-n {
  flex: none;
  font-size: 15px;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

/* ---------- Sources: bars ---------- */

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

#dashboard .lg-src {
  display: grid;
  gap: 8px;
  min-width: 0;
}

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

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

#dashboard .lg-src-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 .lg-src-track {
  display: block;
  height: 4px;
  background: var(--line);
}

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

#dashboard .lg-src-fill--key {
  background: var(--accent);
}

/* Bars and histogram grow once when the window is seen. The finished sizes are set by the script,
   so ?static=1, reduced motion and no-JS all show the finished state. */
#dashboard .lg-dash--play .lg-bin {
  animation: lg-rise 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0s);
}

#dashboard .lg-dash--play .lg-src-fill,
#dashboard .lg-dash--play .lg-m-bar i {
  animation: lg-grow 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0s);
}

@keyframes lg-rise {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

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

/* ---------- Dashboard, tablet: columns stack below 1024 ---------- */

@media (max-width: 1023px) {
  #dashboard .lg-block > .dashboard-toolbar {
    padding-top: 20px;
  }
}

/* ---------- Dashboard, phone: 2x2 cards, stacked market rows, stacked export rows ---------- */

@media (max-width: 639px) {
  #dashboard .lg-mtable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  #dashboard .lg-mtable,
  #dashboard .lg-mtable tbody {
    display: block;
  }

  #dashboard .lg-mtable tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "market found"
      "fit last";
    gap: 10px 16px;
    padding: 16px 14px;
    border-top: 1px solid var(--line-soft);
  }

  #dashboard .lg-mtable tbody tr:first-child {
    border-top: 0;
  }

  #dashboard .lg-mtable tbody td,
  #dashboard .lg-mtable tbody td:first-child,
  #dashboard .lg-mtable tbody td:last-child {
    display: block;
    height: auto;
    padding: 0;
    border: 0;
    line-height: 1.35;
  }

  #dashboard .lg-mtable tbody .lg-m-market {
    grid-area: market;
    min-width: 0;
  }

  #dashboard .lg-mtable tbody .lg-m-found {
    grid-area: found;
    text-align: right;
  }

  #dashboard .lg-mtable tbody .lg-m-good {
    grid-area: fit;
  }

  #dashboard .lg-mtable tbody .lg-m-last {
    grid-area: last;
    justify-self: end;
    align-self: center;
  }

  #dashboard .lg-exp {
    gap: 8px 12px;
  }

  #dashboard .lg-exports,
  #dashboard .lg-bands,
  #dashboard .lg-sources,
  #dashboard .lg-hist-wrap {
    padding-left: 14px;
    padding-right: 14px;
  }

  #dashboard .lg-hist {
    height: 128px;
    gap: 4px;
  }

  #dashboard .lg-axis {
    gap: 4px;
  }

  #dashboard .lg-sub > .dashboard-toolbar,
  #dashboard .lg-block > .dashboard-toolbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  #dashboard .lg-dash .dashboard-foot-sync {
    display: inline;
  }
}

/* ---------- 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 .lg-stack {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  #stack .lg-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 .lg-stack > * {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0;
  }

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

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

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

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

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

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

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

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

@media (prefers-reduced-motion: reduce) {
  #dashboard .lg-dash--play .lg-bin,
  #dashboard .lg-dash--play .lg-src-fill,
  #dashboard .lg-dash--play .lg-m-bar i {
    animation: none;
  }
}

/* ---------- Fix round 1: section rhythm, footnav targets (closing fragment's classes) ---------- */

/* #stack starts like the other sections under the sticky header, and sits closer to #industries
   so the two read as a pair (04-visual-16) */
#stack.section--tight {
  padding-top: 96px;
  padding-bottom: 48px;
}

@media (max-width: 1023px) {
  #stack.section--tight {
    padding-top: 72px;
    padding-bottom: 40px;
  }
}

/* Footnav: the next link is a 44px tap target like the previous one; the inline styles that
   used to sit on these elements live here (04-a11y-03) */
#footnav .closing-footnav-prev {
  white-space: normal;
}

#footnav .closing-footnav-count {
  text-align: center;
}

#footnav .lg-footnav-all {
  display: inline-block;
  padding: 14px 0;
  margin: -14px 0;
  white-space: nowrap;
}

#footnav .closing-footnav-next {
  min-height: 44px;
  padding-block: 14px;
}
