/* features.html. Loaded after site.css. */

/* Feature bento */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
.tile {
  position: relative;
  grid-column: span 2;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, -20%), var(--accent-soft), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.tile:hover {
  border-color: var(--line-strong);
}
.tile:hover::before {
  opacity: 1;
}
.tile.wide {
  grid-column: span 4;
}
.tile.half {
  grid-column: span 3;
}
.tile h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.018em;
  margin-top: 18px;
}
.tile p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.6;
}
.tile .viz {
  margin-top: 24px;
}

/* One-log diagram */
.log-viz {
  display: grid;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12.5px;
}
.log-row {
  display: grid;
  grid-template-columns: 66px 1fr;
  align-items: center;
  gap: 12px;
}
.log-row .label {
  color: var(--faint);
  text-align: right;
}
.cells {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}
.cell {
  position: relative;
  height: 30px;
  border-radius: 7px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 11.5px;
}
.cell.k {
  color: var(--muted);
}
.log-row.stream .cell {
  animation: sweep 6s linear infinite;
  animation-delay: calc(var(--i) * 0.42s);
}
@keyframes sweep {
  0%,
  10% {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    color: var(--accent-text);
  }
  22%,
  100% {
    background: var(--bg-sunken);
    border-color: var(--line);
    color: var(--faint);
  }
}
.log-row.cache .cell.latest {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent-text);
}
.log-row.cache .cell.old {
  opacity: 0.45;
  text-decoration: line-through;
}
.log-row.queue .cell.done {
  background: color-mix(in srgb, var(--accent) 9%, var(--bg-sunken));
  color: var(--muted);
}
.log-row.queue .cell.cursor {
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.log-row.queue .cell.cursor::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--accent);
}

/* Live one-log diagram: features.js moves a shared playhead across all three rows. */
.log-viz[data-live] .log-row.stream .cell {
  animation: none;
}
.log-viz[data-live] .cell {
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}
.log-viz[data-live] .cell.pending {
  opacity: 0.35;
}
.log-viz[data-live] .log-row.stream .cell.read {
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-sunken));
  color: var(--muted);
}
.log-viz[data-live] .log-row.stream .cell.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Queue row: two workers claim records and finish them at different speeds.
   The position (cursor) waits at the oldest record not yet acknowledged. */
.log-viz {
  --w0: hsl(14, 88%, 58%);
  --w1: hsl(262, 72%, 66%);
}
.log-viz[data-live] .log-row.queue .cell.waiting {
  color: var(--muted);
}
.log-viz[data-live] .log-row.queue .cell.claim {
  color: var(--text);
  background: color-mix(in srgb, var(--wc) 16%, var(--bg-sunken));
  border-color: color-mix(in srgb, var(--wc) 70%, transparent);
}
.log-viz[data-live] .log-row.queue .cell.claim.w0 { --wc: var(--w0); }
.log-viz[data-live] .log-row.queue .cell.claim.w1 { --wc: var(--w1); }
.log-viz[data-live] .log-row.queue .cell.claim::before {
  content: "";
  position: absolute;
  inset: auto 4px 3px 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--wc);
  animation: working 0.65s linear infinite;
}
@keyframes working {
  0% { opacity: 0.35; }
  50% { opacity: 1; }
  100% { opacity: 0.35; }
}
.log-viz[data-live] .log-row.queue .cell.acked {
  color: var(--accent-text);
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-sunken));
}
.log-viz[data-live] .log-row.queue .cell.done {
  background: color-mix(in srgb, var(--accent) 9%, var(--bg-sunken));
  color: var(--muted);
}
.queue-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 2px 0 0 78px;
  font-size: 11.5px;
  color: var(--faint);
}
.queue-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.queue-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--bg-sunken);
}
.queue-legend .w0 { background: color-mix(in srgb, var(--w0) 30%, var(--bg-sunken)); border-color: var(--w0); }
.queue-legend .w1 { background: color-mix(in srgb, var(--w1) 30%, var(--bg-sunken)); border-color: var(--w1); }
.queue-legend .acked { border: 1px dashed var(--accent); }
.queue-legend .pos { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
@media (max-width: 640px) {
  .queue-legend { margin-left: 0; }
}


@media (max-width: 960px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
  }
  .tile,
  .tile.wide,
  .tile.half {
    grid-column: span 1;
  }
  .tile.wide {
    grid-column: span 2;
  }
}
/* With two columns, an odd last tile would sit alone in half a row. */
@media (min-width: 761px) and (max-width: 960px) {
  .tile:last-child:nth-child(even) {
    grid-column: span 2;
  }
}
@media (max-width: 760px) {
  .bento {
    grid-template-columns: 1fr;
  }
  .tile,
  .tile.wide,
  .tile.half {
    grid-column: span 1;
  }
  .tile {
    padding: 22px;
  }
  .log-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .log-row .label {
    text-align: left;
  }
  .cells {
    gap: 3px;
  }
  .cell {
    height: 26px;
    font-size: 10.5px;
    border-radius: 6px;
  }
}
/* Subscriber lanes. The resting state is the end of the story: two lanes
   full, the slow one behind. features.js plays the fill once on screen. */
