/* Shared header behaviour for small screens - loaded on every page after the
   page's own styles. Desktop is untouched; below 860px the page links move into
   a menu opened by the ☰ button (added by js/site-nav.js), and the header
   buttons shrink so the account / sign-in button always fits on screen. */

.nav-burger { display: none; }

@media (max-width: 860px) {
    header.site .nav { padding: 10px 16px; gap: 8px; position: relative; flex-wrap: nowrap; }
    header.site .nav { justify-content: flex-start; }
    header.site .brand { font-size: 16px; flex-shrink: 0; min-width: 0; margin-right: auto; }

    /* Right-hand group (auth / theme) sits next to the menu button. */
    header.site .nav-cta { display: flex; align-items: center; gap: 8px; min-width: 0; }

    /* The page's own big button sits right below; drop the duplicate from the header. */
    header.site .nav-cta > .btn-primary,
    header.site .nav > a.btn-primary { display: none !important; }

    header.site .nav-auth .btn { padding: 8px 14px !important; white-space: nowrap; line-height: 1; }
    header.site .nav-auth-name { display: none !important; }
    header.site .account-menu-btn { padding: 4px !important; }

    /* Dark-mode toggle becomes an icon. */
    header.site .theme-toggle { width: 36px; height: 36px; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; flex-shrink: 0; }
    header.site .theme-toggle::after { content: "\263E" !important; font-size: 16px; }
    :root[data-theme="dark"] header.site .theme-toggle::after { content: "\2600" !important; }

    .nav-burger {
        display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
        width: 40px; height: 40px; flex-shrink: 0; margin-left: 4px;
        border: 1px solid var(--line, #e3e8f0); border-radius: 10px; background: var(--surface-0, #fff); cursor: pointer; padding: 0;
    }
    .nav-burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink-900, #0d1b2a); transition: transform .2s, opacity .2s; }
    header.site.nav-open .nav-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    header.site.nav-open .nav-burger span:nth-child(2) { opacity: 0; }
    header.site.nav-open .nav-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    /* The menu itself. */
    header.site.nav-open nav.links {
        display: flex !important; flex-direction: column; align-items: stretch; gap: 0;
        position: absolute; top: 100%; left: 0; right: 0; z-index: 300;
        background: var(--surface-0, #fff); border-bottom: 1px solid var(--line, #e3e8f0);
        box-shadow: 0 16px 32px -16px rgba(13, 27, 42, .25); padding: 4px 16px 12px;
    }
    header.site.nav-open nav.links a {
        display: block; padding: 14px 4px; font-size: 16px !important; font-weight: 500;
        color: var(--ink-900, #0d1b2a); border-bottom: 1px solid var(--line, #e3e8f0); text-decoration: none;
    }
    header.site.nav-open nav.links a:last-child { border-bottom: 0; }
}

@media (max-width: 340px) {
    header.site .brand .brand-tld { display: none; }       /* just "ATPLSTUDY" on very narrow phones */
}

/* Article pages: never let the content column grow wider than the screen. */
@media (max-width: 1000px) {
    .article-wrap { grid-template-columns: minmax(0, 1fr) !important; }
    .article-wrap > * { min-width: 0; max-width: 100%; }
    .article-wrap table { display: block; overflow-x: auto; max-width: 100%; }
    .article-wrap img, .article-wrap svg { max-width: 100%; height: auto; }
}

/* Narrow laptops / tablets in landscape (861-1120px): the full link row is still shown,
   but with the wider "ATPLSTUDY.com" logo it no longer fit - links wrapped onto two
   lines and ran into the logo. Tighten the row and keep every label on one line; below
   960px also drop the duplicate "Start Practicing" header button, as phones already do. */
@media (min-width: 861px) and (max-width: 1120px) {
    header.site .nav { gap: 16px; }
    header.site .brand { flex-shrink: 0; }
    header.site nav.links { gap: 14px !important; }
    header.site nav.links a { white-space: nowrap; font-size: 14px; }
    header.site .nav-auth .btn, header.site .theme-toggle, header.site .btn-primary { white-space: nowrap; }
}
@media (min-width: 861px) and (max-width: 960px) {
    header.site .nav { gap: 12px; }
    header.site nav.links { gap: 11px !important; }
    header.site nav.links a { font-size: 13.5px; }
    header.site .nav-cta > .btn-primary,
    header.site .nav > a.btn-primary { display: none !important; }
}

/* Wordmark logo: the name alone, one colour, with a quieter ".com". */
.brand .brand-tld { color: inherit !important; font-weight: 500 !important; opacity: .5; }
