/* Design drills — diagram player and index cards */

.drill-stage {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.drill-svg {
    display: block;
    width: 100%;
    height: auto;
    background:
        radial-gradient(circle at 1px 1px, #e2e8f0 1px, transparent 0) 0 0 / 24px 24px;
}

/* --- nodes ------------------------------------------------------------- */

.dg-node-box {
    fill: #ffffff;
    stroke: #cbd5e1;
    stroke-width: 1.5;
}

.dg-node-box.kind-client  { stroke: #94a3b8; }
.dg-node-box.kind-service { stroke: #3b82f6; }
.dg-node-box.kind-db      { stroke: #8b5cf6; }
.dg-node-box.kind-cache   { stroke: #db2777; }  /* not red: red means saturated */
.dg-node-box.kind-queue   { stroke: #f59e0b; }
.dg-node-box.kind-lb      { stroke: #0ea5e9; }
.dg-node-box.kind-cdn     { stroke: #10b981; }
.dg-node-box.kind-worker  { stroke: #6366f1; }
.dg-node-box.kind-config  { stroke: #64748b; }

.dg-node-strip { stroke: none; }
.dg-strip-client  { fill: #94a3b8; }
.dg-strip-service { fill: #3b82f6; }
.dg-strip-db      { fill: #8b5cf6; }
.dg-strip-cache   { fill: #db2777; }
.dg-strip-queue   { fill: #f59e0b; }
.dg-strip-lb      { fill: #0ea5e9; }
.dg-strip-cdn     { fill: #10b981; }
.dg-strip-worker  { fill: #6366f1; }
.dg-strip-config  { fill: #64748b; }

.dg-node-label {
    font: 600 15px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
    fill: #0f172a;
}

.dg-node-sub {
    font: 400 11px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
    fill: #64748b;
}

.dg-edge-label {
    font: 500 11px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
    fill: #64748b;
}

/* The saturated component. Pulsing is the "this is what's full" signal. */
.dg-node.is-bottleneck .dg-node-box {
    stroke: #dc2626;
    stroke-width: 2.5;
    animation: dg-pulse 1.1s ease-in-out infinite;
}

@keyframes dg-pulse {
    0%, 100% { fill: #ffffff; }
    50%      { fill: #fee2e2; }
}

.dg-node.is-healthy .dg-node-box {
    stroke: #16a34a;
    stroke-width: 2;
}

.dg-edge {
    stroke: #cbd5e1;
    stroke-width: 2;
    fill: none;
}

.dg-particle { stroke: none; }

/* --- the empty slot ---------------------------------------------------- */

.dg-slot-box {
    fill: #ffffff;
    stroke: #94a3b8;
    stroke-width: 2;
    stroke-dasharray: 7 5;
}

.dg-slot.is-empty .dg-slot-box {
    animation: dg-slot-breathe 2s ease-in-out infinite;
}

@keyframes dg-slot-breathe {
    0%, 100% { stroke: #94a3b8; fill: #ffffff; }
    50%      { stroke: #2563eb; fill: #eff6ff; }
}

.dg-slot-label {
    font: 600 14px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
    fill: #64748b;
}

.dg-config-chip {
    font: 600 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
    fill: #0f172a;
}

/* --- metrics HUD ------------------------------------------------------- */

.drill-hud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hud-tile {
    flex: 1 1 150px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
}

.hud-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    margin-bottom: 2px;
}

.hud-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}

.hud-value.is-bad   { color: #dc2626; }
.hud-value.is-good  { color: #16a34a; }

.hud-sub { font-size: 12px; color: #94a3b8; }

.hud-bar {
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    margin-top: 8px;
    overflow: hidden;
}

.hud-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: #dc2626;
    transition: width .8s cubic-bezier(.22,.61,.36,1), background-color .5s ease;
}

.hud-bar-fill.is-good { background: #16a34a; }

.drill-caption {
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.drill-caption.is-good {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

/* --- option tray ------------------------------------------------------- */

.drill-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.drill-option {
    flex: 1 1 190px;
    text-align: left;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.drill-option:hover:not(:disabled) {
    border-color: #2563eb;
    box-shadow: 0 2px 10px rgba(37, 99, 235, .12);
    transform: translateY(-1px);
}

.drill-option:disabled { cursor: default; opacity: .55; }

.drill-option.is-chosen { opacity: 1; }
.drill-option.is-chosen-correct { border-color: #16a34a; background: #f0fdf4; opacity: 1; }
.drill-option.is-chosen-wrong   { border-color: #dc2626; background: #fef2f2; opacity: 1; }

.drill-option-label { font-weight: 600; color: #0f172a; }
.drill-option-sub   { font-size: 12px; color: #64748b; }

.drill-verdict { border-radius: 12px; padding: 18px 20px; }
.drill-verdict.is-correct { background: #f0fdf4; border: 1px solid #bbf7d0; }
.drill-verdict.is-wrong   { background: #fffbeb; border: 1px solid #fde68a; }

.drill-card { transition: transform .15s ease, box-shadow .15s ease; }
.drill-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(15, 23, 42, .09); }

/* Locked drills stay legible — the point is to advertise them, not to tease. */
.drill-card-locked {
    background: #f8fafc;
    border-style: dashed;
}
.drill-card-locked:hover { transform: none; box-shadow: none; }
.drill-card-locked .card-title { color: #475569 !important; }

.drills-gate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 14px;
    padding: 22px 26px;
}

.drill-locked-panel {
    max-width: 620px;
    margin: 0 auto;
    text-align: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 40px 32px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .07);
}

.drill-locked-icon {
    font-size: 2.5rem;
    color: #4f46e5;
}

@media (prefers-reduced-motion: reduce) {
    .dg-node.is-bottleneck .dg-node-box,
    .dg-slot.is-empty .dg-slot-box { animation: none; }
}
