/* =============================================
   Protocol Deep-Dive Page Styles
   ============================================= */

/* --- Sticky Back Bar --- */
.proto-back-bar {
    position: sticky;
    top: 60px;
    z-index: 50;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0.6rem 0;
}

.proto-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.proto-back-link:hover {
    opacity: 0.8;
}

/* --- Hero --- */
.proto-hero {
    padding: 3rem 0 2.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.proto-hero-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.proto-hero-title {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
    margin: 0 0 0.5rem;
}

.proto-hero-freq {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    color: var(--accent);
    font-weight: 600;
    margin: 0 0 1.25rem;
}

.proto-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.proto-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.proto-meta-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

/* --- Body Layout --- */
.proto-body {
    padding-bottom: 3rem;
}

/* --- Section --- */
.proto-section {
    margin-bottom: 3rem;
    scroll-margin-top: 120px;
}

.proto-section-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.proto-section-title svg {
    flex-shrink: 0;
}

/* --- Specs Grid --- */
.proto-specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.proto-spec-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 1.15rem;
    background: var(--bg-primary);
}

.proto-spec-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.proto-spec-value {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.45;
}

/* --- Device Groups --- */
.proto-device-group {
    margin-bottom: 1.5rem;
}

.proto-device-cat {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 0.75rem;
}

.proto-device-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.proto-device-list li {
    position: relative;
    padding-left: 1.25rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.proto-device-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.6;
}

/* --- Circuit Cards --- */
.proto-circuit-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.proto-circuit-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.proto-circuit-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0 0 1.25rem;
}

/* Pin Table */
.proto-pin-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.proto-pin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.proto-pin-table thead th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.65rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.proto-pin-table tbody td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: top;
}

.proto-pin-table tbody tr:last-child td {
    border-bottom: none;
}

.proto-pin-table code {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.proto-pin-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
    border: 1px solid rgba(255,255,255,0.15);
}

/* Walk-Through */
.proto-walkthrough {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 1.15rem 1.25rem;
}

.proto-walkthrough h4 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin: 0 0 0.5rem;
}

.proto-walkthrough p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* --- Signal Structure --- */
.proto-signal-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
}

.proto-signal-card > h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.6rem;
}

.proto-signal-card > p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1.5rem;
}

/* Frame Diagram */
.proto-frame-diagram {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.proto-frame-part {
    flex: 1 1 140px;
    min-width: 140px;
    border: 1px solid;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-primary);
}

.proto-frame-name {
    padding: 0.45rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.proto-frame-bits {
    padding: 0.35rem 0.75rem 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.proto-frame-timing {
    padding: 0.2rem 0.75rem 0.6rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Timing Notes */
.proto-timing-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.65;
    padding: 0.9rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.proto-timing-notes strong {
    color: var(--text-primary);
}

/* Analysis Tips */
.proto-analysis-tips {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.15rem 1.25rem;
}

.proto-analysis-tips h4 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 0.75rem;
}

.proto-analysis-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.55rem;
}

.proto-analysis-tips li {
    position: relative;
    padding-left: 1.15rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.proto-analysis-tips li::before {
    content: '\25B8';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 0.7rem;
}

/* --- Troubleshooting --- */
.proto-troubleshoot-list {
    display: grid;
    gap: 1rem;
}

.proto-ts-step {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
}

.proto-ts-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.proto-ts-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.proto-ts-tool {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

.proto-ts-step > p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
}

/* --- Prev/Next Pager --- */
.proto-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.proto-pager-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    padding: 1rem 1.25rem;
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 48%;
}

.proto-pager-link:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.proto-pager-link span {
    display: flex;
    flex-direction: column;
}

.proto-pager-link small {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.proto-pager-link span:not(small) {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.proto-pager-link svg {
    color: var(--accent);
    flex-shrink: 0;
}

.proto-pager-next {
    margin-left: auto;
    text-align: right;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .proto-hero {
        padding: 2rem 0 1.5rem;
    }

    .proto-hero-title {
        font-size: 1.6rem;
    }

    .proto-hero-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .proto-specs-grid {
        grid-template-columns: 1fr;
    }

    .proto-circuit-card {
        padding: 1.15rem;
    }

    .proto-frame-diagram {
        flex-direction: column;
    }

    .proto-frame-part {
        min-width: auto;
    }

    .proto-pager {
        flex-direction: column;
    }

    .proto-pager-link {
        max-width: 100%;
    }

    .proto-ts-header {
        flex-direction: column;
        gap: 0.4rem;
    }
}

@media (max-width: 480px) {
    .proto-section-title {
        font-size: 1.1rem;
    }

    .proto-pin-table {
        font-size: 0.78rem;
    }
}
