/* Technology colours: every slide or element with .t-* gets its accent. */
.t-pg { --accent: #336791; --accent-deep: #24496b; --accent-soft: #e0e9f2; --accent-ink: #fff; }
.t-redis { --accent: #d82c20; --accent-deep: #a51f16; --accent-soft: #fbe3e1; --accent-ink: #fff; }
.t-rabbit { --accent: #ff6600; --accent-deep: #b84a00; --accent-soft: #ffe9da; --accent-ink: #13293d; }
.t-kafka { --accent: #231f20; --accent-deep: #000; --accent-soft: #e7e7e7; --accent-ink: #fff; }
.t-es { --accent: #00bfb3; --accent-deep: #00756e; --accent-soft: #d5f4f1; --accent-ink: #13293d; }
.t-ch { --accent: #f5d90a; --accent-deep: #7a6a00; --accent-soft: #fcf6c8; --accent-ink: #13293d; }
.t-s3 { --accent: #569a31; --accent-deep: #3c6d21; --accent-soft: #e3f0db; --accent-ink: #fff; }

/* Title: a server rack */
.title-slide { flex-direction: row; align-items: center; gap: clamp(28px, 6vw, 80px); }
.title-slide h1 { font-size: clamp(2.3rem, 4.5vw + 0.5rem, 4.6rem); max-width: 13ch; }
.title-slide .lead { font-size: clamp(1.05rem, 0.8vw + 0.8rem, 1.3rem); max-width: 40ch; }
.rack {
  flex: none;
  width: min(100%, 340px);
  background: var(--ink);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
}
.unit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 5px;
  background: #1f3a52;
  color: #fff;
  font-size: 0.9em;
  border-left: 6px solid var(--accent);
}
.unit b { font-family: var(--mono); font-size: 0.9em; }
.unit span { margin-left: auto; color: #9fb4c6; font-size: 0.85em; }
.unit::after {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: blink 2.4s steps(1) infinite;
}
.unit:nth-child(2n)::after { animation-delay: -0.7s; }
.unit:nth-child(3n)::after { animation-delay: -1.5s; }
@keyframes blink { 50% { opacity: 0.25; } }
@media (max-width: 900px) {
  .title-slide { flex-direction: column-reverse; align-items: stretch; }
  .rack { width: 100%; grid-template-columns: 1fr 1fr; }
  .unit span { display: none; }
}

/* Architecture map */
.map { display: grid; gap: 4px; }
.map-row { display: grid; gap: 8px; }
.map-row.n1 { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.map-row.n2 { grid-template-columns: 1fr 1fr; }
.map-row.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.map-row.n1 .map-node { min-width: 50%; }
.map-arrow { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; text-align: center; color: var(--muted); line-height: 1.2; }
.map-node {
  font: inherit; font-size: 0.82em; font-weight: 600;
  padding: 10px 6px; min-height: 44px; border-radius: 8px; cursor: pointer;
  background: var(--panel); color: var(--ink);
  border: 1.5px solid var(--accent, var(--ink));
  border-left-width: 6px;
  overflow-wrap: anywhere;
}
.map-node.plain { border-color: var(--line); border-left-color: var(--ink); }
.map-node:hover { background: var(--accent-soft, var(--paper)); }
.map-node.sel { background: var(--accent, var(--ink)); color: var(--accent-ink, #fff); }
.map-node.plain.sel { background: var(--ink); color: #fff; }
.map-detail { border-left: 4px solid var(--accent); padding: 4px 0 4px 14px; min-height: 7.5em; }
.map-detail p { margin: 4px 0 6px; font-size: 0.92em; color: var(--muted); }
.map-detail a { font-size: 0.88em; font-weight: 600; }
@media (max-width: 520px) {
  .map-row.n4 { grid-template-columns: 1fr 1fr; }
}

/* Transaction */
.accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acc { border: 1.5px solid var(--ink); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.acc-bal { font-size: 1.6em; font-weight: 700; font-variant-numeric: tabular-nums; }
.acc-bal.pending { color: var(--accent); font-style: italic; }
.acc-bal small { display: block; font-size: 0.42em; font-weight: 500; font-style: normal; color: var(--muted); }
.acc-total { font-size: 0.9em; }
.acc-total.bad { color: var(--block); font-weight: 600; }
.sql-steps { list-style: none; margin: 0; padding: 8px; background: var(--ink); border-radius: 10px; display: grid; gap: 2px; counter-reset: none; }
.sql-steps li { padding: 4px 8px; border-radius: 5px; color: #e3ecf3; font-size: clamp(11px, 0.4vw + 9.5px, 14px); }
.sql-steps code { background: none; padding: 0; color: inherit; font-size: inherit; overflow-wrap: anywhere; }
.sql-steps .k { color: #8fb8e0; }
.sql-steps .s { color: #9ee6c9; }
.sql-steps .n { color: #f7a8c0; }
.sql-steps li.cur { background: rgba(255, 255, 255, 0.14); outline: 1.5px solid #8fb8e0; }
.sql-steps li.done::after { content: " ✓"; color: #7be0c7; }
.sql-steps li.err { background: rgba(206, 50, 98, 0.45); }
.sql-steps li.skip { opacity: 0.35; text-decoration: line-through; }

/* Index */
.ix-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ix-row b { font-size: 1.15em; font-variant-numeric: tabular-nums; }
.ix-row span:last-child { font-family: var(--mono); font-size: 0.85em; min-width: 6em; text-align: right; }
.cost-n b { font-size: 2em; letter-spacing: -0.02em; margin-right: 4px; }
.tree { display: grid; gap: 6px; }
.tree-level { display: grid; grid-template-columns: 5.5em 1fr; gap: 10px; align-items: center; }
.tree-nodes { display: flex; gap: 6px; justify-content: center; align-items: center; }
.tnode { width: 34px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line); background: var(--panel); }
.tnode.hit { border-color: var(--accent); background: var(--accent); }
.tnode.row { width: auto; height: auto; padding: 2px 8px; color: var(--accent-ink); font-size: 0.75em; font-weight: 600; }
.tree .more { color: var(--muted); }

/* Redis cache */
.crow { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.3fr; gap: 10px; align-items: center; padding: 5px 8px; border-radius: 6px; font-size: 0.9em; transition: background 0.3s; }
.chead { font-size: 0.75em; color: var(--muted); font-weight: 600; padding-bottom: 0; }
.crows { display: grid; gap: 2px; }
.crow .num { font-family: var(--mono); font-size: 0.9em; }
.crow .num.stale { color: var(--block); font-weight: 700; }
.crow.hit { background: var(--accent-soft); transition: none; }
.crow.miss { background: #e6edf3; transition: none; }
.crow.stale { background: var(--value); transition: none; }

/* RabbitMQ */

.btn.pub { border-color: var(--msg); }
.k1 { --msg: #336791; }
.k2 { --msg: #00a29c; }
.k3 { --msg: #ce3262; }
.btn.pub::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--msg); margin-right: 6px; }
.rqueues { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rqueue { border: 1.5px solid var(--ink); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rq-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.rq-head code { font-size: 0.72em; }
.rq { min-height: 4.2em; align-content: flex-start; background: var(--paper); border-radius: 6px; padding: 6px; }
.msg { display: inline-flex; align-items: center; height: 1.8em; padding: 0 0.5em; border-radius: 4px; background: var(--msg); color: #fff; font-family: var(--mono); font-size: 0.72em; font-weight: 700; }
.msg.again { outline: 2px dashed var(--ink); outline-offset: 1px; }
.rworker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 2.2em; font-size: 0.9em; }
.rworker.off .label { color: var(--block); }
.rworker .track { min-width: 50px; }
.rworker .track .fill { background: var(--accent); }
.rdone { margin-left: auto; font-family: var(--mono); font-size: 0.75em; color: var(--muted); }
@media (max-width: 420px) { .rqueues { grid-template-columns: 1fr; } }

/* Kafka */
.klog { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-start; min-height: 4em; }
.kcell {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  min-width: 2.3em; padding: 4px 3px 0; border-radius: 4px;
  border-top: 5px solid var(--msg); background: var(--panel); border-inline: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.72em;
}
.kcell.end { border-top-color: transparent; border-style: dashed; color: var(--muted); }
.kdots { display: flex; gap: 2px; height: 10px; margin: 2px 0 3px; }
.kdots i { width: 8px; height: 8px; border-radius: 50%; }
.kcut { font-size: 0.72em; color: var(--muted); align-self: center; margin-right: 4px; }
.g1 { --g: #336791; } .g2 { --g: #ce3262; } .g3 { --g: #00a29c; }
.kdots i, .kdot { background: var(--g); }
.kgroups { display: grid; gap: 6px; }
.kgroup { display: grid; grid-template-columns: auto auto 1fr auto; gap: 8px; align-items: center; font-size: 0.9em; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kdot { width: 12px; height: 12px; border-radius: 50%; }
.kinfo { font-size: 0.85em; color: var(--muted); }
.kinfo b { color: var(--ink); font-variant-numeric: tabular-nums; }
.kinfo b.lag { color: var(--block); }
.kbtns { display: flex; gap: 6px; }
@media (max-width: 520px) {
  .kgroup { grid-template-columns: auto 1fr; }
  .kinfo { grid-column: 2; }
  .kbtns { grid-column: 1 / -1; }
}

/* Rabbit vs Kafka */
.vs { display: grid; margin-top: 8px; border-top: 2px solid var(--ink); }
.vs-row { display: grid; grid-template-columns: 1fr 1.5fr 1.5fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.vs-row [role="rowheader"] { font-weight: 700; }
.vs-head { padding: 12px 0; }
@media (max-width: 700px) {
  .vs-row { grid-template-columns: 1fr 1fr; gap: 4px 14px; font-size: 0.92em; }
  .vs-row [role="rowheader"] { grid-column: 1 / -1; }
  .vs-head > span:first-child { display: none; }
}

/* Elasticsearch */
.search-in {
  font: inherit; width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 2px solid var(--accent); background: var(--panel); color: var(--ink);
}
.srow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.term { font-family: var(--mono); font-size: 0.78em; padding: 2px 8px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.scols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sres { display: grid; gap: 6px; margin-top: 6px; }
.hit { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 6px; background: var(--paper); font-size: 0.88em; }
.hit mark { background: var(--accent-soft); color: inherit; border-bottom: 2px solid var(--accent); padding: 0 1px; }
.score { font-family: var(--mono); font-size: 0.8em; color: var(--muted); flex: none; }
.sdetails summary { cursor: pointer; font-weight: 600; font-size: 0.9em; padding: 4px 0; }
.sindex { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; margin-top: 8px; }
.irow { display: flex; justify-content: space-between; gap: 6px; padding: 3px 6px; border-radius: 4px; font-size: 0.85em; }
.irow.on { background: var(--accent-soft); }
.irow code { background: none; padding: 0; }
.docid { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; margin-left: 3px; border-radius: 4px; background: var(--line); font-family: var(--mono); font-size: 0.8em; }
.irow.on .docid { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 520px) { .scols { grid-template-columns: 1fr; } }

/* Row vs column storage */

.stores { display: grid; gap: 14px; }
.store { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.store-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.store-head span { font-size: 0.75em; color: var(--muted); }
.disk { display: grid; gap: 2px; }
.disk .line { display: flex; gap: 2px; padding: 2px; border-radius: 4px; background: var(--paper); }
.disk .cname { font-family: var(--mono); font-size: 0.6em; width: 4.2em; flex: none; align-self: center; color: var(--muted); }
.sc {
  flex: 1; min-width: 0; height: 1.5em; display: grid; place-items: center;
  font-size: 0.66em; border-radius: 3px; background: var(--panel); color: var(--muted);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.sc.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.store-foot { font-size: 0.8em; color: var(--muted); }
.store-foot b { color: var(--ink); font-size: 1.15em; }

/* Chooser */
.cq { font-size: 1.2em; font-weight: 600; min-height: 3em; }
.copts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.copt {
  font: inherit; font-family: var(--mono); font-size: 0.8em; font-weight: 700;
  padding: 10px 8px; min-height: 44px; border-radius: 8px; cursor: pointer;
  background: var(--panel); color: var(--ink);
  border: 1.5px solid var(--line); border-left: 6px solid var(--accent);
}
.copt:hover:not(:disabled) { background: var(--accent-soft); }
.copt:disabled { cursor: default; opacity: 0.45; }
.copt.right { background: var(--ok-soft); border-color: var(--ok); opacity: 1; }
.copt.okay { background: #fdf4c4; border-color: #d9b800; opacity: 1; }
.copt.wrong { background: var(--block-soft); border-color: var(--block); opacity: 1; }
.cverdict { border-left: 4px solid var(--ok); padding: 4px 0 4px 14px; font-size: 0.92em; }
.cverdict.okay { border-color: #d9b800; }
.cverdict.wrong { border-color: var(--block); }
