/* =========================================================================
   Redis Ultra demo: choose and size a database
   Builds on the .rcr tokens and components in context-retriever-demo.css,
   so the dark theme's token swap darkens it too. Colors here use only those
   tokens.
   ========================================================================= */

/* Red instead of the shared demos' purple for selections, step numbers, hover, and focus. The second
   selector outranks the dark theme's token block in iris-dark.css. */
.rcr.ultra,
body.iris-dark main .rcr.ultra {
  --rcr-accent-2: var(--rcr-accent);
  --rcr-focus: rgba(255, 68, 56, .3);
}

.ultra-q { font-weight: 600; margin-bottom: 10px !important; }
.ultra-answers { display: flex; gap: 8px; margin-bottom: 10px; }
.ultra .ultra-answer[aria-pressed="true"],
.ultra .ultra-seg[aria-pressed="true"],
.ultra .rcr-chip[aria-pressed="true"] {
  border-color: var(--rcr-accent-2); color: var(--rcr-accent-2); font-weight: 600;
  background-color: rgba(255, 68, 56, .12);
}
.ultra-why { color: var(--rcr-muted); font-size: 13.5px; }
.ultra-depends { display: inline-block; margin-bottom: 6px !important; font-size: 11.5px; font-weight: 600; color: var(--rcr-accent-2); }

.ultra-type { font-size: 18px; font-weight: 700; margin-bottom: 6px !important; }
.ultra-traits { margin: 0 0 10px; padding-left: 18px; color: var(--rcr-muted); font-size: 13.5px; }
.ultra-traits li { margin: 2px 0; }
.ultra-facts { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0; }
.ultra-facts th { text-align: left; font-weight: 600; color: var(--rcr-faint); padding: 4px 8px 4px 0; width: 48%; border-bottom: 1px solid var(--rcr-line); }
.ultra-facts td { padding: 4px 0; border-bottom: 1px solid var(--rcr-line); }
.ultra-facts tr:last-child th, .ultra-facts tr:last-child td { border-bottom: 0; }

/* The docs content column is a little narrower than the shared 560px split breakpoint, so this demo splits
   sooner: the turn and the systems it reaches stay side by side while the turn plays. */
@container (min-width: 500px) {
  .ultra .rcr-split { grid-template-columns: 1fr 1fr; }
}

/* ---- step 1: the big picture ---- */
.ultra-turn { list-style: none; counter-reset: turn; margin: 0; padding: 0; display: grid; gap: 4px; }
/* `.ultra .ultra-turn > li` outranks the page's prose list styles, which add margins and padding. */
.ultra .ultra-turn > li { margin: 0; padding: 6px 8px; line-height: 1.35; }
.ultra .ultra-turn > li::marker { content: none; }
.ultra-turnstep { counter-increment: turn; display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; border-radius: 8px; border: 1px solid transparent; font-size: 13.5px; transition: background .2s ease, border-color .2s ease; }
.ultra-turnstep::before { content: counter(turn); grid-row: span 2; align-self: start; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1px solid var(--rcr-line-strong); color: var(--rcr-muted); }
.ultra-turnwhere { grid-column: 2; font-size: 12px; color: var(--rcr-faint); }
.ultra-turnstep.is-on { background: var(--rcr-surface-2); border-color: var(--rcr-accent); }
.ultra-turnstep.is-on::before { background: var(--rcr-accent); border-color: var(--rcr-accent); color: #fff; }
.ultra-turnstep.is-done::before { border-color: var(--rcr-ok); color: var(--rcr-ok); }

.ultra-systems { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.ultra-systems-3 { grid-template-columns: 1fr; }
@container (min-width: 560px) { .ultra-systems-3 { grid-template-columns: repeat(3, 1fr); } }
.ultra-sys { display: grid; gap: 2px; padding: 10px; border-radius: 8px; border: 1px solid var(--rcr-line-strong); background: var(--rcr-surface-2); transition: border-color .2s ease, box-shadow .2s ease; }
.ultra-sys.is-separate { border-style: dashed; }
.ultra-sysname { font-weight: 600; font-size: 13.5px; }
.ultra-sysholds { font-size: 12px; color: var(--rcr-muted); }
.ultra-sys.is-used { border-color: var(--rcr-muted); }
.ultra-sys.is-on { border-color: var(--rcr-accent); box-shadow: 0 0 0 3px rgba(255, 68, 56, .25); }
.ultra-platform { border: 1px solid var(--rcr-accent); border-radius: 10px; padding: 10px; transition: box-shadow .2s ease; }
.ultra-platform.is-on { box-shadow: 0 0 0 3px rgba(255, 68, 56, .15); }
.ultra-platform .rcr-lbl { color: var(--rcr-accent); }
.ultra-tally { margin-top: 12px !important; }
.ultra-tally th { width: 80%; }

/* ---- step 3: size ---- */
.ultra-controls { display: grid; gap: 14px; }
.ultra-row { display: grid; gap: 6px; }
.ultra-segs { display: flex; flex-wrap: wrap; gap: 6px; }
.ultra-seg { cursor: pointer; border: 1px solid var(--rcr-line-strong); background: var(--rcr-surface-2); border-radius: 8px; padding: 5px 12px; font-size: 13px; }
.ultra-seg:disabled { opacity: .45; cursor: default; }
.ultra-size { display: flex; align-items: center; gap: 12px; }
.ultra-size input[type="range"] { flex: 1; accent-color: var(--rcr-accent); }
.ultra-sizeval { font-family: var(--rcr-mono); font-weight: 700; min-width: 72px; text-align: right; }

.ultra-bar { display: flex; height: 34px; border-radius: 8px; overflow: hidden; border: 1px solid var(--rcr-line-strong); margin: 4px 0 8px; }
.ultra-bar-ram, .ultra-bar-ssd { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; transition: width .25s ease; }
.ultra-bar-ram { background: var(--rcr-accent); color: #fff; }
.ultra-bar-ssd { background: var(--rcr-surface-2); color: var(--rcr-muted); }
.ultra-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; }
.ultra-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.ultra-swatch-ram { background: var(--rcr-accent); }
.ultra-swatch-ssd { background: var(--rcr-surface-2); border: 1px solid var(--rcr-line-strong); }

@media (prefers-reduced-motion: reduce) {
  .ultra-bar-ram, .ultra-bar-ssd, .ultra-turnstep, .ultra-sys, .ultra-platform { transition: none; }
}
