.mobile-menu-toggle,.mobile-guest-bell,.mobile-bottom-nav{display:none}
.mobile-site-menu{position:fixed;inset:0 auto 0 0;box-sizing:border-box;width:min(360px,calc(100vw - 32px));height:100dvh;max-width:none;max-height:none;margin:0;padding:24px;border:0;border-radius:0 20px 20px 0;background:var(--card);color:var(--ink);overflow-y:auto}
.mobile-site-menu::backdrop{background:#30272d66}
.mobile-site-menu>header{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:24px}
.mobile-site-menu h2{font:600 24px/1.3 system-ui,sans-serif;margin:0}
.mobile-site-menu>header button{width:40px;height:40px;min-width:40px;min-height:40px}
.mobile-menu-sections .site-navigation{display:flex;flex-direction:column;align-items:stretch;gap:6px;margin:0;padding:0}
.mobile-menu-sections .site-navigation>a{display:flex;align-items:center;gap:10px;min-height:48px;padding:10px 12px;box-sizing:border-box;border:0;border-radius:10px;text-decoration:none;font-size:18px;color:var(--ink);margin:0}
.mobile-menu-sections .site-navigation>a:hover,.mobile-menu-sections .site-navigation>a[aria-current=page]{background:var(--soft);color:var(--accent)}
.mobile-menu-sections .site-navigation>a[href="/"],.mobile-menu-sections .site-navigation>.nav-feed-link{display:none}
.mobile-menu-search{border-top:1px solid var(--line);margin-top:24px;padding-top:24px}
.mobile-menu-search h3{font:600 16px/1.5 system-ui,sans-serif;margin:0 0 12px}
.mobile-menu-search .user-search{display:block;width:100%;max-width:none;margin:0}
.mobile-menu-search .user-search-control{display:flex;width:100%;box-sizing:border-box}
.mobile-menu-search .user-search input{width:100%;min-width:0;font-size:16px}
.mobile-menu-search .user-search-dropdown{position:absolute;top:calc(100% + 8px);left:0;right:auto;width:100%;max-width:100%;max-height:320px;box-sizing:border-box;margin:0;box-shadow:0 8px 24px #30232b20;overflow-y:auto}
@media(max-width:760px){
 body{padding-bottom:calc(88px + env(safe-area-inset-bottom))}
 :root body .topbar{position:relative;display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:10px;padding:10px 16px;min-height:64px;box-sizing:border-box}
 :root body .topbar>.brand-links,:root body .topbar>.topbar-actions{display:contents}
 :root body .topbar .brand{grid-column:2;grid-row:1;justify-self:center;min-width:0;margin:0;max-width:180px}
 :root body .topbar .brand-logo{width:100%;max-width:180px;height:auto;max-height:38px;object-fit:contain}
 :root body .topbar .site-navigation,:root body .topbar .user-search,:root body .topbar #account-link,:root body .topbar #account-menu{display:none!important}
 :root body .mobile-menu-toggle,:root body .mobile-guest-bell{display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;border:0;border-radius:50%;background:transparent;color:var(--accent);padding:10px;box-sizing:border-box;text-decoration:none}
 .mobile-menu-toggle{grid-column:1;grid-row:1}
 .mobile-guest-bell{grid-column:3;grid-row:1}
 :root body .mobile-guest-bell[hidden],:root body.has-account .mobile-guest-bell{display:none}
 :root body .topbar #site-notifications{grid-column:3;grid-row:1;justify-self:end;margin:0}
 :root body .topbar .notification-bell{width:44px;height:44px;min-width:44px;min-height:44px;padding:10px;border:0;background:transparent}
 :root body .topbar .notification-panel{position:fixed;top:70px;right:12px;left:12px;width:auto;max-width:none;max-height:calc(100dvh - 180px);box-sizing:border-box}
 :root body .mobile-bottom-nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;bottom:0;left:0;right:0;z-index:80;min-height:82px;padding:8px 4px calc(8px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--card);box-shadow:0 -4px 20px #30232b06;box-sizing:border-box}
 .mobile-bottom-nav>a{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:4px;padding:2px 1px;color:var(--muted);text-decoration:none;font:400 16px/1.15 system-ui,sans-serif;text-align:center;min-width:0}
 .mobile-bottom-nav>a>svg{flex:none;width:24px;height:24px}
 .mobile-bottom-nav>a>span{max-width:100%}
 .mobile-bottom-nav>a[href="/favorites"]{container-type:inline-size;white-space:nowrap}
 .mobile-bottom-nav .mobile-favorites-short{display:none}
 .mobile-bottom-nav>a[aria-current=page]{color:var(--accent);font-weight:600}
 .mobile-bottom-nav>a:focus-visible,.mobile-menu-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:-2px;border-radius:10px}
 .back-to-top{display:none!important}
 #quick-navigator{bottom:calc(98px + env(safe-area-inset-bottom))!important}
 html:has(dialog[open]) .mobile-bottom-nav{visibility:hidden}
 html.mobile-menu-open{overflow:hidden}
 html.mobile-menu-open body{position:fixed;top:var(--mobile-menu-scroll);width:100%}
}
.desktop-helper-slot{display:none}
@media(min-width:761px){
 :root body .topbar{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:auto auto;gap:14px 28px;padding:14px max(28px,calc((100vw - 1440px)/2));align-items:center}
 :root body .topbar>.brand-links{display:contents}
 :root body .topbar .brand{grid-column:1;grid-row:1;margin:0}
 :root body .topbar>.desktop-helper-slot{display:block;grid-column:2;grid-row:1;justify-self:end}
 :root body .topbar>.topbar-actions{display:flex;justify-content:flex-end;align-items:center;grid-column:3;grid-row:1;gap:20px;min-width:0;flex-wrap:nowrap}
 :root body .topbar .site-navigation{grid-column:1/-1;grid-row:2;display:flex;justify-content:flex-start;align-items:center;gap:30px;padding-top:8px;margin:0;border-top:1px solid var(--line)}
 :root body .topbar .site-navigation>a{margin:0}
 :root body .topbar .user-search{width:300px;max-width:100%;min-width:150px;flex:0 1 300px}
 :root body .topbar .user-search-control{width:100%;box-sizing:border-box}
 :root body .topbar .user-search input{width:100%;min-width:0;font-size:16px}
 :root body .topbar #account-link{font-size:16px;white-space:nowrap}
 .desktop-helper-slot>#quick-navigator{position:relative;inset:auto;width:auto;z-index:90}
 .desktop-helper-slot .quick-nav-toggle{margin:0;height:44px;min-width:0;padding:10px 16px;gap:8px;border-radius:12px;box-shadow:none}
 .desktop-helper-slot .quick-nav-toggle-label,.desktop-helper-slot .quick-nav-toggle:hover .quick-nav-toggle-label,.desktop-helper-slot .quick-nav-toggle[aria-expanded=true] .quick-nav-toggle-label{max-width:none;opacity:1;margin:0}
 .desktop-helper-slot .quick-nav-panel{position:absolute;top:54px;bottom:auto;left:auto;right:0;width:370px;max-width:calc(100vw - 80px);max-height:calc(100dvh - 140px);margin:0}
}
@media(min-width:761px) and (max-width:1000px){
 :root body .topbar{gap:12px 18px;padding-left:22px;padding-right:22px}
 :root body .topbar .brand-logo{max-width:165px}
 :root body .topbar .user-search{flex-basis:230px;width:230px}
 :root body .topbar .site-navigation{gap:24px}
}
@media(max-width:760px){:root body .mobile-bottom-nav{grid-template-columns:.95fr .7fr 1.25fr 1.15fr .95fr}}

@media(min-width:761px){
 .desktop-helper-slot .quick-nav-toggle{background:var(--accent);border-color:var(--accent);color:#fff}
 .desktop-helper-slot .quick-nav-panel{border-color:var(--line)}
 .desktop-helper-slot .quick-nav-heading{background:var(--soft);color:var(--ink)}
 .desktop-helper-slot .quick-nav-options>a:hover,.desktop-helper-slot .quick-nav-options>button:hover,.desktop-helper-slot .quick-nav-results>a:hover{background:var(--soft);border-color:var(--accent)}
}
@media(max-width:760px){:root body #quick-navigator{display:none!important}}

.mobile-menu-account{padding-top:16px;margin-top:16px;border-top:1px solid var(--line)}
.mobile-menu-account>a{display:flex;align-items:center;min-height:48px;padding:10px 12px;border-radius:10px;font-size:18px;text-decoration:none;color:var(--ink)}
.mobile-menu-account>a:hover{background:var(--soft)}
@media(max-width:760px){:root body .mobile-bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(min-width:361px) and (max-width:760px){:root body .mobile-bottom-nav{grid-template-columns:.95fr .8fr 1.2fr 1.1fr .95fr}}

.mobile-create-menu{position:fixed;inset:auto 0 0;width:100%;max-width:none;max-height:80dvh;margin:0;padding:20px 20px calc(24px + env(safe-area-inset-bottom));box-sizing:border-box;border:1px solid var(--line);border-radius:22px 22px 0 0;background:var(--card);color:var(--ink)}
.mobile-create-menu::backdrop{background:#30272d66}
.mobile-create-menu>header{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}
.mobile-create-menu h2{margin:0;font:600 22px/1.4 system-ui,sans-serif}
.mobile-create-menu>header button{width:40px;height:40px;min-width:40px;min-height:40px}
.mobile-create-menu>nav{display:grid;gap:8px}
.mobile-create-menu>nav>a{display:flex;align-items:center;gap:14px;padding:14px 16px;border:1px solid var(--line);border-radius:12px;text-decoration:none;font-size:18px;min-height:50px;box-sizing:border-box}
.mobile-create-menu>nav>a svg{color:var(--accent);flex:none}
.mobile-create-menu>nav>a:hover{background:var(--soft)}
@media(max-width:760px){
 :root body .mobile-bottom-nav{grid-template-columns:1fr 1fr .9fr 1.25fr 1fr;align-items:center}
 :root body .mobile-bottom-nav>.mobile-create-toggle{display:grid;place-items:center;align-self:center;justify-self:center;width:56px;height:56px;min-width:56px;min-height:56px;padding:0;border:0;border-radius:50%;background:var(--accent);color:white;box-shadow:0 3px 10px #39263322}
 .mobile-create-toggle svg{width:28px;height:28px}
 .mobile-create-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
}

/* Shared page-title origin below the site header. Keep content widths independent. */
:root{--page-heading-offset:28px;--page-heading-bottom:24px}
:root body :is(main.yarn-finder,main.yarn-catalog,#yarn-access-gate,main.magazines-page,main.authors-page,main.stash-page,main.account-settings,main.cabinet:has(#admin-content),main.feed-page:has(>.feed-saved-title)),
:root body.catalog-first-home>main,
:root body.collections-page>main{margin-top:0;padding-top:var(--page-heading-offset)}
:root body.catalog-first-home #catalog-view{padding-top:0}
:root body :where(.yarn-catalog>.yarn-intro,.magazines-heading,.authors-intro,.stash-heading,.collections-page .favorites-heading,#member-heading){margin-top:0;padding-top:0;align-items:flex-start}
:root body :where(main.yarn-finder>h1,.yarn-title-group>h1,#yarn-access-gate>h1,.magazines-title>h1,.authors-intro>h1,.stash-heading h1,.collections-heading-copy>h1,.collections-page .favorites-heading>h1,.feed-saved-title,#member-heading>h1,main.cabinet:has(#admin-content)>h1,.home-catalog-heading>h1){margin-top:0;margin-bottom:var(--page-heading-bottom);font-family:var(--page-title-font)!important;font-size:var(--page-title-size)!important;font-weight:400!important;line-height:1.2!important;letter-spacing:-.02em!important}
:root body :is(.home-catalog-heading,.yarn-intro,.magazines-heading,.authors-intro,.collections-page .favorites-heading){margin-bottom:var(--page-heading-bottom)}
:root body :is(.home-catalog-heading>h1,.yarn-title-group>h1,.magazines-title>h1,.authors-intro>h1,.collections-heading-copy>h1,.collections-page .favorites-heading>h1){margin-bottom:0}
:root body .collections-page .favorites-heading{padding-top:0}
:root body .yarn-title-group{align-items:flex-start}
@media(max-width:760px){
 :root{--page-heading-offset:20px}
 :root body :is(main.yarn-finder,main.yarn-catalog,#yarn-access-gate,main.magazines-page,main.authors-page,main.stash-page,main.account-settings,main.feed-page:has(>.feed-saved-title)),
 :root body.collections-page>main{padding-left:18px;padding-right:18px}
 :root body .feed-saved-title{margin-left:0;margin-right:0}
}

/* Light account control with a smaller avatar and a crisp vector chevron. */
:root body .topbar #account-menu-toggle{gap:9px;min-height:44px;padding:5px 9px 5px 5px;border:1px solid transparent;border-radius:12px;background:transparent;box-shadow:none;max-width:210px;font-size:16px;line-height:1.4}
:root body .topbar #account-menu-toggle:hover,:root body .topbar #account-menu-toggle[aria-expanded=true]{background:var(--soft);border-color:transparent}
:root body .topbar #account-menu-toggle .header-avatar{width:32px;height:32px;flex:0 0 32px;background:var(--soft)}
:root body .topbar #account-menu-name{font-weight:500}
:root body .topbar #account-menu-toggle>.account-toggle-chevron{display:grid;place-items:center;flex:0 0 16px;width:16px;height:16px;color:var(--muted);transition:transform .15s}
.account-toggle-chevron svg{width:14px;height:14px}
#account-menu-toggle[aria-expanded=true]>.account-toggle-chevron{transform:rotate(180deg)}
@media(prefers-reduced-motion:reduce){:root body .topbar #account-menu-toggle>.account-toggle-chevron{transition:none}}

.mobile-menu-footer>.mobile-menu-logout{display:flex;align-items:center;width:100%;min-height:48px;padding:10px 12px;margin-top:8px;border:0;border-radius:10px;background:transparent;color:var(--accent);font:400 18px/1.4 system-ui,sans-serif;text-align:left;cursor:pointer}
.mobile-menu-footer>.mobile-menu-logout:hover{background:var(--soft)}
.mobile-menu-error{padding:0 12px;color:#a2374e;font-size:16px}
@media(max-width:760px){
 :root body .mobile-bottom-nav{min-height:72px;padding-top:6px;padding-bottom:calc(6px + env(safe-area-inset-bottom))}
 :root body .mobile-bottom-nav>.mobile-create-toggle{width:52px;height:52px;min-width:52px;min-height:52px;transform:none;border:3px solid var(--card);box-shadow:0 4px 12px #39263326;box-sizing:border-box}
}
@media(max-width:760px){
 :root body .mobile-bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr))}
}

.mobile-menu-footer{margin-top:18px;padding-top:12px;border-top:1px solid var(--line)}
.mobile-logout-dialog{box-sizing:border-box;width:min(420px,calc(100vw - 32px));max-height:85dvh;padding:24px;border:1px solid var(--line);border-radius:20px;background:var(--card);color:var(--ink)}
.mobile-logout-dialog::backdrop{background:#30272d66}
.mobile-logout-dialog h2{margin:0 0 24px;font:600 22px/1.35 system-ui,sans-serif}
.mobile-logout-dialog .detail-actions{display:flex;align-items:center;gap:28px;margin:0}
.mobile-logout-dialog .mobile-menu-error{padding:0}

.mobile-menu-search .user-search-dropdown[popover]{position:fixed;inset:auto;margin:0;max-width:none;box-sizing:border-box;border:1px solid var(--line);border-radius:12px;background:var(--card);color:var(--ink);box-shadow:0 8px 24px #30232b26;overflow-y:auto;overscroll-behavior:contain}
.mobile-menu-search .user-search-dropdown::backdrop{background:transparent;pointer-events:none}

@container (width < 92px){
 .mobile-bottom-nav>a[href="/favorites"]>span{display:none}
 .mobile-bottom-nav>a[href="/favorites"]>.mobile-favorites-short{display:inline}
}
