/* Module: sections 07-10 of automation 10 (Content Repurposing Engine).
   #features, #dashboard, #stack and #industries. Every rule is scoped under its section id;
   every class invented here starts with ce-. Frames and shared pieces come from features.css,
   dashboard.css and site.css. Channel and group hues arrive as --ce-hue on each element (from
   AEX.content.groups); no hue is written here. */

/* ---------- 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;
}

@media (min-width: 1280px) {
  #features .features-tile .cell-t {
    max-width: 20ch;
  }
}

/* ---------- 08 / Dashboard: window frame ---------- */

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

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

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

#dashboard .ce-dash .dashboard-bar-avatar {
  width: 22px;
  height: 22px;
}

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

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

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

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

#dashboard .ce-dash .dashboard-meta {
  text-align: right;
  text-wrap: pretty;
}

/* The footer keeps "Synced from Buffer and Notion" on phones too */
#dashboard .ce-dash .dashboard-foot-sync {
  display: inline;
}

/* Panel titles sit in the display face at 17px, as the spec's panel titles do */
#dashboard .ce-dash .ce-h {
  font-size: 17px;
  text-wrap: balance;
  white-space: normal;
}

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

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

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

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

#dashboard .ce-columns > .ce-block + .ce-side,
#dashboard .ce-side > .ce-block + .ce-block {
  border-top: 1px solid var(--line);
}

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

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

  #dashboard .ce-columns > .ce-block + .ce-side {
    border-top: 0;
  }

  #dashboard .ce-side {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
  }

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

/* ---------- Content calendar ---------- */

#dashboard .ce-cal {
  display: flex;
  flex-direction: column;
}

/* The calendar fills the height its column shares with the right-hand panels */
#dashboard .ce-cal-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 0 20px 20px;
}

#dashboard .ce-weekdays,
#dashboard .ce-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

#dashboard .ce-weekdays {
  margin-bottom: 6px;
}

#dashboard .ce-wd {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ash);
}

#dashboard .ce-grid {
  flex: none;
  grid-auto-rows: minmax(64px, 96px);
}

/* The legend sits at the foot of the panel, level with the right column's last block */
#dashboard .ce-legend {
  margin-top: auto;
}

#dashboard .ce-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 7px 8px 8px;
  border-radius: 4px;
  background: var(--elev);
  border: 1px solid var(--line-soft);
  transition: border-color 0.3s var(--ease-std);
}

#dashboard .ce-cell:hover {
  border-color: hsl(42 30% 94% / 0.1);
}

#dashboard .ce-cell--out {
  background: transparent;
  border-color: transparent;
}

#dashboard .ce-cell--out .ce-date {
  color: #6b655c;
}

#dashboard .ce-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
}

#dashboard .ce-marks {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 0;
  padding-top: 8px;
}

#dashboard .ce-mark {
  display: block;
  width: 100%;
  height: 5px;
  border-radius: 2.5px;
  background: var(--ce-hue);
}

#dashboard .ce-legend {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
}

#dashboard .ce-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#dashboard .ce-swatch {
  display: block;
  width: 10px;
  height: 10px;
  flex: none;
  background: var(--ce-hue);
}

#dashboard .ce-legend-n {
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

/* ---------- Top performers ---------- */

/* The side panels stack their caption under the title, so long captions never squeeze the title */
#dashboard .ce-top .dashboard-toolbar,
#dashboard .ce-speed .dashboard-toolbar {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

#dashboard .ce-top .dashboard-meta,
#dashboard .ce-speed .dashboard-meta {
  text-align: left;
}

#dashboard .ce-top-list {
  margin: 0;
  padding: 0 20px 8px;
  list-style: none;
}

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

#dashboard .ce-top-row:first-child {
  border-top: 0;
}

#dashboard .ce-rank {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 20px;
  letter-spacing: 0.04em;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
}

#dashboard .ce-chan {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: var(--ce-hue);
  background: color-mix(in oklab, var(--ce-hue) 16%, transparent);
  border: 1px solid color-mix(in oklab, var(--ce-hue) 38%, transparent);
}

#dashboard .ce-chan .ce-svg {
  display: block;
  line-height: 0;
}

#dashboard .ce-chan svg {
  display: block;
  width: 12px;
  height: 12px;
}

#dashboard .ce-top-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

#dashboard .ce-top-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.4;
  color: var(--bone);
  text-wrap: pretty;
}

