/* Shared chrome for the four long tool pages:
   pipeline-designer, data-modelling, bus-matrix, distributed-computing.
   Loaded after each page's inline <style>. Only layout, focus, and overflow.
   Colors and diagram logic stay in the page. */

@media (max-width: 860px) {
    .top-nav {
        top: 8px;
        margin: 0 10px;
        border-radius: 18px;
    }

    .nav-c {
        height: auto;
        min-height: 48px;
        flex-wrap: wrap;
        padding: 8px 10px;
    }

    .top-nav .nav-links {
        flex-wrap: nowrap;
        justify-content: flex-end;
        min-width: 0;
        max-width: 100%;
    }

    .main,
    .workspace,
    .builder,
    .canvas-wrap,
    .diagram-wrap {
        min-width: 0;
        max-width: 100%;
    }
}

.config,
.cfg-card,
.panel,
.board {
    min-width: 0;
    max-width: 100%;
}

.top-nav .mobile-menu-toggle {
    display: none;
}

.top-nav a:focus-visible,
.top-nav button:focus-visible,
.nav-dropdown-trigger:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Touch size for tool controls. The site nav breakpoint is 768px.
   This file's 860px rule only wraps the tool workspace; it includes 768. */
@media (max-width: 768px) {
    .opt-btn,
    .medal-btn,
    .tab-btn,
    .btn-add,
    .btn-quick,
    .btn-export,
    .quiz-option,
    .top-nav .nav-link,
    .top-nav button {
        min-height: 48px;
    }

    .nav-c,
    .top-nav .nav-c {
        min-height: 48px;
    }

    .top-nav {
        position: sticky;
    }

    .top-nav .nav-container,
    .top-nav .nav-c {
        position: relative;
        height: auto;
        min-height: 56px;
    }

    .top-nav .nav-links {
        display: none;
    }

    .top-nav .nav-links.nav-open {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        max-height: min(70vh, calc(100dvh - 96px));
        overflow-y: auto;
        padding: 8px;
        border: 1px solid rgba(226, 232, 240, 0.9);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
    }

    .top-nav .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        margin-left: auto;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: #334155;
        font-size: 1.15rem;
        cursor: pointer;
    }
}