.lanes {
  display: grid;
  gap: 8px;
}
.lane-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
}
.lane {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  overflow: hidden;
}
.lane i {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--accent);
  opacity: 0.8;
  transform-origin: left center;
}
.lane.slow i {
  background: var(--warn);
  opacity: 0.75;
  transform: scaleX(0.3);
}
.lanes.armed .lane i {
  transform: scaleX(0.04);
}
.lanes.play .lane i {
  animation: lane-fill 2.4s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
.lanes.play .lane i.two {
  animation-duration: 2.8s;
}
.lanes.play .lane.slow i {
  animation-name: lane-fill-slow;
  animation-duration: 2.8s;
}
@keyframes lane-fill {
  to {
    transform: scaleX(1);
  }
}
@keyframes lane-fill-slow {
  to {
    transform: scaleX(0.3);
  }
}
.lane-row b {
  font-weight: 500;
  color: var(--warn);
}

/* Quorum: two of three replicas hold the record. */
.quorum {
  display: flex;
  align-items: center;
  gap: 10px;
}
.node {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  background: var(--bg-sunken);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}
.node.has {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.node svg {
  width: 16px;
  height: 16px;
}
.quorum .note {
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--faint);
}

/* Kafka and clients: copy on one side, a figure on the other. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 56px;
  align-items: center;
}
.split .section-head {
  margin-bottom: 0;
}
.kf-fig {
  margin: 0;
}
.kafka {
  background: var(--bg-sunken);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.kf-svg text {
  font-family: var(--mono);
  font-size: 12px;
  fill: var(--muted);
}
.kf-svg .kf-box {
  fill: var(--bg-raised);
  stroke: var(--line-strong);
}
.kf-svg .kf-felix {
  fill: color-mix(in srgb, var(--accent) 6%, var(--bg-raised));
  stroke: var(--accent);
  stroke-width: 1.5;
}
.kf-svg .kf-t {
  fill: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.kf-svg .kf-acc {
  fill: var(--accent-text);
}
.kf-svg .kf-faint {
  fill: var(--faint);
  font-size: 11px;
}
.kf-svg .kf-row {
  fill: var(--bg-sunken);
  stroke: var(--line);
}
.kf-svg .kf-wire {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0.7;
}
.kf-svg .kf-eq {
  fill: var(--faint);
}
.kf-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}
.kf-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.kf-list .mk {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
}
.kf-list .mk svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kf-list .yes .mk {
  color: var(--ok);
  background: var(--ok-soft);
}
.kf-list .no {
  color: var(--muted);
}
.kf-list .no .mk {
  color: var(--faint);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
}
.section-head .kf-note {
  margin-top: 16px;
  font-size: 14.5px;
  color: var(--muted);
}

.client-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.client-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}
.client-list li:first-child {
  border-top: 0;
}
.client-list .ficon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.client-list b {
  display: block;
  font-weight: 600;
  font-size: 15.5px;
}
.client-list small {
  display: block;
  color: var(--faint);
  font-size: 13.5px;
}
.client-list a {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}
.client-list .later .ficon {
  color: var(--faint);
  background: var(--bg-sunken);
  border-color: var(--line-strong);
}
@media (max-width: 960px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }
}
@media (max-width: 520px) {
  .kf-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .client-list li {
    padding: 14px 16px;
  }
}

.stage .kf-tall {
  display: none;
}
@media (max-width: 520px) {
  .kf-fig .kf-svg:not(.kf-tall) {
    display: none;
  }
  .kf-fig .kf-tall {
    display: block;
  }
  .kf-tall .kf-faint {
    font-size: 11.5px;
  }
}
@media (max-width: 760px) {
  .cell {
    font-size: 11px;
  }
  .client-list a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}
