/* The Funnel — stations variant */

.dl-funnel {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 28px 28px 24px;
  position: relative;
}
.dl-funnel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 20px;
  gap: 20px; flex-wrap: wrap;
}
.dl-funnel-head h2 {
  font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0;
  letter-spacing: -0.01em;
}
.dl-funnel-head .meta { color: var(--ink-3); }
.dl-funnel-live { display: inline-flex; align-items: center; gap: 8px; }
.dl-funnel-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--daylight); animation: dl-pulse 1.6s infinite; }

.dl-funnel-stations {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
  min-height: 260px;
  isolation: isolate;
}

.dl-station {
  display: flex; flex-direction: column;
  border-left: 1px dashed var(--paper-rule);
  padding: 0 18px;
  position: relative;
  /* Allow this grid item to shrink narrower than its content so long token
     labels inside can truncate with ellipsis instead of pushing the column
     wider than the funnel's container. */
  min-width: 0;
  overflow: hidden;
}
.dl-station:first-child { border-left: 0; padding-left: 0; }
.dl-station:last-child { padding-right: 0; }

.dl-station-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.dl-station-num {
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  letter-spacing: 0.1em;
}
.dl-station-count {
  font-family: var(--serif); font-size: 34px; font-weight: 400;
  line-height: 1; letter-spacing: -0.02em;
}
.dl-station-count-label {
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px;
}
.dl-station-title {
  font-family: var(--serif); font-size: 20px; font-weight: 500;
  margin: 12px 0 4px;
}
.dl-station-sub {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  color: var(--ink-3); text-transform: uppercase;
  margin-bottom: 14px;
}

/* Queue of tokens */
.dl-queue {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  min-height: 120px;
  min-width: 0;
}
.dl-tok {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--ink-3);
  background: var(--paper);
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-2);
  transition: transform 0.3s ease, opacity 0.3s ease;
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.dl-tok-glyph {
  width: 10px; height: 12px; flex-shrink: 0;
  background: var(--ink-3);
  position: relative;
}
.dl-tok-glyph::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(var(--paper) 25%, transparent 25%, transparent 45%,
                    var(--paper) 45%, var(--paper) 55%, transparent 55%, transparent 75%,
                    var(--paper) 75%);
  background-size: 100% 4px;
}
.dl-tok-label {
  flex: 1;
  min-width: 0; /* critical — without this, nowrap text won't shrink inside a flex row */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* Clickable tokens: subtle affordance, no button chrome. */
a.dl-tok { text-decoration: none; color: inherit; }
.dl-tok--link { cursor: pointer; }
.dl-tok--link:hover { background: var(--paper-2); border-color: var(--ink); }
.dl-tok--link[data-published="1"]:hover { background: var(--daylight-wash); }
.dl-tok--link[data-planned="1"]:hover { background: var(--paper-2); border-left-color: var(--daylight-deep); }
.dl-tok--link:focus-visible { outline: 2px solid var(--daylight); outline-offset: 2px; }

/* Source kinds */
.dl-tok[data-kind="p2025"]   { border-color: var(--ink); }
.dl-tok[data-kind="p2025"] .dl-tok-glyph { background: var(--ink); }
.dl-tok[data-kind="news"]    { border-color: var(--dusk-2); }
.dl-tok[data-kind="news"] .dl-tok-glyph { background: var(--dusk-2); }
.dl-tok[data-kind="citizen"] { border-color: var(--daylight-deep); }
.dl-tok[data-kind="citizen"] .dl-tok-glyph { background: var(--daylight-deep); }

/* Lens: token with persona attached */
.dl-tok[data-lensed="1"] {
  border-color: var(--daylight);
  background: var(--daylight-wash);
}
.dl-tok[data-lensed="1"] .dl-tok-glyph { background: var(--daylight); }

/* Record: published look */
.dl-tok[data-published="1"] {
  border-color: var(--ink);
  background: var(--paper-2);
}
.dl-tok[data-published="1"] .dl-tok-glyph { background: var(--ink); }

/* Plan: owner stamped */
.dl-tok[data-planned="1"] {
  border-color: var(--ink);
  background: var(--paper);
  border-left-width: 4px;
  padding-left: 6px;
}

/* Arrow between stations */
.dl-arrow {
  position: absolute;
  top: 26px;
  right: -16px;
  width: 32px;
  height: 18px;
  z-index: 2;
}
.dl-arrow path {
  stroke: var(--ink); stroke-width: 1.5; fill: none;
}
.dl-station:last-child .dl-arrow { display: none; }

/* Persona avatar hovering over lens */
.dl-lens-personas {
  display: flex; gap: -4px; margin-top: 4px;
}
.dl-lens-personas > * { margin-right: -6px; border: 1.5px solid var(--paper); }

/* Bottom legend */
.dl-funnel-legend {
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 16px;
  border-top: var(--rule);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em;
  color: var(--ink-3); text-transform: uppercase;
}
.dl-legend-item { display: inline-flex; align-items: center; gap: 8px; }
.dl-legend-swatch { width: 14px; height: 14px; border: 1px solid currentColor; }
.dl-legend-swatch.p2025 { border-color: var(--ink); background: var(--ink); }
.dl-legend-swatch.news  { border-color: var(--dusk-2); background: var(--dusk-2); }
.dl-legend-swatch.cz    { border-color: var(--daylight-deep); background: var(--daylight-deep); }

/* animated token arriving */
@keyframes dl-tok-arrive {
  0%   { opacity: 0; transform: translateY(-18px) scale(0.96); }
  60%  { opacity: 1; transform: translateY(2px)   scale(1.02); }
  100% { opacity: 1; transform: translateY(0)     scale(1); }
}
.dl-tok.is-new { animation: dl-tok-arrive 450ms ease-out; }
@keyframes dl-tok-leave {
  to { opacity: 0; transform: translateX(28px) scale(0.96); }
}
.dl-tok.is-leaving { animation: dl-tok-leave 420ms ease-in forwards; }

/* Processing bar at Lens */
.dl-station[data-station="lens"] .dl-queue::after {
  content: "";
  display: block; height: 2px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--daylight), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: dl-lens-scan 2.8s linear infinite;
  position: absolute; bottom: 0; left: 0; right: 0;
}
@keyframes dl-lens-scan {
  0%   { background-position: -40% 0; }
  100% { background-position: 140% 0; }
}

