/* Custom CSS for DaMiao Motor documentation */

/* Home page hero block */
.home-hero {
    padding: 1.25rem 1.5rem;
    margin: 0 0 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 45%),
        linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 116, 144, 0.12));
}

.home-hero h2 {
    margin-top: 0;
}

.home-actions {
    margin-top: 0.75rem;
}

.home-actions .md-button {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Keep large documentation screenshots readable on desktop */
.md-typeset img.doc-screenshot {
    display: block;
    width: 72%;
    max-width: 820px;
    margin: 0.5rem auto 1rem;
}

@media (max-width: 900px) {
    .md-typeset img.doc-screenshot {
        width: 100%;
        max-width: 100%;
    }
}

/* Ensure proper spacing for git revision dates */
.md-source__fact {
    margin-right: 0.5rem;
}

/* Improve code block readability */
.highlight {
    border-radius: 4px;
}

/* Better table styling */
.md-typeset table:not([class]) {
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.md-typeset table:not([class]) th {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* Improve tag styling */
.md-typeset .md-tag {
    border-radius: 0.25rem;
}

/* Protocol byte-map labels */
.md-typeset .bm {
    display: inline-block;
    padding: 0.06rem 0.45rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.76rem;
    line-height: 1.3;
    white-space: nowrap;
}

.md-typeset .bm-pos {
    background: rgba(37, 99, 235, 0.14);
    border-color: rgba(37, 99, 235, 0.35);
}

.md-typeset .bm-vel {
    background: rgba(14, 165, 233, 0.14);
    border-color: rgba(14, 165, 233, 0.35);
}

.md-typeset .bm-kp {
    background: rgba(147, 51, 234, 0.14);
    border-color: rgba(147, 51, 234, 0.35);
}

.md-typeset .bm-kd {
    background: rgba(168, 85, 247, 0.14);
    border-color: rgba(168, 85, 247, 0.35);
}

.md-typeset .bm-torque {
    background: rgba(249, 115, 22, 0.14);
    border-color: rgba(249, 115, 22, 0.35);
}

.md-typeset .bm-status {
    background: rgba(220, 38, 38, 0.14);
    border-color: rgba(220, 38, 38, 0.35);
}

.md-typeset .bm-mid {
    background: rgba(22, 163, 74, 0.14);
    border-color: rgba(22, 163, 74, 0.35);
}

.md-typeset .bm-temp {
    background: rgba(251, 191, 36, 0.16);
    border-color: rgba(251, 191, 36, 0.36);
}

.md-typeset .bm-canid {
    background: rgba(107, 114, 128, 0.16);
    border-color: rgba(107, 114, 128, 0.35);
}

.md-typeset .bm-rid {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.35);
}

.md-typeset .bm-read {
    background: rgba(2, 132, 199, 0.14);
    border-color: rgba(2, 132, 199, 0.35);
}

.md-typeset .bm-write {
    background: rgba(124, 58, 237, 0.14);
    border-color: rgba(124, 58, 237, 0.35);
}

.md-typeset .bm-store {
    background: rgba(234, 88, 12, 0.14);
    border-color: rgba(234, 88, 12, 0.35);
}

.md-typeset .bm-value {
    background: rgba(5, 150, 105, 0.14);
    border-color: rgba(5, 150, 105, 0.35);
}

.md-typeset .bm-pad {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.35);
}

/* Protocol table box styling (applies to explicit protocol-frame wrappers) */
.md-typeset .protocol-frame table:not([class]) {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid rgba(14, 116, 144, 0.28);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(14, 116, 144, 0.08);
    margin: 0.55rem 0 1rem;
    background: linear-gradient(
        180deg,
        rgba(14, 165, 233, 0.02),
        rgba(37, 99, 235, 0.01)
    );
}

.md-typeset .protocol-frame table:not([class]) th {
    background: linear-gradient(
        180deg,
        rgba(14, 116, 144, 0.16),
        rgba(14, 116, 144, 0.08)
    );
    font-weight: 600;
    border-bottom: 1px solid rgba(14, 116, 144, 0.22);
}

.md-typeset .protocol-frame table:not([class]) td {
    background: transparent;
}

.md-typeset .protocol-frame table:not([class]) tbody tr:nth-child(even) td {
    background: rgba(14, 116, 144, 0.03);
}

/* Motor mode visual emphasis */
.md-typeset .mode-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.35rem 0 1rem;
}

.md-typeset .mode-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
}

.md-typeset .mode-title {
    display: inline-block;
    padding: 0.05rem 0.52rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.md-typeset .mode-chip-mit,
.md-typeset .mode-title-mit {
    background: rgba(37, 99, 235, 0.14);
    border-color: rgba(37, 99, 235, 0.35);
    color: rgb(30, 64, 175);
}

.md-typeset .mode-chip-posvel,
.md-typeset .mode-title-posvel {
    background: rgba(2, 132, 199, 0.14);
    border-color: rgba(2, 132, 199, 0.35);
    color: rgb(7, 89, 133);
}

.md-typeset .mode-chip-vel,
.md-typeset .mode-title-vel {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.35);
    color: rgb(6, 95, 70);
}

.md-typeset .mode-chip-forcepos,
.md-typeset .mode-title-forcepos {
    background: rgba(249, 115, 22, 0.14);
    border-color: rgba(249, 115, 22, 0.35);
    color: rgb(154, 52, 18);
}

.md-typeset .mode-chip:hover {
    filter: brightness(0.95);
}