#dashboard .ce-top-ref {
  justify-self: start;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ash);
}

#dashboard .ce-top-track {
  display: block;
  height: 3px;
  margin-top: 2px;
  background: var(--line);
}

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

#dashboard .ce-top-fill--gold {
  background: var(--accent);
}

#dashboard .ce-top-n {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 20px;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

/* ---------- Approval speed ---------- */

#dashboard .ce-speed-body {
  display: grid;
  gap: 10px;
  padding: 0 20px 20px;
}

#dashboard .ce-speed-body .dashboard-stat-s {
  margin-top: 0;
}

#dashboard .ce-speed-n {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

#dashboard .ce-speed-chart {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  margin-top: 10px;
}

#dashboard .ce-bar-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#dashboard .ce-bar-area {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 110px;
  border-bottom: 1px solid var(--line);
}

#dashboard .ce-bar {
  display: block;
  width: 18px;
  border-radius: 3px 3px 0 0;
  background: hsl(42 30% 94% / 0.22);
}

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

#dashboard .ce-bar-v {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1;
  color: var(--bone-70);
  font-variant-numeric: tabular-nums;
}

/* Day over month, so each label fits its column at 390 */
#dashboard .ce-bar-l {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
  color: var(--ash);
}

#dashboard .ce-bar-d {
  color: var(--bone-70);
  font-variant-numeric: tabular-nums;
}

#dashboard .ce-speed-foot {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

#dashboard .ce-speed-foot .dashboard-stat-s {
  margin-top: 0;
}

#dashboard .ce-speed-edits {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 500;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

/* Bars grow once when the window is seen. The finished sizes are already in the markup. */
#dashboard .ce-dash--play .ce-top-fill {
  animation: ce-grow-x 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0s);
}

#dashboard .ce-dash--play .ce-bar {
  animation: ce-grow-y 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0s);
  transform-origin: center bottom;
}

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

@keyframes ce-grow-y {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

/* Below 1024: one column, the side blocks stack under the calendar */
@media (max-width: 1023px) {
  #dashboard .ce-side {
    display: block;
  }
}

/* Phone: calendar cells keep 40px and 4px bars; the legend wraps; the speed chart keeps its width */
@media (max-width: 639px) {
  #dashboard .ce-cal-body {
    padding: 0 14px 16px;
  }

  #dashboard .ce-weekdays,
  #dashboard .ce-grid {
    gap: 3px;
  }

  #dashboard .ce-cell {
    min-height: 40px;
    padding: 4px 5px 5px;
  }

  #dashboard .ce-date {
    font-size: 11px;
  }

  #dashboard .ce-marks {
    gap: 2px;
    padding-top: 4px;
  }

  #dashboard .ce-mark {
    height: 4px;
    border-radius: 2px;
  }

  #dashboard .ce-legend {
    gap: 6px 14px;
    margin-top: 12px;
  }

  #dashboard .ce-top-list {
    padding: 0 14px 6px;
  }

  #dashboard .ce-speed-body {
    padding: 0 14px 16px;
  }

  #dashboard .ce-speed-n {
    font-size: 30px;
  }
}

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

/* ---------- 09 / Stack: eight tools on hairlines ----------
   Each cell draws its own hairlines, so any column count works. Four across from 1024 (two rows),
   two across from 640, one across below that. */

#stack .sec-head {
  margin-bottom: 48px;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#stack .features-caption {
  margin-top: 24px;
}

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

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

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

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

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

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

/* Sidebar: icons share one 20px box so the column lines up; the rail stops at its own content */
#dashboard .dashboard-nav-item .ce-svg {
  display: inline-flex;
  flex: none;
  width: 20px;
  height: 20px;
}

#dashboard .dashboard-nav-item .ce-svg svg {
  width: 100%;
  height: 100%;
}

#dashboard .dashboard-nav-item svg {
  stroke-width: 1.5;
}

#dashboard .ce-dash-body > .dashboard-rail {
  align-self: start;
}

/* Features: the gold phrase in the heading stays on one line; titles no longer reserve a blank line */
#features .gold-i {
  white-space: nowrap;
}

@media (min-width: 1024px) {
  #features .features-tile .cell-t {
    min-height: 0;
    margin-bottom: 14px;
  }
}

/* Stack and industries have less top padding than the other sections; their scroll landing matches */
#stack,
#industries {
  scroll-margin-top: calc(var(--topbar-h) + 32px);
}