/* Station hover highlight */
.dl-station:hover .dl-station-count { color: var(--daylight-deep); transition: color 0.3s; }

/* ===================================================================
   MOBILE FUNNEL — vertical stack with down-arrows between stations.
   Reading L→R on a phone breaks the metaphor; vertical preserves the
   "things arrive, get worked on, get published, get scheduled" flow
   and lets us still show a real queue at each stop.
   =================================================================== */
@media (max-width: 900px) {
  .dl-funnel { padding: 20px 18px 18px; }
  .dl-funnel-head { margin-bottom: 14px; }
  .dl-funnel-head h2 { font-size: 20px; }
  .dl-funnel-head .meta { font-size: 10px; }

  .dl-funnel-stations {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
  }
  .dl-station {
    border-left: 0;
    border-top: 1px dashed var(--paper-rule);
    padding: 16px 0 12px;
    position: relative;
    display: grid;
    grid-template-columns: 68px 1fr;
    grid-template-areas:
      "count head"
      "queue queue";
    gap: 4px 14px;
    align-items: start;
  }
  .dl-station:first-child { border-top: 0; padding-top: 4px; }

  .dl-station-head {
    grid-area: head;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 0;
  }
  .dl-station-num {
    grid-area: count;
    font-size: 9px;
    align-self: start;
    padding-top: 4px;
  }
  .dl-station-count {
    grid-area: count;
    font-size: 32px;
    line-height: 0.95;
    align-self: center;
    margin-top: 14px;
  }
  .dl-station-count-label { display: none; }
  .dl-station-title {
    font-size: 18px;
    margin: 0;
  }
  .dl-station-sub {
    margin-bottom: 0;
    font-size: 9.5px;
  }

  .dl-queue {
    grid-area: queue;
    margin-top: 10px;
    min-height: 0;
    padding-top: 0;
  }
  .dl-tok { font-size: 10.5px; padding: 5px 7px; }

  /* Down-arrow between stations */
  .dl-arrow {
    position: absolute;
    top: auto;
    bottom: -9px;
    right: auto;
    left: 20px;
    width: 18px;
    height: 20px;
    transform: rotate(90deg);
    transform-origin: center;
    background: var(--paper);
    z-index: 3;
  }
  .dl-station:last-child .dl-arrow { display: none; }

  /* Lens scan line still reads on mobile */
  .dl-station[data-station="lens"] .dl-queue::after { left: 0; right: 0; }

  .dl-funnel-legend {
    margin-top: 14px;
    padding-top: 12px;
    gap: 10px 16px;
    font-size: 9.5px;
  }
  .dl-funnel-legend > span:last-child { width: 100%; margin-left: 0; font-size: 9px; }
}

@media (max-width: 520px) {
  .dl-station { grid-template-columns: 56px 1fr; }
  .dl-station-count { font-size: 26px; }
  .dl-station-title { font-size: 16px; }
  .dl-arrow { left: 14px; }
}
