/* Edition switcher shared by every edition of the tutorial site.
   The default edition is chosen in /index.html. */

.nav-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.edition-switcher {
    position: relative;
    flex-shrink: 0;
}

.edition-switcher > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 13px;
    border: 1px solid var(--rule-strong, #d4d1c7);
    border-radius: 999px;
    background: #fff;
    color: var(--accent, #0b1b3a);
    font-family: var(--serif, Georgia, serif);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    list-style: none;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s ease, background-color .15s ease;
}
.edition-switcher > summary::-webkit-details-marker { display: none; }
.edition-switcher > summary:hover,
.edition-switcher[open] > summary {
    border-color: var(--accent, #0b1b3a);
    background: var(--accent-bg, #eef1f8);
}
.edition-switcher > summary:focus-visible {
    outline: 3px solid #5b8def;
    outline-offset: 2px;
}

.edition-chevron {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    transition: transform .15s ease;
}
.edition-switcher[open] .edition-chevron { transform: rotate(180deg); }

.edition-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 70;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 8px;
    background: #fff;
    border: 1px solid var(--rule, #e5e3dc);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(11, 27, 58, 0.16);
}
.edition-menu-label {
    margin: 6px 10px 8px;
    font-family: var(--sans, -apple-system, sans-serif);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fg-soft, #6b7280);
}
.edition-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.edition-menu li + li { margin-top: 2px; }
.edition-menu a {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 10px;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    color: var(--fg, #0f1116);
}
.edition-menu a:hover {
    background: var(--bg-alt, #f7f5f0);
    color: var(--fg, #0f1116);
}
.edition-menu a:focus-visible {
    outline: 3px solid #5b8def;
    outline-offset: -3px;
}
.edition-menu a[aria-current="page"] {
    background: var(--accent-bg, #eef1f8);
    box-shadow: inset 3px 0 0 var(--accent, #0b1b3a);
}
.edition-name {
    font-family: var(--serif, Georgia, serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent, #0b1b3a);
}
.edition-badge {
    font-family: var(--sans, -apple-system, sans-serif);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent, #0b1b3a);
    color: #fff;
}
.edition-meta {
    grid-column: 1 / -1;
    font-family: var(--sans, -apple-system, sans-serif);
    font-size: 0.85rem;
    color: var(--fg-muted, #4b5563);
}

.es-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Below this width the switcher alone identifies the site, leaving room for the nav links. */
@media (max-width: 1100px) {
    .nav-left .nav-brand { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .edition-switcher > summary,
    .edition-chevron { transition: none; }
}

@media print {
    .edition-switcher { display: none; }
}
